use of net.minecraft.nbt.NBTTagFloat in project MorePlanets by SteveKunG.
the class ItemElectricAxeMP method getElectricityStored.
@Override
public float getElectricityStored(ItemStack itemStack) {
if (!itemStack.hasTagCompound()) {
itemStack.setTagCompound(new NBTTagCompound());
}
float energyStored = 0f;
if (itemStack.getTagCompound().hasKey("Electricity")) {
NBTBase obj = itemStack.getTagCompound().getTag("Electricity");
if (obj instanceof NBTTagDouble) {
energyStored = ((NBTTagDouble) obj).getFloat();
} else if (obj instanceof NBTTagFloat) {
energyStored = ((NBTTagFloat) obj).getFloat();
}
}
itemStack.setItemDamage((int) (100 - energyStored / this.getMaxElectricityStored(itemStack) * 100));
return energyStored;
}
use of net.minecraft.nbt.NBTTagFloat in project MorePlanets by SteveKunG.
the class ItemElectricPickaxeMP method getElectricityStored.
@Override
public float getElectricityStored(ItemStack itemStack) {
if (!itemStack.hasTagCompound()) {
itemStack.setTagCompound(new NBTTagCompound());
}
float energyStored = 0f;
if (itemStack.getTagCompound().hasKey("Electricity")) {
NBTBase obj = itemStack.getTagCompound().getTag("Electricity");
if (obj instanceof NBTTagDouble) {
energyStored = ((NBTTagDouble) obj).getFloat();
} else if (obj instanceof NBTTagFloat) {
energyStored = ((NBTTagFloat) obj).getFloat();
}
}
itemStack.setItemDamage((int) (100 - energyStored / this.getMaxElectricityStored(itemStack) * 100));
return energyStored;
}
Aggregations