Class ButtonBlock
- All Implemented Interfaces:
FeatureElement, 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.Properties, BlockBehaviour.StateArgumentPredicate<A>, BlockBehaviour.StatePredicate -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ButtonBlock> static final BooleanPropertyprivate final Function<BlockState, VoxelShape> private final intprivate final BlockSetTypeFields inherited from class FaceAttachedHorizontalDirectionalBlock
FACEFields 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
ConstructorsConstructorDescriptionButtonBlock(BlockSetType type, int ticksToStayPressed, BlockBehaviour.Properties properties) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaffectNeighborsAfterRemoval(BlockState state, ServerLevel level, BlockPos pos, boolean movedByPiston) protected voidcheckPressed(BlockState state, Level level, BlockPos pos) com.mojang.serialization.MapCodec<ButtonBlock> codec()protected voidprotected voidentityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier, boolean isPrecise) protected intgetDirectSignal(BlockState state, BlockGetter level, BlockPos pos, Direction direction) Returns the direct signal this block emits in the given direction.protected VoxelShapegetShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) protected intgetSignal(BlockState state, BlockGetter level, BlockPos pos, Direction direction) Returns the signal this block emits in the given direction.protected SoundEventgetSound(boolean pressed) protected booleanisSignalSource(BlockState state) Returns whether this block is capable of emitting redstone signals.private Function<BlockState, VoxelShape> protected voidonExplosionHit(BlockState state, ServerLevel level, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> onHit) protected voidplaySound(@Nullable Player player, LevelAccessor level, BlockPos pos, boolean pressed) voidpress(BlockState state, Level level, BlockPos pos, @Nullable Player player) protected voidtick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) private voidupdateNeighbours(BlockState state, Level level, BlockPos pos) protected InteractionResultuseWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) Methods inherited from class FaceAttachedHorizontalDirectionalBlock
canAttach, canSurvive, getConnectedDirection, getStateForPlacement, updateShapeMethods 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, fallOn, getDrops, getDrops, getExplosionResistance, getFriction, getId, getJumpFactor, getName, getShapeForEachState, getShapeForEachState, getSpeedFactor, getStateDefinition, handlePrecipitation, hasDynamicShape, isExceptionForConnection, isFaceFull, isPossibleToRespawnInThis, isShapeFullBlock, playerDestroy, playerWillDestroy, popExperience, popResource, popResourceFromFace, pushEntitiesUp, registerDefaultState, setPlacedBy, shouldRenderFace, shouldRenderFace, spawnDestroyParticles, stateById, stepOn, toString, tryDropExperience, updateEntityMovementAfterFallOn, updateFromNeighbourShapes, updateOrDestroy, updateOrDestroy, wasExploded, withPropertiesOfMethods inherited from class BlockBehaviour
attack, canBeReplaced, canBeReplaced, defaultDestroyTime, defaultMapColor, getAnalogOutputSignal, getBlockSupportShape, getCloneItemStack, getCollisionShape, getDescriptionId, getDestroyProgress, getDrops, getEntityInsideCollisionShape, getFluidState, getInteractionShape, getLightBlock, getLootTable, getMaxHorizontalOffset, getMaxVerticalOffset, getMenuProvider, getOcclusionShape, getRenderShape, getSeed, getShadeBrightness, getSoundType, getVisualShape, hasAnalogOutputSignal, isAir, isCollisionShapeFullBlock, isPathfindable, isRandomlyTicking, neighborChanged, onPlace, onProjectileHit, propagatesSkylightDown, properties, propertiesCodec, randomTick, requiredFeatures, shouldChangedStateKeepBlockEntity, simpleCodec, skipRendering, spawnAfterBreak, triggerEvent, updateIndirectNeighbourShapes, useItemOn, useShapeForLightOcclusionMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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
-
POWERED
-
type
-
ticksToStayPressed
private final int ticksToStayPressed -
shapes
-
-
Constructor Details
-
ButtonBlock
-
-
Method Details
-
codec
- Specified by:
codecin classFaceAttachedHorizontalDirectionalBlock
-
makeShapes
-
getShape
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) - Overrides:
getShapein classBlockBehaviour
-
useWithoutItem
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) - Overrides:
useWithoutItemin classBlockBehaviour
-
onExplosionHit
protected void onExplosionHit(BlockState state, ServerLevel level, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> onHit) - Overrides:
onExplosionHitin classBlockBehaviour
-
press
-
playSound
protected void playSound(@Nullable Player player, LevelAccessor level, BlockPos pos, boolean pressed) -
getSound
-
affectNeighborsAfterRemoval
protected void affectNeighborsAfterRemoval(BlockState state, ServerLevel level, BlockPos pos, boolean movedByPiston) - Overrides:
affectNeighborsAfterRemovalin classBlockBehaviour
-
getSignal
Description copied from class:BlockBehaviourReturns the signal this block emits in the given direction.NOTE: directions in redstone signal related methods are backwards, so this method checks for the signal emitted in the opposite direction of the one given.
- Overrides:
getSignalin classBlockBehaviour
-
getDirectSignal
protected int getDirectSignal(BlockState state, BlockGetter level, BlockPos pos, Direction direction) Description copied from class:BlockBehaviourReturns the direct signal this block emits in the given direction.NOTE: directions in redstone signal related methods are backwards, so this method checks for the signal emitted in the opposite direction of the one given.
- Overrides:
getDirectSignalin classBlockBehaviour
-
isSignalSource
Description copied from class:BlockBehaviourReturns whether this block is capable of emitting redstone signals.- Overrides:
isSignalSourcein classBlockBehaviour
-
tick
- Overrides:
tickin classBlockBehaviour
-
entityInside
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier, boolean isPrecise) - Overrides:
entityInsidein classBlockBehaviour
-
checkPressed
-
updateNeighbours
-
createBlockStateDefinition
- Overrides:
createBlockStateDefinitionin classBlock
-