summary refs log tree commit diff stats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/ganarchy/chewstuff/ChewComponent.java6
-rw-r--r--src/main/java/ganarchy/chewstuff/ChewStuff.java38
-rw-r--r--src/main/java/ganarchy/chewstuff/ChewableItem.java9
3 files changed, 27 insertions, 26 deletions
diff --git a/src/main/java/ganarchy/chewstuff/ChewComponent.java b/src/main/java/ganarchy/chewstuff/ChewComponent.java
index 4b6dcd8..aefa539 100644
--- a/src/main/java/ganarchy/chewstuff/ChewComponent.java
+++ b/src/main/java/ganarchy/chewstuff/ChewComponent.java
@@ -6,7 +6,7 @@ import dev.onyxstudios.cca.api.v3.component.ComponentV3;
 import net.minecraft.entity.effect.StatusEffect;
 import net.minecraft.nbt.NbtCompound;
 import net.minecraft.nbt.NbtOps;
-import net.minecraft.util.registry.Registry;
+import net.minecraft.registry.Registries;
 
 import java.util.*;
 
@@ -20,10 +20,10 @@ public class ChewComponent implements ComponentV3 {
     public static final Codec<ChewComponent> CODEC = RecordCodecBuilder.create(
         inst -> inst.group(
             Codec.unboundedMap(
-                Registry.STATUS_EFFECT.getCodec(), Codec.INT
+                Registries.STATUS_EFFECT.getCodec(), Codec.INT
             ).fieldOf("effects").forGetter(i -> i.effects),
             Codec.list(
-                Registry.STATUS_EFFECT.getCodec()
+                Registries.STATUS_EFFECT.getCodec()
             ).fieldOf("applied").forGetter(i -> new ArrayList<>(i.applied)),
             Codec.BOOL.fieldOf("sendUpdate").forGetter(i -> i.sendUpdate)
         ).apply(inst, ChewComponent::new)
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);
+        });
     }
 }
diff --git a/src/main/java/ganarchy/chewstuff/ChewableItem.java b/src/main/java/ganarchy/chewstuff/ChewableItem.java
index e3c8f60..5e637c4 100644
--- a/src/main/java/ganarchy/chewstuff/ChewableItem.java
+++ b/src/main/java/ganarchy/chewstuff/ChewableItem.java
@@ -9,7 +9,6 @@ import net.minecraft.entity.effect.StatusEffect;
 import net.minecraft.entity.effect.StatusEffectInstance;
 import net.minecraft.entity.player.PlayerEntity;
 import net.minecraft.item.ItemStack;
-import net.minecraft.item.Wearable;
 import net.minecraft.nbt.NbtCompound;
 import net.minecraft.network.packet.s2c.play.EntityStatusEffectS2CPacket;
 import net.minecraft.server.network.ServerPlayerEntity;
@@ -23,7 +22,7 @@ import java.util.stream.Collectors;
 /**
  * An item that can be chewed.
  */
-public class ChewableItem extends TrinketItem implements Wearable {
+public class ChewableItem extends TrinketItem {
     /**
      * The cooldown between activations, in ticks.
      */
@@ -44,7 +43,7 @@ public class ChewableItem extends TrinketItem implements Wearable {
 
     @Override
     public void onEquip(ItemStack stack, SlotReference slot, LivingEntity entity) {
-        if (entity.world.isClient) {
+        if (entity.getWorld().isClient) {
             return;
         }
         var maybeInfo = ChewComponents.CHEW.maybeGet(entity);
@@ -57,7 +56,7 @@ public class ChewableItem extends TrinketItem implements Wearable {
     public void onUnequip(
         ItemStack stack, SlotReference slot, LivingEntity entity
     ) {
-        if (entity.world.isClient) {
+        if (entity.getWorld().isClient) {
             return;
         }
         var maybeInfo = ChewComponents.CHEW.maybeGet(entity);
@@ -70,7 +69,7 @@ public class ChewableItem extends TrinketItem implements Wearable {
 
     @Override
     public void tick(ItemStack stack, SlotReference slot, LivingEntity entity) {
-        if (entity.world.isClient) {
+        if (entity.getWorld().isClient) {
             return;
         }
         if (entity instanceof PlayerEntity player) {