Skip to content

Commit e849f9f

Browse files
committed
ArmorMaterial code cleanup, and new register method in ArmorSet
Signed-off-by: Noaaan <[email protected]>
1 parent 1bf94b4 commit e849f9f

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/main/java/nourl/mythicmetals/armor/ArmorSet.java

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import net.minecraft.item.ArmorMaterial;
77
import net.minecraft.item.Item;
88
import net.minecraft.item.ItemStack;
9+
import net.minecraft.util.Identifier;
910
import net.minecraft.util.registry.Registry;
1011
import nourl.mythicmetals.MythicMetals;
1112
import nourl.mythicmetals.utils.RegistryHelper;
@@ -48,6 +49,13 @@ public void register(String name) {
4849
Registry.register(Registry.ITEM, RegistryHelper.id(name + "_boots"), boots);
4950
}
5051

52+
public void register(String modid, String name) {
53+
Registry.register(Registry.ITEM, new Identifier(modid, name + "_helmet"), helmet);
54+
Registry.register(Registry.ITEM, new Identifier(modid, name + "_chestplate"), chestplate);
55+
Registry.register(Registry.ITEM, new Identifier(modid, name + "_leggings"), leggings);
56+
Registry.register(Registry.ITEM, new Identifier(modid, name + "_boots"), boots);
57+
}
58+
5159
protected ArmorItem makeItem(ArmorMaterial material, EquipmentSlot slot, Item.Settings settings) {
5260
return new ArmorItem(material, slot, settings);
5361
}

src/main/java/nourl/mythicmetals/armor/MythicArmorMaterials.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import java.util.List;
1515
import java.util.function.Supplier;
1616

17-
@SuppressWarnings("ALL")
17+
@SuppressWarnings("CodeBlock2Expr")
1818
public enum MythicArmorMaterials implements ArmorMaterial {
1919
ADAMANTITE("adamantite", 30, new int[]{3, 6, 8, 3}, 16, SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 2.0F, 0.0F, () -> {
2020
return Ingredient.ofItems(MythicItems.Ingots.ADAMANTITE_INGOT);
@@ -97,7 +97,7 @@ public enum MythicArmorMaterials implements ArmorMaterial {
9797
private final float knockbackResistance;
9898
private final Supplier<Ingredient> repairIngredientSupplier;
9999

100-
private MythicArmorMaterials(String name, int durabilityMultiplier, int[] protectionAmounts, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Supplier<Ingredient> repairIngredientSupplier) {
100+
MythicArmorMaterials(String name, int durabilityMultiplier, int[] protectionAmounts, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Supplier<Ingredient> repairIngredientSupplier) {
101101
this.name = name;
102102
this.durabilityMultiplier = durabilityMultiplier;
103103
this.protectionAmounts = protectionAmounts;
@@ -125,7 +125,7 @@ public SoundEvent getEquipSound() {
125125
}
126126

127127
public Ingredient getRepairIngredient() {
128-
return (Ingredient) this.repairIngredientSupplier.get();
128+
return this.repairIngredientSupplier.get();
129129
}
130130

131131
public String getName() {
@@ -140,8 +140,7 @@ public float getKnockbackResistance() {
140140
return this.knockbackResistance;
141141
}
142142

143-
public static final List KNOCKBACKABLE_ARMOR_MATERIALS = Arrays.asList(new ArmorMaterial[]{
144-
ORICHALCUM, OSMIUM, METALLURGIUM
145-
});
143+
@SuppressWarnings("rawtypes")
144+
public static final List KNOCKBACKABLE_ARMOR_MATERIALS = Arrays.asList(ORICHALCUM, OSMIUM, METALLURGIUM);
146145

147146
}

0 commit comments

Comments
 (0)