Exemplo n.º 1
0
 /**
  * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't
  * full, etc.
  */
 private boolean canSmelt() {
   if (this.furnaceItemStacks[0] == null) {
     return false;
   } else {
     ItemStack var1 = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]);
     return var1 == null
         ? false
         : (this.furnaceItemStacks[2] == null
             ? true
             : (!this.furnaceItemStacks[2].isItemEqual(var1)
                 ? false
                 : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit()
                         && this.furnaceItemStacks[2].stackSize
                             < this.furnaceItemStacks[2].getMaxStackSize()
                     ? true
                     : this.furnaceItemStacks[2].stackSize < var1.getMaxStackSize())));
   }
 }
Exemplo n.º 2
0
  /**
   * Turn one item from the furnace source stack into the appropriate smelted item in the furnace
   * result stack
   */
  public void smeltItem() {
    if (this.canSmelt()) {
      ItemStack var1 = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]);

      if (this.furnaceItemStacks[2] == null) {
        this.furnaceItemStacks[2] = var1.copy();
      } else if (this.furnaceItemStacks[2].getItem() == var1.getItem()) {
        ++this.furnaceItemStacks[2].stackSize;
      }

      if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge)
          && this.furnaceItemStacks[0].getMetadata() == 1
          && this.furnaceItemStacks[1] != null
          && this.furnaceItemStacks[1].getItem() == Items.bucket) {
        this.furnaceItemStacks[1] = new ItemStack(Items.water_bucket);
      }

      --this.furnaceItemStacks[0].stackSize;

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