public class TileEntityHopper extends TileEntityLockable implements IHopper, ITickable
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
customName |
private ItemStack[] |
inventory |
private int |
transferCooldown |
blockType, pos, tileEntityInvalid, worldObj
Constructor and Description |
---|
TileEntityHopper() |
Modifier and Type | Method and Description |
---|---|
private static boolean |
canCombine(ItemStack stack1,
ItemStack stack2) |
private static boolean |
canExtractItemFromSlot(IInventory inventoryIn,
ItemStack stack,
int index,
EnumFacing side)
Can this hopper extract the specified item from the specified slot on the specified side?
|
private static boolean |
canInsertItemInSlot(IInventory inventoryIn,
ItemStack stack,
int index,
EnumFacing side)
Can this hopper insert the specified item from the specified slot on the specified side?
|
static boolean |
captureDroppedItems(IHopper p_145891_0_) |
void |
clear() |
void |
closeInventory(EntityPlayer player) |
Container |
createContainer(InventoryPlayer playerInventory,
EntityPlayer playerIn) |
ItemStack |
decrStackSize(int index,
int count)
Removes up to a specified number of items from an inventory slot and returns them in a new stack.
|
static java.util.List<EntityItem> |
func_181556_a(World p_181556_0_,
double p_181556_1_,
double p_181556_3_,
double p_181556_5_) |
int |
getField(int id) |
int |
getFieldCount() |
java.lang.String |
getGuiID() |
static IInventory |
getHopperInventory(IHopper hopper)
Returns the IInventory for the specified hopper
|
static IInventory |
getInventoryAtPosition(World worldIn,
double x,
double y,
double z)
Returns the IInventory (if applicable) of the TileEntity at the specified position
|
private IInventory |
getInventoryForHopperTransfer()
Returns the IInventory that this hopper is pointing into
|
int |
getInventoryStackLimit()
Returns the maximum stack size for a inventory slot.
|
java.lang.String |
getName()
Gets the name of this command sender (usually username, but possibly "Rcon")
|
int |
getSizeInventory()
Returns the number of slots in the inventory.
|
ItemStack |
getStackInSlot(int index)
Returns the stack in the given slot.
|
double |
getXPos()
Gets the world X position for this hopper entity.
|
double |
getYPos()
Gets the world Y position for this hopper entity.
|
double |
getZPos()
Gets the world Z position for this hopper entity.
|
boolean |
hasCustomName()
Returns true if this thing is named
|
private static ItemStack |
insertStack(IInventory inventoryIn,
ItemStack stack,
int index,
EnumFacing side)
Insert the specified stack to the specified inventory and return any leftover items
|
private boolean |
isEmpty() |
private boolean |
isFull() |
private static boolean |
isInventoryEmpty(IInventory inventoryIn,
EnumFacing side)
Returns false if the specified IInventory contains any items
|
private boolean |
isInventoryFull(IInventory inventoryIn,
EnumFacing side)
Returns false if the inventory has any room to place items in
|
boolean |
isItemValidForSlot(int index,
ItemStack stack)
Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
|
boolean |
isOnTransferCooldown() |
boolean |
isUseableByPlayer(EntityPlayer player)
Do not make give this method the name canInteractWith because it clashes with Container
|
void |
markDirty()
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.
|
boolean |
mayTransfer() |
void |
openInventory(EntityPlayer player) |
private static boolean |
pullItemFromSlot(IHopper hopper,
IInventory inventoryIn,
int index,
EnumFacing direction)
Pulls from the specified slot in the inventory and places in any available slot in the hopper.
|
static boolean |
putDropInInventoryAllSlots(IInventory p_145898_0_,
EntityItem itemIn)
Attempts to place the passed EntityItem's stack into the inventory using as many slots as possible.
|
static ItemStack |
putStackInInventoryAllSlots(IInventory inventoryIn,
ItemStack stack,
EnumFacing side)
Attempts to place the passed stack in the inventory, using as many slots as required.
|
void |
readFromNBT(NBTTagCompound compound) |
ItemStack |
removeStackFromSlot(int index)
Removes a stack from the given slot and returns it.
|
void |
setCustomName(java.lang.String customNameIn) |
void |
setField(int id,
int value) |
void |
setInventorySlotContents(int index,
ItemStack stack)
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
|
void |
setTransferCooldown(int ticks) |
private boolean |
transferItemsOut() |
void |
update()
Like the old updateEntity(), except more generic.
|
boolean |
updateHopper() |
void |
writeToNBT(NBTTagCompound compound) |
getDisplayName, getLockCode, isLocked, setLockCode
addInfoToCrashReport, createAndLoadEntity, func_183000_F, getBlockMetadata, getBlockType, getDescriptionPacket, getDistanceSq, getMaxRenderDistanceSquared, getPos, getWorld, hasWorldObj, invalidate, isInvalid, receiveClientEvent, setPos, setWorldObj, updateContainingBlockInfo, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDisplayName
private ItemStack[] inventory
private java.lang.String customName
private int transferCooldown
public void readFromNBT(NBTTagCompound compound)
readFromNBT
in class TileEntityLockable
public void writeToNBT(NBTTagCompound compound)
writeToNBT
in class TileEntityLockable
public void markDirty()
markDirty
in interface IInventory
markDirty
in class TileEntity
public int getSizeInventory()
getSizeInventory
in interface IInventory
public ItemStack getStackInSlot(int index)
getStackInSlot
in interface IInventory
public ItemStack decrStackSize(int index, int count)
decrStackSize
in interface IInventory
public ItemStack removeStackFromSlot(int index)
removeStackFromSlot
in interface IInventory
public void setInventorySlotContents(int index, ItemStack stack)
setInventorySlotContents
in interface IInventory
public java.lang.String getName()
getName
in interface IWorldNameable
public boolean hasCustomName()
hasCustomName
in interface IWorldNameable
public void setCustomName(java.lang.String customNameIn)
public int getInventoryStackLimit()
getInventoryStackLimit
in interface IInventory
public boolean isUseableByPlayer(EntityPlayer player)
isUseableByPlayer
in interface IInventory
public void openInventory(EntityPlayer player)
openInventory
in interface IInventory
public void closeInventory(EntityPlayer player)
closeInventory
in interface IInventory
public boolean isItemValidForSlot(int index, ItemStack stack)
isItemValidForSlot
in interface IInventory
public void update()
public boolean updateHopper()
private boolean isEmpty()
private boolean isFull()
private boolean transferItemsOut()
private boolean isInventoryFull(IInventory inventoryIn, EnumFacing side)
private static boolean isInventoryEmpty(IInventory inventoryIn, EnumFacing side)
public static boolean captureDroppedItems(IHopper p_145891_0_)
private static boolean pullItemFromSlot(IHopper hopper, IInventory inventoryIn, int index, EnumFacing direction)
public static boolean putDropInInventoryAllSlots(IInventory p_145898_0_, EntityItem itemIn)
public static ItemStack putStackInInventoryAllSlots(IInventory inventoryIn, ItemStack stack, EnumFacing side)
private static boolean canInsertItemInSlot(IInventory inventoryIn, ItemStack stack, int index, EnumFacing side)
private static boolean canExtractItemFromSlot(IInventory inventoryIn, ItemStack stack, int index, EnumFacing side)
private static ItemStack insertStack(IInventory inventoryIn, ItemStack stack, int index, EnumFacing side)
private IInventory getInventoryForHopperTransfer()
public static IInventory getHopperInventory(IHopper hopper)
public static java.util.List<EntityItem> func_181556_a(World p_181556_0_, double p_181556_1_, double p_181556_3_, double p_181556_5_)
public static IInventory getInventoryAtPosition(World worldIn, double x, double y, double z)
public double getXPos()
public double getYPos()
public double getZPos()
public void setTransferCooldown(int ticks)
public boolean isOnTransferCooldown()
public boolean mayTransfer()
public java.lang.String getGuiID()
getGuiID
in interface IInteractionObject
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
createContainer
in interface IInteractionObject
public int getField(int id)
getField
in interface IInventory
public void setField(int id, int value)
setField
in interface IInventory
public int getFieldCount()
getFieldCount
in interface IInventory
public void clear()
clear
in interface IInventory