VanillaPlus/src/main/java/tech/nevets/vplus/items/VPMaterials.java
2022-08-03 09:33:14 -04:00

139 lines
4.7 KiB
Java

package tech.nevets.vplus.items;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
public enum VPMaterials implements ToolMaterial, ArmorMaterial {
COPPER("copper", 20, Ingredient.ofItems(Items.COPPER_INGOT), 13, new int[]{2, 4, 5, 2}, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F, 0.0F, 2, 200, 5.0F, 3.0F),
EMERALD("emerald", 30, Ingredient.ofItems(Items.EMERALD), 30, new int[]{2, 6, 8, 2}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.5F, 0.0F, 3, 750, 7.0F, 4.0F),
SAPPHIRE("sapphire", 50, Ingredient.ofItems(VPItems.SAPPHIRE), 40, new int[]{6, 8, 10, 6}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, 0.1F, 4, 3000, 8.0F, 6.0F),
RUBY("ruby", 50, Ingredient.ofItems(VPItems.RUBY), 40, new int[]{10, 15, 20, 10}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, .01F, 4, 3000, 8.0F, 6.0F),
JADE("jade", 50, Ingredient.ofItems(VPItems.JADE), 40, new int[]{10, 15, 20, 10}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, 0.1F, 4, 3000, 8.0F, 6.0F);
private static final int[] BASE_ARMOR_DURABILITY = new int[]{13, 15, 16, 11};
// Used by both
private String name;
private int enchantability;
private Ingredient repairIngredient;
// Used by armor
private int armorDurability;
private int[] protectionAmounts;
private SoundEvent equipSound;
private float toughness;
private float knockbackResistance;
// Used by tools
private int miningLevel;
private float miningSpeed;
private float attackDamage;
private int toolDurability;
// Used for armor materials
VPMaterials(String name, int armorDurability, int[] protectionAmounts, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Ingredient repairIngredient) {
this.name = name;
this.armorDurability = armorDurability;
this.protectionAmounts = protectionAmounts;
this.enchantability = enchantability;
this.equipSound = equipSound;
this.toughness = toughness;
this.knockbackResistance = knockbackResistance;
this.repairIngredient = repairIngredient;
}
// Used for tool materials
VPMaterials(String name, int miningLevel, int toolDurability, float miningSpeed, float attackDamage, int enchantability, Ingredient repairIngredient) {
this.name = name;
this.miningLevel = miningLevel;
this.toolDurability = toolDurability;
this.miningSpeed = miningSpeed;
this.attackDamage = attackDamage;
this.enchantability = enchantability;
this.repairIngredient = repairIngredient;
}
//Used for both
VPMaterials(String name, int enchantability, Ingredient repairIngredient, int armorDurability, int[] protectionAmounts, SoundEvent equipSound, float toughness, float knockbackResistance, int miningLevel, int toolDurability, float miningSpeed, float attackDamage) {
this.name = name;
this.enchantability = enchantability;
this.repairIngredient = repairIngredient;
this.armorDurability = armorDurability;
this.protectionAmounts = protectionAmounts;
this.equipSound = equipSound;
this.toughness = toughness;
this.knockbackResistance = knockbackResistance;
this.miningLevel = miningLevel;
this.toolDurability = toolDurability;
this.miningSpeed = miningSpeed;
this.attackDamage = attackDamage;
}
@Override
public String getName() {
return this.name;
}
@Override
public Ingredient getRepairIngredient() {
return this.repairIngredient;
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public int getDurability() {
return this.toolDurability;
}
@Override
public int getDurability(EquipmentSlot slot) {
return BASE_ARMOR_DURABILITY[slot.getEntitySlotId()] * this.armorDurability;
}
@Override
public int getProtectionAmount(EquipmentSlot slot) {
return this.protectionAmounts[slot.getEntitySlotId()];
}
@Override
public SoundEvent getEquipSound() {
return this.equipSound;
}
@Override
public float getToughness() {
return this.toughness;
}
@Override
public float getKnockbackResistance() {
return this.knockbackResistance;
}
@Override
public float getMiningSpeedMultiplier() {
return this.miningSpeed;
}
@Override
public float getAttackDamage() {
return this.attackDamage;
}
@Override
public int getMiningLevel() {
return this.miningLevel;
}
}