Skip to main content

Response

Enum Response 

Source
pub enum Response {
Show 16 variants Broadcast(BroadcastMessage), SendBlockAck { sequence: i32, }, SendSystemChat { content: NbtCompound, action_bar: bool, }, SendPosition { teleport_id: i32, position: Position, rotation: Rotation, }, StreamChunks(ChunkPosition), SendGameStateChange { reason: u8, value: f32, }, PersistChunk(ChunkPosition), SpawnDroppedItem { position: BlockPosition, item_id: i32, count: i32, }, OpenChest(BlockPosition), OpenCraftingTable { position: BlockPosition, }, OpenContainer(Container), BroadcastBlockAction { position: BlockPosition, action_id: u8, action_param: u8, block_id: i32, }, NotifyContainerViewers { position: BlockPosition, slot_index: i16, item: Slot, }, DestroyBlockEntity { position: BlockPosition, }, UnlockRecipe { recipe_id: RecipeId, reason: UnlockReason, }, LockRecipe { recipe_id: RecipeId, },
}
Expand description

A deferred operation queued by a sync event handler.

Variants§

§

Broadcast(BroadcastMessage)

Broadcast a message to all connected players.

§

SendBlockAck

Send a block action acknowledgement.

Fields

§sequence: i32

Sequence number.

§

SendSystemChat

Send a system chat message.

Fields

§content: NbtCompound

The formatted text component as NBT.

§action_bar: bool

Whether to display as action bar.

§

SendPosition

Teleport the current player.

Fields

§teleport_id: i32

Teleport ID.

§position: Position

Target position.

§rotation: Rotation

Target facing direction.

§

StreamChunks(ChunkPosition)

Stream chunks around a chunk position.

§

SendGameStateChange

Send a game state change.

Fields

§reason: u8

Reason code.

§value: f32

Associated value.

§

PersistChunk(ChunkPosition)

Schedule a chunk for asynchronous persistence.

§

SpawnDroppedItem

Spawn a dropped item entity in the world.

Fields

§position: BlockPosition

Block position where the item spawns.

§item_id: i32

Item ID to drop.

§count: i32

Item count.

§

OpenChest(BlockPosition)

Open a chest container at the given position.

§

OpenCraftingTable

Open a crafting table window for the current player.

Sends an OpenScreen packet with the 3x3 crafting grid type and attaches a CraftingGrid component to the player entity.

Fields

§position: BlockPosition

Block position of the crafting table.

§

OpenContainer(Container)

Open a custom container window for the current player.

Accepts a Container template value built via Container::builder().

§

BroadcastBlockAction

Broadcast a BlockAction packet to all connected players.

Used by container/door/note-block plugins for state-change animations (chest lid open/close, door open/close, etc.). The meaning of action_id and action_param depends on the block_id registry value.

Fields

§position: BlockPosition

World position of the block.

§action_id: u8

Action identifier (block-specific).

§action_param: u8

Action parameter (block-specific; for chests this is the number of viewers, 0 = closed).

§block_id: i32

Block registry ID (e.g. 185 for chest in 1.21.4).

§

NotifyContainerViewers

Send a SetContainerSlot to every player viewing the same block-backed container, excluding the current player.

Used by ContainerPlugin to keep co-viewers’ open chests in sync when a slot is mutated by the source player. The server resolves which players are co-viewers by scanning the OpenContainer components.

Fields

§position: BlockPosition

World position of the block-backed container.

§slot_index: i16

Protocol slot index that changed.

§item: Slot

New slot contents to broadcast.

§

DestroyBlockEntity

Remove a block entity at the given position and dispatch BlockEntityDestroyedEvent with its last state.

Used by ContainerPlugin on chest break to drive the destroy → drop-items chain through the event pipeline. No-op if no block entity exists at the position.

Fields

§position: BlockPosition

World position of the block entity to remove.

§

UnlockRecipe

Unlock a recipe for the current player.

The server inserts the recipe id into the player’s KnownRecipes component, sends a Recipe Book Add S2C packet, and dispatches RecipeUnlockedEvent at Post. No-op if the recipe is already unlocked.

Fields

§recipe_id: RecipeId

Stable identifier of the recipe to unlock.

§reason: UnlockReason

Why the unlock happened — surfaced on RecipeUnlockedEvent.

§

LockRecipe

Lock a recipe for the current player.

The server removes the recipe from the player’s KnownRecipes, sends a Recipe Book Remove S2C packet, and dispatches RecipeLockedEvent at Post. No-op if the recipe is not currently unlocked.

Fields

§recipe_id: RecipeId

Stable identifier of the recipe to lock.

Trait Implementations§

Source§

impl Clone for Response

Source§

fn clone(&self) -> Response

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Response

Source§

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

Formats the value using the given formatter. Read more

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.

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.