public interface ITileEntityBlock
Modifier and Type | Method and Description |
---|---|
net.minecraft.tileentity.TileEntityType<?> |
getTileEntityType(net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos)
/** Returns the
TileEntityType of the block. |
default <T extends net.minecraft.tileentity.TileEntity> |
isTileEntityFromType(net.minecraft.world.IBlockReader world,
net.minecraft.util.math.BlockPos pos)
Return an optional with a tile entity if the tile entity at this position exists and is the same tile entity type as
this block creates.
|
default boolean |
openContainer(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.entity.player.PlayerEntity player)
Opens the container that is specified in the tile entity with
IContainerProvider . |
default boolean |
openContainer(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.entity.player.PlayerEntity player,
boolean canOpenSneak)
Opens the container that is specified in the tile entity with
IContainerProvider . |
net.minecraft.tileentity.TileEntityType<?> getTileEntityType(net.minecraft.world.IBlockReader world, net.minecraft.util.math.BlockPos pos)
TileEntityType
of the block.world
- Worldpos
- The tile entities positiondefault boolean openContainer(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, net.minecraft.entity.player.PlayerEntity player)
IContainerProvider
. If the tile entity
implements IInitSyncedTileEntity
then the IInitSyncedTileEntity.sendInitialDataBuffer(PacketBuffer)
is called and the data will be send to the client. The container cannot be opened when sneaking.world
- Worldpos
- The tile entities positionplayer
- The player that opens the tile entitydefault boolean openContainer(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, net.minecraft.entity.player.PlayerEntity player, boolean canOpenSneak)
IContainerProvider
. If the tile entity
implements IInitSyncedTileEntity
then the IInitSyncedTileEntity.sendInitialDataBuffer(PacketBuffer)
is called and the data will be send to the client.world
- Worldpos
- The tile entities posplayer
- The player that opens the tile entitycanOpenSneak
- If the container can be opened when shift clicking with an item that has no right click functiondefault <T extends net.minecraft.tileentity.TileEntity> java.util.Optional<T> isTileEntityFromType(net.minecraft.world.IBlockReader world, net.minecraft.util.math.BlockPos pos)
T
- Tile entityworld
- Worldpos
- Position of the tile entity