mirror of
https://github.com/TeamMidnightDust/DeliciousDishes.git
synced 2025-12-16 08:35:10 +01:00
Today marks my 17th Birthday, and I've got something cooking up for ya'! After a 2-year hiatus, my first big feature mod Delicious Dishes makes a return! - Update from 1.16 to 1.19 - Code modernization - Switch from Cloth Config to MidnightLib - New Food: Ukrainian Borscht and Pizza Margherita - Added Glow Berry Ice Cream (applies Glowing Effect for 5 seconds) - Added Spaceburger (Can be found in chests on planets from Ad Astra!) - Added Patchouli entries for all the new features - Fixed multiple long-standing bugs - Added Bowl (right now only for Borscht, though I might add some more soups, stews and desserts in the future)
68 lines
3.3 KiB
Java
68 lines
3.3 KiB
Java
package eu.midnightdust.motschen.dishes.entities;
|
|
|
|
import com.google.common.collect.ImmutableMap;
|
|
import eu.midnightdust.motschen.dishes.DishesMain;
|
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.item.Items;
|
|
import net.minecraft.util.math.random.Random;
|
|
import net.minecraft.village.TradeOffer;
|
|
import net.minecraft.village.TradeOffers;
|
|
|
|
public class IceCreamTraderTradeOffers {
|
|
public static final Int2ObjectMap<TradeOffers.Factory[]> ICE_CREAM_TRADER_TRADES;
|
|
|
|
private static Int2ObjectMap<TradeOffers.Factory[]> copyToFastUtilMap(ImmutableMap<Integer, TradeOffers.Factory[]> map) {
|
|
return new Int2ObjectOpenHashMap<>(map);
|
|
}
|
|
|
|
static {
|
|
ICE_CREAM_TRADER_TRADES = copyToFastUtilMap(ImmutableMap.of(1, new TradeOffers.Factory[]
|
|
{
|
|
new IceCreamTraderTradeOffers.SellItemFactory(DishesMain.IceCreamVanilla, 1, 1, 10, 3),
|
|
new IceCreamTraderTradeOffers.SellItemFactory(DishesMain.IceCreamChocolate, 1, 1, 10, 3),
|
|
new IceCreamTraderTradeOffers.SellItemFactory(DishesMain.IceCreamWhiteChocolate, 1, 1, 10, 3),
|
|
new IceCreamTraderTradeOffers.SellItemFactory(DishesMain.IceCreamStrawberry, 1, 1, 10, 3),
|
|
new IceCreamTraderTradeOffers.SellItemFactory(DishesMain.IceCreamBanana, 1, 1, 10, 3),
|
|
new IceCreamTraderTradeOffers.SellItemFactory(DishesMain.IceCreamPear, 1, 1, 10, 3),
|
|
new IceCreamTraderTradeOffers.SellItemFactory(DishesMain.IceCreamSweetberry, 1, 1, 10, 3),
|
|
new IceCreamTraderTradeOffers.SellItemFactory(DishesMain.IceCreamBlueberry, 1, 1, 10, 3),
|
|
new IceCreamTraderTradeOffers.SellItemFactory(DishesMain.IceCreamBubblegum, 1, 1, 10, 3),
|
|
new IceCreamTraderTradeOffers.SellItemFactory(DishesMain.IceCreamGlowberry, 1, 1, 10, 3)
|
|
}));
|
|
}
|
|
|
|
static class SellItemFactory implements TradeOffers.Factory {
|
|
private final ItemStack sell;
|
|
private final int price;
|
|
private final int count;
|
|
private final int maxUses;
|
|
private final int experience;
|
|
private final float multiplier;
|
|
|
|
public SellItemFactory(Item item, int price, int count, int maxUses, int experience) {
|
|
this(new ItemStack(item), price, count, maxUses, experience);
|
|
}
|
|
|
|
public SellItemFactory(ItemStack stack, int price, int count, int maxUses, int experience) {
|
|
this(stack, price, count, maxUses, experience, 0.05F);
|
|
}
|
|
|
|
public SellItemFactory(ItemStack stack, int price, int count, int maxUses, int experience, float multiplier) {
|
|
this.sell = stack;
|
|
this.price = price;
|
|
this.count = count;
|
|
this.maxUses = maxUses;
|
|
this.experience = experience;
|
|
this.multiplier = multiplier;
|
|
}
|
|
|
|
public TradeOffer create(Entity entity, Random random) {
|
|
return new TradeOffer(new ItemStack(Items.EMERALD, this.price), new ItemStack(this.sell.getItem(), this.count), this.maxUses, this.experience, this.multiplier);
|
|
}
|
|
}
|
|
}
|