Interface IBaseRailBlockExtension

All Known Implementing Classes:
BaseRailBlock, DetectorRailBlock, PoweredRailBlock, RailBlock, ValidRailShapeTest.RailSlopeBlock

public interface IBaseRailBlockExtension
  • Method Details

    • isFlexibleRail

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

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

      RailShape getRailDirection(BlockState state, BlockGetter level, BlockPos pos, @Nullable @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:
      state - The BlockState
      level - The level.
      pos - Block's position in level
      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 level, BlockPos pos, AbstractMinecart cart)
      Returns the max speed of the rail at the specified position.
      Parameters:
      level - The level.
      pos - Block's position in level
      cart - The cart on the rail, may be null.
      Returns:
      The max speed of the current rail.
    • onMinecartPass

      default void onMinecartPass(BlockState state, Level level, 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:
      level - The level.
      pos - Block's position in level
      cart - The cart on the rail.
    • isValidRailShape

      default boolean isValidRailShape(RailShape shape)
      Returns true if the given RailShape is valid for this rail block. This is called when the RailShape for the initial placement of this block is calculated or when another rail block tries to connect to this block and this block's RailState calculates the new RailShape for its current neigbors.
      Parameters:
      shape - The new RailShape
      Returns:
      True when the given RailShape is valid