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, setLockCodeaddInfoToCrashReport, createAndLoadEntity, func_183000_F, getBlockMetadata, getBlockType, getDescriptionPacket, getDistanceSq, getMaxRenderDistanceSquared, getPos, getWorld, hasWorldObj, invalidate, isInvalid, receiveClientEvent, setPos, setWorldObj, updateContainingBlockInfo, validateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDisplayNameprivate ItemStack[] inventory
private java.lang.String customName
private int transferCooldown
public void readFromNBT(NBTTagCompound compound)
readFromNBT in class TileEntityLockablepublic void writeToNBT(NBTTagCompound compound)
writeToNBT in class TileEntityLockablepublic void markDirty()
markDirty in interface IInventorymarkDirty in class TileEntitypublic int getSizeInventory()
getSizeInventory in interface IInventorypublic ItemStack getStackInSlot(int index)
getStackInSlot in interface IInventorypublic ItemStack decrStackSize(int index, int count)
decrStackSize in interface IInventorypublic ItemStack removeStackFromSlot(int index)
removeStackFromSlot in interface IInventorypublic void setInventorySlotContents(int index,
ItemStack stack)
setInventorySlotContents in interface IInventorypublic java.lang.String getName()
getName in interface IWorldNameablepublic boolean hasCustomName()
hasCustomName in interface IWorldNameablepublic void setCustomName(java.lang.String customNameIn)
public int getInventoryStackLimit()
getInventoryStackLimit in interface IInventorypublic boolean isUseableByPlayer(EntityPlayer player)
isUseableByPlayer in interface IInventorypublic void openInventory(EntityPlayer player)
openInventory in interface IInventorypublic void closeInventory(EntityPlayer player)
closeInventory in interface IInventorypublic boolean isItemValidForSlot(int index,
ItemStack stack)
isItemValidForSlot in interface IInventorypublic 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 IInteractionObjectpublic Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
createContainer in interface IInteractionObjectpublic int getField(int id)
getField in interface IInventorypublic void setField(int id,
int value)
setField in interface IInventorypublic int getFieldCount()
getFieldCount in interface IInventorypublic void clear()
clear in interface IInventory