Skip to main content

Host

Trait Host 

pub trait Host:
    BlockEntitiesHost
    + BlockStatesHost
    + ClientViewHost
    + ConfigHost
    + EntitiesHost
    + ItemEntitiesHost
    + ItemsHost
    + KeysHost
    + LevelsHost
    + LivingHost
    + MobsHost
    + ModStateHost
    + PlayersHost
    + RecipePropertiesHost
    + RecipesHost
    + ResourcesHost
    + TagsHost { }
Expand description

Services supplied by the game to trait mods. Each method’s default panics with its name, so a test double implements only what its test calls; the game implements every one. The backend accessors are the exception: they default to None, so a double without a backend answers every handle’s typed refusal. Its methods are declared by area in host/<area>.rs; use mod_api::prelude::* names every area trait.

Trait Implementations§

§

impl AttachmentStore for dyn Host + '_

§

fn holds( &mut self, holder: Holder, namespace: &str, name: &str, ) -> Result<bool, AttachmentError>

Whether holder keeps a value under namespace:name, saved or decoded.
§

fn decoded( &mut self, holder: Holder, namespace: &str, name: &str, ) -> Result<Option<Arc<dyn Any + Send + Sync>>, AttachmentError>

The value under namespace:name if it has been decoded.
§

fn saved( &mut self, holder: Holder, namespace: &str, name: &str, ) -> Result<Option<BTreeMap<JavaString, Tag>>, AttachmentError>

The saved form under namespace:name if it hasn’t been decoded yet.
§

fn store( &mut self, holder: Holder, namespace: &str, name: &str, value: Arc<dyn Any + Send + Sync>, form: AttachmentForm, ) -> Result<(), AttachmentError>

Keep value under namespace:name, with what comes with it.
§

fn discard( &mut self, holder: Holder, namespace: &str, name: &str, sync: bool, ) -> Result<(), AttachmentError>

Drop the value under namespace:name, saved or decoded; clients hear of it if sync.
§

fn queue_sync( &mut self, holder: Holder, namespace: &str, name: &str, ) -> Result<(), AttachmentError>

Send the value under namespace:name to the clients that see the holder again.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§