- 129
- 0
Как сделать так чтоб переменная i была индивидуальна к разным предметам MyItem,то есть у меня в инвентаре есть 3 прeдмeта MyItem и каждый из них считал свою переменную i+1.
public class MyItem extends Item
{
int i = 0;
public MyItem (int id)
{
super(id);
this.setCreativeTab(CreativeTabs.tabCombat);
this.maxStackSize = 1;
}
public void registerIcons(IconRegister tex)
{
this.itemIcon = tex.registerIcon(ModInf.MODID + ":MyItem ");
}
public ItemStack onItemRightClick (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
i=-1
return par1ItemStack;
}
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
EntityPlayer player = (EntityPlayer)par3Entity;
ItemStack is = player.inventory.getCurrentItem();
if(MyKEY.keyPressed){
if (is != null && is.getItem().itemID == MyMod.MyItem.itemID) {
i=+1
}
}
public class MyItem extends Item
{
int i = 0;
public MyItem (int id)
{
super(id);
this.setCreativeTab(CreativeTabs.tabCombat);
this.maxStackSize = 1;
}
public void registerIcons(IconRegister tex)
{
this.itemIcon = tex.registerIcon(ModInf.MODID + ":MyItem ");
}
public ItemStack onItemRightClick (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
i=-1
return par1ItemStack;
}
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
EntityPlayer player = (EntityPlayer)par3Entity;
ItemStack is = player.inventory.getCurrentItem();
if(MyKEY.keyPressed){
if (is != null && is.getItem().itemID == MyMod.MyItem.itemID) {
i=+1
}
}