pub trait AbstractMinecart: VehicleEntity + AbstractMinecartEventSource {
Show 33 methods
// Required methods
fn minecart_base(&self) -> &AbstractMinecartBase;
fn custom_display_block(&self) -> Option<BlockStateId>;
fn set_custom_display_block(&self, value: Option<BlockStateId>);
fn display_offset(&self) -> i32;
fn set_display_offset(&self, value: i32);
// Provided methods
fn default_display_offset(&self) -> i32 { ... }
fn max_speed(&self, world: &World) -> f64 { ... }
fn minecart_default_gravity(&self) -> f64 { ... }
fn minecart_air_drag(&self) -> f64 { ... }
fn minecart_is_pickable(&self) -> bool { ... }
fn minecart_is_pushable(&self) -> bool { ... }
fn minecart_movement_emission(&self) -> EntityMovementEmission { ... }
fn minecart_blocks_building(&self) -> bool { ... }
fn minecart_can_collide_with(&self, other: &dyn Entity) -> bool { ... }
fn display_block_state(&self) -> BlockStateId { ... }
fn default_display_block_state(&self) -> BlockStateId { ... }
fn activate_minecart(&self, _world: &World, _pos: BlockPos, _powered: bool) { ... }
fn is_rideable(&self) -> bool { ... }
fn is_flipped(&self) -> bool { ... }
fn is_redstone_conductor(&self, world: &World, pos: BlockPos) -> bool { ... }
fn is_furnace(&self) -> bool { ... }
fn current_block_pos_or_rail_below(&self, world: &World) -> BlockPos { ... }
fn minecart_block_speed_factor(&self) -> f32 { ... }
fn minecart_apply_effects_from_blocks(&self) { ... }
fn minecart_move_entity(
self: Arc<Self>,
mover_type: MoverType,
delta: DVec3,
) -> Option<MoveResult> { ... }
fn tick_minecart(&self, entity: &SharedEntity) { ... }
fn apply_natural_slowdown(&self, movement: DVec3) -> DVec3 { ... }
fn come_off_track(&self, entity: &SharedEntity, world: &World) { ... }
fn minecart_push_entity(&self, other: &dyn Entity) { ... }
fn push_other_minecart(
&self,
other_minecart: &dyn AbstractMinecart,
xa: f64,
za: f64,
) { ... }
fn minecart_passenger_attachment_point(
&self,
passenger: &dyn Entity,
) -> DVec3 { ... }
fn save_abstract_minecart_data(&self, nbt: &mut NbtCompound) { ... }
fn load_abstract_minecart_data(&self, nbt: BorrowedNbtCompoundView<'_, '_>) { ... }
}Expand description
Shared behavior for every minecart variant entity.
Required Methods§
Sourcefn minecart_base(&self) -> &AbstractMinecartBase
fn minecart_base(&self) -> &AbstractMinecartBase
Returns the minecart’s shared non-synchronized minecart state.
Sourcefn custom_display_block(&self) -> Option<BlockStateId>
fn custom_display_block(&self) -> Option<BlockStateId>
Returns the custom display block, if any.
Sourcefn set_custom_display_block(&self, value: Option<BlockStateId>)
fn set_custom_display_block(&self, value: Option<BlockStateId>)
Sets the custom display block.
Sourcefn display_offset(&self) -> i32
fn display_offset(&self) -> i32
Returns the vertical offset of the minecart’s display block.
Sourcefn set_display_offset(&self, value: i32)
fn set_display_offset(&self, value: i32)
Sets the vertical offset of the minecart’s display block.
Provided Methods§
Sourcefn default_display_offset(&self) -> i32
fn default_display_offset(&self) -> i32
Returns the default vertical display-block offset, in sixteenths of a block.
Sourcefn minecart_default_gravity(&self) -> f64
fn minecart_default_gravity(&self) -> f64
Returns the default gravity of this minecart.
Sourcefn minecart_air_drag(&self) -> f64
fn minecart_air_drag(&self) -> f64
Returns the default air drag of this minecart.
Sourcefn minecart_is_pickable(&self) -> bool
fn minecart_is_pickable(&self) -> bool
Returns whether this minecart can be targeted by picking.
Sourcefn minecart_is_pushable(&self) -> bool
fn minecart_is_pushable(&self) -> bool
Returns whether this minecart can be pushed.
Sourcefn minecart_movement_emission(&self) -> EntityMovementEmission
fn minecart_movement_emission(&self) -> EntityMovementEmission
Returns the movement side effects emitted by this minecart.
Sourcefn minecart_blocks_building(&self) -> bool
fn minecart_blocks_building(&self) -> bool
Returns whether this minecart obstructs block placement.
Sourcefn minecart_can_collide_with(&self, other: &dyn Entity) -> bool
fn minecart_can_collide_with(&self, other: &dyn Entity) -> bool
Returns whether this minecart can collide with other.
Sourcefn display_block_state(&self) -> BlockStateId
fn display_block_state(&self) -> BlockStateId
Returns the custom display block, or the default block state if none is set.
Sourcefn default_display_block_state(&self) -> BlockStateId
fn default_display_block_state(&self) -> BlockStateId
Returns air as the default display block.
Sourcefn activate_minecart(&self, _world: &World, _pos: BlockPos, _powered: bool)
fn activate_minecart(&self, _world: &World, _pos: BlockPos, _powered: bool)
Handles contact with an activator rail. Default does nothing.
Sourcefn is_rideable(&self) -> bool
fn is_rideable(&self) -> bool
Returns whether this minecart is rideable.
Sourcefn is_flipped(&self) -> bool
fn is_flipped(&self) -> bool
Returns whether this minecart’s movement-facing rotation is flipped.
Sourcefn is_redstone_conductor(&self, world: &World, pos: BlockPos) -> bool
fn is_redstone_conductor(&self, world: &World, pos: BlockPos) -> bool
Returns whether the block at pos is a redstone conductor.
Sourcefn is_furnace(&self) -> bool
fn is_furnace(&self) -> bool
Returns whether this minecart is a furnace minecart.
Sourcefn current_block_pos_or_rail_below(&self, world: &World) -> BlockPos
fn current_block_pos_or_rail_below(&self, world: &World) -> BlockPos
Returns the block below when it contains rails, otherwise the minecart’s current block position.
Sourcefn minecart_block_speed_factor(&self) -> f32
fn minecart_block_speed_factor(&self) -> f32
Returns 1.0 on rails, otherwise the default block speed factor.
Sourcefn minecart_apply_effects_from_blocks(&self)
fn minecart_apply_effects_from_blocks(&self)
Applies block-contact effects at the current position and clears movement.
Sourcefn minecart_move_entity(
self: Arc<Self>,
mover_type: MoverType,
delta: DVec3,
) -> Option<MoveResult>
fn minecart_move_entity( self: Arc<Self>, mover_type: MoverType, delta: DVec3, ) -> Option<MoveResult>
Moves this minecart using default entity movement, then applies block-contact effects.
Sourcefn tick_minecart(&self, entity: &SharedEntity)
fn tick_minecart(&self, entity: &SharedEntity)
Advances minecart movement, damage decay, portal handling, and fluid effects.
Sourcefn apply_natural_slowdown(&self, movement: DVec3) -> DVec3
fn apply_natural_slowdown(&self, movement: DVec3) -> DVec3
Applies natural slowdown to the minecart movement.
Sourcefn come_off_track(&self, entity: &SharedEntity, world: &World)
fn come_off_track(&self, entity: &SharedEntity, world: &World)
Slows down the minecart when it comes off the track.
Sourcefn minecart_push_entity(&self, other: &dyn Entity)
fn minecart_push_entity(&self, other: &dyn Entity)
Applies collision impulses between this minecart and another entity.
Sourcefn push_other_minecart(
&self,
other_minecart: &dyn AbstractMinecart,
xa: f64,
za: f64,
)
fn push_other_minecart( &self, other_minecart: &dyn AbstractMinecart, xa: f64, za: f64, )
Updates both cart’s horizontal velocities after an aligned collision, handling special cases for furnace minecarts.
Sourcefn minecart_passenger_attachment_point(&self, passenger: &dyn Entity) -> DVec3
fn minecart_passenger_attachment_point(&self, passenger: &dyn Entity) -> DVec3
Returns the passenger attachment point used by this minecart.
Villagers and wandering traders use vanilla’s lowered attachment point.
Sourcefn save_abstract_minecart_data(&self, nbt: &mut NbtCompound)
fn save_abstract_minecart_data(&self, nbt: &mut NbtCompound)
Saves display settings, flipped rotation, and first-tick state to NBT.
Sourcefn load_abstract_minecart_data(&self, nbt: BorrowedNbtCompoundView<'_, '_>)
fn load_abstract_minecart_data(&self, nbt: BorrowedNbtCompoundView<'_, '_>)
Loads display settings, flipped rotation, and first-tick state from NBT.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".