Esempio n. 1
0
  /** Called when the container is closed. */
  public void onContainerClosed(Player playerIn) {
    super.onContainerClosed(playerIn);

    for (int i = 0; i < 4; ++i) {
      ItemStack itemstack = this.craftMatrix.removeStackFromSlot(i);

      if (itemstack != null) {
        playerIn.dropPlayerItemWithRandomChoice(itemstack, false);
      }
    }

    this.craftResult.setInventorySlotContents(0, (ItemStack) null);
  }
Esempio n. 2
0
  private ItemStack fillBucket(ItemStack emptyBuckets, Player player, Item fullBucket) {
    if (player.capabilities.isCreativeMode) {
      return emptyBuckets;
    } else if (--emptyBuckets.stackSize <= 0) {
      return new ItemStack(fullBucket);
    } else {
      if (!player.inventory.addItemStackToInventory(new ItemStack(fullBucket))) {
        player.dropPlayerItemWithRandomChoice(new ItemStack(fullBucket, 1, 0), false);
      }

      return emptyBuckets;
    }
  }