Interface IForgeBaseRailBlock
- All Known Implementing Classes:
BaseRailBlock
,DetectorRailBlock
,PoweredRailBlock
,RailBlock
public interface IForgeBaseRailBlock
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canMakeSlopes
(BlockState state, BlockGetter level, BlockPos pos) Returns true if the rail can make up and down slopes.getRailDirection
(BlockState state, BlockGetter level, BlockPos pos, @Nullable AbstractMinecart cart) Return the rail's direction.default float
getRailMaxSpeed
(BlockState state, Level level, BlockPos pos, AbstractMinecart cart) Returns the max speed of the rail at the specified position.boolean
isFlexibleRail
(BlockState state, BlockGetter level, BlockPos pos) Return true if the rail can make corners.default boolean
isValidRailShape
(RailShape shape) Returns true if the givenRailShape
is valid for this rail block.default void
onMinecartPass
(BlockState state, Level level, 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:
level
- The level.pos
- Block's position in level- 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:
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 BlockStatelevel
- The level.pos
- Block's position in levelcart
- 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:
level
- The level.pos
- Block's position in levelcart
- The cart on the rail, may be null.- 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:
level
- The level.pos
- Block's position in levelcart
- The cart on the rail.
-
isValidRailShape
Returns true if the givenRailShape
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
-