Package net.minecraft.world.level.block
Class ComparatorBlock
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.DiodeBlock
net.minecraft.world.level.block.ComparatorBlock
- All Implemented Interfaces:
FeatureElement
,EntityBlock
,ItemLike
,IBlockExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.Block
Block.BlockStatePairKey
Nested classes/interfaces inherited from class net.minecraft.world.level.block.state.BlockBehaviour
BlockBehaviour.BlockStateBase, BlockBehaviour.OffsetFunction, BlockBehaviour.OffsetType, BlockBehaviour.Properties, BlockBehaviour.StateArgumentPredicate<A>, BlockBehaviour.StatePredicate
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec
<ComparatorBlock> static final EnumProperty
<ComparatorMode> Fields inherited from class net.minecraft.world.level.block.DiodeBlock
POWERED, SHAPE
Fields inherited from class net.minecraft.world.level.block.HorizontalDirectionalBlock
FACING
Fields inherited from class net.minecraft.world.level.block.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_SUPPRESS_DROPS
Fields inherited from class net.minecraft.world.level.block.state.BlockBehaviour
drops, dynamicShape, explosionResistance, friction, hasCollision, isRandomlyTicking, jumpFactor, properties, requiredFeatures, soundType, speedFactor, UPDATE_SHAPE_ORDER
Fields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate int
calculateOutputSignal
(Level level, BlockPos pos, BlockState state) protected void
checkTickOnNeighbor
(Level level, BlockPos pos, BlockState state) Check the output signal of this diode and schedule a new block tick if it should change.com.mojang.serialization.MapCodec
<ComparatorBlock> codec()
protected void
protected int
getDelay
(BlockState state) protected int
getInputSignal
(Level level, BlockPos pos, BlockState state) private ItemFrame
getItemFrame
(Level level, Direction facing, BlockPos pos) protected int
getOutputSignal
(BlockGetter level, BlockPos pos, BlockState state) boolean
getWeakChanges
(BlockState state, LevelReader world, BlockPos pos) If this block should be notified of weak changes.newBlockEntity
(BlockPos pos, BlockState state) void
onNeighborChange
(BlockState state, LevelReader world, BlockPos pos, BlockPos neighbor) Called when a block entity on a side of this block changes, is created, or is destroyed.private void
refreshOutputState
(Level level, BlockPos pos, BlockState state) protected boolean
shouldTurnOn
(Level level, BlockPos pos, BlockState state) protected void
tick
(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) protected boolean
triggerEvent
(BlockState state, Level level, BlockPos pos, int id, int param) Called on server whenLevel.blockEvent(net.minecraft.core.BlockPos, net.minecraft.world.level.block.Block, int, int)
is called.updateShape
(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) Update the provided state given the provided neighbor direction and neighbor state, returning a new state.protected InteractionResult
useWithoutItem
(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) Methods inherited from class net.minecraft.world.level.block.DiodeBlock
canSurvive, canSurviveOn, getAlternateSignal, getDirectSignal, getShape, getSignal, getStateForPlacement, isDiode, isLocked, isSignalSource, neighborChanged, onPlace, onRemove, setPlacedBy, shouldPrioritize, sideInputDiodesOnly, updateNeighborsInFront
Methods inherited from class net.minecraft.world.level.block.HorizontalDirectionalBlock
mirror, rotate
Methods inherited from class net.minecraft.world.level.block.Block
animateTick, appendHoverText, asBlock, asItem, box, builtInRegistryHolder, byItem, canSupportCenter, canSupportRigidBlock, defaultBlockState, destroy, dropFromExplosion, dropResources, dropResources, dropResources, fallOn, getCloneItemStack, getDescriptionId, getDrops, getDrops, getExplosionResistance, getFriction, getId, getJumpFactor, getName, getShapeForEachState, getSpeedFactor, getStateDefinition, handlePrecipitation, hasDynamicShape, initializeClient, isExceptionForConnection, isFaceFull, isPossibleToRespawnInThis, isShapeFullBlock, playerDestroy, playerWillDestroy, popExperience, popResource, popResourceFromFace, pushEntitiesUp, registerDefaultState, shouldRenderFace, spawnDestroyParticles, stateById, stepOn, toString, tryDropExperience, updateEntityAfterFallOn, updateFromNeighbourShapes, updateOrDestroy, updateOrDestroy, wasExploded, withPropertiesOf
Methods inherited from class net.minecraft.world.level.block.state.BlockBehaviour
attack, canBeReplaced, canBeReplaced, defaultDestroyTime, defaultMapColor, entityInside, getAnalogOutputSignal, getBlockSupportShape, getCollisionShape, getDestroyProgress, getDrops, getFluidState, getInteractionShape, getLightBlock, getLootTable, getMaxHorizontalOffset, getMaxVerticalOffset, getMenuProvider, getOcclusionShape, getRenderShape, getSeed, getShadeBrightness, getSoundType, getVisualShape, hasAnalogOutputSignal, isAir, isCollisionShapeFullBlock, isOcclusionShapeFullBlock, isPathfindable, isRandomlyTicking, onExplosionHit, onProjectileHit, propagatesSkylightDown, properties, propertiesCodec, randomTick, requiredFeatures, simpleCodec, skipRendering, spawnAfterBreak, updateIndirectNeighbourShapes, useItemOn, useShapeForLightOcclusion
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.world.level.block.EntityBlock
getListener, getTicker
Methods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabled
Methods inherited from interface net.neoforged.neoforge.common.extensions.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, hasDynamicLightEmission, hidesNeighborFace, isBed, isBurning, isConduitFrame, isEmpty, isFertile, isFireSource, isFlammable, isLadder, isPortalFrame, isScaffolding, isSlimeBlock, isStickyBlock, makesOpenTrapdoorAboveClimbable, onBlockExploded, onBlockStateChange, onCaughtFire, onDestroyedByPlayer, onDestroyedByPushReaction, onTreeGrow, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay, shouldHideAdjacentFluidFace, supportsExternalFaceHiding
-
Field Details
-
CODEC
-
MODE
-
-
Constructor Details
-
ComparatorBlock
-
-
Method Details
-
codec
- Specified by:
codec
in classDiodeBlock
-
getDelay
- Specified by:
getDelay
in classDiodeBlock
-
updateShape
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) Update the provided state given the provided neighbor direction and neighbor state, returning a new state. For example, fences make their connections to the passed in state if possible, and wet concrete powder immediately returns its solidified counterpart. Note that this method should ideally consider only the specific direction passed in.- Overrides:
updateShape
in classBlockBehaviour
-
getOutputSignal
- Overrides:
getOutputSignal
in classDiodeBlock
-
calculateOutputSignal
-
shouldTurnOn
- Overrides:
shouldTurnOn
in classDiodeBlock
-
getInputSignal
- Overrides:
getInputSignal
in classDiodeBlock
-
getItemFrame
-
useWithoutItem
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) - Overrides:
useWithoutItem
in classBlockBehaviour
-
checkTickOnNeighbor
Check the output signal of this diode and schedule a new block tick if it should change.- Overrides:
checkTickOnNeighbor
in classDiodeBlock
-
refreshOutputState
-
tick
- Overrides:
tick
in classDiodeBlock
-
triggerEvent
Called on server whenLevel.blockEvent(net.minecraft.core.BlockPos, net.minecraft.world.level.block.Block, int, int)
is called. If server returns true, then also called on the client. On the Server, this may perform additional changes to the world, like pistons replacing the block with an extended base. On the client, the update may involve replacing block entities or effects such as sounds or particles- Overrides:
triggerEvent
in classBlockBehaviour
-
newBlockEntity
- Specified by:
newBlockEntity
in interfaceEntityBlock
-
createBlockStateDefinition
- Overrides:
createBlockStateDefinition
in classBlock
-
getWeakChanges
Description copied from interface:IBlockExtension
If this block should be notified of weak changes. Weak changes are changes 1 block away through a solid block. Similar to comparators.- Specified by:
getWeakChanges
in interfaceIBlockExtension
- Parameters:
world
- The current levelpos
- Block position in level- Returns:
- true To be notified of changes
-
onNeighborChange
Description copied from interface:IBlockExtension
Called when a block entity on a side of this block changes, is created, or is destroyed.This method is not suitable for listening to capability invalidations. For capability invalidations specifically, use
BlockCapabilityCache
instead.- Specified by:
onNeighborChange
in interfaceIBlockExtension
- Parameters:
world
- The levelpos
- Block position in levelneighbor
- Block position of neighbor
-