Enum PlayerAction
pub enum PlayerAction {
UseOn {
hand: Hand,
pos: [i32; 3],
hit: BlockHit,
},
UseItem {
hand: Hand,
},
InteractOn {
hand: Hand,
target: EntityRef,
location: [f64; 3],
},
Attack {
target: EntityRef,
},
BreakBlock {
pos: [i32; 3],
},
}Expand description
What a fake player does in PlayerRef::perform_action: a player’s own action, run through
the game’s path for it, as a client’s packet is. Its answer is an ActionOutcome, or an
ActionRefused when none of it ran.
Variants§
UseOn
Use the item in hand on the block at pos, clicked at hit
(ServerPlayerGameMode.useItemOn): the block’s use, then the item’s useOn, which
places a block item.
Fields
UseItem
Use the item in hand in the air (ServerPlayerGameMode.useItem).
InteractOn
Interact with target using one hand (Player.interactOn), without falling back to
using the item in the air when the entity passes the click.
Fields
Attack
Attack target with the main hand (ServerGamePacketListenerImpl.handleInteract’s
ATTACK, then Player.attack): a player, a mob or another entity, or a fireball, a wind
charge or a shulker bullet turned back. Mobs don’t take the fake as the player to answer.
BreakBlock
Break the block at pos at once (ServerPlayerGameMode.destroyBlock), with the game
mode’s and the held tool’s rules, the tool’s wear and the drops, and no digging time:
a mod that digs over time counts the progress itself. Outside creative, a block no
digging breaks (destroy time -1, such as bedrock) stays.
Trait Implementations§
§impl Clone for PlayerAction
impl Clone for PlayerAction
§fn clone(&self) -> PlayerAction
fn clone(&self) -> PlayerAction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more