Skip to content

Commit 052866d

Browse files
authored
Simplify armor logic (#4431)
1 parent 4bdbbd6 commit 052866d

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

src/main/java/com/gregtechceu/gtceu/core/MixinHelpers.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import net.minecraft.resources.ResourceKey;
3737
import net.minecraft.resources.ResourceLocation;
3838
import net.minecraft.tags.*;
39+
import net.minecraft.world.item.ArmorItem;
3940
import net.minecraft.world.item.Item;
4041
import net.minecraft.world.item.ItemStack;
4142
import net.minecraft.world.item.Items;
@@ -58,7 +59,6 @@
5859
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
5960
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
6061
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
61-
import net.neoforged.neoforge.common.Tags;
6262

6363
import com.tterrag.registrate.util.entry.BlockEntry;
6464
import org.apache.logging.log4j.util.TriConsumer;
@@ -133,6 +133,9 @@ public static <T> void generateGTDynamicTags(Map<ResourceLocation, List<TagLoade
133133

134134
GTMaterialItems.ARMOR_ITEMS.rowMap().forEach((material, map) -> {
135135
map.forEach((type, item) -> {
136+
if (type == null || type == ArmorItem.Type.BODY) {
137+
return;
138+
}
136139
if (item != null) {
137140
var entry = new TagLoader.EntryWithSource(TagEntry.element(item.getId()),
138141
GTValues.CUSTOM_TAG_SOURCE);
@@ -143,14 +146,7 @@ public static <T> void generateGTDynamicTags(Map<ResourceLocation, List<TagLoade
143146
case CHESTPLATE -> ItemTags.CHEST_ARMOR.location();
144147
case LEGGINGS -> ItemTags.LEG_ARMOR.location();
145148
case BOOTS -> ItemTags.FOOT_ARMOR.location();
146-
case BODY -> Tags.Items.ARMORS.location();
147-
}, $ -> new ArrayList<>()).add(entry);
148-
tagMap.computeIfAbsent(switch (type) {
149-
case HELMET -> ItemTags.HEAD_ARMOR_ENCHANTABLE.location();
150-
case CHESTPLATE -> ItemTags.CHEST_ARMOR_ENCHANTABLE.location();
151-
case LEGGINGS -> ItemTags.LEG_ARMOR_ENCHANTABLE.location();
152-
case BOOTS -> ItemTags.FOOT_ARMOR_ENCHANTABLE.location();
153-
case BODY -> Tags.Items.ENCHANTABLES.location();
149+
default -> throw new IllegalStateException("Unexpected value: " + type);
154150
}, $ -> new ArrayList<>()).add(entry);
155151
}
156152
});

0 commit comments

Comments
 (0)