@SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List dataList, boolean b) { if (stack.stackTagCompound == null) stack.setTagCompound(new NBTTagCompound()); updateStats(stack); dataList.add( "+" + (int) stack.stackTagCompound.getDouble("damage") + " (1 + 10% Energy) Attack Damage"); dataList.add( "+" + (int) stack.stackTagCompound.getDouble("lifeSteal") + "% (5% Energy) LifeSteal"); dataList.add(""); dataList.add("�assive: �ain 5 energy on hit."); dataList.add("�assive: �eal 6% of your current health"); dataList.add("�s bonus damage on hit."); dataList.add( "�ctive: �onsume " + stack.stackTagCompound.getInteger("cost") + " �nergy to heal a maximum"); dataList.add( "�f " + (int) stack.stackTagCompound.getDouble("energy") / 20 + "�(5% Energy) Heart(s)."); super.addInformation(stack, player, dataList, b); /*dataList.add(""); dataList.add("�\"A Godly staff only the Pineapple Gods can use. The"); dataList.add("�Pineapple Gods showed Steve the way to make it"); dataList.add("�after he found the shrine of Pineapples\"");*/ }
/** * Heals the user if they are missing health. * * @param itemStack * @param world * @param player */ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if (!world.isRemote) { if (stack.stackTagCompound.getInteger("cooldown") == 0) { if (player.shouldHeal()) { updateStats(stack); float missingHealth = GameMethods.getMissingHealth((EntityLivingBase) player); float current_health = ((EntityLivingBase) player).getHealth(); if (stack.stackTagCompound.getDouble("energy") < 0.0D) { player.addChatMessage(new ChatComponentText("�our staff has run out of energy!")); updateStats(stack); } else if (missingHealth > stack.stackTagCompound.getDouble("energy") / 20) { player.heal((float) (stack.stackTagCompound.getDouble("energy") / 20)); stack.stackTagCompound.setDouble( "energy", stack.stackTagCompound.getDouble("energy") / 5); stack.stackTagCompound.setBoolean("showParticles", true); updateStats(stack); super.onItemRightClick(stack, world, player); } else if (missingHealth < stack.stackTagCompound.getDouble("energy") / 20) { float f = missingHealth; player.heal(missingHealth); stack.stackTagCompound.setDouble( "energy", stack.stackTagCompound.getDouble("energy") - f); stack.stackTagCompound.setBoolean("showParticles", true); updateStats(stack); super.onItemRightClick(stack, world, player); } else { updateStats(stack); } } updateStats(stack); } } if (world.isRemote) { if (stack.stackTagCompound.getBoolean("showParticles")) { GameMethods.spawnParticles("heal", stack, world, player); stack.stackTagCompound.setBoolean("showParticles", false); } } return stack; }
public void onCreated(ItemStack stack, World world, EntityPlayer player) { super.onCreated(stack, world, player); setNBTTag(stack); }
public ItemStack setNBTTag(ItemStack stack) { super.setNBTTag(stack); stack.stackTagCompound.setDouble("lifeSteal", 0.0); stack.stackTagCompound.setInteger("cost", 50); return stack; }