Skip to main content

AbstractMinecart

Trait AbstractMinecart 

Source
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§

Source

fn minecart_base(&self) -> &AbstractMinecartBase

Returns the minecart’s shared non-synchronized minecart state.

Source

fn custom_display_block(&self) -> Option<BlockStateId>

Returns the custom display block, if any.

Source

fn set_custom_display_block(&self, value: Option<BlockStateId>)

Sets the custom display block.

Source

fn display_offset(&self) -> i32

Returns the vertical offset of the minecart’s display block.

Source

fn set_display_offset(&self, value: i32)

Sets the vertical offset of the minecart’s display block.

Provided Methods§

Source

fn default_display_offset(&self) -> i32

Returns the default vertical display-block offset, in sixteenths of a block.

Source

fn max_speed(&self, world: &World) -> f64

Returns the minecart’s max speed.

Source

fn minecart_default_gravity(&self) -> f64

Returns the default gravity of this minecart.

Source

fn minecart_air_drag(&self) -> f64

Returns the default air drag of this minecart.

Source

fn minecart_is_pickable(&self) -> bool

Returns whether this minecart can be targeted by picking.

Source

fn minecart_is_pushable(&self) -> bool

Returns whether this minecart can be pushed.

Source

fn minecart_movement_emission(&self) -> EntityMovementEmission

Returns the movement side effects emitted by this minecart.

Source

fn minecart_blocks_building(&self) -> bool

Returns whether this minecart obstructs block placement.

Source

fn minecart_can_collide_with(&self, other: &dyn Entity) -> bool

Returns whether this minecart can collide with other.

Source

fn display_block_state(&self) -> BlockStateId

Returns the custom display block, or the default block state if none is set.

Source

fn default_display_block_state(&self) -> BlockStateId

Returns air as the default display block.

Source

fn activate_minecart(&self, _world: &World, _pos: BlockPos, _powered: bool)

Handles contact with an activator rail. Default does nothing.

Source

fn is_rideable(&self) -> bool

Returns whether this minecart is rideable.

Source

fn is_flipped(&self) -> bool

Returns whether this minecart’s movement-facing rotation is flipped.

Source

fn is_redstone_conductor(&self, world: &World, pos: BlockPos) -> bool

Returns whether the block at pos is a redstone conductor.

Source

fn is_furnace(&self) -> bool

Returns whether this minecart is a furnace minecart.

Source

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.

Source

fn minecart_block_speed_factor(&self) -> f32

Returns 1.0 on rails, otherwise the default block speed factor.

Source

fn minecart_apply_effects_from_blocks(&self)

Applies block-contact effects at the current position and clears movement.

Source

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.

Source

fn tick_minecart(&self, entity: &SharedEntity)

Advances minecart movement, damage decay, portal handling, and fluid effects.

Source

fn apply_natural_slowdown(&self, movement: DVec3) -> DVec3

Applies natural slowdown to the minecart movement.

Source

fn come_off_track(&self, entity: &SharedEntity, world: &World)

Slows down the minecart when it comes off the track.

Source

fn minecart_push_entity(&self, other: &dyn Entity)

Applies collision impulses between this minecart and another entity.

Source

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.

Source

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.

Source

fn save_abstract_minecart_data(&self, nbt: &mut NbtCompound)

Saves display settings, flipped rotation, and first-tick state to NBT.

Source

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".

Implementors§