Advertisement
Eastonium

TileEntityStuff

May 7th, 2013
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.07 KB | None | 0 0
  1. private boolean canSmelt()
  2.     {
  3.         if (this.furnaceItemStacks[0] == null && this.furnaceItemStacks[3] == null && this.furnaceItemStacks[4] == null)
  4.         {
  5.             return false;
  6.         }
  7.         else
  8.         {
  9.             ItemStack itemstack = MaskForgeRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0], this.furnaceItemStacks[3], this.furnaceItemStacks[4]);//TODO
  10.             if (itemstack == null) return false;
  11.             if (this.furnaceItemStacks[2] == null) return true;
  12.             if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false;
  13.             int result = furnaceItemStacks[2].stackSize + itemstack.stackSize;
  14.             return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize());
  15.         }
  16.     }
  17.  
  18.     /**
  19.      * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack
  20.      */
  21.     public void smeltItem()
  22.     {
  23.         if (this.canSmelt())
  24.         {
  25.             ItemStack itemstack = MaskForgeRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0], this.furnaceItemStacks[3], this.furnaceItemStacks[4]);//TODO
  26.  
  27.             if (this.furnaceItemStacks[2] == null)
  28.             {
  29.                 this.furnaceItemStacks[2] = itemstack.copy();
  30.             }
  31.             else if (this.furnaceItemStacks[2].isItemEqual(itemstack))
  32.             {
  33.                 furnaceItemStacks[2].stackSize += itemstack.stackSize;
  34.             }
  35.  
  36.             --this.furnaceItemStacks[0].stackSize;
  37.  
  38.             if (this.furnaceItemStacks[0].stackSize <= 0)
  39.             {
  40.                 this.furnaceItemStacks[0] = null;
  41.             }
  42.            
  43.             --this.furnaceItemStacks[3].stackSize;
  44.  
  45.             if (this.furnaceItemStacks[3].stackSize <= 0)
  46.             {
  47.                 this.furnaceItemStacks[3] = null;
  48.             }
  49.            
  50.             --this.furnaceItemStacks[4].stackSize;
  51.  
  52.             if (this.furnaceItemStacks[4].stackSize <= 0)
  53.             {
  54.                 this.furnaceItemStacks[4] = null;
  55.             }
  56.         }
  57.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement