Package net.minecraft.src
Class TileEntityHopper
java.lang.Object
net.minecraft.src.TileEntity
net.minecraft.src.TileEntityHopper
- All Implemented Interfaces:
Hopper,IInventory
-
Field Summary
Fields inherited from class net.minecraft.src.TileEntity
blockMetadata, blockType, tileEntityInvalid, worldObj, xCoord, yCoord, zCoord -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddecrStackSize(int par1, int par2) Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a new stack.static EntityItemgetEntityAbove(World par0World, double par1, double par3, double par5) static IInventorygetInventoryAboveHopper(Hopper par0Hopper) Looks for anything, that can hold items (like chests, furnaces, etc.) one block above the given hopper.static IInventorygetInventoryAtLocation(World par0World, double par1, double par3, double par5) Gets an inventory at the given location to extract items into or take items from.intReturns the maximum stack size for a inventory slot.Returns the name of the inventory.intReturns the number of slots in the inventory.getStackInSlot(int par1) Returns the stack in slot igetStackInSlotOnClosing(int par1) 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.doublegetXPos()Gets the world X position for this hopper entity.doublegetYPos()Gets the world Y position for this hopper entity.doublegetZPos()Gets the world Z position for this hopper entity.static ItemStackinsertStack(IInventory par0IInventory, ItemStack par1ItemStack, int par2) Inserts a stack into an inventory.static booleaninsertStackFromEntity(IInventory par0IInventory, EntityItem par1EntityItem) booleanbooleanIf this returns false, the inventory name will be used as an unlocalized name, and translated into the player's language.booleanisItemValidForSlot(int par1, ItemStack par2ItemStack) Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.booleanisUseableByPlayer(EntityPlayer par1EntityPlayer) Do not make give this method the name canInteractWith because it clashes with ContainervoidCalled when an the contents of an Inventory change, usuallyvoidvoidreadFromNBT(NBTTagCompound par1NBTTagCompound) Reads a tile entity from NBT.voidsetInventoryName(String par1Str) voidsetInventorySlotContents(int par1, ItemStack par2ItemStack) Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).voidsetTransferCooldown(int par1) static booleansuckItemsIntoHopper(Hopper par0Hopper) Sucks one item into the given hopper from an inventory or EntityItem above it.voidAllows the entity to update its state.booleanvoidwriteToNBT(NBTTagCompound par1NBTTagCompound) Writes a tile entity to NBT.Methods inherited from class net.minecraft.src.TileEntity
addMapping, createAndLoadEntity, func_85027_a, getBlockMetadata, getBlockType, getDescriptionPacket, getDistanceFrom, getMaxRenderDistanceSquared, getWorldObj, hasWorldObj, invalidate, isInvalid, receiveClientEvent, setWorldObj, updateContainingBlockInfo, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.src.Hopper
getWorldObj
-
Constructor Details
-
TileEntityHopper
public TileEntityHopper()
-
-
Method Details
-
readFromNBT
Reads a tile entity from NBT.- Overrides:
readFromNBTin classTileEntity
-
writeToNBT
Writes a tile entity to NBT.- Overrides:
writeToNBTin classTileEntity
-
onInventoryChanged
public void onInventoryChanged()Called when an the contents of an Inventory change, usually- Specified by:
onInventoryChangedin interfaceIInventory- Overrides:
onInventoryChangedin classTileEntity
-
getSizeInventory
public int getSizeInventory()Returns the number of slots in the inventory.- Specified by:
getSizeInventoryin interfaceIInventory
-
getStackInSlot
Returns the stack in slot i- Specified by:
getStackInSlotin interfaceIInventory
-
decrStackSize
Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a new stack.- Specified by:
decrStackSizein interfaceIInventory
-
getStackInSlotOnClosing
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.- Specified by:
getStackInSlotOnClosingin interfaceIInventory
-
setInventorySlotContents
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).- Specified by:
setInventorySlotContentsin interfaceIInventory
-
getInvName
Returns the name of the inventory.- Specified by:
getInvNamein interfaceIInventory
-
isInvNameLocalized
public boolean isInvNameLocalized()If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's language. Otherwise it will be used directly.- Specified by:
isInvNameLocalizedin interfaceIInventory
-
setInventoryName
-
getInventoryStackLimit
public int getInventoryStackLimit()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?*- Specified by:
getInventoryStackLimitin interfaceIInventory
-
isUseableByPlayer
Do not make give this method the name canInteractWith because it clashes with Container- Specified by:
isUseableByPlayerin interfaceIInventory
-
openChest
public void openChest()- Specified by:
openChestin interfaceIInventory
-
closeChest
public void closeChest()- Specified by:
closeChestin interfaceIInventory
-
isItemValidForSlot
Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.- Specified by:
isItemValidForSlotin interfaceIInventory
-
updateEntity
public void updateEntity()Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count ticks and creates a new spawn inside its implementation.- Overrides:
updateEntityin classTileEntity
-
updateHopper
public boolean updateHopper() -
suckItemsIntoHopper
Sucks one item into the given hopper from an inventory or EntityItem above it. -
insertStackFromEntity
-
insertStack
Inserts a stack into an inventory. Args: Inventory, stack, side. Returns leftover items. -
getInventoryAboveHopper
Looks for anything, that can hold items (like chests, furnaces, etc.) one block above the given hopper. -
getEntityAbove
-
getInventoryAtLocation
public static IInventory getInventoryAtLocation(World par0World, double par1, double par3, double par5) Gets an inventory at the given location to extract items into or take items from. Can find either a tile entity or regular entity implementing IInventory. -
getXPos
public double getXPos()Gets the world X position for this hopper entity. -
getYPos
public double getYPos()Gets the world Y position for this hopper entity. -
getZPos
public double getZPos()Gets the world Z position for this hopper entity. -
setTransferCooldown
public void setTransferCooldown(int par1) -
isCoolingDown
public boolean isCoolingDown()
-