Package net.minecraft.tileentity
Class ChestTileEntity
- java.lang.Object
-
- All Implemented Interfaces:
IContainerProvider
,INamedContainerProvider
,IClearable
,IInventory
,IChestLid
,ITickableTileEntity
,INameable
,ICapabilityProvider
,ICapabilitySerializable<CompoundNBT>
,IForgeTileEntity
,INBTSerializable<CompoundNBT>
- Direct Known Subclasses:
TrappedChestTileEntity
public class ChestTileEntity extends LockableLootTileEntity implements IChestLid, ITickableTileEntity
-
-
Field Summary
Fields Modifier and Type Field Description private LazyOptional<IItemHandlerModifiable>
chestHandler
private NonNullList<ItemStack>
items
protected float
oOpenness
protected int
openCount
protected float
openness
private int
tickInterval
-
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 Modifier Constructor Description ChestTileEntity()
protected
ChestTileEntity(TileEntityType<?> p_i48287_1_)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCache()
private IItemHandlerModifiable
createHandler()
protected Container
createMenu(int p_213906_1_, PlayerInventory p_213906_2_)
<T> LazyOptional<T>
getCapability(Capability<T> cap, Direction side)
Retrieves the Optional handler for the capability requested on the specific side.int
getContainerSize()
protected ITextComponent
getDefaultName()
protected NonNullList<ItemStack>
getItems()
static int
getOpenCount(IBlockReader p_195481_0_, BlockPos p_195481_1_)
static int
getOpenCount(World p_213976_0_, LockableTileEntity p_213976_1_, int p_213976_2_, int p_213976_3_, int p_213976_4_)
static int
getOpenCount(World p_213977_0_, LockableTileEntity p_213977_1_, int p_213977_2_, int p_213977_3_, int p_213977_4_, int p_213977_5_, int p_213977_6_)
float
getOpenNess(float p_195480_1_)
protected void
invalidateCaps()
void
load(BlockState p_230337_1_, CompoundNBT p_230337_2_)
private void
playSound(SoundEvent p_195483_1_)
CompoundNBT
save(CompoundNBT p_189515_1_)
protected void
setItems(NonNullList<ItemStack> p_199721_1_)
protected void
signalOpenCount()
void
startOpen(PlayerEntity p_174889_1_)
void
stopOpen(PlayerEntity p_174886_1_)
static void
swapContents(ChestTileEntity p_199722_0_, ChestTileEntity p_199722_1_)
void
tick()
boolean
triggerEvent(int p_145842_1_, int p_145842_2_)
-
Methods inherited from class net.minecraft.tileentity.LockableLootTileEntity
canOpen, clearContent, createMenu, getItem, isEmpty, removeItem, removeItemNoUpdate, setItem, setLootTable, setLootTable, stillValid, tryLoadLootTable, trySaveLootTable, unpackLootTable
-
Methods inherited from class net.minecraft.tileentity.LockableTileEntity
canUnlock, createUnSidedHandler, getCustomName, getDisplayName, getName, setCustomName
-
Methods inherited from class net.minecraft.tileentity.TileEntity
clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getTileData, getType, getUpdatePacket, getUpdateTag, getViewDistance, hasLevel, isRemoved, loadStatic, logInvalidState, mirror, onChunkUnloaded, onlyOpCanSetNbt, rotate, setChanged, setLevelAndPosition, setPosition, setRemoved
-
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.minecraftforge.common.extensions.IForgeTileEntity
deserializeNBT, deserializeNBT, getModelData, getRenderBoundingBox, getTileEntity, handleUpdateTag, onDataPacket, onLoad, requestModelDataUpdate, serializeNBT
-
Methods inherited from interface net.minecraft.inventory.IInventory
canPlaceItem, countItem, getMaxStackSize, hasAnyOf, setChanged
-
Methods inherited from interface net.minecraft.util.INameable
hasCustomName
-
-
-
-
Field Detail
-
items
private NonNullList<ItemStack> items
-
openness
protected float openness
-
oOpenness
protected float oOpenness
-
openCount
protected int openCount
-
tickInterval
private int tickInterval
-
chestHandler
private LazyOptional<IItemHandlerModifiable> chestHandler
-
-
Constructor Detail
-
ChestTileEntity
protected ChestTileEntity(TileEntityType<?> p_i48287_1_)
-
ChestTileEntity
public ChestTileEntity()
-
-
Method Detail
-
getContainerSize
public int getContainerSize()
- Specified by:
getContainerSize
in interfaceIInventory
-
getDefaultName
protected ITextComponent getDefaultName()
- Specified by:
getDefaultName
in classLockableTileEntity
-
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
-
tick
public void tick()
- Specified by:
tick
in interfaceITickableTileEntity
-
getOpenCount
public static int getOpenCount(World p_213977_0_, LockableTileEntity p_213977_1_, int p_213977_2_, int p_213977_3_, int p_213977_4_, int p_213977_5_, int p_213977_6_)
-
getOpenCount
public static int getOpenCount(World p_213976_0_, LockableTileEntity p_213976_1_, int p_213976_2_, int p_213976_3_, int p_213976_4_)
-
playSound
private void playSound(SoundEvent p_195483_1_)
-
triggerEvent
public boolean triggerEvent(int p_145842_1_, int p_145842_2_)
- Overrides:
triggerEvent
in classTileEntity
-
startOpen
public void startOpen(PlayerEntity p_174889_1_)
- Specified by:
startOpen
in interfaceIInventory
-
stopOpen
public void stopOpen(PlayerEntity p_174886_1_)
- Specified by:
stopOpen
in interfaceIInventory
-
signalOpenCount
protected void signalOpenCount()
-
getItems
protected NonNullList<ItemStack> getItems()
- Specified by:
getItems
in classLockableLootTileEntity
-
setItems
protected void setItems(NonNullList<ItemStack> p_199721_1_)
- Specified by:
setItems
in classLockableLootTileEntity
-
getOpenNess
public float getOpenNess(float p_195480_1_)
- Specified by:
getOpenNess
in interfaceIChestLid
-
getOpenCount
public static int getOpenCount(IBlockReader p_195481_0_, BlockPos p_195481_1_)
-
swapContents
public static void swapContents(ChestTileEntity p_199722_0_, ChestTileEntity p_199722_1_)
-
createMenu
protected Container createMenu(int p_213906_1_, PlayerInventory p_213906_2_)
- Specified by:
createMenu
in classLockableTileEntity
-
clearCache
public void clearCache()
- Overrides:
clearCache
in classTileEntity
-
getCapability
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side)
Description copied from interface:ICapabilityProvider
Retrieves the Optional handler for the capability requested on the specific side. The return value CAN be the same for multiple faces. Modders are encouraged to cache this value, using the listener capabilities of the Optional to be notified if the requested capability get lost.- Specified by:
getCapability
in interfaceICapabilityProvider
- Overrides:
getCapability
in classLockableTileEntity
- Returns:
- The requested an optional holding the requested capability.
-
createHandler
private IItemHandlerModifiable createHandler()
-
invalidateCaps
protected void invalidateCaps()
- Overrides:
invalidateCaps
in classLockableTileEntity
-
-