Package net.minecraft.tileentity
Class HopperTileEntity
- java.lang.Object
-
- All Implemented Interfaces:
IContainerProvider
,INamedContainerProvider
,IClearable
,IInventory
,IHopper
,ITickableTileEntity
,INameable
,ICapabilityProvider
,ICapabilitySerializable<CompoundNBT>
,IForgeTileEntity
,INBTSerializable<CompoundNBT>
public class HopperTileEntity extends LockableLootTileEntity implements IHopper, ITickableTileEntity
-
-
Field Summary
Fields Modifier and Type Field Description private int
cooldownTime
private NonNullList<ItemStack>
items
private long
tickedGameTime
-
Fields inherited from class net.minecraft.tileentity.LockableLootTileEntity
lootTable, lootTableSeed
-
Fields inherited from class net.minecraft.tileentity.TileEntity
level, remove, worldPosition
-
Fields inherited from interface net.minecraftforge.common.extensions.IForgeTileEntity
INFINITE_EXTENT_AABB
-
-
Constructor Summary
Constructors Constructor Description HopperTileEntity()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
addItem(IInventory p_200114_0_, ItemEntity p_200114_1_)
static ItemStack
addItem(IInventory p_174918_0_, IInventory p_174918_1_, ItemStack p_174918_2_, Direction p_174918_3_)
private static boolean
canMergeItems(ItemStack p_145894_0_, ItemStack p_145894_1_)
private static boolean
canPlaceItemInContainer(IInventory p_174920_0_, ItemStack p_174920_1_, int p_174920_2_, Direction p_174920_3_)
private static boolean
canTakeItemFromContainer(IInventory p_174921_0_, ItemStack p_174921_1_, int p_174921_2_, Direction p_174921_3_)
protected Container
createMenu(int p_213906_1_, PlayerInventory p_213906_2_)
protected IItemHandler
createUnSidedHandler()
private boolean
ejectItems()
void
entityInside(Entity p_200113_1_)
private IInventory
getAttachedContainer()
static IInventory
getContainerAt(World p_145893_0_, double p_145893_1_, double p_145893_3_, double p_145893_5_)
static IInventory
getContainerAt(World p_195484_0_, BlockPos p_195484_1_)
int
getContainerSize()
protected ITextComponent
getDefaultName()
protected NonNullList<ItemStack>
getItems()
static java.util.List<ItemEntity>
getItemsAtAndAbove(IHopper p_200115_0_)
long
getLastUpdateTime()
double
getLevelX()
double
getLevelY()
double
getLevelZ()
private static java.util.stream.IntStream
getSlots(IInventory p_213972_0_, Direction p_213972_1_)
static IInventory
getSourceContainer(IHopper p_145884_0_)
private boolean
inventoryFull()
private static boolean
isEmptyContainer(IInventory p_174917_0_, Direction p_174917_1_)
private boolean
isFullContainer(IInventory p_174919_1_, Direction p_174919_2_)
private boolean
isOnCooldown()
boolean
isOnCustomCooldown()
void
load(BlockState p_230337_1_, CompoundNBT p_230337_2_)
ItemStack
removeItem(int p_70298_1_, int p_70298_2_)
CompoundNBT
save(CompoundNBT p_189515_1_)
void
setCooldown(int p_145896_1_)
void
setItem(int p_70299_1_, ItemStack p_70299_2_)
protected void
setItems(NonNullList<ItemStack> p_199721_1_)
static boolean
suckInItems(IHopper p_145891_0_)
void
tick()
private static ItemStack
tryMoveInItem(IInventory p_174916_0_, IInventory p_174916_1_, ItemStack p_174916_2_, int p_174916_3_, Direction p_174916_4_)
private boolean
tryMoveItems(java.util.function.Supplier<java.lang.Boolean> p_200109_1_)
private static boolean
tryTakeInItemFromSlot(IHopper p_174915_0_, IInventory p_174915_1_, int p_174915_2_, Direction p_174915_3_)
-
Methods inherited from class net.minecraft.tileentity.LockableLootTileEntity
canOpen, clearContent, createMenu, getItem, isEmpty, removeItemNoUpdate, setLootTable, setLootTable, stillValid, tryLoadLootTable, trySaveLootTable, unpackLootTable
-
Methods inherited from class net.minecraft.tileentity.LockableTileEntity
canUnlock, getCapability, getCustomName, getDisplayName, getName, invalidateCaps, setCustomName
-
Methods inherited from class net.minecraft.tileentity.TileEntity
clearCache, clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getTileData, getType, getUpdatePacket, getUpdateTag, getViewDistance, hasLevel, isRemoved, loadStatic, logInvalidState, mirror, onChunkUnloaded, onlyOpCanSetNbt, rotate, setChanged, setLevelAndPosition, setPosition, setRemoved, triggerEvent
-
Methods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, reviveCaps, serializeCaps
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapability
-
Methods inherited from interface net.minecraft.inventory.IClearable
clearContent
-
Methods inherited from interface net.minecraftforge.common.extensions.IForgeTileEntity
deserializeNBT, deserializeNBT, getModelData, getRenderBoundingBox, getTileEntity, handleUpdateTag, onDataPacket, onLoad, requestModelDataUpdate, serializeNBT
-
Methods inherited from interface net.minecraft.tileentity.IHopper
getLevel, getSuckShape
-
Methods inherited from interface net.minecraft.inventory.IInventory
canPlaceItem, countItem, getItem, getMaxStackSize, hasAnyOf, isEmpty, removeItemNoUpdate, setChanged, startOpen, stillValid, stopOpen
-
Methods inherited from interface net.minecraft.util.INameable
hasCustomName
-
-
-
-
Field Detail
-
items
private NonNullList<ItemStack> items
-
cooldownTime
private int cooldownTime
-
tickedGameTime
private long tickedGameTime
-
-
Method Detail
-
load
public void load(BlockState p_230337_1_, CompoundNBT p_230337_2_)
- Overrides:
load
in classLockableTileEntity
-
save
public CompoundNBT save(CompoundNBT p_189515_1_)
- Overrides:
save
in classLockableTileEntity
-
getContainerSize
public int getContainerSize()
- Specified by:
getContainerSize
in interfaceIInventory
-
removeItem
public ItemStack removeItem(int p_70298_1_, int p_70298_2_)
- Specified by:
removeItem
in interfaceIInventory
- Overrides:
removeItem
in classLockableLootTileEntity
-
setItem
public void setItem(int p_70299_1_, ItemStack p_70299_2_)
- Specified by:
setItem
in interfaceIInventory
- Overrides:
setItem
in classLockableLootTileEntity
-
getDefaultName
protected ITextComponent getDefaultName()
- Specified by:
getDefaultName
in classLockableTileEntity
-
tick
public void tick()
- Specified by:
tick
in interfaceITickableTileEntity
-
tryMoveItems
private boolean tryMoveItems(java.util.function.Supplier<java.lang.Boolean> p_200109_1_)
-
inventoryFull
private boolean inventoryFull()
-
ejectItems
private boolean ejectItems()
-
getSlots
private static java.util.stream.IntStream getSlots(IInventory p_213972_0_, Direction p_213972_1_)
-
isFullContainer
private boolean isFullContainer(IInventory p_174919_1_, Direction p_174919_2_)
-
isEmptyContainer
private static boolean isEmptyContainer(IInventory p_174917_0_, Direction p_174917_1_)
-
suckInItems
public static boolean suckInItems(IHopper p_145891_0_)
-
tryTakeInItemFromSlot
private static boolean tryTakeInItemFromSlot(IHopper p_174915_0_, IInventory p_174915_1_, int p_174915_2_, Direction p_174915_3_)
-
addItem
public static boolean addItem(IInventory p_200114_0_, ItemEntity p_200114_1_)
-
addItem
public static ItemStack addItem(@Nullable IInventory p_174918_0_, IInventory p_174918_1_, ItemStack p_174918_2_, @Nullable Direction p_174918_3_)
-
canPlaceItemInContainer
private static boolean canPlaceItemInContainer(IInventory p_174920_0_, ItemStack p_174920_1_, int p_174920_2_, @Nullable Direction p_174920_3_)
-
canTakeItemFromContainer
private static boolean canTakeItemFromContainer(IInventory p_174921_0_, ItemStack p_174921_1_, int p_174921_2_, Direction p_174921_3_)
-
tryMoveInItem
private static ItemStack tryMoveInItem(@Nullable IInventory p_174916_0_, IInventory p_174916_1_, ItemStack p_174916_2_, int p_174916_3_, @Nullable Direction p_174916_4_)
-
getAttachedContainer
@Nullable private IInventory getAttachedContainer()
-
getSourceContainer
@Nullable public static IInventory getSourceContainer(IHopper p_145884_0_)
-
getItemsAtAndAbove
public static java.util.List<ItemEntity> getItemsAtAndAbove(IHopper p_200115_0_)
-
getContainerAt
@Nullable public static IInventory getContainerAt(World p_195484_0_, BlockPos p_195484_1_)
-
getContainerAt
@Nullable public static IInventory getContainerAt(World p_145893_0_, double p_145893_1_, double p_145893_3_, double p_145893_5_)
-
setCooldown
public void setCooldown(int p_145896_1_)
-
isOnCooldown
private boolean isOnCooldown()
-
isOnCustomCooldown
public boolean isOnCustomCooldown()
-
getItems
protected NonNullList<ItemStack> getItems()
- Specified by:
getItems
in classLockableLootTileEntity
-
setItems
protected void setItems(NonNullList<ItemStack> p_199721_1_)
- Specified by:
setItems
in classLockableLootTileEntity
-
entityInside
public void entityInside(Entity p_200113_1_)
-
createMenu
protected Container createMenu(int p_213906_1_, PlayerInventory p_213906_2_)
- Specified by:
createMenu
in classLockableTileEntity
-
createUnSidedHandler
protected IItemHandler createUnSidedHandler()
- Overrides:
createUnSidedHandler
in classLockableTileEntity
-
getLastUpdateTime
public long getLastUpdateTime()
-
-