Class BedBlock
java.lang.Object
net.minecraft.world.level.block.state.BlockBehaviour
net.minecraft.world.level.block.Block
net.minecraft.world.level.block.HorizontalDirectionalBlock
net.minecraft.world.level.block.BedBlock
- All Implemented Interfaces:
FeatureElement, EntityBlock, ItemLike, IBlockExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class Block
Block.UpdateFlagsNested classes/interfaces inherited from class BlockBehaviour
BlockBehaviour.BlockStateBase, BlockBehaviour.OffsetFunction, BlockBehaviour.OffsetType, BlockBehaviour.PostProcess, BlockBehaviour.Properties, BlockBehaviour.StateArgumentPredicate<A>, BlockBehaviour.StatePredicate -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<BedBlock> private final DyeColorstatic final BooleanPropertystatic final EnumProperty<BedPart> private static final Map<Direction, VoxelShape> Fields inherited from class HorizontalDirectionalBlock
FACINGFields inherited from class Block
BLOCK_STATE_REGISTRY, INDESTRUCTIBLE, INSTANT, stateDefinition, UPDATE_ALL, UPDATE_ALL_IMMEDIATE, UPDATE_CLIENTS, UPDATE_IMMEDIATE, UPDATE_INVISIBLE, UPDATE_KNOWN_SHAPE, UPDATE_LIMIT, UPDATE_MOVE_BY_PISTON, UPDATE_NEIGHBORS, UPDATE_NONE, UPDATE_SKIP_ALL_SIDEEFFECTS, UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS, UPDATE_SKIP_ON_PLACE, UPDATE_SKIP_SHAPE_UPDATE_ON_WIRE, UPDATE_SUPPRESS_DROPSFields inherited from class BlockBehaviour
descriptionId, drops, dynamicShape, explosionResistance, friction, hasCollision, isRandomlyTicking, jumpFactor, properties, requiredFeatures, soundType, speedFactor, UPDATE_SHAPE_ORDERFields inherited from interface FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int[][]bedAboveStandUpOffsets(Direction forward) private static int[][]bedStandUpOffsets(Direction forward, Direction side) private static int[][]bedSurroundStandUpOffsets(Direction forward, Direction side) private voidcom.mojang.serialization.MapCodec<BedBlock> codec()protected voidvoidfallOn(Level level, BlockState state, BlockPos pos, Entity entity, double fallDistance) findBunkBedStandUpPosition(EntityType<?> type, CollisionGetter level, BlockPos pos, Direction forward, Direction side) findStandUpPosition(EntityType<?> type, CollisionGetter level, BlockPos pos, Direction forward, float yaw) findStandUpPositionAtOffset(EntityType<?> type, CollisionGetter level, BlockPos pos, int[][] offsets, boolean checkDangerous) getBedOrientation(BlockGetter level, BlockPos pos) getBlockType(BlockState state) getColor()static DirectiongetConnectedDirection(BlockState state) private static DirectiongetNeighbourDirection(BedPart part, Direction facing) getRelocability(LevelReader level, BlockPos pos, BlockState state) Declares whether a block may be relocated and under what circumstances.protected longgetSeed(BlockState state, BlockPos pos) protected VoxelShapegetShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) getStateForPlacement(BlockPlaceContext context) private static booleanisBunkBed(BlockGetter level, BlockPos pos) protected booleanisPathfindable(BlockState state, PathComputationType type) private booleankickVillagerOutOfBed(Level level, BlockPos pos) newBlockEntity(BlockPos worldPosition, BlockState blockState) playerWillDestroy(Level level, BlockPos pos, BlockState state, Player player) voidsetPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity by, ItemStack itemStack) voidupdateEntityMovementAfterFallOn(BlockGetter level, Entity entity) protected BlockStateupdateShape(BlockState state, LevelReader level, ScheduledTickAccess ticks, BlockPos pos, Direction directionToNeighbour, BlockPos neighbourPos, BlockState neighbourState, RandomSource random) protected InteractionResultuseWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) Methods inherited from class HorizontalDirectionalBlock
mirror, rotateMethods inherited from class Block
animateTick, asBlock, asItem, box, boxes, boxZ, boxZ, boxZ, builtInRegistryHolder, byItem, canSupportCenter, canSupportRigidBlock, column, column, cube, cube, defaultBlockState, destroy, dropFromBlockInteractLootTable, dropFromExplosion, dropFromLootTable, dropResources, dropResources, dropResources, getDrops, getDrops, getExplosionResistance, getFriction, getId, getJumpFactor, getName, getShapeForEachState, getShapeForEachState, getSpeedFactor, getStateDefinition, handlePrecipitation, hasDynamicShape, isExceptionForConnection, isFaceFull, isPossibleToRespawnInThis, isShapeFullBlock, playerDestroy, popExperience, popResource, popResourceFromFace, pushEntitiesUp, registerDefaultState, shouldRenderFace, shouldRenderFace, spawnDestroyParticles, stateById, stepOn, toString, tryDropExperience, updateFromNeighbourShapes, updateOrDestroy, updateOrDestroy, wasExploded, withPropertiesOfMethods inherited from class BlockBehaviour
affectNeighborsAfterRemoval, attack, canBeReplaced, canBeReplaced, canSurvive, defaultDestroyTime, defaultMapColor, entityInside, getAnalogOutputSignal, getBlockSupportShape, getCloneItemStack, getCollisionShape, getDescriptionId, getDestroyProgress, getDirectSignal, getDrops, getEntityInsideCollisionShape, getFluidState, getInteractionShape, getLightDampening, getLootTable, getMaxHorizontalOffset, getMaxVerticalOffset, getMenuProvider, getOcclusionShape, getRenderShape, getShadeBrightness, getSignal, getSoundType, getVisualShape, hasAnalogOutputSignal, isAir, isCollisionShapeFullBlock, isRandomlyTicking, isSignalSource, neighborChanged, onExplosionHit, onPlace, onProjectileHit, propagatesSkylightDown, properties, propertiesCodec, randomTick, requiredFeatures, shouldChangedStateKeepBlockEntity, simpleCodec, skipRendering, spawnAfterBreak, tick, triggerEvent, updateIndirectNeighbourShapes, useItemOn, useShapeForLightOcclusionMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface EntityBlock
getListener, getTickerMethods inherited from interface FeatureElement
isEnabledMethods inherited from interface IBlockExtension
addLandingEffects, addRunningEffects, canBeHydrated, canConnectRedstone, canDropFromExplosion, canEntityDestroy, canHarvestBlock, canStickTo, canSustainPlant, collisionExtendsVertically, getAdjacentBlockPathType, getAppearance, getBeaconColorMultiplier, getBedDirection, getBlockPathType, getBubbleColumnDirection, getCloneItemStack, getEnchantPowerBonus, getExpDrop, getExplosionResistance, getFireSpreadSpeed, getFlammability, getFriction, getLightEmission, getMapColor, getPistonPushReaction, getRespawnPosition, getSoundType, getStateAtViewpoint, getToolModifiedState, getWeakChanges, hasDynamicLightEmission, hidesNeighborFace, ignitedByLava, isBed, isBurning, isConduitFrame, isEmpty, isFertile, isFireSource, isFlammable, isLadder, isPortalFrame, isScaffolding, isSlimeBlock, isStickyBlock, makesOpenTrapdoorAboveClimbable, onBlockExploded, onBlockStateChange, onCaughtFire, onDestroyedByPlayer, onDestroyedByPushReaction, onNeighborChange, onTreeGrow, playFallSound, playStepSound, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay, shouldHideAdjacentFluidFace, supportsExternalFaceHiding
-
Field Details
-
CODEC
-
PART
-
OCCUPIED
-
SHAPES
-
color
-
-
Constructor Details
-
BedBlock
-
-
Method Details
-
codec
- Specified by:
codecin classHorizontalDirectionalBlock
-
getBedOrientation
-
useWithoutItem
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) - Overrides:
useWithoutItemin classBlockBehaviour
-
kickVillagerOutOfBed
-
fallOn
-
updateEntityMovementAfterFallOn
- Overrides:
updateEntityMovementAfterFallOnin classBlock
-
bounceUp
-
updateShape
protected BlockState updateShape(BlockState state, LevelReader level, ScheduledTickAccess ticks, BlockPos pos, Direction directionToNeighbour, BlockPos neighbourPos, BlockState neighbourState, RandomSource random) - Overrides:
updateShapein classBlockBehaviour
-
getNeighbourDirection
-
playerWillDestroy
- Overrides:
playerWillDestroyin classBlock
-
getStateForPlacement
- Overrides:
getStateForPlacementin classBlock
-
getShape
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) - Overrides:
getShapein classBlockBehaviour
-
getConnectedDirection
-
getBlockType
-
isBunkBed
-
findStandUpPosition
public static Optional<Vec3> findStandUpPosition(EntityType<?> type, CollisionGetter level, BlockPos pos, Direction forward, float yaw) -
findBunkBedStandUpPosition
private static Optional<Vec3> findBunkBedStandUpPosition(EntityType<?> type, CollisionGetter level, BlockPos pos, Direction forward, Direction side) -
findStandUpPositionAtOffset
private static Optional<Vec3> findStandUpPositionAtOffset(EntityType<?> type, CollisionGetter level, BlockPos pos, int[][] offsets, boolean checkDangerous) -
createBlockStateDefinition
- Overrides:
createBlockStateDefinitionin classBlock
-
newBlockEntity
- Specified by:
newBlockEntityin interfaceEntityBlock
-
setPlacedBy
public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity by, ItemStack itemStack) - Overrides:
setPlacedByin classBlock
-
getColor
-
getSeed
- Overrides:
getSeedin classBlockBehaviour
-
isPathfindable
- Overrides:
isPathfindablein classBlockBehaviour
-
bedStandUpOffsets
-
bedSurroundStandUpOffsets
-
bedAboveStandUpOffsets
-
getRelocability
Description copied from interface:IBlockExtensionDeclares whether a block may be relocated and under what circumstances. "Relocation" here means a region of blocks being cut or copied, and pasted somewhere else, with a translation and possibly a rotation or mirror, also copying any blockentity data to the new position(s).
A multiblock which is relocatable if and only if the entire multiblock is being relocated (e.g. a bed, a door, a 3x3 machine) may override this method to define such behavior.
Blocks which may never be relocated should be added to
Tags.Blocks.RELOCATION_NOT_SUPPORTED, in which case this method does not need to be overridden.- Specified by:
getRelocabilityin interfaceIBlockExtension- Parameters:
level- LevelReader which the block is being relocated frompos- BlockPos which the block is being relocated fromstate- BlockState of the block being relocated- Returns:
- BlockRelocability declaring whether the block may be relocated
-