diff --git a/src/generated/resources/data/forge/tags/items/tools/knives.json b/src/generated/resources/data/forge/tags/items/tools/knives.json new file mode 100644 index 00000000..8ab05b66 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/tools/knives.json @@ -0,0 +1,5 @@ +{ + "values": [ + "growthcraft_rice:knife" + ] +} \ No newline at end of file diff --git a/src/main/java/growthcraft/core/datagen/providers/GrowthcraftCoreItemTags.java b/src/main/java/growthcraft/core/datagen/providers/GrowthcraftCoreItemTags.java index 2811558e..f22ff68d 100644 --- a/src/main/java/growthcraft/core/datagen/providers/GrowthcraftCoreItemTags.java +++ b/src/main/java/growthcraft/core/datagen/providers/GrowthcraftCoreItemTags.java @@ -144,6 +144,8 @@ protected void addTags(HolderLookup.Provider provider) { .add(GrowthcraftRiceItems.RICE_STALK.get()); tag(GrowthcraftRiceTags.Items.TAG_GRAIN_RICE) .add(GrowthcraftRiceItems.RICE.get()); + tag(GrowthcraftTags.Items.TAG_KNIFE) + .add(GrowthcraftRiceItems.KNIFE.get()); } @Override diff --git a/src/main/java/growthcraft/core/init/GrowthcraftTags.java b/src/main/java/growthcraft/core/init/GrowthcraftTags.java index 7edb7963..c9a6bb09 100644 --- a/src/main/java/growthcraft/core/init/GrowthcraftTags.java +++ b/src/main/java/growthcraft/core/init/GrowthcraftTags.java @@ -47,6 +47,7 @@ private static void init(){ public static final TagKey SALT = tag(Reference.UnlocalizedName.TAG_SALT); public static final TagKey DUSTS_SALT = forgeTag(Reference.UnlocalizedName.DUSTS_SALT); + public static final TagKey TAG_KNIFE = forgeTag(Reference.UnlocalizedName.TAG_KNIVES); private static TagKey tag(String name) { return ItemTags.create(new ResourceLocation(Reference.MODID, name)); diff --git a/src/main/java/growthcraft/core/shared/Reference.java b/src/main/java/growthcraft/core/shared/Reference.java index 7a01950a..c8301936 100644 --- a/src/main/java/growthcraft/core/shared/Reference.java +++ b/src/main/java/growthcraft/core/shared/Reference.java @@ -62,6 +62,7 @@ public static class UnlocalizedName { public static final String TAG_CROPS_RICE = "crops/rice"; public static final String TAG_GRAIN_RICE = "grain/rice"; public static final String DUSTS_SALT = "dusts/salt"; + public static final String TAG_KNIVES = "tools/knives"; private UnlocalizedName() { /* Disable default public constructor. */ } diff --git a/src/main/java/growthcraft/milk/block/CheeseWheelBlock.java b/src/main/java/growthcraft/milk/block/CheeseWheelBlock.java index 602a21be..453ec063 100644 --- a/src/main/java/growthcraft/milk/block/CheeseWheelBlock.java +++ b/src/main/java/growthcraft/milk/block/CheeseWheelBlock.java @@ -1,7 +1,9 @@ package growthcraft.milk.block; +import growthcraft.core.init.GrowthcraftTags; import growthcraft.milk.block.entity.CheeseWheelBlockEntity; import growthcraft.milk.init.GrowthcraftMilkBlockEntities; +import growthcraft.rice.init.GrowthcraftRiceTags; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -131,7 +133,7 @@ public InteractionResult use(BlockState blockState, Level level, BlockPos blockP // Allow the stackage of cheese beyond 1 block high return InteractionResult.PASS; } - } else if(!player.isCrouching() && player.getItemInHand(interactionHand).isEmpty()) { + } else if(!player.isCrouching() && player.getItemInHand(interactionHand).is(GrowthcraftTags.Items.TAG_KNIFE)) { if(blockEntity.canTakeSlice()) { player.getInventory().add(blockEntity.takeSlice()); } diff --git a/src/main/java/growthcraft/milk/block/CheeseWheelProcessedBlock.java b/src/main/java/growthcraft/milk/block/CheeseWheelProcessedBlock.java index 55559455..a2c1ee91 100644 --- a/src/main/java/growthcraft/milk/block/CheeseWheelProcessedBlock.java +++ b/src/main/java/growthcraft/milk/block/CheeseWheelProcessedBlock.java @@ -1,6 +1,8 @@ package growthcraft.milk.block; +import growthcraft.core.init.GrowthcraftTags; import growthcraft.milk.block.entity.CheeseWheelBlockEntity; +import growthcraft.rice.init.GrowthcraftRiceTags; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -21,9 +23,9 @@ public InteractionResult use(BlockState blockState, Level level, BlockPos blockP CheeseWheelBlockEntity entity = (CheeseWheelBlockEntity) level.getBlockEntity(blockPos); assert entity != null; - + System.out.println(player.getItemInHand(interactionHand).getTags().toList()); // handle taking slices - if (!player.isCrouching() && player.getItemInHand(interactionHand).isEmpty()) { + if (!player.isCrouching() && player.getItemInHand(interactionHand).is(GrowthcraftTags.Items.TAG_KNIFE)) { entity.takeSlice(1); player.getInventory().add(getVariant().getSlices(1)); if (entity.getSliceCount() == 0) level.destroyBlock(blockPos, false);