pub struct World {
    pub time: WorldInstant,
    pub chunks: Vec<Option<Chunk>>,
}
Expand description

Contains all the game state.

Fields

time: WorldInstant

The timestamp of the world currently.

chunks: Vec<Option<Chunk>>

The chunks the world consists of. The server’s chunks will never be None, but the client’s will. Only the chunks around the player character will be Some on the client-side, to save on network bandwidth and client-side performance.

Implementations

Creates an empty world at time 0. A starting point for a client to apply ChunkUpdates to, as they come from the server.

Applies the given effects to the chunk, and returns false if the chunk being affected is not loaded.

Does deterministic simulation of the game state for one time step, and increments World::time by 1.

Returns the player character and the index of the chunk where the player character is.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.