Package net.minecraft.block
Class ChestBlock
- All Implemented Interfaces:
BlockEntityProvider
,FluidDrainable
,FluidFillable
,Waterloggable
,ItemConvertible
- Direct Known Subclasses:
TrappedChestBlock
public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements Waterloggable
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.block.Block
Block.NeighborGroup
Nested classes/interfaces inherited from class net.minecraft.block.AbstractBlock
AbstractBlock.AbstractBlockState, AbstractBlock.ContextPredicate, AbstractBlock.OffsetType, AbstractBlock.Settings, AbstractBlock.TypedContextPredicate<A>
-
Field Summary
Fields Modifier and Type Field Description static EnumProperty<ChestType>
CHEST_TYPE
protected static VoxelShape
DOUBLE_EAST_SHAPE
protected static VoxelShape
DOUBLE_NORTH_SHAPE
protected static VoxelShape
DOUBLE_SOUTH_SHAPE
protected static VoxelShape
DOUBLE_WEST_SHAPE
static DirectionProperty
FACING
private static DoubleBlockProperties.PropertyRetriever<ChestBlockEntity,Optional<Inventory>>
INVENTORY_RETRIEVER
private static DoubleBlockProperties.PropertyRetriever<ChestBlockEntity,Optional<NamedScreenHandlerFactory>>
NAME_RETRIEVER
protected static VoxelShape
SINGLE_SHAPE
static BooleanProperty
WATERLOGGED
Fields inherited from class net.minecraft.block.AbstractChestBlock
entityTypeRetriever
Fields inherited from class net.minecraft.block.Block
LOGGER, STATE_IDS, stateManager
Fields inherited from class net.minecraft.block.AbstractBlock
collidable, dynamicBounds, FACINGS, jumpVelocityMultiplier, lootTableId, material, randomTicks, resistance, settings, slipperiness, soundGroup, velocityMultiplier
-
Constructor Summary
Constructors Modifier Constructor Description protected
ChestBlock(AbstractBlock.Settings settings, Supplier<BlockEntityType<? extends ChestBlockEntity>> entityTypeSupplier)
-
Method Summary
Methods inherited from class net.minecraft.block.BlockWithEntity
onSyncedBlockEvent
Methods inherited from class net.minecraft.block.Block
addStacksForDisplay, afterBreak, appendTooltip, asBlock, asItem, canMobSpawnInside, cannotConnect, createCuboidShape, dropExperience, dropStack, dropStacks, dropStacks, dropStacks, getBlastResistance, getBlockFromItem, getDefaultState, getDroppedStacks, getDroppedStacks, getJumpVelocityMultiplier, getName, getPickStack, getRawIdFromState, getSlipperiness, getSoundGroup, getStateFromRawId, getStateManager, getTranslationKey, getVelocityMultiplier, hasDynamicBounds, hasRandomTicks, hasTopRim, is, isFaceFullSquare, isIn, isShapeFullCube, isTranslucent, onBreak, onBroken, onDestroyedByExplosion, onEntityLand, onLandedUpon, onSteppedOn, postProcessState, pushEntitiesUpBeforeBlockChange, rainTick, randomDisplayTick, replace, replace, setDefaultState, shouldDrawSide, shouldDropItemsOnExplosion, sideCoversSmallSquare, toString
Methods inherited from class net.minecraft.block.AbstractBlock
calcBlockBreakingDelta, canBucketPlace, canPlaceAt, canReplace, emitsRedstonePower, getAmbientOcclusionLightLevel, getCollisionShape, getCullingShape, getDefaultMaterialColor, getDroppedStacks, getLootTableId, getOffsetType, getOpacity, getPistonBehavior, getRaycastShape, getRenderingSeed, getSidesShape, getStrongRedstonePower, getVisualShape, getWeakRedstonePower, hasBlockEntity, hasSidedTransparency, isSideInvisible, neighborUpdate, onBlockAdded, onBlockBreakStart, onEntityCollision, onProjectileHit, onStacksDropped, prepare, randomTick, scheduledTick
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.block.Waterloggable
canFillWithFluid, tryDrainFluid, tryFillWithFluid
-
Field Details
-
FACING
-
CHEST_TYPE
-
WATERLOGGED
-
DOUBLE_NORTH_SHAPE
-
DOUBLE_SOUTH_SHAPE
-
DOUBLE_WEST_SHAPE
-
DOUBLE_EAST_SHAPE
-
SINGLE_SHAPE
-
INVENTORY_RETRIEVER
private static final DoubleBlockProperties.PropertyRetriever<ChestBlockEntity,Optional<Inventory>> INVENTORY_RETRIEVER -
NAME_RETRIEVER
private static final DoubleBlockProperties.PropertyRetriever<ChestBlockEntity,Optional<NamedScreenHandlerFactory>> NAME_RETRIEVER
-
-
Constructor Details
-
ChestBlock
protected ChestBlock(AbstractBlock.Settings settings, Supplier<BlockEntityType<? extends ChestBlockEntity>> entityTypeSupplier)
-
-
Method Details
-
getDoubleBlockType
-
getRenderType
- Overrides:
getRenderType
in classBlockWithEntity
-
getStateForNeighborUpdate
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom)- Overrides:
getStateForNeighborUpdate
in classAbstractBlock
-
getOutlineShape
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context)- Overrides:
getOutlineShape
in classAbstractBlock
-
getFacing
-
getPlacementState
- Overrides:
getPlacementState
in classBlock
-
getFluidState
- Overrides:
getFluidState
in classAbstractBlock
-
getNeighborChestDirection
-
onPlaced
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) -
onStateReplaced
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved)Called inWorldChunk.setBlockState(BlockPos, BlockState, boolean)
ifnewState
is different fromstate
. Vanilla blocks perform removal cleanups here.- Overrides:
onStateReplaced
in classAbstractBlock
-
onUse
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit)Called when this block is used by a player. This, by default, is bound to using the right mouse button.This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
world.isClient()
.If the action result is successful on a logical client, then the action will be sent to the logical server for processing.
- Overrides:
onUse
in classAbstractBlock
- Returns:
- an action result that specifies if using the block was successful.
-
getOpenStat
-
getInventory
@Nullable public static Inventory getInventory(ChestBlock block, BlockState state, World world, BlockPos pos, boolean ignoreBlocked) -
getBlockEntitySource
public DoubleBlockProperties.PropertySource<? extends ChestBlockEntity> getBlockEntitySource(BlockState state, World world, BlockPos pos, boolean ignoreBlocked)- Specified by:
getBlockEntitySource
in classAbstractChestBlock<ChestBlockEntity>
-
createScreenHandlerFactory
@Nullable public NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos)- Overrides:
createScreenHandlerFactory
in classBlockWithEntity
-
getAnimationProgressRetriever
@Environment(CLIENT) public static DoubleBlockProperties.PropertyRetriever<ChestBlockEntity,Float2FloatFunction> getAnimationProgressRetriever(ChestAnimationProgress chestAnimationProgress) -
createBlockEntity
- Specified by:
createBlockEntity
in interfaceBlockEntityProvider
-
isChestBlocked
-
hasBlockOnTop
-
hasOcelotOnTop
-
hasComparatorOutput
- Overrides:
hasComparatorOutput
in classAbstractBlock
-
getComparatorOutput
- Overrides:
getComparatorOutput
in classAbstractBlock
-
rotate
Applies a block rotation to a block state.By default, this returns the provided block state.
- Overrides:
rotate
in classAbstractBlock
- Returns:
- the rotated block state
-
mirror
- Overrides:
mirror
in classAbstractBlock
-
appendProperties
- Overrides:
appendProperties
in classBlock
-