From 12048dc1a1cf01f8a0f37ced83af78b57a35b4cd Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Sun, 2 Jul 2023 01:32:49 -0300 Subject: Update to 1.20 --- src/main/java/ganarchy/chewstuff/ChewStuff.java | 38 +++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'src/main/java/ganarchy/chewstuff/ChewStuff.java') diff --git a/src/main/java/ganarchy/chewstuff/ChewStuff.java b/src/main/java/ganarchy/chewstuff/ChewStuff.java index 7bea0ec..ee035f3 100644 --- a/src/main/java/ganarchy/chewstuff/ChewStuff.java +++ b/src/main/java/ganarchy/chewstuff/ChewStuff.java @@ -1,10 +1,12 @@ package ganarchy.chewstuff; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemGroups; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,7 +24,7 @@ public class ChewStuff implements ModInitializer { * chews. */ public static final Item SILICONE = new Item( - new Item.Settings().group(ItemGroup.MISC) + new Item.Settings() ); /** * 1 day, in ticks. @@ -33,27 +35,21 @@ public class ChewStuff implements ModInitializer { */ public static final Item SOFT_CHEW = new ChewableItem( 1, - new Item.Settings().maxDamage(5 * DAY_MULTIPLIER).group(ItemGroup.TOOLS) + new Item.Settings().maxDamage(5 * DAY_MULTIPLIER) ); /** * Medium chew. Lasts 6 days, 2 effect slots. */ public static final Item MEDIUM_CHEW = new ChewableItem( 2, - new Item.Settings().maxDamage(6 * DAY_MULTIPLIER).group(ItemGroup.TOOLS) + new Item.Settings().maxDamage(6 * DAY_MULTIPLIER) ); /** * Hard chew. Lasts 7 days, 3 effect slots. */ public static final Item HARD_CHEW = new ChewableItem( 3, - new Item.Settings().maxDamage(7 * DAY_MULTIPLIER).group(ItemGroup.TOOLS) - ); - /** - * The stat for chew effects. - */ - public static final Identifier CHEW_EFFECTS = new Identifier( - "chewstuff", "effects" + new Item.Settings().maxDamage(7 * DAY_MULTIPLIER) ); @Override @@ -65,26 +61,32 @@ public class ChewStuff implements ModInitializer { LOGGER.info("This software is made with love by a queer trans person."); Registry.register( - Registry.ITEM, + Registries.ITEM, new Identifier("chewstuff", "silicone"), SILICONE ); Registry.register( - Registry.ITEM, + Registries.ITEM, new Identifier("chewstuff", "soft_chew"), SOFT_CHEW ); Registry.register( - Registry.ITEM, + Registries.ITEM, new Identifier("chewstuff", "medium_chew"), MEDIUM_CHEW ); Registry.register( - Registry.ITEM, + Registries.ITEM, new Identifier("chewstuff", "hard_chew"), HARD_CHEW ); -// Registry.register(Registry.CUSTOM_STAT, CHEW_EFFECTS, CHEW_EFFECTS); -// Stats.CUSTOM.getOrCreateStat(CHEW_EFFECTS, StatFormatter.DEFAULT); + ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(content -> { + content.add(SOFT_CHEW); + content.add(MEDIUM_CHEW); + content.add(HARD_CHEW); + }); + ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(content -> { + content.add(SILICONE); + }); } } -- cgit 1.4.1