Package net.minecraft.world.level.block
Class RedStoneWireBlock
java.lang.Object
net.minecraft.world.level.block.state.BlockBehaviour
net.minecraft.world.level.block.Block
net.minecraft.world.level.block.RedStoneWireBlock
- All Implemented Interfaces:
FeatureElement
,ItemLike
,IBlockExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.Block
Block.ShapePairKey
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
<RedStoneWireBlock> private static final int[]
private final BlockState
static final EnumProperty
<RedstoneSide> private final RedstoneWireEvaluator
static final EnumProperty
<RedstoneSide> private static final float
static final IntegerProperty
static final Map
<Direction, EnumProperty<RedstoneSide>> private final Function
<BlockState, VoxelShape> private boolean
static final EnumProperty
<RedstoneSide> static final EnumProperty
<RedstoneSide> 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_SKIP_ALL_SIDEEFFECTS, UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS, UPDATE_SKIP_ON_PLACE, UPDATE_SKIP_SHAPE_UPDATE_ON_WIRE, UPDATE_SUPPRESS_DROPS
Fields inherited from class net.minecraft.world.level.block.state.BlockBehaviour
descriptionId, 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 void
affectNeighborsAfterRemoval
(BlockState p_393608_, ServerLevel p_393706_, BlockPos p_394400_, boolean p_393564_) void
animateTick
(BlockState p_221932_, Level p_221933_, BlockPos p_221934_, RandomSource p_221935_) Called periodically clientside on blocks near the player to show effects (like furnace fire particles).protected boolean
canSurvive
(BlockState pState, LevelReader pLevel, BlockPos pPos) private boolean
canSurviveOn
(BlockGetter pLevel, BlockPos pPos, BlockState pState) private void
checkCornerChangeAt
(Level pLevel, BlockPos pPos) CallsLevel.updateNeighborsAt(net.minecraft.core.BlockPos, net.minecraft.world.level.block.Block, net.minecraft.world.level.redstone.Orientation)
for all neighboring blocks, but only if the given block is a redstone wire.com.mojang.serialization.MapCodec
<RedStoneWireBlock> codec()
protected void
int
getBlockSignal
(Level pLevel, BlockPos pPos) static int
getColorForPower
(int pPower) private RedstoneSide
getConnectingSide
(BlockGetter pLevel, BlockPos pPos, Direction pFace) private RedstoneSide
getConnectingSide
(BlockGetter pLevel, BlockPos pPos, Direction pDirection, boolean pNonNormalCubeAbove) private BlockState
getConnectionState
(BlockGetter pLevel, BlockState pState, BlockPos pPos) protected int
getDirectSignal
(BlockState pBlockState, BlockGetter pBlockAccess, BlockPos pPos, Direction pSide) Returns the direct signal this block emits in the given direction.private BlockState
getMissingConnections
(BlockGetter pLevel, BlockState pState, BlockPos pPos) 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) private static boolean
isCross
(BlockState pState) private static boolean
isDot
(BlockState pState) protected boolean
isSignalSource
(BlockState pState) Returns whether this block is capable of emitting redstone signals.private Function
<BlockState, VoxelShape> protected BlockState
mirror
(BlockState pState, Mirror pMirror) Returns the blockstate with the given mirror of the passed blockstate.protected void
neighborChanged
(BlockState p_55561_, Level p_55562_, BlockPos p_55563_, Block p_55564_, Orientation p_362973_, boolean p_55566_) protected void
onPlace
(BlockState pState, Level pLevel, BlockPos pPos, BlockState pOldState, boolean pIsMoving) protected BlockState
rotate
(BlockState pState, Rotation pRotation) Returns the blockstate with the given rotation from the passed blockstate.protected static boolean
shouldConnectTo
(BlockState pState) protected static boolean
shouldConnectTo
(BlockState pState, Direction pDirection) private static void
spawnParticlesAlongLine
(Level pLevel, RandomSource pRandom, BlockPos pPos, int pColor, Direction pDirection, Direction pPerpendicularDirection, float pStart, float pEnd) protected void
updateIndirectNeighbourShapes
(BlockState pState, LevelAccessor pLevel, BlockPos pPos, int pFlags, int pRecursionLeft) Updates the shapes of indirect neighbors of this block.private void
updateNeighborsOfNeighboringWires
(Level pLevel, BlockPos pPos) private void
updatePowerStrength
(Level pLevel, BlockPos pPos, BlockState pState, Orientation pOrientation, boolean pUpdateShape) protected BlockState
updateShape
(BlockState p_55598_, LevelReader p_374191_, ScheduledTickAccess p_374077_, BlockPos p_55602_, Direction p_55599_, BlockPos p_55603_, BlockState p_55600_, RandomSource p_374364_) private void
updatesOnShapeChange
(Level pLevel, BlockPos pPos, BlockState pOldState, BlockState pNewState) private static boolean
useExperimentalEvaluator
(Level pLevel) protected InteractionResult
useWithoutItem
(BlockState p_55554_, Level p_55555_, BlockPos p_55556_, Player p_55557_, BlockHitResult p_55559_) Methods inherited from class net.minecraft.world.level.block.Block
asBlock, asItem, box, boxes, boxZ, boxZ, boxZ, builtInRegistryHolder, byItem, canSupportCenter, canSupportRigidBlock, column, column, cube, cube, defaultBlockState, destroy, dropFromExplosion, 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, withPropertiesOf
Methods inherited from class net.minecraft.world.level.block.state.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, simpleCodec, skipRendering, spawnAfterBreak, tick, triggerEvent, 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.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, playFallSound, playStepSound, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay, shouldHideAdjacentFluidFace, supportsExternalFaceHiding
-
Field Details
-
CODEC
-
NORTH
-
EAST
-
SOUTH
-
WEST
-
POWER
-
PROPERTY_BY_DIRECTION
-
COLORS
private static final int[] COLORS -
PARTICLE_DENSITY
private static final float PARTICLE_DENSITY- See Also:
-
shapes
-
crossState
-
evaluator
-
shouldSignal
private boolean shouldSignal
-
-
Constructor Details
-
RedStoneWireBlock
-
-
Method Details
-
codec
-
makeShapes
-
getShape
protected VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) - Overrides:
getShape
in classBlockBehaviour
-
getStateForPlacement
- Overrides:
getStateForPlacement
in classBlock
-
getConnectionState
-
getMissingConnections
-
updateShape
protected BlockState updateShape(BlockState p_55598_, LevelReader p_374191_, ScheduledTickAccess p_374077_, BlockPos p_55602_, Direction p_55599_, BlockPos p_55603_, BlockState p_55600_, RandomSource p_374364_) - Overrides:
updateShape
in classBlockBehaviour
-
isCross
-
isDot
-
updateIndirectNeighbourShapes
protected void updateIndirectNeighbourShapes(BlockState pState, LevelAccessor pLevel, BlockPos pPos, int pFlags, int pRecursionLeft) Description copied from class:BlockBehaviour
Updates the shapes of indirect neighbors of this block. This method is analogous toinvalid reference
net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase#updateNeighbourShapes
Currently the only implementation of this method is
updateIndirectNeighbourShapes(net.minecraft.world.level.block.state.BlockState, net.minecraft.world.level.LevelAccessor, net.minecraft.core.BlockPos, int, int)
where it is used to validate diagonal connections of redstone wire blocks.- Overrides:
updateIndirectNeighbourShapes
in classBlockBehaviour
-
getConnectingSide
-
getConnectingSide
private RedstoneSide getConnectingSide(BlockGetter pLevel, BlockPos pPos, Direction pDirection, boolean pNonNormalCubeAbove) -
canSurvive
- Overrides:
canSurvive
in classBlockBehaviour
-
canSurviveOn
-
updatePowerStrength
private void updatePowerStrength(Level pLevel, BlockPos pPos, BlockState pState, @Nullable Orientation pOrientation, boolean pUpdateShape) -
getBlockSignal
-
checkCornerChangeAt
CallsLevel.updateNeighborsAt(net.minecraft.core.BlockPos, net.minecraft.world.level.block.Block, net.minecraft.world.level.redstone.Orientation)
for all neighboring blocks, but only if the given block is a redstone wire. -
onPlace
protected void onPlace(BlockState pState, Level pLevel, BlockPos pPos, BlockState pOldState, boolean pIsMoving) - Overrides:
onPlace
in classBlockBehaviour
-
affectNeighborsAfterRemoval
protected void affectNeighborsAfterRemoval(BlockState p_393608_, ServerLevel p_393706_, BlockPos p_394400_, boolean p_393564_) - Overrides:
affectNeighborsAfterRemoval
in classBlockBehaviour
-
updateNeighborsOfNeighboringWires
-
neighborChanged
protected void neighborChanged(BlockState p_55561_, Level p_55562_, BlockPos p_55563_, Block p_55564_, @Nullable Orientation p_362973_, boolean p_55566_) - Overrides:
neighborChanged
in classBlockBehaviour
-
useExperimentalEvaluator
-
getDirectSignal
protected int getDirectSignal(BlockState pBlockState, BlockGetter pBlockAccess, BlockPos pPos, Direction pSide) Description copied from class:BlockBehaviour
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) Description copied from class:BlockBehaviour
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
-
shouldConnectTo
-
shouldConnectTo
-
isSignalSource
Description copied from class:BlockBehaviour
Returns whether this block is capable of emitting redstone signals.- Overrides:
isSignalSource
in classBlockBehaviour
-
getColorForPower
public static int getColorForPower(int pPower) -
spawnParticlesAlongLine
private static void spawnParticlesAlongLine(Level pLevel, RandomSource pRandom, BlockPos pPos, int pColor, Direction pDirection, Direction pPerpendicularDirection, float pStart, float pEnd) -
animateTick
public void animateTick(BlockState p_221932_, Level p_221933_, BlockPos p_221934_, RandomSource p_221935_) Description copied from class:Block
Called periodically clientside on blocks near the player to show effects (like furnace fire particles).- Overrides:
animateTick
in classBlock
-
rotate
Description copied from class:BlockBehaviour
Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed blockstate.- Overrides:
rotate
in classBlockBehaviour
-
mirror
Description copied from class:BlockBehaviour
Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed blockstate.- Overrides:
mirror
in classBlockBehaviour
-
createBlockStateDefinition
- Overrides:
createBlockStateDefinition
in classBlock
-
useWithoutItem
protected InteractionResult useWithoutItem(BlockState p_55554_, Level p_55555_, BlockPos p_55556_, Player p_55557_, BlockHitResult p_55559_) - Overrides:
useWithoutItem
in classBlockBehaviour
-
updatesOnShapeChange
private void updatesOnShapeChange(Level pLevel, BlockPos pPos, BlockState pOldState, BlockState pNewState)
-