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.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
<RedStoneWireBlock> private static final Vec3[]
private final BlockState
protected static final int
static final EnumProperty
<RedstoneSide> protected static final int
protected static final int
static final EnumProperty
<RedstoneSide> private static final float
static final IntegerProperty
static final Map
<Direction, EnumProperty<RedstoneSide>> protected static final int
private static final VoxelShape
private static final Map
<BlockState, VoxelShape> private static final Map
<Direction, VoxelShape> private static final Map
<Direction, VoxelShape> private boolean
static final EnumProperty
<RedstoneSide> protected static final int
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_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 TypeMethodDescriptionvoid
animateTick
(BlockState state, Level level, BlockPos pos, RandomSource random) Called periodically clientside on blocks near the player to show effects (like furnace fire particles).private VoxelShape
calculateShape
(BlockState state) private int
calculateTargetStrength
(Level level, BlockPos pos) protected boolean
canSurvive
(BlockState state, LevelReader level, BlockPos pos) private boolean
canSurviveOn
(BlockGetter level, BlockPos pos, BlockState state) private void
checkCornerChangeAt
(Level level, BlockPos pos) CallsLevel.updateNeighborsAt(net.minecraft.core.BlockPos, net.minecraft.world.level.block.Block)
for all neighboring blocks, but only if the given block is a redstone wire.com.mojang.serialization.MapCodec
<RedStoneWireBlock> codec()
protected void
static int
getColorForPower
(int power) private RedstoneSide
getConnectingSide
(BlockGetter level, BlockPos pos, Direction face) private RedstoneSide
getConnectingSide
(BlockGetter level, BlockPos pos, Direction direction, boolean nonNormalCubeAbove) private BlockState
getConnectionState
(BlockGetter level, BlockState state, BlockPos pos) protected int
getDirectSignal
(BlockState blockState, BlockGetter blockAccess, BlockPos pos, Direction side) Returns the direct signal this block emits in the given direction.private BlockState
getMissingConnections
(BlockGetter level, BlockState state, BlockPos pos) 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) private int
getWireSignal
(BlockState state) private static boolean
isCross
(BlockState state) private static boolean
isDot
(BlockState state) protected boolean
isSignalSource
(BlockState state) Returns whether this block is capable of emitting redstone signals.protected BlockState
mirror
(BlockState state, Mirror mirror) Returns the blockstate with the given mirror of the passed blockstate.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) protected BlockState
rotate
(BlockState state, Rotation rotation) Returns the blockstate with the given rotation from the passed blockstate.protected static boolean
shouldConnectTo
(BlockState state) protected static boolean
shouldConnectTo
(BlockState state, Direction p_direction) private void
spawnParticlesAlongLine
(Level level, RandomSource random, BlockPos pos, Vec3 particleVec, Direction xDirection, Direction zDirection, float min, float max) protected void
updateIndirectNeighbourShapes
(BlockState state, LevelAccessor level, BlockPos pos, int flags, int recursionLeft) Updates the shapes of indirect neighbors of this block.private void
updateNeighborsOfNeighboringWires
(Level level, BlockPos pos) private void
updatePowerStrength
(Level level, BlockPos pos, BlockState state) protected BlockState
updateShape
(BlockState state, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) Update the provided state given the provided neighbor direction and neighbor state, returning a new state.private void
updatesOnShapeChange
(Level level, BlockPos pos, BlockState oldState, BlockState newState) protected InteractionResult
useWithoutItem
(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) Methods inherited from class net.minecraft.world.level.block.Block
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, setPlacedBy, 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, 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, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay, shouldHideAdjacentFluidFace, supportsExternalFaceHiding
-
Field Details
-
CODEC
-
NORTH
-
EAST
-
SOUTH
-
WEST
-
POWER
-
PROPERTY_BY_DIRECTION
-
H
protected static final int H- See Also:
-
W
protected static final int W- See Also:
-
E
protected static final int E- See Also:
-
N
protected static final int N- See Also:
-
S
protected static final int S- See Also:
-
SHAPE_DOT
-
SHAPES_FLOOR
-
SHAPES_UP
-
SHAPES_CACHE
-
COLORS
-
PARTICLE_DENSITY
private static final float PARTICLE_DENSITY- See Also:
-
crossState
-
shouldSignal
private boolean shouldSignal
-
-
Constructor Details
-
RedStoneWireBlock
-
-
Method Details
-
codec
-
calculateShape
-
getShape
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) - Overrides:
getShape
in classBlockBehaviour
-
getStateForPlacement
- Overrides:
getStateForPlacement
in classBlock
-
getConnectionState
-
getMissingConnections
-
updateShape
protected BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) 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
-
isCross
-
isDot
-
updateIndirectNeighbourShapes
protected void updateIndirectNeighbourShapes(BlockState state, LevelAccessor level, BlockPos pos, int flags, int recursionLeft) 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 level, BlockPos pos, Direction direction, boolean nonNormalCubeAbove) -
canSurvive
- Overrides:
canSurvive
in classBlockBehaviour
-
canSurviveOn
-
updatePowerStrength
-
calculateTargetStrength
-
getWireSignal
-
checkCornerChangeAt
CallsLevel.updateNeighborsAt(net.minecraft.core.BlockPos, net.minecraft.world.level.block.Block)
for all neighboring blocks, but only if the given block is a redstone wire. -
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
-
updateNeighborsOfNeighboringWires
-
neighborChanged
protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) - Overrides:
neighborChanged
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
-
shouldConnectTo
-
shouldConnectTo
-
isSignalSource
Returns whether this block is capable of emitting redstone signals.- Overrides:
isSignalSource
in classBlockBehaviour
-
getColorForPower
public static int getColorForPower(int power) -
spawnParticlesAlongLine
-
animateTick
Called periodically clientside on blocks near the player to show effects (like furnace fire particles).- Overrides:
animateTick
in classBlock
-
rotate
Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed blockstate.- Overrides:
rotate
in classBlockBehaviour
-
mirror
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 state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) - Overrides:
useWithoutItem
in classBlockBehaviour
-
updatesOnShapeChange
private void updatesOnShapeChange(Level level, BlockPos pos, BlockState oldState, BlockState newState)
-