mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
57 lines
1.4 KiB
Java
57 lines
1.4 KiB
Java
package com.hbm.items.special;
|
|
|
|
import java.util.List;
|
|
|
|
import com.hbm.items.ModItems;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
public class ItemFuelRod extends ItemRadioactive {
|
|
|
|
public int lifeTime;
|
|
public int heat;
|
|
|
|
public ItemFuelRod(int life, int heat) {
|
|
this.lifeTime = life;
|
|
this.heat = heat;
|
|
this.setMaxDamage(100);
|
|
this.canRepair = false;
|
|
}
|
|
|
|
@Override
|
|
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool)
|
|
{
|
|
list.add("Used in nuclear reactor");
|
|
|
|
list.add("Generates " + heat + " heat per tick");
|
|
list.add("Lasts " + lifeTime + " ticks");
|
|
}
|
|
|
|
public static void setLifeTime(ItemStack stack, int time) {
|
|
if(!stack.hasTagCompound())
|
|
stack.stackTagCompound = new NBTTagCompound();
|
|
|
|
stack.stackTagCompound.setInteger("life", time);
|
|
}
|
|
|
|
public static void updateDamage(ItemStack stack) {
|
|
|
|
if(!stack.hasTagCompound())
|
|
stack.stackTagCompound = new NBTTagCompound();
|
|
|
|
stack.setItemDamage((int)((double)getLifeTime(stack) / (double)((ItemFuelRod)stack.getItem()).lifeTime * 100D));
|
|
}
|
|
|
|
public static int getLifeTime(ItemStack stack) {
|
|
if(!stack.hasTagCompound()) {
|
|
stack.stackTagCompound = new NBTTagCompound();
|
|
return 0;
|
|
}
|
|
|
|
return stack.stackTagCompound.getInteger("life");
|
|
}
|
|
|
|
}
|