Added Sentient Armour - not fully implemented.
This commit is contained in:
parent
61e6cf2a14
commit
4d835257ab
|
@ -0,0 +1,265 @@
|
||||||
|
package WayofTime.bloodmagic.item.armour;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemArmor;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.DamageSource;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.ISpecialArmor;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import WayofTime.bloodmagic.BloodMagic;
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.registry.ModItems;
|
||||||
|
|
||||||
|
public class ItemSentientArmour extends ItemArmor implements ISpecialArmor
|
||||||
|
{
|
||||||
|
public static String[] names = { "helmet", "chest", "legs", "boots" };
|
||||||
|
|
||||||
|
public ItemSentientArmour(int armorType)
|
||||||
|
{
|
||||||
|
super(ItemArmor.ArmorMaterial.IRON, 0, armorType);
|
||||||
|
setUnlocalizedName(Constants.Mod.MODID + ".sentientArmour.");
|
||||||
|
setMaxDamage(250);
|
||||||
|
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArmorProperties getProperties(EntityLivingBase player, ItemStack stack, DamageSource source, double damage, int slot)
|
||||||
|
{
|
||||||
|
double armourReduction = 0.0;
|
||||||
|
double damageAmount = 0.25;
|
||||||
|
|
||||||
|
if (this == ModItems.sentientArmourBoots || this == ModItems.sentientArmourHelmet)
|
||||||
|
{
|
||||||
|
damageAmount = 3d / 20d * 0.6;
|
||||||
|
} else if (this == ModItems.sentientArmourLegs)
|
||||||
|
{
|
||||||
|
damageAmount = 6d / 20d * 0.6;
|
||||||
|
} else if (this == ModItems.sentientArmourChest)
|
||||||
|
{
|
||||||
|
damageAmount = 0.64;
|
||||||
|
}
|
||||||
|
|
||||||
|
double armourPenetrationReduction = 0;
|
||||||
|
|
||||||
|
int maxAbsorption = 100000;
|
||||||
|
|
||||||
|
if (source.equals(DamageSource.drown))
|
||||||
|
{
|
||||||
|
return new ArmorProperties(-1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source.equals(DamageSource.outOfWorld))
|
||||||
|
{
|
||||||
|
return new ArmorProperties(-1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this == ModItems.sentientArmourChest)
|
||||||
|
{
|
||||||
|
armourReduction = 0.24 / 0.64; // This values puts it at iron level
|
||||||
|
|
||||||
|
ItemStack helmet = player.getEquipmentInSlot(4);
|
||||||
|
ItemStack leggings = player.getEquipmentInSlot(2);
|
||||||
|
ItemStack boots = player.getEquipmentInSlot(1);
|
||||||
|
|
||||||
|
if (helmet == null || leggings == null || boots == null)
|
||||||
|
{
|
||||||
|
damageAmount *= (armourReduction);
|
||||||
|
|
||||||
|
return new ArmorProperties(-1, damageAmount, maxAbsorption);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (helmet.getItem() instanceof ItemSentientArmour && leggings.getItem() instanceof ItemSentientArmour && boots.getItem() instanceof ItemSentientArmour)
|
||||||
|
{
|
||||||
|
double remainder = 1; // Multiply this number by the armour upgrades for protection
|
||||||
|
|
||||||
|
armourReduction = armourReduction + (1 - remainder) * (1 - armourReduction);
|
||||||
|
damageAmount *= (armourReduction);
|
||||||
|
|
||||||
|
if (source.isUnblockable())
|
||||||
|
{
|
||||||
|
return new ArmorProperties(-1, damageAmount * armourPenetrationReduction, maxAbsorption);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ArmorProperties(-1, damageAmount, maxAbsorption);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (source.isUnblockable())
|
||||||
|
{
|
||||||
|
return new ArmorProperties(-1, damageAmount * armourPenetrationReduction, maxAbsorption);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ArmorProperties(-1, damageAmount, maxAbsorption);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ArmorProperties(-1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot)
|
||||||
|
{
|
||||||
|
if (armor.getItem() == ModItems.sentientArmourHelmet)
|
||||||
|
{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (armor.getItem() == ModItems.sentientArmourChest)
|
||||||
|
{
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (armor.getItem() == ModItems.sentientArmourLegs)
|
||||||
|
{
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (armor.getItem() == ModItems.sentientArmourBoots)
|
||||||
|
{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot)
|
||||||
|
{
|
||||||
|
return; // Armour shouldn't get damaged... for now
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||||
|
{
|
||||||
|
|
||||||
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
|
||||||
|
{
|
||||||
|
if (this == ModItems.sentientArmourChest || this == ModItems.sentientArmourHelmet || this == ModItems.sentientArmourBoots)
|
||||||
|
{
|
||||||
|
return "bloodmagic:models/armor/sentientArmour_layer_1.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this == ModItems.sentientArmourLegs)
|
||||||
|
{
|
||||||
|
return "bloodmagic:models/armor/sentientArmour_layer_2.png";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
|
||||||
|
{
|
||||||
|
super.onArmorTick(world, player, stack);
|
||||||
|
|
||||||
|
if (world.isRemote)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: Consume will - if the will drops to 0, return the contained item
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnlocalizedName(ItemStack stack)
|
||||||
|
{
|
||||||
|
return super.getUnlocalizedName(stack) + names[armorType];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void revertArmour(EntityPlayer player, ItemStack itemStack)
|
||||||
|
{
|
||||||
|
ItemStack stack = this.getContainedArmourStack(itemStack);
|
||||||
|
player.inventory.armorInventory[3 - this.armorType] = stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void revertAllArmour(EntityPlayer player)
|
||||||
|
{
|
||||||
|
ItemStack[] armourInventory = player.inventory.armorInventory;
|
||||||
|
for (ItemStack stack : armourInventory)
|
||||||
|
{
|
||||||
|
if (stack != null && stack.getItem() instanceof ItemSentientArmour)
|
||||||
|
{
|
||||||
|
((ItemSentientArmour) stack.getItem()).revertArmour(player, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContainedArmourStack(ItemStack newArmour, ItemStack previousArmour)
|
||||||
|
{
|
||||||
|
if (newArmour == null || previousArmour == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
previousArmour.writeToNBT(tag);
|
||||||
|
|
||||||
|
NBTTagCompound omegaTag = newArmour.getTagCompound();
|
||||||
|
if (omegaTag == null)
|
||||||
|
{
|
||||||
|
omegaTag = new NBTTagCompound();
|
||||||
|
newArmour.setTagCompound(omegaTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
omegaTag.setTag("armour", tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getContainedArmourStack(ItemStack newArmour)
|
||||||
|
{
|
||||||
|
NBTTagCompound omegaTag = newArmour.getTagCompound();
|
||||||
|
if (omegaTag == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
NBTTagCompound tag = omegaTag.getCompoundTag("armour");
|
||||||
|
ItemStack armourStack = ItemStack.loadItemStackFromNBT(tag);
|
||||||
|
|
||||||
|
return armourStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean convertPlayerArmour(EntityPlayer player)
|
||||||
|
{
|
||||||
|
ItemStack[] armours = player.inventory.armorInventory;
|
||||||
|
|
||||||
|
ItemStack helmetStack = armours[3];
|
||||||
|
ItemStack chestStack = armours[2];
|
||||||
|
ItemStack leggingsStack = armours[1];
|
||||||
|
ItemStack bootsStack = armours[0];
|
||||||
|
|
||||||
|
{
|
||||||
|
ItemStack omegaHelmetStack = ((ItemSentientArmour) ModItems.sentientArmourHelmet).getSubstituteStack(helmetStack);
|
||||||
|
ItemStack omegaChestStack = ((ItemSentientArmour) ModItems.sentientArmourChest).getSubstituteStack(chestStack);
|
||||||
|
ItemStack omegaLeggingsStack = ((ItemSentientArmour) ModItems.sentientArmourLegs).getSubstituteStack(leggingsStack);
|
||||||
|
ItemStack omegaBootsStack = ((ItemSentientArmour) ModItems.sentientArmourBoots).getSubstituteStack(bootsStack);
|
||||||
|
|
||||||
|
armours[3] = omegaHelmetStack;
|
||||||
|
armours[2] = omegaChestStack;
|
||||||
|
armours[1] = omegaLeggingsStack;
|
||||||
|
armours[0] = omegaBootsStack;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getSubstituteStack(ItemStack previousArmour)
|
||||||
|
{
|
||||||
|
ItemStack newArmour = new ItemStack(this);
|
||||||
|
|
||||||
|
this.setContainedArmourStack(newArmour, previousArmour);
|
||||||
|
|
||||||
|
return newArmour;
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ import WayofTime.bloodmagic.item.ItemSacrificialDagger;
|
||||||
import WayofTime.bloodmagic.item.ItemSlate;
|
import WayofTime.bloodmagic.item.ItemSlate;
|
||||||
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
|
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
|
||||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||||
|
import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
|
||||||
import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
|
import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
|
||||||
import WayofTime.bloodmagic.item.gear.ItemPackSelfSacrifice;
|
import WayofTime.bloodmagic.item.gear.ItemPackSelfSacrifice;
|
||||||
import WayofTime.bloodmagic.item.sigil.ItemSigilAir;
|
import WayofTime.bloodmagic.item.sigil.ItemSigilAir;
|
||||||
|
@ -110,6 +111,11 @@ public class ModItems
|
||||||
public static Item livingArmourLegs;
|
public static Item livingArmourLegs;
|
||||||
public static Item livingArmourBoots;
|
public static Item livingArmourBoots;
|
||||||
|
|
||||||
|
public static Item sentientArmourHelmet;
|
||||||
|
public static Item sentientArmourChest;
|
||||||
|
public static Item sentientArmourLegs;
|
||||||
|
public static Item sentientArmourBoots;
|
||||||
|
|
||||||
public static Item altarMaker;
|
public static Item altarMaker;
|
||||||
|
|
||||||
public static Item arcaneAshes;
|
public static Item arcaneAshes;
|
||||||
|
@ -188,6 +194,11 @@ public class ModItems
|
||||||
livingArmourLegs = registerItem(new ItemLivingArmour(2), "ItemLivingArmourLegs");
|
livingArmourLegs = registerItem(new ItemLivingArmour(2), "ItemLivingArmourLegs");
|
||||||
livingArmourBoots = registerItem(new ItemLivingArmour(3), "ItemLivingArmourBoots");
|
livingArmourBoots = registerItem(new ItemLivingArmour(3), "ItemLivingArmourBoots");
|
||||||
|
|
||||||
|
sentientArmourHelmet = registerItem(new ItemSentientArmour(0), "ItemSentientArmourHelmet");
|
||||||
|
sentientArmourChest = registerItem(new ItemSentientArmour(1), "ItemSentientArmourChest");
|
||||||
|
sentientArmourLegs = registerItem(new ItemSentientArmour(2), "ItemSentientArmourLegs");
|
||||||
|
sentientArmourBoots = registerItem(new ItemSentientArmour(3), "ItemSentientArmourBoots");
|
||||||
|
|
||||||
altarMaker = registerItem(new ItemAltarMaker());
|
altarMaker = registerItem(new ItemAltarMaker());
|
||||||
|
|
||||||
arcaneAshes = registerItem(new ItemArcaneAshes());
|
arcaneAshes = registerItem(new ItemArcaneAshes());
|
||||||
|
@ -292,6 +303,11 @@ public class ModItems
|
||||||
renderHelper.itemRender(livingArmourLegs, "ItemLivingArmour2");
|
renderHelper.itemRender(livingArmourLegs, "ItemLivingArmour2");
|
||||||
renderHelper.itemRender(livingArmourBoots, "ItemLivingArmour3");
|
renderHelper.itemRender(livingArmourBoots, "ItemLivingArmour3");
|
||||||
|
|
||||||
|
renderHelper.itemRender(sentientArmourHelmet, "ItemSentientArmour0");
|
||||||
|
renderHelper.itemRender(sentientArmourChest, "ItemSentientArmour1");
|
||||||
|
renderHelper.itemRender(sentientArmourLegs, "ItemSentientArmour2");
|
||||||
|
renderHelper.itemRender(sentientArmourBoots, "ItemSentientArmour3");
|
||||||
|
|
||||||
renderHelper.itemRender(altarMaker);
|
renderHelper.itemRender(altarMaker);
|
||||||
|
|
||||||
renderHelper.itemRender(arcaneAshes);
|
renderHelper.itemRender(arcaneAshes);
|
||||||
|
|
|
@ -283,7 +283,7 @@ chat.BloodMagic.livingArmour.upgrade.poisonRemove=You are starting to feel bette
|
||||||
jei.BloodMagic.recipe.altar=Blood Altar
|
jei.BloodMagic.recipe.altar=Blood Altar
|
||||||
jei.BloodMagic.recipe.binding=Binding Ritual
|
jei.BloodMagic.recipe.binding=Binding Ritual
|
||||||
jei.BloodMagic.recipe.alchemyArrayCrafting=Alchemy Array
|
jei.BloodMagic.recipe.alchemyArrayCrafting=Alchemy Array
|
||||||
jei.BloodMagic.recipe.soulForge=Soul Forge
|
jei.BloodMagic.recipe.soulForge=Hellfire Forge
|
||||||
jei.BloodMagic.recipe.requiredLP=LP: %d
|
jei.BloodMagic.recipe.requiredLP=LP: %d
|
||||||
jei.BloodMagic.recipe.requiredTier=Tier: %d
|
jei.BloodMagic.recipe.requiredTier=Tier: %d
|
||||||
jei.BloodMagic.recipe.minimumSouls=Minimum: %d Souls
|
jei.BloodMagic.recipe.minimumSouls=Minimum: %d Souls
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"parent":"bloodmagic:item/ItemModelBase",
|
||||||
|
"textures": {
|
||||||
|
"layer0":"bloodmagic:items/SentientHelmet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"parent":"bloodmagic:item/ItemModelBase",
|
||||||
|
"textures": {
|
||||||
|
"layer0":"bloodmagic:items/SentientPlate"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"parent":"bloodmagic:item/ItemModelBase",
|
||||||
|
"textures": {
|
||||||
|
"layer0":"bloodmagic:items/SentientLeggings"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"parent":"bloodmagic:item/ItemModelBase",
|
||||||
|
"textures": {
|
||||||
|
"layer0":"bloodmagic:items/SentientBoots"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 255 B |
Binary file not shown.
After Width: | Height: | Size: 253 B |
Binary file not shown.
After Width: | Height: | Size: 231 B |
Binary file not shown.
After Width: | Height: | Size: 282 B |
Loading…
Reference in a new issue