001package net.minecraft.inventory; 002 003import net.minecraft.entity.player.EntityPlayer; 004import net.minecraft.item.ItemStack; 005 006public class InventoryCraftResult implements IInventory 007{ 008 /** A list of one item containing the result of the crafting formula */ 009 private ItemStack[] stackResult = new ItemStack[1]; 010 011 /** 012 * Returns the number of slots in the inventory. 013 */ 014 public int getSizeInventory() 015 { 016 return 1; 017 } 018 019 /** 020 * Returns the stack in slot i 021 */ 022 public ItemStack getStackInSlot(int par1) 023 { 024 return this.stackResult[0]; 025 } 026 027 /** 028 * Returns the name of the inventory. 029 */ 030 public String getInvName() 031 { 032 return "Result"; 033 } 034 035 public boolean func_94042_c() 036 { 037 return false; 038 } 039 040 /** 041 * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a 042 * new stack. 043 */ 044 public ItemStack decrStackSize(int par1, int par2) 045 { 046 if (this.stackResult[0] != null) 047 { 048 ItemStack itemstack = this.stackResult[0]; 049 this.stackResult[0] = null; 050 return itemstack; 051 } 052 else 053 { 054 return null; 055 } 056 } 057 058 /** 059 * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - 060 * like when you close a workbench GUI. 061 */ 062 public ItemStack getStackInSlotOnClosing(int par1) 063 { 064 if (this.stackResult[0] != null) 065 { 066 ItemStack itemstack = this.stackResult[0]; 067 this.stackResult[0] = null; 068 return itemstack; 069 } 070 else 071 { 072 return null; 073 } 074 } 075 076 /** 077 * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). 078 */ 079 public void setInventorySlotContents(int par1, ItemStack par2ItemStack) 080 { 081 this.stackResult[0] = par2ItemStack; 082 } 083 084 /** 085 * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't 086 * this more of a set than a get?* 087 */ 088 public int getInventoryStackLimit() 089 { 090 return 64; 091 } 092 093 /** 094 * Called when an the contents of an Inventory change, usually 095 */ 096 public void onInventoryChanged() {} 097 098 /** 099 * Do not make give this method the name canInteractWith because it clashes with Container 100 */ 101 public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) 102 { 103 return true; 104 } 105 106 public void openChest() {} 107 108 public void closeChest() {} 109 110 public boolean func_94041_b(int par1, ItemStack par2ItemStack) 111 { 112 return true; 113 } 114}