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.NeighborGroupNested 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_TYPEprotected static VoxelShapeDOUBLE_EAST_SHAPEprotected static VoxelShapeDOUBLE_NORTH_SHAPEprotected static VoxelShapeDOUBLE_SOUTH_SHAPEprotected static VoxelShapeDOUBLE_WEST_SHAPEstatic DirectionPropertyFACINGprivate static DoubleBlockProperties.PropertyRetriever<ChestBlockEntity,Optional<Inventory>>INVENTORY_RETRIEVERprivate static DoubleBlockProperties.PropertyRetriever<ChestBlockEntity,Optional<NamedScreenHandlerFactory>>NAME_RETRIEVERprotected static VoxelShapeSINGLE_SHAPEstatic BooleanPropertyWATERLOGGEDFields inherited from class net.minecraft.block.AbstractChestBlock
entityTypeRetrieverFields inherited from class net.minecraft.block.Block
LOGGER, STATE_IDS, stateManagerFields 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 protectedChestBlock(AbstractBlock.Settings settings, Supplier<BlockEntityType<? extends ChestBlockEntity>> entityTypeSupplier) -
Method Summary
Methods inherited from class net.minecraft.block.BlockWithEntity
checkType, onSyncedBlockEventMethods 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, isFaceFullSquare, isShapeFullCube, isTranslucent, onBreak, onBroken, onDestroyedByExplosion, onEntityLand, onLandedUpon, onSteppedOn, postProcessState, precipitationTick, pushEntitiesUpBeforeBlockChange, randomDisplayTick, replace, replace, setDefaultState, shouldDrawSide, shouldDropItemsOnExplosion, sideCoversSmallSquare, toStringMethods inherited from class net.minecraft.block.AbstractBlock
calcBlockBreakingDelta, canBucketPlace, canPlaceAt, canReplace, emitsRedstonePower, getAmbientOcclusionLightLevel, getCollisionShape, getCullingShape, getDefaultMapColor, getDroppedStacks, getLootTableId, getMaxModelOffset, getOffsetType, getOpacity, getPistonBehavior, getRaycastShape, getRenderingSeed, getSidesShape, getStrongRedstonePower, getVisualShape, getWeakRedstonePower, hasSidedTransparency, isSideInvisible, neighborUpdate, onBlockAdded, onBlockBreakStart, onEntityCollision, onProjectileHit, onStacksDropped, prepare, randomTickMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.block.BlockEntityProvider
getGameEventListenerMethods inherited from interface net.minecraft.block.Waterloggable
canFillWithFluid, getDrainSound, 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:
getRenderTypein classBlockWithEntity
-
getStateForNeighborUpdate
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom)- Overrides:
getStateForNeighborUpdatein classAbstractBlock
-
getOutlineShape
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context)- Overrides:
getOutlineShapein classAbstractBlock
-
getFacing
-
getPlacementState
- Overrides:
getPlacementStatein classBlock
-
getFluidState
- Overrides:
getFluidStatein 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)ifnewStateis different fromstate. Vanilla blocks perform removal cleanups here.- Overrides:
onStateReplacedin 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:
onUsein classAbstractBlock- Returns:
- an action result that specifies if using the block was successful.
-
getOpenStat
-
getExpectedEntityType
-
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:
getBlockEntitySourcein classAbstractChestBlock<ChestBlockEntity>
-
createScreenHandlerFactory
@Nullable public NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos)- Overrides:
createScreenHandlerFactoryin classBlockWithEntity
-
getAnimationProgressRetriever
@Environment(CLIENT) public static DoubleBlockProperties.PropertyRetriever<ChestBlockEntity,Float2FloatFunction> getAnimationProgressRetriever(ChestAnimationProgress chestAnimationProgress) -
createBlockEntity
- Specified by:
createBlockEntityin interfaceBlockEntityProvider
-
getTicker
@Nullable public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type)- Specified by:
getTickerin interfaceBlockEntityProvider
-
isChestBlocked
-
hasBlockOnTop
-
hasOcelotOnTop
-
hasComparatorOutput
- Overrides:
hasComparatorOutputin classAbstractBlock
-
getComparatorOutput
- Overrides:
getComparatorOutputin classAbstractBlock
-
rotate
Applies a block rotation to a block state.By default, this returns the provided block state.
- Overrides:
rotatein classAbstractBlock- Returns:
- the rotated block state
-
mirror
- Overrides:
mirrorin classAbstractBlock
-
appendProperties
- Overrides:
appendPropertiesin classBlock
-
scheduledTick
- Overrides:
scheduledTickin classAbstractBlock
-