|
1 | 1 | package barch.mc_extended.Armor;
|
2 | 2 |
|
3 | 3 |
|
| 4 | +import net.minecraft.item.ArmorItem; |
| 5 | +import net.minecraft.item.ArmorMaterial; |
| 6 | +import net.minecraft.recipe.Ingredient; |
| 7 | +import net.minecraft.registry.Registries; |
| 8 | +import net.minecraft.registry.Registry; |
| 9 | +import net.minecraft.registry.entry.RegistryEntry; |
| 10 | +import net.minecraft.sound.SoundEvent; |
| 11 | +import net.minecraft.util.Identifier; |
| 12 | + |
| 13 | +import java.net.Proxy; |
| 14 | +import java.util.EnumMap; |
| 15 | +import java.util.List; |
| 16 | +import java.util.Map; |
| 17 | +import java.util.function.Supplier; |
| 18 | + |
| 19 | +import static barch.mc_extended.MCExtended.NAMESPACE; |
| 20 | + |
4 | 21 | public class ArmorMaterials {
|
5 | 22 |
|
6 |
| - public static final RubyArmorMaterial RUBY_ARMOR_MATERIAL = new RubyArmorMaterial(); |
7 |
| - public static final SapphireArmorMaterial SAPPHIRE_ARMOR_MATERIAL = new SapphireArmorMaterial(); |
8 |
| - public static final SilverArmorMaterial SILVER_ARMOR_MATERIAL = new SilverArmorMaterial(); |
9 |
| - public static final BronzeArmorMaterial BRONZE_ARMOR_MATERIAL = new BronzeArmorMaterial(); |
10 |
| - public static final CopperArmorMaterial COPPER_ARMOR_MATERIAL = new CopperArmorMaterial(); |
11 |
| - public static final TinArmorMaterial TIN_ARMOR_MATERIAL = new TinArmorMaterial(); |
12 |
| - public static final CorundumArmorMaterial CORUNDUM_ARMOR_MATERIAL = new CorundumArmorMaterial(); |
| 23 | + public static RegistryEntry<ArmorMaterial> registerMaterial(String id, Map<ArmorItem.Type, Integer> defencePoints, int enchantability, RegistryEntry<SoundEvent> equipSound, Supplier<Ingredient> repairIngredientSupplier, float toughness, float knockbackResistance, boolean dyeable) { |
| 24 | + List<ArmorMaterial.Layer> layers = List.of( |
| 25 | + new ArmorMaterial.Layer(Identifier.of(NAMESPACE, id), "", dyeable) |
| 26 | + ); |
| 27 | + |
| 28 | + EnumMap<ArmorItem.Type, Integer> enumMap = new EnumMap(ArmorItem.Type.class); |
| 29 | + ArmorItem.Type[] var9 = ArmorItem.Type.values(); |
| 30 | + int var10 = var9.length; |
| 31 | + |
| 32 | + for(int var11 = 0; var11 < var10; ++var11) { |
| 33 | + ArmorItem.Type type = var9[var11]; |
| 34 | + enumMap.put(type, (Integer)defencePoints.get(type)); |
| 35 | + } |
| 36 | + |
| 37 | + return Registry.registerReference(Registries.ARMOR_MATERIAL, Identifier.ofVanilla(id), new ArmorMaterial(enumMap, enchantability, equipSound, repairIngredientSupplier, layers, toughness, knockbackResistance)); |
| 38 | + |
| 39 | + } |
13 | 40 | public static void RegisterAll() {
|
14 | 41 |
|
15 |
| - RUBY_ARMOR_MATERIAL.RegisterArmor(); |
16 |
| - RUBY_ARMOR_MATERIAL.GroupArmor(); |
17 |
| - SAPPHIRE_ARMOR_MATERIAL.RegisterArmor(); |
18 |
| - SAPPHIRE_ARMOR_MATERIAL.GroupArmor(); |
19 |
| - SILVER_ARMOR_MATERIAL.RegisterArmor(); |
20 |
| - SILVER_ARMOR_MATERIAL.GroupArmor(); |
21 |
| - BRONZE_ARMOR_MATERIAL.RegisterArmor(); |
22 |
| - BRONZE_ARMOR_MATERIAL.GroupArmor(); |
23 |
| - COPPER_ARMOR_MATERIAL.RegisterArmor(); |
24 |
| - COPPER_ARMOR_MATERIAL.GroupArmor(); |
25 |
| - TIN_ARMOR_MATERIAL.RegisterArmor(); |
26 |
| - TIN_ARMOR_MATERIAL.GroupArmor(); |
27 |
| - CORUNDUM_ARMOR_MATERIAL.RegisterArmor(); |
28 |
| - CORUNDUM_ARMOR_MATERIAL.GroupArmor(); |
| 42 | + RubyArmorData.RegisterArmor(); |
| 43 | + RubyArmorData.GroupArmor(); |
| 44 | + SapphireArmorData.RegisterArmor(); |
| 45 | + SapphireArmorData.GroupArmor(); |
| 46 | + SilverArmorData.RegisterArmor(); |
| 47 | + SilverArmorData.GroupArmor(); |
| 48 | + BronzeArmorData.RegisterArmor(); |
| 49 | + BronzeArmorData.GroupArmor(); |
| 50 | + CopperArmorData.RegisterArmor(); |
| 51 | + CopperArmorData.GroupArmor(); |
| 52 | + TinArmorData.RegisterArmor(); |
| 53 | + TinArmorData.GroupArmor(); |
| 54 | + CorundumArmorData.RegisterArmor(); |
| 55 | + CorundumArmorData.GroupArmor(); |
29 | 56 |
|
30 | 57 |
|
31 | 58 | };
|
|
0 commit comments