Skip to main content

MinecartRef

Struct MinecartRef 

pub struct MinecartRef(/* private fields */);
Expand description

A vanilla AbstractMinecart, narrowed from an entity with host.minecart(entity).

Implementations§

§

impl MinecartRef

pub fn push(self, host: &dyn Host) -> Option<[f64; 3]>

Side: server. A furnace minecart’s push (MinecartFurnace.push): the way its fuel drives it on rails, x and z; its y part stays between ticks and sets the push’s length. None for another kind of cart.

pub fn kind(self, host: &dyn Host) -> Option<MinecartKind>

Side: server. Which AbstractMinecart subclass the cart is.

pub fn max_speed(self, host: &dyn Host) -> Option<f64>

Side: server. AbstractMinecart.getMaxSpeed, in blocks per tick: the old behaviour’s 0.4 (0.2 in water), or with the minecart_improvements experiment the max_minecart_speed rule over 20 (halved in water). A furnace minecart takes half of that, three quarters in water (MinecartFurnace).

pub fn is_on_rails(self, host: &dyn Host) -> Option<bool>

Side: server. AbstractMinecart.isOnRails.

pub fn flipped(self, host: &dyn Host) -> Option<bool>

Side: server. AbstractMinecart.isFlipped.

pub fn damage(self, host: &dyn Host) -> Option<f32>

Side: server. VehicleEntity.getDamage, the wobble damage (DATA_ID_DAMAGE).

pub fn hurt_time(self, host: &dyn Host) -> Option<i32>

Side: server. VehicleEntity.getHurtTime, the wobble ticks (DATA_ID_HURT).

pub fn custom_display_block(self, host: &dyn Host) -> Option<Option<BlockState>>

Side: server. AbstractMinecart.customDisplayBlockState: the block the cart shows in place of its kind’s default, None (inner) when it has none.

pub fn display_offset(self, host: &dyn Host) -> Option<i32>

Side: server. AbstractMinecart.getDisplayOffset, in sixteenths of a block: the set offset, else the kind’s default.

pub fn fuel(self, host: &dyn Host) -> Option<i32>

Side: server. MinecartFurnace’s fuel ticks; None for another kind of cart.

pub fn fuse(self, host: &dyn Host) -> Option<i32>

Side: server. MinecartTNT’s fuse ticks, -1 when it is not primed; None for another kind of cart.

pub fn hopper_enabled(self, host: &dyn Host) -> Option<bool>

Side: server. MinecartHopper.isEnabled; None for another kind of cart.

pub fn command(self, host: &dyn Host) -> Option<String>

Side: server. A command block minecart’s command (MinecartCommandBlock.getCommandBlock().getCommand()). None for another kind of cart.

pub fn set_push(self, host: &mut dyn ServerHost, push: [f64; 3]) -> bool

Side: server. Sets a furnace minecart’s push, as a player’s click with fuel sets it toward them (MinecartFurnace.interact): a cart a mod drives runs that way while it has fuel. False for another kind of cart or a push that isn’t finite.

pub fn set_flipped(self, host: &mut dyn ServerHost, flipped: bool) -> bool

Side: server. AbstractMinecart.setFlipped; saved as FlippedRotation, not synced.

pub fn set_damage(self, host: &mut dyn ServerHost, damage: f32) -> bool

Side: server. VehicleEntity.setDamage: synced to clients. The tick counts it down only while positive.

pub fn set_hurt_time(self, host: &mut dyn ServerHost, ticks: i32) -> bool

Side: server. VehicleEntity.setHurtTime: synced to clients.

pub fn set_custom_display_block( self, host: &mut dyn ServerHost, state: Option<BlockState>, ) -> bool

Side: server. Sets the block the cart shows, or with None its kind’s default again: saved as DisplayState and synced to clients. False for a state the registry doesn’t know, as the loader drops one that does not decode.

pub fn set_display_offset(self, host: &mut dyn ServerHost, offset: i32) -> bool

Side: server. AbstractMinecart.setDisplayOffset, in sixteenths of a block: saved as DisplayOffset (only off the kind’s default) and synced to clients.

pub fn set_fuel(self, host: &mut dyn ServerHost, fuel: i32) -> bool

Side: server. Sets a furnace minecart’s fuel ticks, any int as vanilla’s field holds it (saved as a short, the low 16 bits). False for another kind of cart. The lit flag (DATA_ID_FUEL) follows with fuel above zero.

pub fn prime_fuse(self, host: &mut dyn ServerHost) -> bool

Side: server. MinecartTNT.primeFuse(null): an 80 tick fuse, the primed sound and entity event 70 for clients. False for another kind of cart, or with the tnt_explodes rule off.

pub fn set_hopper_enabled( self, host: &mut dyn ServerHost, enabled: bool, ) -> bool

Side: server. MinecartHopper.setEnabled: saved as Enabled, not synced.

pub fn set_command(self, host: &mut dyn ServerHost, command: &str) -> bool

Side: server. Sets a command block minecart’s command (BaseCommandBlock.setCommand, which resets the success count), then MinecartCommandBase.onUpdated, as the edit screen’s save does: the synced command and last output follow, so clients’ editors show the new command. The output and its tracking are kept, and no chat note is sent. An activator rail then runs the new command. False for another kind of cart.

§

impl MinecartRef

pub fn entity(self) -> EntityRef

The same entity as an EntityRef.

Trait Implementations§

§

impl Clone for MinecartRef

§

fn clone(&self) -> MinecartRef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Copy for MinecartRef

§

impl Debug for MinecartRef

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Eq for MinecartRef

§

impl Hash for MinecartRef

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl PartialEq for MinecartRef

§

fn eq(&self, other: &MinecartRef) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl StructuralPartialEq for MinecartRef

§

impl Wire for MinecartRef

§

const MIN: usize

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the writer.
§

fn put_owned(self, out: &mut Writer)

Consumes owned data when a resource’s ownership must cross the boundary.
§

fn take(input: &mut Reader<'_>) -> Result<MinecartRef, WireError>

Decodes one value, leaving any following bytes for the caller.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Put for T
where T: Wire,

§

fn put_to(&self, out: &mut Writer)

Writes it.
§

impl<T> Record for T
where T: Wire,

§

fn encode(&self, out: &mut Writer)

Writes the argument into a hook call.
§

fn apply(&mut self, bytes: &[u8]) -> Result<(), WireError>

Applies one complete reply, refusing malformed or trailing bytes atomically.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.