From ad22ce7342139bab6f8ecfdea9cdd28105674149 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 20 Nov 2024 21:59:25 +0100 Subject: [PATCH] fixed armor not having the proper tags closes #369 --- .../data/minecraft/tags/item/chest_armor.json | 7 +++++++ .../data/minecraft/tags/item/foot_armor.json | 7 +++++++ .../data/minecraft/tags/item/head_armor.json | 7 +++++++ .../resources/data/minecraft/tags/item/leg_armor.json | 7 +++++++ .../de/ellpeck/naturesaura/data/ItemTagProvider.java | 11 +++++++++++ 5 files changed, 39 insertions(+) create mode 100644 src/generated/resources/data/minecraft/tags/item/chest_armor.json create mode 100644 src/generated/resources/data/minecraft/tags/item/foot_armor.json create mode 100644 src/generated/resources/data/minecraft/tags/item/head_armor.json create mode 100644 src/generated/resources/data/minecraft/tags/item/leg_armor.json diff --git a/src/generated/resources/data/minecraft/tags/item/chest_armor.json b/src/generated/resources/data/minecraft/tags/item/chest_armor.json new file mode 100644 index 00000000..dc0d749e --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/item/chest_armor.json @@ -0,0 +1,7 @@ +{ + "values": [ + "naturesaura:depth_chest", + "naturesaura:infused_iron_chest", + "naturesaura:sky_chest" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/item/foot_armor.json b/src/generated/resources/data/minecraft/tags/item/foot_armor.json new file mode 100644 index 00000000..f0004e7f --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/item/foot_armor.json @@ -0,0 +1,7 @@ +{ + "values": [ + "naturesaura:depth_shoes", + "naturesaura:infused_iron_shoes", + "naturesaura:sky_shoes" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/item/head_armor.json b/src/generated/resources/data/minecraft/tags/item/head_armor.json new file mode 100644 index 00000000..91ce668b --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/item/head_armor.json @@ -0,0 +1,7 @@ +{ + "values": [ + "naturesaura:depth_helmet", + "naturesaura:infused_iron_helmet", + "naturesaura:sky_helmet" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/item/leg_armor.json b/src/generated/resources/data/minecraft/tags/item/leg_armor.json new file mode 100644 index 00000000..26dbc046 --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/item/leg_armor.json @@ -0,0 +1,7 @@ +{ + "values": [ + "naturesaura:depth_pants", + "naturesaura:infused_iron_pants", + "naturesaura:sky_pants" + ] +} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/naturesaura/data/ItemTagProvider.java b/src/main/java/de/ellpeck/naturesaura/data/ItemTagProvider.java index 301959ae..ea30fc6f 100644 --- a/src/main/java/de/ellpeck/naturesaura/data/ItemTagProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/data/ItemTagProvider.java @@ -51,6 +51,16 @@ public class ItemTagProvider extends ItemTagsProvider { this.tag(ItemTags.SWORDS).add(i); } else if (i instanceof ItemShovel) { this.tag(ItemTags.SHOVELS).add(i); + } else if (i instanceof ItemArmor a) { + var tag = switch (a.getType()) { + case HELMET -> ItemTags.HEAD_ARMOR; + case CHESTPLATE -> ItemTags.CHEST_ARMOR; + case LEGGINGS -> ItemTags.LEG_ARMOR; + case BOOTS -> ItemTags.FOOT_ARMOR; + default -> null; + }; + if (tag != null) + this.tag(tag).add(i); } }); @@ -62,4 +72,5 @@ public class ItemTagProvider extends ItemTagsProvider { // super is protected, but CuriosCompat needs this return super.tag(tag); } + }