Added ArmorMaterials
This commit is contained in:
parent
eb51e07998
commit
59b0633353
2 changed files with 48 additions and 31 deletions
|
@ -1,54 +1,74 @@
|
||||||
package techreborn.init;
|
package techreborn.init;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
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.LazyLoadBase;
|
||||||
import net.minecraft.util.SoundEvent;
|
import net.minecraft.util.SoundEvent;
|
||||||
|
|
||||||
|
|
||||||
/* //TODO move values over
|
|
||||||
public static ArmorMaterial BRONZE_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "BRONZE", ARMOR_PARAMETERS, "techreborn:bronze", 17, new int[] { 3, 6, 5,
|
|
||||||
2 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
|
|
||||||
public static ArmorMaterial RUBY_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "RUBY", ARMOR_PARAMETERS, "techreborn:ruby", 16, new int[] { 2, 7, 5,
|
|
||||||
2 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
|
|
||||||
public static ArmorMaterial SAPPHIRE_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "SAPPHIRE", ARMOR_PARAMETERS, "techreborn:sapphire", 19, new int[] { 4, 4, 4,
|
|
||||||
4 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
|
|
||||||
public static ArmorMaterial PERIDOT_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "PERIDOT", ARMOR_PARAMETERS, "techreborn:peridot", 17, new int[] { 3, 8, 3,
|
|
||||||
2 }, 16, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
|
|
||||||
public static ArmorMaterial CLOAKING_ARMOR = EnumHelper.addEnum(ArmorMaterial.class, "CLOAKING", ARMOR_PARAMETERS, "techreborn:cloaking", 5, new int[] { 1, 2, 3,
|
|
||||||
1 }, 0, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0F);
|
|
||||||
|
|
||||||
*/
|
|
||||||
public enum TRArmorMaterial implements IArmorMaterial {
|
public enum TRArmorMaterial implements IArmorMaterial {
|
||||||
|
|
||||||
BRONZE,
|
BRONZE(17, new int[] { 3, 6, 5, 2 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0F, () -> {
|
||||||
RUBY,
|
return Ingredient.fromItems(TRContent.Ingots.BRONZE.asItem());
|
||||||
SAPPHIRE,
|
}),
|
||||||
PERIDOT,
|
RUBY(16, new int[] { 2, 7, 5, 2 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> {
|
||||||
CLOAKING;
|
return Ingredient.fromItems(TRContent.Gems.RUBY.asItem());
|
||||||
|
}),
|
||||||
|
SAPPHIRE(19, new int[] { 4, 4, 4, 4 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> {
|
||||||
|
return Ingredient.fromItems(TRContent.Gems.SAPPHIRE.asItem());
|
||||||
|
}),
|
||||||
|
PERIDOT(17, new int[] { 3, 8, 3, 2 }, 16, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> {
|
||||||
|
return Ingredient.fromItems(TRContent.Gems.PERIDOT.asItem());
|
||||||
|
}),
|
||||||
|
CLOAKING(5, new int[] { 1, 2, 3, 1 }, 0, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F, null);
|
||||||
|
|
||||||
@Override
|
private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11};
|
||||||
public int getDurability(EntityEquipmentSlot entityEquipmentSlot) {
|
private final int maxDamageFactor;
|
||||||
return 0;
|
private final int[] damageReductionAmountArray;
|
||||||
|
private final int enchantability;
|
||||||
|
private final SoundEvent soundEvent;
|
||||||
|
private final float toughness;
|
||||||
|
private final LazyLoadBase<Ingredient> repairMaterial;
|
||||||
|
|
||||||
|
private TRArmorMaterial(int maxDamageFactor, int[] damageReductionAmountArray, int enchantability,
|
||||||
|
SoundEvent soundEvent, float toughness, Supplier<Ingredient> repairMaterialIn) {
|
||||||
|
this.maxDamageFactor = maxDamageFactor;
|
||||||
|
this.damageReductionAmountArray = damageReductionAmountArray;
|
||||||
|
this.enchantability = enchantability;
|
||||||
|
this.soundEvent = soundEvent;
|
||||||
|
this.toughness = toughness;
|
||||||
|
this.repairMaterial = new LazyLoadBase<>(repairMaterialIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDamageReductionAmount(EntityEquipmentSlot entityEquipmentSlot) {
|
public int getDurability(EntityEquipmentSlot slotIn) {
|
||||||
return 0;
|
return MAX_DAMAGE_ARRAY[slotIn.getIndex()] * maxDamageFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDamageReductionAmount(EntityEquipmentSlot slotIn) {
|
||||||
|
return damageReductionAmountArray[slotIn.getIndex()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnchantability() {
|
public int getEnchantability() {
|
||||||
return 0;
|
return enchantability;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SoundEvent getSoundEvent() {
|
public SoundEvent getSoundEvent() {
|
||||||
return null;
|
return soundEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Ingredient getRepairMaterial() {
|
public Ingredient getRepairMaterial() {
|
||||||
|
if (repairMaterial != null) {
|
||||||
|
return repairMaterial.getValue();
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +79,6 @@ public enum TRArmorMaterial implements IArmorMaterial {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getToughness() {
|
public float getToughness() {
|
||||||
return 0;
|
return toughness;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.MobEffects;
|
import net.minecraft.init.MobEffects;
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
import net.minecraft.item.ArmorMaterial;
|
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -46,6 +45,7 @@ import reborncore.common.registration.RebornRegister;
|
||||||
import reborncore.common.util.ItemUtils;
|
import reborncore.common.util.ItemUtils;
|
||||||
import techreborn.TechReborn;
|
import techreborn.TechReborn;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
import techreborn.init.TRArmorMaterial;
|
||||||
import techreborn.init.TRContent;
|
import techreborn.init.TRContent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -60,9 +60,7 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
|
||||||
|
|
||||||
// 40M FE capacity with 10k FE\t charge rate
|
// 40M FE capacity with 10k FE\t charge rate
|
||||||
public ItemCloakingDevice() {
|
public ItemCloakingDevice() {
|
||||||
//TODO: Update ArmorMaterial
|
super(TRArmorMaterial.CLOAKING, EntityEquipmentSlot.CHEST);
|
||||||
super(ArmorMaterial.DIAMOND, EntityEquipmentSlot.CHEST);
|
|
||||||
//setMaxStackSize(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item
|
// Item
|
||||||
|
@ -73,7 +71,6 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
||||||
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||||
if (entityIn instanceof EntityPlayer) {
|
if (entityIn instanceof EntityPlayer) {
|
||||||
EntityPlayer player = (EntityPlayer) entityIn;
|
EntityPlayer player = (EntityPlayer) entityIn;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue