Advertisement
Guest User

ItemHardwareWallet.java

a guest
May 26th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. public class ItemHardwareWallet extends Item {
  2.  
  3. public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
  4. {
  5.  
  6. if(!worldIn.isRemote) {
  7. //CryptoMod.logger.info("Right Clicked");
  8.  
  9. ItemStack stack = playerIn.getHeldItem(handIn);
  10. NBTTagCompound nbt = stack.getTagCompound();
  11. if(nbt == null) { nbt = new NBTTagCompound(); }
  12. if(nbt.hasKey("clicks")) { nbt.setInteger("clicks", nbt.getInteger("clicks") + 1); }
  13. else
  14. {
  15. if (stack.getCount() > 1 )
  16. {
  17. stack.shrink(1);
  18. }
  19.  
  20. nbt.setInteger("clicks", 1);
  21. }
  22. CryptoMod.logger.info(nbt.getInteger("clicks"));
  23. stack.setTagCompound(nbt);
  24.  
  25. }
  26.  
  27. return new ActionResult(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn));
  28.  
  29. }
  30.  
  31. @Override
  32. public int getItemStackLimit(ItemStack stack) {
  33. return (stack.hasTagCompound()) ? 1 : 16;
  34. }
  35.  
  36. @Override
  37. public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
  38.  
  39. //CryptoMod.logger.info("Ticking Item");
  40.  
  41. }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement