mirror of
https://github.com/TechnoVisionDev/Forge-Modding-Tutorial-1.16
synced 2024-10-27 20:34:04 +00:00
Customize Armor Values
This commit is contained in:
parent
f8cb68375a
commit
0b67d50874
@ -5,7 +5,6 @@ import com.technovision.tutorial.util.RegistryHandler;
|
|||||||
import net.minecraft.inventory.EquipmentSlotType;
|
import net.minecraft.inventory.EquipmentSlotType;
|
||||||
import net.minecraft.item.IArmorMaterial;
|
import net.minecraft.item.IArmorMaterial;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.util.LazyValue;
|
|
||||||
import net.minecraft.util.SoundEvent;
|
import net.minecraft.util.SoundEvent;
|
||||||
import net.minecraft.util.SoundEvents;
|
import net.minecraft.util.SoundEvents;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
@ -15,17 +14,17 @@ import java.util.function.Supplier;
|
|||||||
|
|
||||||
public enum ModArmorMaterial implements IArmorMaterial {
|
public enum ModArmorMaterial implements IArmorMaterial {
|
||||||
|
|
||||||
RUBY(Tutorial.MOD_ID + ":ruby", 5, new int[] { 7, 9, 11, 7 }, 18,
|
RUBY(Tutorial.MOD_ID + ":ruby", 25, new int[] { 2, 5, 6, 2 }, 18,
|
||||||
SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 6.9F, () -> { return Ingredient.fromItems(RegistryHandler.RUBY_HELMET.get()); });
|
SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0.0F, () -> { return Ingredient.fromItems(RegistryHandler.RUBY.get()); });
|
||||||
|
|
||||||
private static final int[] MAX_DAMAGE_ARRAY = new int[] { 16, 16, 16, 16 };
|
private static final int[] MAX_DAMAGE_ARRAY = new int[] { 11, 16, 15, 13 };
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int maxDamageFactor;
|
private final int maxDamageFactor; //Durability - Iron=15, Diamond=33, Gold=7, Leather=5
|
||||||
private final int[] damageReductionAmountArray;
|
private final int[] damageReductionAmountArray; //Armor Bar Protection, 1 = 1/2 armor bar
|
||||||
private final int enchantability;
|
private final int enchantability;
|
||||||
private final SoundEvent soundEvent;
|
private final SoundEvent soundEvent;
|
||||||
private final float toughness;
|
private final float toughness; //Increases Protection - 0.0F = Disabled
|
||||||
private final LazyValue<Ingredient> repairMaterial;
|
private final Supplier<Ingredient> repairMaterial;
|
||||||
|
|
||||||
ModArmorMaterial(String name, int maxDamageFactor, int[] damageReductionAmount, int enchantability,
|
ModArmorMaterial(String name, int maxDamageFactor, int[] damageReductionAmount, int enchantability,
|
||||||
SoundEvent soundEvent, float toughness, Supplier<Ingredient> repairMaterial) {
|
SoundEvent soundEvent, float toughness, Supplier<Ingredient> repairMaterial) {
|
||||||
@ -35,7 +34,7 @@ public enum ModArmorMaterial implements IArmorMaterial {
|
|||||||
this.enchantability = enchantability;
|
this.enchantability = enchantability;
|
||||||
this.soundEvent = soundEvent;
|
this.soundEvent = soundEvent;
|
||||||
this.toughness = toughness;
|
this.toughness = toughness;
|
||||||
this.repairMaterial = new LazyValue<>(repairMaterial);
|
this.repairMaterial = repairMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -60,7 +59,7 @@ public enum ModArmorMaterial implements IArmorMaterial {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Ingredient getRepairMaterial() {
|
public Ingredient getRepairMaterial() {
|
||||||
return this.repairMaterial.getValue();
|
return this.repairMaterial.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
@ -9,7 +9,7 @@ import java.util.function.Supplier;
|
|||||||
public enum ModItemTier implements IItemTier {
|
public enum ModItemTier implements IItemTier {
|
||||||
|
|
||||||
RUBY(3, 800, 7.0F, 3.0F, 12, () -> {
|
RUBY(3, 800, 7.0F, 3.0F, 12, () -> {
|
||||||
return Ingredient.fromItems(RegistryHandler.RUBY_SWORD.get());
|
return Ingredient.fromItems(RegistryHandler.RUBY.get());
|
||||||
});
|
});
|
||||||
|
|
||||||
private final int harvestLevel;
|
private final int harvestLevel;
|
||||||
|
Loading…
Reference in New Issue
Block a user