Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.kestrel.ultimahora.Items.Overrides;
- import net.minecraft.world.food.Foods;
- import net.minecraft.world.item.Item;
- import net.neoforged.bus.api.IEventBus;
- import net.neoforged.neoforge.registries.DeferredRegister;
- import org.kestrel.ultimahora.Items.Base.FoodBase;
- import java.util.Map;
- import java.util.function.Supplier;
- import static org.kestrel.ultimahora.Ultimahora.LOGGER;
- public class Food {
- public static final DeferredRegister.Items FOOD_ITEMS = DeferredRegister.createItems("minecraft");
- public static final Supplier<Item> RAW_BEEF = FOOD_ITEMS.register("beef", () -> new FoodBase((new Item.Properties()).food(Foods.BEEF), Map.of(
- FoodBase.PoisonType.ECOLI, true
- )));
- public static final Supplier<Item> RAW_PORK = FOOD_ITEMS.register("porkchop", () -> new FoodBase((new Item.Properties()).food(Foods.PORKCHOP), Map.of(
- FoodBase.PoisonType.PARASITE, true
- )));
- public static final Supplier<Item> RAW_CHICKEN = FOOD_ITEMS.register("chicken", () -> new FoodBase((new Item.Properties()).food(Foods.CHICKEN), Map.of(
- FoodBase.PoisonType.SALMONELLA, true
- )));
- public static final Supplier<Item> RAW_MUTTON = FOOD_ITEMS.register("mutton", () -> new FoodBase((new Item.Properties()).food(Foods.MUTTON), Map.of(
- FoodBase.PoisonType.SALMONELLA, true,
- FoodBase.PoisonType.ECOLI, true
- )));
- public static void Ready(IEventBus event) {
- LOGGER.info("Registering food apperently...");
- FOOD_ITEMS.register(event);
- }
- }
- Register:
- package org.kestrel.ultimahora.data;
- import net.minecraft.core.registries.Registries;
- import net.minecraft.network.chat.Component;
- import net.minecraft.resources.ResourceLocation;
- import net.minecraft.world.item.CreativeModeTab;
- import net.minecraft.world.item.ItemStack;
- import net.neoforged.bus.api.IEventBus;
- import net.neoforged.neoforge.registries.DeferredRegister;
- import org.kestrel.ultimahora.Items.Overrides.Food;
- import java.util.function.Supplier;
- import static org.kestrel.ultimahora.Ultimahora.MODID;
- public class ULTHCreativeModeTabs {
- public static final DeferredRegister<CreativeModeTab> ULTH_TAB =
- DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID);
- static final ResourceLocation foodIcon = ResourceLocation.fromNamespaceAndPath(MODID, "textures/gui/container/creative_inventory/ulth-food.png");
- public static final Supplier<CreativeModeTab> BASIC = ULTH_TAB.register("ulthbasic", () -> CreativeModeTab.builder()
- .withTabsImage(foodIcon)
- .title(Component.translatable("creativetab.ultimahora.basic"))
- .icon(() -> new ItemStack(Food.RAW_BEEF.get()))
- .displayItems(((itemDisplayParameters, output) -> {
- Food.FOOD_ITEMS.getEntries().forEach(entry -> {
- output.accept(entry.get());
- });
- }))
- .build());
- public static void register(IEventBus eventBus) {
- ULTH_TAB.register(eventBus);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement