public abstract class ChestStateManager extends Object
| Modifier and Type | Field and Description |
|---|---|
private int |
viewerCount |
| Constructor and Description |
|---|
ChestStateManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
closeChest(World world,
BlockPos pos,
BlockState state) |
private int |
getInRangeViewerCount(World world,
BlockPos pos) |
int |
getViewerCount() |
protected abstract boolean |
isPlayerViewing(PlayerEntity player)
Determines whether the given player is currently viewing this chest.
|
protected abstract void |
onChestClosed(World world,
BlockPos pos,
BlockState state)
Run when this chest closes (when the viewer count reaches zero).
|
protected abstract void |
onChestOpened(World world,
BlockPos pos,
BlockState state)
Run when this chest is opened (when the viewer count becomes nonzero).
|
protected abstract void |
onInteracted(World world,
BlockPos pos,
BlockState state,
int oldViewerCount,
int newViewerCount)
Run when a player interacts with this chest.
|
void |
openChest(World world,
BlockPos pos,
BlockState state) |
private static void |
scheduleBlockTick(World world,
BlockPos pos,
BlockState state) |
void |
updateViewerCount(World world,
BlockPos pos,
BlockState state) |
protected abstract void onChestOpened(World world, BlockPos pos, BlockState state)
protected abstract void onChestClosed(World world, BlockPos pos, BlockState state)
protected abstract void onInteracted(World world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount)
protected abstract boolean isPlayerViewing(PlayerEntity player)
public void openChest(World world, BlockPos pos, BlockState state)
public void closeChest(World world, BlockPos pos, BlockState state)
public void updateViewerCount(World world, BlockPos pos, BlockState state)
public int getViewerCount()
private static void scheduleBlockTick(World world, BlockPos pos, BlockState state)