Class RedstoneSidedConnectivityTest.EastRedstoneBlock

java.lang.Object
net.minecraft.world.level.block.state.BlockBehaviour
net.minecraft.world.level.block.Block
net.neoforged.neoforge.oldtest.block.RedstoneSidedConnectivityTest.EastRedstoneBlock
All Implemented Interfaces:
FeatureElement, ItemLike, IBlockExtension
Enclosing class:
RedstoneSidedConnectivityTest

private static class RedstoneSidedConnectivityTest.EastRedstoneBlock extends Block
  • Constructor Details

  • Method Details

    • canConnectRedstone

      public boolean canConnectRedstone(BlockState state, BlockGetter level, BlockPos pos, @Nullable @Nullable Direction direction)
      Description copied from interface: IBlockExtension
      Whether redstone dust should visually connect to this block on a given side

      The default implementation is identical to RedStoneWireBlock#shouldConnectTo(BlockState, Direction)

      RedStoneWireBlock updates its visual connection when

      invalid reference
      BlockState#updateShape(Direction, BlockState, LevelAccessor, BlockPos, BlockPos)
      is called, this callback is used during the evaluation of its new shape.
      Parameters:
      state - The current state
      level - The level
      pos - The block position in level
      direction - The coming direction of the redstone dust connection (with respect to the block at pos)
      Returns:
      True if redstone dust should visually connect on the side passed

      If the return value is evaluated based on level and pos (e.g. from BlockEntity), then the implementation of this block should notify its neighbors to update their shapes when necessary. Consider using BlockBehaviour.BlockStateBase.updateNeighbourShapes(LevelAccessor, BlockPos, int, int) or

      invalid reference
      BlockState#updateShape(Direction, BlockState, LevelAccessor, BlockPos, BlockPos)
      .

      Example:

      1. yourBlockState.updateNeighbourShapes(level, yourBlockPos, UPDATE_ALL);

      2. neighborState.updateShape(fromDirection, stateOfYourBlock, level, neighborBlockPos, yourBlockPos), where fromDirection is defined from the neighbor block's point of view.

    • neighborChanged

      public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, @Nullable @Nullable Orientation orientation, boolean isMoving)
      Overrides:
      neighborChanged in class BlockBehaviour