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 pState, LevelReader pLevel, BlockPos pPos) protected boolean
canSurviveOn
(LevelReader pLevel, BlockPos pPos, BlockState pState) protected void
checkTickOnNeighbor
(Level pLevel, BlockPos pPos, BlockState pState) 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 pLevel, BlockPos pPos, BlockState pState) protected abstract int
getDelay
(BlockState pState) protected int
getDirectSignal
(BlockState pBlockState, BlockGetter pBlockAccess, BlockPos pPos, Direction pSide) Returns the direct signal this block emits in the given direction.protected int
getInputSignal
(Level pLevel, BlockPos pPos, BlockState pState) protected int
getOutputSignal
(BlockGetter pLevel, BlockPos pPos, BlockState pState) protected VoxelShape
getShape
(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) protected int
getSignal
(BlockState pBlockState, BlockGetter pBlockAccess, BlockPos pPos, Direction pSide) Returns the signal this block emits in the given direction.getStateForPlacement
(BlockPlaceContext pContext) static boolean
isDiode
(BlockState pState) boolean
isLocked
(LevelReader pLevel, BlockPos pPos, BlockState pState) Check if neighboring blocks are locking this diode.protected boolean
isSignalSource
(BlockState pState) Returns whether this block is capable of emitting redstone signals.protected void
neighborChanged
(BlockState pState, Level pLevel, BlockPos pPos, Block pBlock, BlockPos pFromPos, boolean pIsMoving) protected void
onPlace
(BlockState pState, Level pLevel, BlockPos pPos, BlockState pOldState, boolean pIsMoving) protected void
onRemove
(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pIsMoving) void
setPlacedBy
(Level pLevel, BlockPos pPos, BlockState pState, LivingEntity pPlacer, ItemStack pStack) Called by BlockItem after this block has been placed.boolean
shouldPrioritize
(BlockGetter pLevel, BlockPos pPos, BlockState pState) Check if this diode should have a higher tick priority than default.protected boolean
shouldTurnOn
(Level pLevel, BlockPos pPos, BlockState pState) protected boolean
protected void
tick
(BlockState pState, ServerLevel pLevel, BlockPos pPos, RandomSource pRandom) protected void
updateNeighborsInFront
(Level pLevel, BlockPos pPos, BlockState pState) 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 pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) - Overrides:
getShape
in classBlockBehaviour
-
canSurvive
- Overrides:
canSurvive
in classBlockBehaviour
-
canSurviveOn
-
tick
- Overrides:
tick
in classBlockBehaviour
-
getDirectSignal
protected int getDirectSignal(BlockState pBlockState, BlockGetter pBlockAccess, BlockPos pPos, Direction pSide) 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 pBlockState, BlockGetter pBlockAccess, BlockPos pPos, Direction pSide) 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 pState, Level pLevel, BlockPos pPos, Block pBlock, BlockPos pFromPos, boolean pIsMoving) - 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 pLevel, BlockPos pPos, BlockState pState, LivingEntity pPlacer, ItemStack pStack) Called by BlockItem after this block has been placed.- Overrides:
setPlacedBy
in classBlock
-
onPlace
protected void onPlace(BlockState pState, Level pLevel, BlockPos pPos, BlockState pOldState, boolean pIsMoving) - Overrides:
onPlace
in classBlockBehaviour
-
onRemove
protected void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pIsMoving) - 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
-