use of thaumcraft.api.IRunicArmor in project BloodMagic by WayofTime.
the class BoundArmour method getRunicCharge.
@Override
@Optional.Method(modid = "Thaumcraft")
public int getRunicCharge(ItemStack itemstack) {
ItemStack[] inv = this.getInternalInventory(itemstack);
int shardLevel = this.getMaxBloodShardLevel(itemstack);
int count = 0;
int harden = 0;
if (inv == null) {
return 0;
}
for (ItemStack stack : inv) {
if (count >= shardLevel) {
break;
}
if (stack == null || !(stack.getItem() instanceof ArmourUpgrade)) {
continue;
}
if (stack.getItem() instanceof ItemArmor && ((ItemArmor) stack.getItem()).armorType != this.armorType) {
continue;
}
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound();
int enchLvl = tag.getByte("RS.HARDEN");
if (stack.getItem() instanceof IRunicArmor) {
enchLvl += ((IRunicArmor) stack.getItem()).getRunicCharge(stack);
}
if (enchLvl > 0) {
harden += enchLvl;
if (((ArmourUpgrade) stack.getItem()).isUpgrade()) {
count += 1;
}
}
}
}
return harden;
}
Aggregations