I don`t know and i wait help :3
Code
protected int maxCharge=400;
protected int cost = 10;
public ItemElectricScribingTools() {
super();
this.setMaxDamage(maxCharge);
this.setMaxStackSize(1);
this.setNoRepair();
setHasSubtypes(false);
}
@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entity, int itemSlot, boolean isSelected) {
try
{
if(entity instanceof EntityPlayer)
{
if(ElectricItem.manager.canUse(stack,cost) )
{
ElectricItem.manager.use(stack,cost, (EntityPlayer) entity);
}
}
}catch(Exception e)
{
e.printStackTrace();
return;
}
}
@Override
public void setDamage(ItemStack stack, int damage) {
if(ElectricItem.manager.canUse(stack,cost))
super.setDamage(stack, stack.getItemDamage() - cost);
}
@Override
public boolean canProvideEnergy(ItemStack itemStack) {
return false;
}
@Override
public double getMaxCharge(ItemStack itemStack) {
return maxCharge;
}
@Override
public int getTier(ItemStack itemStack) {
return 1;
}
@Override
public double getTransferLimit(ItemStack itemStack) {
return 5;
}
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
if(tab== EMTCreativeTabs.EMT_CREATIVEtabs){
ItemStack itemStack = new ItemStack(this, 1);
if (getChargedItem(itemStack) == this) {
ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
items.add(charged);
}
if (getEmptyItem(itemStack) == this) {
items.add(new ItemStack(this, 1, getMaxDamage()));
}
}
}
public Item getChargedItem(ItemStack itemStack) {
return this;
}
public Item getEmptyItem(ItemStack itemStack) {
return this;
}
}
Display More