Package net.minecraft.world.level.block
Class DiodeBlock
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
- All Implemented Interfaces:
FeatureElement
,ItemLike
,IBlockExtension
- Direct Known Subclasses:
ComparatorBlock
,RepeaterBlock
-
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
FieldsFields inherited from class net.minecraft.world.level.block.HorizontalDirectionalBlock
FACING
Fields inherited from class net.minecraft.world.level.block.Block
BLOCK_STATE_REGISTRY, CODEC, 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 TypeMethodDescriptionprotected boolean
canSurvive
(BlockState state, LevelReader level, BlockPos pos) protected boolean
canSurviveOn
(LevelReader 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.protected abstract com.mojang.serialization.MapCodec
<? extends DiodeBlock> codec()
protected int
getAlternateSignal
(SignalGetter level, BlockPos pos, BlockState state) protected abstract int
getDelay
(BlockState state) protected int
getDirectSignal
(BlockState blockState, BlockGetter blockAccess, BlockPos pos, Direction side) Returns the direct signal this block emits in the given direction.protected int
getInputSignal
(Level level, BlockPos pos, BlockState state) protected int
getOutputSignal
(BlockGetter level, BlockPos pos, BlockState state) protected VoxelShape
getShape
(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) protected int
getSignal
(BlockState blockState, BlockGetter blockAccess, BlockPos pos, Direction side) Returns the signal this block emits in the given direction.getStateForPlacement
(BlockPlaceContext context) static boolean
isDiode
(BlockState state) boolean
isLocked
(LevelReader level, BlockPos pos, BlockState state) Check if neighboring blocks are locking this diode.protected boolean
isSignalSource
(BlockState state) Returns whether this block is capable of emitting redstone signals.protected void
neighborChanged
(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) protected void
onPlace
(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) protected void
onRemove
(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) void
setPlacedBy
(Level level, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) Called by BlockItem after this block has been placed.boolean
shouldPrioritize
(BlockGetter level, BlockPos pos, BlockState state) Check if this diode should have a higher tick priority than default.protected boolean
shouldTurnOn
(Level level, BlockPos pos, BlockState state) protected boolean
protected void
tick
(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) protected void
updateNeighborsInFront
(Level level, BlockPos pos, BlockState state) 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, createBlockStateDefinition, 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, triggerEvent, updateIndirectNeighbourShapes, updateShape, useItemOn, useShapeForLightOcclusion, useWithoutItem
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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, getWeakChanges, hasDynamicLightEmission, hidesNeighborFace, isBed, isBurning, isConduitFrame, isEmpty, isFertile, isFireSource, isFlammable, isLadder, isPortalFrame, isScaffolding, isSlimeBlock, isStickyBlock, makesOpenTrapdoorAboveClimbable, onBlockExploded, onBlockStateChange, onCaughtFire, onDestroyedByPlayer, onDestroyedByPushReaction, onNeighborChange, onTreeGrow, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay, shouldHideAdjacentFluidFace, supportsExternalFaceHiding
-
Field Details
-
SHAPE
-
POWERED
-
-
Constructor Details
-
DiodeBlock
-
-
Method Details
-
codec
- Specified by:
codec
in classHorizontalDirectionalBlock
-
getShape
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) - Overrides:
getShape
in classBlockBehaviour
-
canSurvive
- Overrides:
canSurvive
in classBlockBehaviour
-
canSurviveOn
-
tick
- Overrides:
tick
in classBlockBehaviour
-
getDirectSignal
protected int getDirectSignal(BlockState blockState, BlockGetter blockAccess, BlockPos pos, Direction side) Returns 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:
getDirectSignal
in classBlockBehaviour
-
getSignal
protected int getSignal(BlockState blockState, BlockGetter blockAccess, BlockPos pos, Direction side) Returns 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:
getSignal
in classBlockBehaviour
-
neighborChanged
protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) - Overrides:
neighborChanged
in classBlockBehaviour
-
checkTickOnNeighbor
Check the output signal of this diode and schedule a new block tick if it should change. -
isLocked
Check if neighboring blocks are locking this diode. -
shouldTurnOn
-
getInputSignal
-
getAlternateSignal
-
isSignalSource
Returns whether this block is capable of emitting redstone signals.- Overrides:
isSignalSource
in classBlockBehaviour
-
getStateForPlacement
- Overrides:
getStateForPlacement
in classBlock
-
setPlacedBy
public void setPlacedBy(Level level, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) Called by BlockItem after this block has been placed.- Overrides:
setPlacedBy
in classBlock
-
onPlace
protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) - Overrides:
onPlace
in classBlockBehaviour
-
onRemove
protected void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) - Overrides:
onRemove
in classBlockBehaviour
-
updateNeighborsInFront
-
sideInputDiodesOnly
protected boolean sideInputDiodesOnly() -
getOutputSignal
-
isDiode
-
shouldPrioritize
Check if this diode should have a higher tick priority than default.Both repeaters and comparators use this method to increase their tick priorities when facing other diodes. This makes certain monostable circuits based on the repeater locking mechanic more reliable.
-
getDelay
-