コード例 #1
0
 private boolean canSmelt() {
   if (this.inv[0] == null) {
     return false;
   } else {
     ItemStack itemstack = RecipeTrader.smelting().getSmeltingResult(this.inv[0]);
     if (itemstack == null) return false;
     if (this.inv[2] == null) return true;
     if (!this.inv[2].isItemEqual(itemstack)) return false;
     int result = inv[2].stackSize + itemstack.stackSize;
     return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize());
   }
 }
コード例 #2
0
  public void smeltItem() {
    if (this.canSmelt()) {
      ItemStack itemstack = RecipeTrader.smelting().getSmeltingResult(this.inv[0]);

      if (this.inv[2] == null) {
        this.inv[2] = itemstack.copy();
      } else if (this.inv[2].isItemEqual(itemstack)) {
        inv[2].stackSize += itemstack.stackSize;
      }

      --this.inv[0].stackSize;

      if (this.inv[0].stackSize <= 0) {
        this.inv[0] = null;
      }
    }
  }