From ea65722d51522cebe6911fe766855b937e77a37d Mon Sep 17 00:00:00 2001 From: TelepathicGrunt <40846040+TelepathicGrunt@users.noreply.github.com> Date: Mon, 30 Sep 2024 08:23:56 -0400 Subject: [PATCH 1/3] Make Neoforge's Needs Netherite Tool block tag be added to vanilla's incorrect block tags --- .../block/incorrect_for_diamond_tool.json | 5 +++++ .../tags/block/incorrect_for_gold_tool.json | 5 +++++ .../tags/block/incorrect_for_iron_tool.json | 5 +++++ .../tags/block/incorrect_for_stone_tool.json | 5 +++++ .../tags/block/incorrect_for_wooden_tool.json | 5 +++++ .../tags/block/needs_netherite_tool.json | 3 +++ .../net/neoforged/neoforge/common/Tags.java | 20 +++++++++++++++++++ .../internal/NeoForgeBlockTagsProvider.java | 8 ++++++++ 8 files changed, 56 insertions(+) create mode 100644 src/generated/resources/data/minecraft/tags/block/incorrect_for_diamond_tool.json create mode 100644 src/generated/resources/data/minecraft/tags/block/incorrect_for_gold_tool.json create mode 100644 src/generated/resources/data/minecraft/tags/block/incorrect_for_iron_tool.json create mode 100644 src/generated/resources/data/minecraft/tags/block/incorrect_for_stone_tool.json create mode 100644 src/generated/resources/data/minecraft/tags/block/incorrect_for_wooden_tool.json create mode 100644 src/generated/resources/data/neoforge/tags/block/needs_netherite_tool.json diff --git a/src/generated/resources/data/minecraft/tags/block/incorrect_for_diamond_tool.json b/src/generated/resources/data/minecraft/tags/block/incorrect_for_diamond_tool.json new file mode 100644 index 0000000000..1486484827 --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/block/incorrect_for_diamond_tool.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#neoforge:needs_netherite_tool" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/block/incorrect_for_gold_tool.json b/src/generated/resources/data/minecraft/tags/block/incorrect_for_gold_tool.json new file mode 100644 index 0000000000..1486484827 --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/block/incorrect_for_gold_tool.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#neoforge:needs_netherite_tool" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/block/incorrect_for_iron_tool.json b/src/generated/resources/data/minecraft/tags/block/incorrect_for_iron_tool.json new file mode 100644 index 0000000000..1486484827 --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/block/incorrect_for_iron_tool.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#neoforge:needs_netherite_tool" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/block/incorrect_for_stone_tool.json b/src/generated/resources/data/minecraft/tags/block/incorrect_for_stone_tool.json new file mode 100644 index 0000000000..1486484827 --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/block/incorrect_for_stone_tool.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#neoforge:needs_netherite_tool" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/block/incorrect_for_wooden_tool.json b/src/generated/resources/data/minecraft/tags/block/incorrect_for_wooden_tool.json new file mode 100644 index 0000000000..1486484827 --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/block/incorrect_for_wooden_tool.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#neoforge:needs_netherite_tool" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/tags/block/needs_netherite_tool.json b/src/generated/resources/data/neoforge/tags/block/needs_netherite_tool.json new file mode 100644 index 0000000000..f72d209df7 --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/block/needs_netherite_tool.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/main/java/net/neoforged/neoforge/common/Tags.java b/src/main/java/net/neoforged/neoforge/common/Tags.java index 8a57785dc8..6ff6876aa1 100644 --- a/src/main/java/net/neoforged/neoforge/common/Tags.java +++ b/src/main/java/net/neoforged/neoforge/common/Tags.java @@ -35,8 +35,28 @@ public static class Blocks { * This is patched into the following method: {@link net.minecraft.world.entity.monster.EnderMan.EndermanLeaveBlockGoal#canPlaceBlock(Level, BlockPos, BlockState, BlockState, BlockState, BlockPos)} */ public static final TagKey ENDERMAN_PLACE_ON_BLACKLIST = neoforgeTag("enderman_place_on_blacklist"); + + /** + * For denoting blocks that need tools that are Wood or higher to mine. + * By default, this is not added to any Minecraft tag since by default, Wood is in the lowest "tier". + */ public static final TagKey NEEDS_WOOD_TOOL = neoforgeTag("needs_wood_tool"); + + /** + * For denoting blocks that need tools that are Gold or higher to mine. + * By default, this is not added to any Minecraft tag since by default, Gold is in the lowest "tier". + */ public static final TagKey NEEDS_GOLD_TOOL = neoforgeTag("needs_gold_tool"); + + /** + * For denoting blocks that need tools that are Netherite or higher to mine. + * Blocks in this tag gets added to the following Minecraft tags: + * {@link BlockTags#INCORRECT_FOR_WOODEN_TOOL} + * {@link BlockTags#INCORRECT_FOR_STONE_TOOL} + * {@link BlockTags#INCORRECT_FOR_IRON_TOOL} + * {@link BlockTags#INCORRECT_FOR_GOLD_TOOL} + * {@link BlockTags#INCORRECT_FOR_DIAMOND_TOOL} + */ public static final TagKey NEEDS_NETHERITE_TOOL = neoforgeTag("needs_netherite_tool"); // `c` tags for common conventions diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider.java index ca4fde00ba..e986e6559c 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider.java @@ -160,6 +160,14 @@ public void addTags(HolderLookup.Provider p_256380_) { tag(Tags.Blocks.VILLAGER_FARMLANDS).add(Blocks.FARMLAND); + // Make our Needs Netherite Tool tag be functional. + tag(Tags.Blocks.NEEDS_NETHERITE_TOOL); + tag(BlockTags.INCORRECT_FOR_WOODEN_TOOL).addTag(Tags.Blocks.NEEDS_NETHERITE_TOOL); + tag(BlockTags.INCORRECT_FOR_STONE_TOOL).addTag(Tags.Blocks.NEEDS_NETHERITE_TOOL); + tag(BlockTags.INCORRECT_FOR_IRON_TOOL).addTag(Tags.Blocks.NEEDS_NETHERITE_TOOL); + tag(BlockTags.INCORRECT_FOR_GOLD_TOOL).addTag(Tags.Blocks.NEEDS_NETHERITE_TOOL); + tag(BlockTags.INCORRECT_FOR_DIAMOND_TOOL).addTag(Tags.Blocks.NEEDS_NETHERITE_TOOL); + // Backwards compat with pre-1.21 tags. Done after so optional tag is last for better readability. // TODO: Remove backwards compat tag entries in 1.22 tagWithOptionalLegacy(Tags.Blocks.BARRELS); From b60f2fd6bc2406ddb9b8170662d1e9a8875fb61b Mon Sep 17 00:00:00 2001 From: TelepathicGrunt <40846040+TelepathicGrunt@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:56:48 -0500 Subject: [PATCH 2/3] removed extra default --- src/main/java/net/neoforged/neoforge/common/Tags.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/neoforged/neoforge/common/Tags.java b/src/main/java/net/neoforged/neoforge/common/Tags.java index 6ff6876aa1..95b9497db7 100644 --- a/src/main/java/net/neoforged/neoforge/common/Tags.java +++ b/src/main/java/net/neoforged/neoforge/common/Tags.java @@ -44,7 +44,7 @@ public static class Blocks { /** * For denoting blocks that need tools that are Gold or higher to mine. - * By default, this is not added to any Minecraft tag since by default, Gold is in the lowest "tier". + * By default, this is not added to any Minecraft tag since Gold is in the lowest "tier". */ public static final TagKey NEEDS_GOLD_TOOL = neoforgeTag("needs_gold_tool"); From e213ab9bf347692809761d34753fe580fe9e8cf4 Mon Sep 17 00:00:00 2001 From: TelepathicGrunt <40846040+TelepathicGrunt@users.noreply.github.com> Date: Sun, 10 Nov 2024 17:11:57 -0500 Subject: [PATCH 3/3] E --- src/main/java/net/neoforged/neoforge/common/Tags.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/neoforged/neoforge/common/Tags.java b/src/main/java/net/neoforged/neoforge/common/Tags.java index 95b9497db7..8e3333d0fd 100644 --- a/src/main/java/net/neoforged/neoforge/common/Tags.java +++ b/src/main/java/net/neoforged/neoforge/common/Tags.java @@ -38,7 +38,7 @@ public static class Blocks { /** * For denoting blocks that need tools that are Wood or higher to mine. - * By default, this is not added to any Minecraft tag since by default, Wood is in the lowest "tier". + * By default, this is not added to any Minecraft tag since Wood is in the lowest "tier". */ public static final TagKey NEEDS_WOOD_TOOL = neoforgeTag("needs_wood_tool");