Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ItemHardwareWallet extends Item {
- public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
- {
- if(!worldIn.isRemote) {
- //CryptoMod.logger.info("Right Clicked");
- ItemStack stack = playerIn.getHeldItem(handIn);
- NBTTagCompound nbt = stack.getTagCompound();
- if(nbt == null) { nbt = new NBTTagCompound(); }
- if(nbt.hasKey("clicks")) { nbt.setInteger("clicks", nbt.getInteger("clicks") + 1); }
- else
- {
- if (stack.getCount() > 1 )
- {
- stack.shrink(1);
- }
- nbt.setInteger("clicks", 1);
- }
- CryptoMod.logger.info(nbt.getInteger("clicks"));
- stack.setTagCompound(nbt);
- }
- return new ActionResult(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn));
- }
- @Override
- public int getItemStackLimit(ItemStack stack) {
- return (stack.hasTagCompound()) ? 1 : 16;
- }
- @Override
- public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
- //CryptoMod.logger.info("Ticking Item");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement