Interface IForgeBaseRailBlock

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

public interface IForgeBaseRailBlock
  • Method Details

    • isFlexibleRail

      boolean isFlexibleRail(BlockState state, BlockGetter 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, BlockGetter 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, BlockGetter world, BlockPos pos, @Nullable AbstractMinecart 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, Level world, BlockPos pos, AbstractMinecart 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, Level world, BlockPos pos, AbstractMinecart 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