I was making an item for a game im modding, but it cant seem to read the variable and perform its function. Yeah, it recompiles fine, but dosent work ingame
The functions that dont work ingame, are
-Printing A Chat Message To An Entity
-Setting Variable Timesshot to 0
-Damaging the item by 60 part
Pretty much all the ones below "if(timesshot ==45)"
As for the counting part or "Test Notes" part, once it reaches 45, nothing happens, and continues on to 46 and 47 and so on. It dosent reset
package net.minecraft.src;
import java.util.Random;
import java.util.*;
public class ItemPP901M extends Item
{
int timesshot = 0;
public ItemPP901M(int i)
{
super(i);
maxStackSize = 1;
setMaxDamage(60);
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
if(timesshot != 45);
{
if(itemstack.getItemDamage() == 0)
{
if(entityplayer.inventory.consumeInventoryItem(mod_com.PP901MMagazine.shiftedIndex))
{
world.playSoundAtEntity(entityplayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
if(!world.multiplayerWorld)
{
world.entityJoinedWorld(new EntityBulletPP901Friendly(world, entityplayer));
entityplayer.addChatMessage("Test Notes: Times shot: " + timesshot);
}
timesshot++;
}
itemstack.damageItem(1, entityplayer);
}
else
{
if(timesshot == 45);
{
if(entityplayer.inventory.consumeInventoryItem(mod_com.PP901MMagazine.shiftedIndex));
{
world.playSoundAtEntity(entityplayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
if(!world.multiplayerWorld)
entityplayer.addChatMessage("Test Notes: Damage 60 Now");
{
world.entityJoinedWorld(new EntityBulletPP901Friendly(world, entityplayer));
}
itemstack.damageItem(60, entityplayer);
}
timesshot = 0;
}
}
}
return itemstack;
}
public boolean isFull3D()
{
return true;
}
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
{
if(itemstack.getItemDamage() != 0)
{
itemstack.damageItem(-1, (EntityLiving)entity);
}
}
}