From 962ced7cd1312644e699cc6562ed135c0f5d653e Mon Sep 17 00:00:00 2001 From: BlayTheNinth <1933180+BlayTheNinth@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:28:16 +0100 Subject: [PATCH] wip: Continue port to Minecraft 1.21.3 --- .../block/incorrect_for_chicken_stick.json | 3 +++ .../tags/block/mineable/chicken_stick.json | 5 ++++ .../excompressum/item/ChickenStickItem.java | 25 +------------------ .../mods/excompressum/tag/ModBlockTags.java | 1 + .../fabric/datagen/ModBlockTagProvider.java | 4 +++ 5 files changed, 14 insertions(+), 24 deletions(-) create mode 100644 common/src/generated/resources/data/excompressum/tags/block/incorrect_for_chicken_stick.json create mode 100644 common/src/generated/resources/data/excompressum/tags/block/mineable/chicken_stick.json diff --git a/common/src/generated/resources/data/excompressum/tags/block/incorrect_for_chicken_stick.json b/common/src/generated/resources/data/excompressum/tags/block/incorrect_for_chicken_stick.json new file mode 100644 index 00000000..f72d209d --- /dev/null +++ b/common/src/generated/resources/data/excompressum/tags/block/incorrect_for_chicken_stick.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/common/src/generated/resources/data/excompressum/tags/block/mineable/chicken_stick.json b/common/src/generated/resources/data/excompressum/tags/block/mineable/chicken_stick.json new file mode 100644 index 00000000..012bae24 --- /dev/null +++ b/common/src/generated/resources/data/excompressum/tags/block/mineable/chicken_stick.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#excompressum:mineable/hammer" + ] +} \ No newline at end of file diff --git a/common/src/main/java/net/blay09/mods/excompressum/item/ChickenStickItem.java b/common/src/main/java/net/blay09/mods/excompressum/item/ChickenStickItem.java index 6d15b856..6e3ac2b0 100644 --- a/common/src/main/java/net/blay09/mods/excompressum/item/ChickenStickItem.java +++ b/common/src/main/java/net/blay09/mods/excompressum/item/ChickenStickItem.java @@ -21,10 +21,8 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ToolMaterial; -import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.block.state.BlockState; import java.util.List; @@ -38,7 +36,7 @@ public class ChickenStickItem extends DiggerItem { ModItemTags.CHICKEN_STICK_TOOL_MATERIALS); public ChickenStickItem(Item.Properties properties) { - super(CHICKEN_STICK_TIER, ModBlockTags.MINEABLE_WITH_HAMMER, 6f, -3.2f, properties.fireResistant()); + super(CHICKEN_STICK_TIER, ModBlockTags.MINEABLE_WITH_CHICKEN_STICK, 6f, -3.2f, properties.fireResistant()); } @Override @@ -54,27 +52,6 @@ public InteractionResult use(Level level, Player player, InteractionHand hand) { return InteractionResult.SUCCESS; } - @Override - public boolean isCorrectToolForDrops(ItemStack itemStack, BlockState state) { - // TODO no more recipe manager on client, might need to introduce a tag and manage it alongside the recipes - // RecipeManager recipeManager = ExCompressum.proxy.get().getRecipeManager(null); - // return ExRegistries.getChickenStickRegistry().isHammerable(recipeManager, new ItemStack(state.getBlock())); - return true; - } - - @Override - public float getDestroySpeed(ItemStack stack, BlockState state) { - // TODO no more recipe manager on client, might need to introduce a tag and manage it alongside the recipes - // RecipeManager recipeManager = ExCompressum.proxy.get().getRecipeManager(null); - // if ((ExRegistries.getChickenStickRegistry().isHammerable(recipeManager, new ItemStack(state.getBlock())))) { - // if (isAngry(stack)) { - // return CHICKEN_STICK_TIER.speed() * 1.5f; - // } - // return CHICKEN_STICK_TIER.speed(); - // } - return 0.8f; - } - public void tryPlayChickenSound(LevelAccessor level, BlockPos pos) { if (level.getRandom().nextFloat() <= ExCompressumConfig.getActive().tools.chickenStickSoundChance) { ResourceLocation location = null; diff --git a/common/src/main/java/net/blay09/mods/excompressum/tag/ModBlockTags.java b/common/src/main/java/net/blay09/mods/excompressum/tag/ModBlockTags.java index e1dd0838..276ec78f 100644 --- a/common/src/main/java/net/blay09/mods/excompressum/tag/ModBlockTags.java +++ b/common/src/main/java/net/blay09/mods/excompressum/tag/ModBlockTags.java @@ -9,5 +9,6 @@ public class ModBlockTags { public static final TagKey MINEABLE_WITH_CROOK = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(ExCompressum.MOD_ID, "mineable/crook")); public static final TagKey MINEABLE_WITH_HAMMER = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(ExCompressum.MOD_ID, "mineable/hammer")); + public static final TagKey MINEABLE_WITH_CHICKEN_STICK = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(ExCompressum.MOD_ID, "mineable/chicken_stick")); public static final TagKey INCORRECT_FOR_CHICKEN_STICK = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(ExCompressum.MOD_ID, "incorrect_for_chicken_stick")); } diff --git a/fabric/src/main/java/net/blay09/mods/excompressum/fabric/datagen/ModBlockTagProvider.java b/fabric/src/main/java/net/blay09/mods/excompressum/fabric/datagen/ModBlockTagProvider.java index 96669e8f..2eb311e1 100644 --- a/fabric/src/main/java/net/blay09/mods/excompressum/fabric/datagen/ModBlockTagProvider.java +++ b/fabric/src/main/java/net/blay09/mods/excompressum/fabric/datagen/ModBlockTagProvider.java @@ -74,6 +74,10 @@ protected void addTags(HolderLookup.Provider arg) { ModBlocks.compressedBlocks[CompressedBlockType.GRAVEL.ordinal()], ModBlocks.compressedBlocks[CompressedBlockType.NETHERRACK.ordinal()], ModBlocks.compressedBlocks[CompressedBlockType.SAND.ordinal()]); + + getOrCreateTagBuilder(ModBlockTags.MINEABLE_WITH_CHICKEN_STICK).addTag(ModBlockTags.MINEABLE_WITH_HAMMER); + + getOrCreateTagBuilder(ModBlockTags.INCORRECT_FOR_CHICKEN_STICK); } }