SHARE
TWEET

Untitled

a guest Mar 26th, 2020 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  @SubscribeEvent
  2.     public void pickupÎtemBag(PlayerEvent.ItemPickupEvent event)
  3.     {
  4.  
  5.  
  6.  
  7.             PlayerEntity player = event.getPlayer();
  8.  
  9.             if(event.getStack().getItem() == Items.COBBLESTONE){
  10.  
  11.                 if(player.inventory.hasItemStack(new ItemStack(ItemInit.cobblestone_bag))){
  12.  
  13.                     player.inventory.deleteStack(new ItemStack(Items.COBBLESTONE));
  14.  
  15.                     for(ItemStack itemStack : player.inventory.mainInventory) {
  16.  
  17.                         if(itemStack.getItem() == ItemInit.cobblestone_bag){
  18.  
  19.                             CompoundNBT nbt = itemStack.getOrCreateTag();
  20.  
  21.                             nbt.putInt("cobblestone", nbt.getInt("cobblestone") + event.getStack().getCount());
  22.  
  23.                             break;
  24.  
  25.                         }
  26.  
  27.  
  28.                     }
  29.  
  30.                 }
  31.  
  32.             }
  33.  
  34.  
  35.  
  36.  
  37.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top