This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
@Override public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { int power2 = par1ItemStack.stackTagCompound.getInteger("power2"); int shieldpower = par1ItemStack.stackTagCompound.getInteger("shieldpower"); if(par3EntityLivingBase.hitByEntity(par2EntityLivingBase)) { par1ItemStack.stackTagCompound.setInteger("shieldpower", shieldpower++); par1ItemStack.stackTagCompound.setInteger("power2", power2-10); }
Quote from RomanMP My issue is the line of code is not executing when I get hit by a mob/player. @Override public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { int power2 = par1ItemStack.stackTagCompound.getInteger("power2"); int shieldpower = par1ItemStack.stackTagCompound.getInteger("shieldpower"); if(par3EntityLivingBase.hitByEntity(par2EntityLivingBase)) { par1ItemStack.stackTagCompound.setInteger("shieldpower", shieldpower++); par1ItemStack.stackTagCompound.setInteger("power2", power2-10); }
I realize now i put the code in the wrong spot, but where should it go?