Interface IForgeBaseRailBlock
- All Known Implementing Classes:
BaseRailBlock
,DetectorRailBlock
,PoweredRailBlock
,RailBlock
public interface IForgeBaseRailBlock
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canMakeSlopes(BlockState state, BlockGetter world, BlockPos pos)
Returns true if the rail can make up and down slopes.getRailDirection(BlockState state, BlockGetter world, BlockPos pos, AbstractMinecart cart)
Return the rail's direction.default float
getRailMaxSpeed(BlockState state, Level world, BlockPos pos, AbstractMinecart cart)
Returns the max speed of the rail at the specified position.boolean
isFlexibleRail(BlockState state, BlockGetter world, BlockPos pos)
Return true if the rail can make corners.default void
onMinecartPass(BlockState state, Level world, BlockPos pos, AbstractMinecart cart)
This function is called by any minecart that passes over this rail.
-
Method Details
-
isFlexibleRail
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
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 worldstate
- The BlockStatecart
- The cart asking for the metadata, null if it is not called by EntityMinecart.- Returns:
- The direction.
-
getRailMaxSpeed
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
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
-