Package cn.nukkit.blockentity
Class BlockEntitySpawnableContainer
java.lang.Object
cn.nukkit.math.Vector3
cn.nukkit.positiontracking.NamedPosition
cn.nukkit.level.Position
cn.nukkit.blockentity.BlockEntity
cn.nukkit.blockentity.BlockEntitySpawnable
cn.nukkit.blockentity.BlockEntitySpawnableContainer
- All Implemented Interfaces:
BlockEntityContainer
,InventoryHolder
,Cloneable
- Direct Known Subclasses:
BlockEntityBarrel
,BlockEntityChest
@PowerNukkitOnly
public abstract class BlockEntitySpawnableContainer
extends BlockEntitySpawnable
implements InventoryHolder, BlockEntityContainer
-
Field Summary
Fields inherited from class cn.nukkit.blockentity.BlockEntity
BANNER, BARREL, BEACON, BED, BEEHIVE, BELL, BLAST_FURNACE, BREWING_STAND, CAMPFIRE, CAULDRON, CHEST, chunk, closed, COMMAND_BLOCK, COMPARATOR, CONDUIT, count, DAYLIGHT_DETECTOR, DISPENSER, DROPPER, ENCHANT_TABLE, END_GATEWAY, END_PORTAL, ENDER_CHEST, FLOWER_POT, FURNACE, GLOW_ITEM_FRAME, HOPPER, id, ITEM_FRAME, JUKEBOX, lastUpdate, LECTERN, LODESTONE, MOB_SPAWNER, movable, MOVING_BLOCK, MUSIC, name, namedTag, NETHER_REACTOR, PISTON_ARM, SCULK_CATALYST, SCULK_SENSOR, SCULK_SHRIEKER, server, SHULKER_BOX, SIGN, SKULL, SMOKER, STRUCTURE_BLOCK, TARGET, timing
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getItem
(int index) 返回一个存储在容器里的物品的Item
对象。
Returns an item that stores in this container, as anItem
object.protected int
getSlotIndex
(int index) void
loadNBT()
从方块实体的namedtag中读取数据void
onBreak()
protected abstract ContainerInventory
继承于此类的容器方块实体必须实现此方法void
saveNBT()
存储方块实体数据到namedtagvoid
把一个物品存储进容器。
Sets or stores this item into this container.Methods inherited from class cn.nukkit.blockentity.BlockEntitySpawnable
getSpawnCompound, getSpawnPacket, getSpawnPacket, initBlockEntity, spawnTo, spawnToAll, updateCompoundTag
Methods inherited from class cn.nukkit.blockentity.BlockEntity
createBlockEntity, createBlockEntity, createBlockEntity, getBlock, getCleanedNBT, getDefaultCompound, getId, getLevelBlockEntity, getName, getSaveId, init, isBlockEntityValid, isMovable, isObservable, onBreak, onUpdate, registerBlockEntity, scheduleUpdate, setDirty
Methods inherited from class cn.nukkit.level.Position
abs, add, add, add, add, ceil, clone, divide, floor, fromObject, fromObject, getChunk, getLevel, getLevelBlock, getLevelBlock, getLevelBlock, getLevelBlockAround, getLevelBlockAtLayer, getLevelBlockState, getLevelBlockState, getLevelName, getLocation, getSide, getSide, getSidePos, getTickCachedLevelBlock, getTickCachedLevelBlockAtLayer, getTypedBlockEntity, getValidLevel, isValid, multiply, round, setComponents, setComponents, setLevel, setStrong, setWeak, subtract, subtract, subtract, subtract, subtract, toString
Methods inherited from class cn.nukkit.positiontracking.NamedPosition
matchesNamedPosition
Methods inherited from class cn.nukkit.math.Vector3
asBlockVector3, asVector3f, cross, distance, distance, distanceManhattan, distanceSquared, distanceSquared, dot, down, down, east, east, equals, getAxis, getChunkSectionY, getChunkVector, getChunkX, getChunkZ, getFloorX, getFloorY, getFloorZ, getForward, getIntermediateWithXValue, getIntermediateWithYValue, getIntermediateWithZValue, getRight, getSideVec, getSouth, getUp, getWest, getX, getY, getZ, hashCode, length, lengthSquared, maxPlainDistance, maxPlainDistance, maxPlainDistance, maxPlainDistance, maxPlainDistance, normalize, north, north, rawHashCode, setComponentsAdding, setComponentsAdding, setX, setY, setZ, south, south, up, up, west, west
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface cn.nukkit.blockentity.BlockEntityContainer
getSize
Methods inherited from interface cn.nukkit.inventory.InventoryHolder
getInventory
-
Field Details
-
inventory
-
-
Constructor Details
-
BlockEntitySpawnableContainer
-
-
Method Details
-
loadNBT
Description copied from class:BlockEntity
从方块实体的namedtag中读取数据- Overrides:
loadNBT
in classBlockEntity
-
close
public void close()- Overrides:
close
in classBlockEntity
-
onBreak
public void onBreak()- Overrides:
onBreak
in classBlockEntity
-
saveNBT
public void saveNBT()Description copied from class:BlockEntity
存储方块实体数据到namedtag- Overrides:
saveNBT
in classBlockEntity
-
getSlotIndex
-
getItem
Description copied from interface:BlockEntityContainer
返回一个存储在容器里的物品的Item
对象。
Returns an item that stores in this container, as anItem
object.- Specified by:
getItem
in interfaceBlockEntityContainer
- Parameters:
index
- 这个物品的索引序号。
The index number of this item.- Returns:
- 这个物品的
Item
对象。
AnItem
object for this item.
-
setItem
Description copied from interface:BlockEntityContainer
把一个物品存储进容器。
Sets or stores this item into this container.注意:如果这个容器相应的索引序号已经有了物品,那么新存储的物品将会替换原有的物品。
Notice: If there is already an item for this index number, the new item being stored will REPLACE the old one.- Specified by:
setItem
in interfaceBlockEntityContainer
- Parameters:
index
- 这个物品的索引序号。
The index number of this item.item
- 描述这个物品的Item
对象。
TheItem
object that describes this item.
-
requireContainerInventory
@PowerNukkitXOnly @Since("1.19.60-r1") protected abstract ContainerInventory requireContainerInventory()继承于此类的容器方块实体必须实现此方法- Returns:
- ContainerInventory
-