public abstract class LockableContainerBlockEntity extends BlockEntity implements Inventory, NamedScreenHandlerFactory, Nameable
Modifier and Type | Field and Description |
---|---|
private Text |
customName |
private ContainerLock |
lock |
pos, removed, world
Modifier | Constructor and Description |
---|---|
protected |
LockableContainerBlockEntity(BlockEntityType<?> type) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkUnlocked(PlayerEntity player) |
static boolean |
checkUnlocked(PlayerEntity player,
ContainerLock lock,
Text containerName) |
ScreenHandler |
createMenu(int syncId,
PlayerInventory inv,
PlayerEntity player) |
protected abstract ScreenHandler |
createScreenHandler(int syncId,
PlayerInventory playerInventory) |
void |
fromTag(BlockState state,
CompoundTag tag) |
protected abstract Text |
getContainerName() |
Text |
getCustomName() |
Text |
getDisplayName()
Returns the title of this screen handler; will be a part of the open
screen packet sent to the client.
|
Text |
getName() |
void |
setCustomName(Text customName) |
CompoundTag |
toTag(CompoundTag tag) |
applyMirror, applyRotation, cancelRemoval, copyItemDataRequiresOperator, createFromTag, getCachedState, getPos, getSquaredRenderDistance, getType, getWorld, hasWorld, isRemoved, markDirty, markInvalid, markRemoved, onSyncedBlockEvent, populateCrashReport, resetBlock, setLocation, setPos, toInitialChunkDataTag, toUpdatePacket
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canPlayerUse, containsAny, count, getMaxCountPerStack, getStack, isEmpty, isValid, markDirty, onClose, onOpen, removeStack, removeStack, setStack, size
hasCustomName
private ContainerLock lock
private Text customName
protected LockableContainerBlockEntity(BlockEntityType<?> type)
public void fromTag(BlockState state, CompoundTag tag)
fromTag
in class BlockEntity
public CompoundTag toTag(CompoundTag tag)
toTag
in class BlockEntity
public void setCustomName(Text customName)
public Text getDisplayName()
getDisplayName
in interface NamedScreenHandlerFactory
getDisplayName
in interface Nameable
@Nullable public Text getCustomName()
getCustomName
in interface Nameable
protected abstract Text getContainerName()
public boolean checkUnlocked(PlayerEntity player)
public static boolean checkUnlocked(PlayerEntity player, ContainerLock lock, Text containerName)
@Nullable public ScreenHandler createMenu(int syncId, PlayerInventory inv, PlayerEntity player)
createMenu
in interface ScreenHandlerFactory
protected abstract ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory)