parent
e34e51e48c
commit
f8cb68375a
@ -0,0 +1,76 @@
|
||||
package com.technovision.tutorial.armor;
|
||||
|
||||
import com.technovision.tutorial.Tutorial;
|
||||
import com.technovision.tutorial.util.RegistryHandler;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.IArmorMaterial;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.LazyValue;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum ModArmorMaterial implements IArmorMaterial {
|
||||
|
||||
RUBY(Tutorial.MOD_ID + ":ruby", 5, new int[] { 7, 9, 11, 7 }, 18,
|
||||
SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 6.9F, () -> { return Ingredient.fromItems(RegistryHandler.RUBY_HELMET.get()); });
|
||||
|
||||
private static final int[] MAX_DAMAGE_ARRAY = new int[] { 16, 16, 16, 16 };
|
||||
private final String name;
|
||||
private final int maxDamageFactor;
|
||||
private final int[] damageReductionAmountArray;
|
||||
private final int enchantability;
|
||||
private final SoundEvent soundEvent;
|
||||
private final float toughness;
|
||||
private final LazyValue<Ingredient> repairMaterial;
|
||||
|
||||
ModArmorMaterial(String name, int maxDamageFactor, int[] damageReductionAmount, int enchantability,
|
||||
SoundEvent soundEvent, float toughness, Supplier<Ingredient> repairMaterial) {
|
||||
this.name = name;
|
||||
this.maxDamageFactor = maxDamageFactor;
|
||||
this.damageReductionAmountArray = damageReductionAmount;
|
||||
this.enchantability = enchantability;
|
||||
this.soundEvent = soundEvent;
|
||||
this.toughness = toughness;
|
||||
this.repairMaterial = new LazyValue<>(repairMaterial);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurability(EquipmentSlotType slotIn) {
|
||||
return MAX_DAMAGE_ARRAY[slotIn.getIndex()] * this.maxDamageFactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageReductionAmount(EquipmentSlotType slotIn) {
|
||||
return this.damageReductionAmountArray[slotIn.getIndex()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantability() {
|
||||
return this.enchantability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoundEvent getSoundEvent() {
|
||||
return this.soundEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ingredient getRepairMaterial() {
|
||||
return this.repairMaterial.getValue();
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getToughness() {
|
||||
return this.toughness;
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "tutorial:items/ruby_boots"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "tutorial:items/ruby_chestplate"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "tutorial:items/ruby_helmet"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "tutorial:items/ruby_leggings"
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 221 B |
After Width: | Height: | Size: 294 B |
After Width: | Height: | Size: 209 B |
After Width: | Height: | Size: 195 B |
After Width: | Height: | Size: 582 B |
After Width: | Height: | Size: 295 B |
Loading…
Reference in new issue