Referencia
Esta página se muestra en inglés.
display
Display and interaction resources and transform types.
Declarations from the script contract strawberry:plugin, version 0.2.0, without source comments.
How to use it: guide.
WIT declarations
use %world.{entity, equipment-viewers};
use text.{text-component};
use item-stack.{item-stack};
use uuid.{uuid};
use player.{player};
enum billboard-mode {
fixed,
vertical,
horizontal,
center,
}
enum item-display-mode {
none,
thirdperson-lefthand,
thirdperson-righthand,
firstperson-lefthand,
firstperson-righthand,
head,
gui,
ground,
fixed,
}
enum text-alignment {
center,
left,
right,
}
record vector3f {
x: f32,
y: f32,
z: f32,
}
record quaternionf {
x: f32,
y: f32,
z: f32,
w: f32,
}
record display-transformation {
translation: vector3f,
scale: vector3f,
left-rotation: quaternionf,
right-rotation: quaternionf,
}
resource display-entity {
from-entity: static func(entity: borrow<entity>) -> option<display-entity>;
get-entity: func() -> entity;
get-transformation: func() -> display-transformation;
set-transformation: func(transformation: display-transformation);
get-interpolation-duration: func() -> s32;
set-interpolation-duration: func(duration: s32);
get-interpolation-start: func() -> s32;
set-interpolation-start: func(delta-ticks: s32);
get-teleport-duration: func() -> s32;
set-teleport-duration: func(duration: s32);
get-billboard: func() -> billboard-mode;
set-billboard: func(mode: billboard-mode);
get-view-range: func() -> f32;
set-view-range: func(range: f32);
get-shadow-radius: func() -> f32;
set-shadow-radius: func(radius: f32);
get-shadow-strength: func() -> f32;
set-shadow-strength: func(strength: f32);
get-display-width: func() -> f32;
set-display-width: func(width: f32);
get-display-height: func() -> f32;
set-display-height: func(height: f32);
get-glow-color-override: func() -> s32;
set-glow-color-override: func(color: s32);
get-brightness: func() -> s32;
set-brightness: func(brightness: s32);
}
resource block-display-entity {
from-entity: static func(entity: borrow<entity>) -> option<block-display-entity>;
get-display: func() -> display-entity;
get-entity: func() -> entity;
get-block-state-id: func() -> u16;
set-block-state-id: func(state-id: u16);
}
enum skin-part {
head,
body,
right-arm,
left-arm,
right-leg,
left-leg,
}
resource item-display-entity {
from-entity: static func(entity: borrow<entity>) -> option<item-display-entity>;
get-display: func() -> display-entity;
get-entity: func() -> entity;
get-item: func() -> option<item-stack>;
set-item: func(item: option<item-stack>);
get-item-display-mode: func() -> item-display-mode;
set-item-display-mode: func(mode: item-display-mode);
show-skin-part: func(part: skin-part, of: borrow<player>, overlay: bool) -> result<_, string>;
}
resource text-display-entity {
from-entity: static func(entity: borrow<entity>) -> option<text-display-entity>;
get-display: func() -> display-entity;
get-entity: func() -> entity;
get-text: func() -> text-component;
set-text: func(text: text-component);
set-text-for: func(viewer: borrow<player>, text: option<text-component>) -> result<_, string>;
get-text-for: func(viewer: borrow<player>) -> option<text-component>;
get-line-width: func() -> s32;
set-line-width: func(width: s32);
get-background: func() -> s32;
set-background: func(color: s32);
get-text-opacity: func() -> s8;
set-text-opacity: func(opacity: s8);
get-shadow: func() -> bool;
set-shadow: func(shadow: bool);
get-see-through: func() -> bool;
set-see-through: func(see-through: bool);
get-default-background: func() -> bool;
set-default-background: func(default-background: bool);
get-alignment: func() -> text-alignment;
set-alignment: func(alignment: text-alignment);
}
resource interaction-entity {
from-entity: static func(entity: borrow<entity>) -> option<interaction-entity>;
get-entity: func() -> entity;
get-width: func() -> f32;
set-width: func(width: f32);
get-height: func() -> f32;
set-height: func(height: f32);
get-response: func() -> bool;
set-response: func(response: bool);
get-last-attacker: func() -> option<uuid>;
get-last-interaction: func() -> option<uuid>;
}
record rig-pose {
piece: u32,
transformation: display-transformation,
}
record rig-keyframe {
tick: u32,
transformation: display-transformation,
}
record rig-track {
piece: u32,
keyframes: list<rig-keyframe>,
}
record rig-animation {
name: string,
length-ticks: u32,
tracks: list<rig-track>,
}
resource display-rig {
create: static func(pieces: list<borrow<display-entity>>) -> result<display-rig, string>;
apply: func(poses: list<rig-pose>, interpolation-ticks: u32) -> result<_, string>;
piece-count: func() -> u32;
add-animation: func(animation: rig-animation) -> result<_, string>;
play: func(name: string, looped: bool) -> result<_, string>;
stop: func();
playing: func() -> option<string>;
}
variant part-look {
item(part-item),
block(u16),
text(text-component),
}
record part-item {
stack: item-stack,
mode: item-display-mode,
}
enum part-follow {
fixed,
body,
head,
}
record attached-part {
look: part-look,
transformation: display-transformation,
billboard: billboard-mode,
follow: part-follow,
turn-ticks: u8,
}
attach-part: func(wearer: borrow<entity>, viewers: equipment-viewers, part: attached-part) -> result<s32, string>;
detach-part: func(wearer: borrow<entity>, id: s32) -> bool;
detach-parts: func(wearer: borrow<entity>);
get-parts: func(wearer: borrow<entity>) -> list<s32>;
set-part-own-view: func(wearer: borrow<entity>, id: s32, shown: bool) -> bool;
enum head-place {
hat,
face,
}
attach-head-part: func(wearer: borrow<entity>, viewers: equipment-viewers, part: attached-part, place: option<head-place>) -> result<s32, string>;
set-part-box: func(wearer: borrow<entity>, id: s32, min: vector3f, max: vector3f) -> bool;