package net.minecraft.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class InventoryCraftResult implements IInventory
{
/** A list of one item containing the result of the crafting formula */
private ItemStack[] stackResult = new ItemStack[1];
private static final String __OBFID = "CL_00001760";
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory()
{
return 1;
}
/**
* Returns the stack in slot i
*/
public ItemStack getStackInSlot(int slotIn)
{
return this.stackResult[0];
}
/**
* Returns the name of the inventory
*/
public String getInventoryName()
{
return "Result";
}
/**
* Returns if the inventory is named
*/
public boolean isCustomInventoryName()
{
return false;
}
/**
* Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a
* new stack.
*/
public ItemStack decrStackSize(int index, int count)
{
if (this.stackResult[0] != null)
{
ItemStack itemstack = this.stackResult[0];
this.stackResult[0] = null;
return itemstack;
}
else
{
return null;
}
}
/**
* When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem -
* like when you close a workbench GUI.
*/
public ItemStack getStackInSlotOnClosing(int index)
{
if (this.stackResult[0] != null)
{
ItemStack itemstack = this.stackResult[0];
this.stackResult[0] = null;
return itemstack;
}
else
{
return null;
}
}
/**
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
*/
public void setInventorySlotContents(int index, ItemStack stack)
{
this.stackResult[0] = stack;
}
/**
* Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't
* this more of a set than a get?*
*/
public int getInventoryStackLimit()
{
return 64;
}
/**
* For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it
* hasn't changed and skip it.
*/
public void markDirty() {}
/**
* Do not make give this method the name canInteractWith because it clashes with Container
*/
public boolean isUseableByPlayer(EntityPlayer player)
{
return true;
}
public void openChest() {}
public void closeChest() {}
/**
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
*/
public boolean isItemValidForSlot(int index, ItemStack stack)
{
return true;
}
}