Interface IAbstractRailBlock

All Known Implementing Classes:
AbstractRailBlock, DetectorRailBlock, PoweredRailBlock, RailBlock

public interface IAbstractRailBlock
  • Method Details

    • getAbstractBlock

      default AbstractBlock getAbstractBlock()
    • isFlexibleRail

      boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos)
      Return true if the rail can make corners. Used by placement logic.
      Parameters:
      world - The world.
      pos - Block's position in world
      Returns:
      True if the rail can make corners.
    • canMakeSlopes

      default boolean canMakeSlopes(BlockState state, IBlockReader world, BlockPos pos)
      Returns true if the rail can make up and down slopes. Used by placement logic.
      Parameters:
      world - The world.
      pos - Block's position in world
      Returns:
      True if the rail can make slopes.
    • getRailDirection

      RailShape getRailDirection(BlockState state, IBlockReader world, BlockPos pos, @Nullable AbstractMinecartEntity cart)
      Return the rail's direction. Can be used to make the cart think the rail is a different shape, for example when making diamond junctions or switches. The cart parameter will often be null unless it it called from EntityMinecart.
      Parameters:
      world - The world.
      pos - Block's position in world
      state - The BlockState
      cart - The cart asking for the metadata, null if it is not called by EntityMinecart.
      Returns:
      The direction.
    • getRailMaxSpeed

      default float getRailMaxSpeed(BlockState state, World world, BlockPos pos, AbstractMinecartEntity cart)
      Returns the max speed of the rail at the specified position.
      Parameters:
      world - The world.
      cart - The cart on the rail, may be null.
      pos - Block's position in world
      Returns:
      The max speed of the current rail.
    • onMinecartPass

      default void onMinecartPass(BlockState state, World world, BlockPos pos, AbstractMinecartEntity cart)
      This function is called by any minecart that passes over this rail. It is called once per update tick that the minecart is on the rail.
      Parameters:
      world - The world.
      cart - The cart on the rail.
      pos - Block's position in world