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 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<ComparatorBlock> static final EnumProperty<ComparatorMode> Fields inherited from class DiodeBlock
POWEREDFields 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 intcalculateOutputSignal(Level level, BlockPos pos, BlockState state) protected voidcheckTickOnNeighbor(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 voidprotected intgetDelay(BlockState state) protected intgetInputSignal(Level level, BlockPos pos, BlockState state) private @Nullable ItemFramegetItemFrame(Level level, Direction direction, BlockPos tPos) protected intgetOutputSignal(BlockGetter level, BlockPos pos, BlockState state) booleangetWeakChanges(BlockState state, LevelReader world, BlockPos pos) If this block should be notified of weak changes.newBlockEntity(BlockPos worldPosition, BlockState blockState) voidonNeighborChange(BlockState state, LevelReader levelReader, BlockPos pos, BlockPos neighbor) Called when a block entity on a side of this block changes, is created, or is destroyed.private voidrefreshOutputState(Level level, BlockPos pos, BlockState state) protected booleanshouldTurnOn(Level level, BlockPos pos, BlockState state) protected voidtick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) protected booleantriggerEvent(BlockState state, Level level, BlockPos pos, int b0, int b1) Called on server whenLevel.blockEvent(BlockPos, Block, int, int)is called.updateShape(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 DiodeBlock
affectNeighborsAfterRemoval, canSurvive, canSurviveOn, getAlternateSignal, getDirectSignal, getShape, getSignal, getStateForPlacement, isDiode, isLocked, isSignalSource, neighborChanged, onPlace, setPlacedBy, shouldPrioritize, sideInputDiodesOnly, updateNeighborsInFrontMethods 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, shouldRenderFace, shouldRenderFace, spawnDestroyParticles, stateById, stepOn, toString, tryDropExperience, updateEntityMovementAfterFallOn, updateFromNeighbourShapes, updateOrDestroy, updateOrDestroy, wasExploded, withPropertiesOfMethods inherited from class BlockBehaviour
attack, canBeReplaced, canBeReplaced, defaultDestroyTime, defaultMapColor, entityInside, 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, onExplosionHit, onProjectileHit, propagatesSkylightDown, properties, propertiesCodec, randomTick, requiredFeatures, shouldChangedStateKeepBlockEntity, simpleCodec, skipRendering, spawnAfterBreak, 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, hasDynamicLightEmission, hidesNeighborFace, ignitedByLava, isBed, isBurning, isConduitFrame, isEmpty, isFertile, isFireSource, isFlammable, isLadder, isPortalFrame, isScaffolding, isSlimeBlock, isStickyBlock, makesOpenTrapdoorAboveClimbable, onBlockExploded, onBlockStateChange, onCaughtFire, onDestroyedByPlayer, onDestroyedByPushReaction, onTreeGrow, playFallSound, playStepSound, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay, shouldHideAdjacentFluidFace, supportsExternalFaceHiding
-
Field Details
-
CODEC
-
MODE
-
-
Constructor Details
-
ComparatorBlock
-
-
Method Details
-
codec
- Specified by:
codecin classDiodeBlock
-
getDelay
- Specified by:
getDelayin classDiodeBlock
-
updateShape
public BlockState updateShape(BlockState state, LevelReader level, ScheduledTickAccess ticks, BlockPos pos, Direction directionToNeighbour, BlockPos neighbourPos, BlockState neighbourState, RandomSource random) - Overrides:
updateShapein classBlockBehaviour
-
getOutputSignal
- Overrides:
getOutputSignalin classDiodeBlock
-
calculateOutputSignal
-
shouldTurnOn
- Overrides:
shouldTurnOnin classDiodeBlock
-
getInputSignal
- Overrides:
getInputSignalin classDiodeBlock
-
getItemFrame
-
useWithoutItem
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) - Overrides:
useWithoutItemin classBlockBehaviour
-
checkTickOnNeighbor
Description copied from class:DiodeBlockCheck the output signal of this diode and schedule a new block tick if it should change.- Overrides:
checkTickOnNeighborin classDiodeBlock
-
refreshOutputState
-
tick
- Overrides:
tickin classDiodeBlock
-
triggerEvent
Description copied from class:BlockBehaviourCalled on server whenLevel.blockEvent(BlockPos, 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:
triggerEventin classBlockBehaviour
-
newBlockEntity
- Specified by:
newBlockEntityin interfaceEntityBlock
-
createBlockStateDefinition
- Overrides:
createBlockStateDefinitionin classBlock
-
getWeakChanges
Description copied from interface:IBlockExtensionIf this block should be notified of weak changes. Weak changes are changes 1 block away through a solid block. Similar to comparators.- Specified by:
getWeakChangesin interfaceIBlockExtension- Parameters:
world- The current levelpos- Block position in level- Returns:
- true To be notified of changes
-
onNeighborChange
public void onNeighborChange(BlockState state, LevelReader levelReader, BlockPos pos, BlockPos neighbor) Description copied from interface:IBlockExtensionCalled 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
BlockCapabilityCacheinstead.- Specified by:
onNeighborChangein interfaceIBlockExtension- Parameters:
levelReader- The levelpos- Block position in levelneighbor- Block position of neighbor
-