Referencia
Esta página se muestra en inglés.
world
World, entity, mob, chunk, border, and generation resources.
Declarations from the script contract strawberry:plugin, version 0.2.0, without source comments.
How to use it: guide.
WIT declarations
use common.{position, entity-pose, block-pos, nbt-tree};
use block-entity.{block-entity, command-block-entity, block-entity-type};
use text.{text-component};
use scoreboard.{scoreboard};
use particles.{particle, particle-options};
use sounds.{sound, sound-category};
use entity-types.{entity-type};
use biomes.{biome};
use attributes.{attribute, modifier-operation, attribute-modifier};
use item-stack.{item-stack};
use damage-types.{damage-type};
use game-rules.{game-rule, game-rule-value};
use uuid.{uuid};
enum equipment-slot {
main-hand,
off-hand,
feet,
legs,
chest,
head,
body,
saddle,
}
variant equipment-viewers {
one(uuid),
all-others,
}
variant equipment-look {
hidden,
item(item-stack),
}
enum piston-behavior {
normal,
destroy,
block,
ignore,
push-only
}
variant builtin-ai-goal {
swim,
wander-around(f32),
melee-attack(f32),
look-at-player(f32),
look-around,
escape-danger(f32),
avoid-entity(f32),
blaze-attack,
creeper-ignite,
eat-grass,
zombie-attack(f32),
}
enum path-node-type {
blocked,
open,
walkable,
walkable-door,
trapdoor,
powder-snow,
danger-powder-snow,
fence,
lava,
water,
water-border,
rail,
unpassable-rail,
danger-fire,
damage-fire,
danger-other,
damage-other,
door-open,
door-wood-closed,
door-iron-closed,
breach,
leaves,
sticky-honey,
cocoa,
damage-cautious,
danger-trapdoor,
}
enum dye-color {
white,
orange,
magenta,
light-blue,
yellow,
lime,
pink,
gray,
light-gray,
cyan,
purple,
blue,
brown,
green,
red,
black,
}
enum villager-profession {
none,
armorer,
butcher,
cartographer,
cleric,
farmer,
fisherman,
fletcher,
leatherworker,
librarian,
mason,
nitwit,
shepherd,
toolsmith,
weaponsmith,
}
record sheep-data {
color: dye-color,
is-sheared: bool,
}
record wolf-data {
is-tamed: bool,
owner: option<uuid>,
is-sitting: bool,
collar-color: dye-color,
is-angry: bool,
is-begging: bool,
}
record cat-data {
is-tamed: bool,
owner: option<uuid>,
is-sitting: bool,
collar-color: dye-color,
}
enum villager-type {
desert,
jungle,
plains,
savanna,
snow,
swamp,
taiga,
}
record villager-data {
profession: villager-profession,
level: u8,
experience: u32,
}
record creeper-data {
is-powered: bool,
fuse: s32,
is-ignited: bool,
explosion-radius: u8,
}
record slime-data {
size: s32,
}
record enderman-data {
carried-block-state: option<u16>,
is-screaming: bool,
is-staring: bool,
}
record iron-golem-data {
is-player-created: bool,
}
record fox-data {
is-sitting: bool,
is-sleeping: bool,
is-crouching: bool,
}
record ageable-data {
is-baby: bool,
age: s32,
in-love-ticks: s32,
}
record zombie-data {
is-baby: bool,
can-break-doors: bool,
}
record shulker-data {
attached-face: block-direction,
peek-amount: u8,
color: option<dye-color>,
}
variant mob-data {
sheep(sheep-data),
wolf(wolf-data),
cat(cat-data),
villager(villager-data),
creeper(creeper-data),
slime(slime-data),
enderman(enderman-data),
iron-golem(iron-golem-data),
fox(fox-data),
ageable(ageable-data),
zombie(zombie-data),
shulker(shulker-data),
generic,
}
enum explosion-interaction {
none,
block,
mob,
tnt,
trigger,
}
flags block-flags {
notify-neighbors,
notify-listeners,
force-state,
skip-drops,
moved,
skip-redstone-wire-state-replacement,
skip-block-entity-replaced-callback,
skip-block-added-callback,
}
record flammable {
spread-chance: u8,
burn-chance: u8,
}
record block-state {
id: u16,
block-id: u16,
block-name: string,
luminance: u8,
opacity: u8,
hardness: f32,
is-air: bool,
is-liquid: bool,
is-solid: bool,
is-full-cube: bool,
piston-behavior: piston-behavior,
has-random-ticks: bool,
burnable: bool,
tool-required: bool,
sided-transparency: bool,
replaceable: bool,
is-solid-block: bool,
block-entity-type: u16,
instrument: noteblock-instrument,
collision-shapes: list<bounding-box>,
outline-shapes: list<bounding-box>,
down-side-solid: bool,
up-side-solid: bool,
north-side-solid: bool,
south-side-solid: bool,
west-side-solid: bool,
east-side-solid: bool,
down-center-solid: bool,
up-center-solid: bool,
map-color: u8,
properties: list<tuple<string, string>>,
}
enum noteblock-instrument {
harp,
basedrum,
snare,
hat,
bass,
flute,
bell,
guitar,
chime,
xylophone,
iron-xylophone,
cow-bell,
didgeridoo,
bit,
banjo,
pling,
trumpet,
trumpet-exposed,
trumpet-oxidized,
trumpet-weathered,
zombie,
skeleton,
creeper,
dragon,
wither-skeleton,
piglin,
custom-head,
}
record block {
id: u16,
name: string,
hardness: f32,
blast-resistance: f32,
map-color: u8,
slipperiness: f32,
velocity-multiplier: f32,
jump-velocity-multiplier: f32,
item-id: u16,
default-state-id: u16,
state-ids: list<u16>,
is-solid: bool,
is-air: bool,
is-flammable: bool,
flammable: option<flammable>,
}
record block-state-id {
id: u16,
}
enum arm-model {
wide,
slim,
}
variant mannequin-account {
name(string),
id(uuid),
}
record mannequin-profile {
account: option<mannequin-account>,
body-texture: option<string>,
arm-model: option<arm-model>,
}
resource entity {
get-id: func() -> u32;
get-uuid: func() -> uuid;
get-type: func() -> entity-type;
get-position: func() -> position;
get-world: func() -> %world;
get-yaw: func() -> f32;
get-pitch: func() -> f32;
get-head-yaw: func() -> f32;
teleport: func(pos: position, world-ref: %world);
set-velocity: func(velocity: position);
get-velocity: func() -> position;
get-pose: func() -> entity-pose;
set-pose: func(pose: entity-pose, fixed: bool) -> result<_, string>;
set-head-yaw: func(yaw: f32);
set-mannequin-label: func(label: option<text-component>) -> result<_, string>;
set-mannequin-immovable: func(immovable: bool) -> result<_, string>;
set-mannequin-profile: func(profile: mannequin-profile) -> result<_, string>;
get-mannequin-profile: func() -> result<mannequin-profile, string>;
get-name: func() -> text-component;
set-custom-name: func(name: text-component);
get-custom-name: func() -> option<text-component>;
set-custom-name-for: func(viewer: uuid, name: option<text-component>) -> result<_, string>;
get-custom-name-for: func(viewer: uuid) -> option<text-component>;
set-custom-name-visible: func(visible: bool);
is-custom-name-visible: func() -> bool;
is-invulnerable: func() -> bool;
set-invulnerable: func(invulnerable: bool);
get-fire-ticks: func() -> s32;
set-fire-ticks: func(ticks: s32);
get-fall-distance: func() -> f32;
set-fall-distance: func(distance: f32);
get-ticks-lived: func() -> s32;
set-ticks-lived: func(ticks: s32);
is-sneaking: func() -> bool;
set-sneaking: func(sneaking: bool);
is-sprinting: func() -> bool;
set-sprinting: func(sprinting: bool);
is-swimming: func() -> bool;
set-swimming: func(swimming: bool);
is-invisible: func() -> bool;
set-invisible: func(invisible: bool);
is-glowing: func() -> bool;
set-glowing: func(glowing: bool);
is-fall-flying: func() -> bool;
set-fall-flying: func(fall-flying: bool);
is-silent: func() -> bool;
set-silent: func(silent: bool);
has-gravity: func() -> bool;
set-has-gravity: func(gravity: bool);
get-width: func() -> f32;
get-height: func() -> f32;
set-rotation: func(yaw: f32, pitch: f32);
is-on-ground: func() -> bool;
is-on-fire: func() -> bool;
set-on-fire: func(on-fire: bool);
has-visual-fire: func() -> bool;
set-visual-fire: func(visual-fire: bool);
get-portal-cooldown: func() -> u32;
set-portal-cooldown: func(cooldown: u32);
get-remaining-air: func() -> s32;
set-remaining-air: func(air: s32);
get-max-air: func() -> s32;
get-eye-height: func() -> f32;
get-eye-position: func() -> position;
get-nearby-entities: func(x: f64, y: f64, z: f64) -> list<entity>;
get-vehicle: func() -> option<entity>;
set-vehicle: func(vehicle: option<entity>);
get-passengers: func() -> list<entity>;
add-passenger: func(passenger: entity);
remove-passenger: func(passenger: entity);
eject-passengers: func();
get-bounding-box: func() -> bounding-box;
is-in-water: func() -> bool;
is-in-lava: func() -> bool;
remove: func();
try-remove: func() -> bool;
snapshot: func() -> result<list<u8>, snapshot-error>;
get-passenger-attachment-point: func(index: u32) -> option<position>;
add-seat: func(offset: position) -> result<entity, string>;
set-follow-vehicle-yaw: func(follow: bool) -> result<_, string>;
raycast: func(max-distance: f64, fluid-handling: bool) -> option<raycast-result>;
ray-trace-block: func(max-distance: f64, include-fluids: bool) -> option<ray-trace-block-result>;
ray-trace-entity: func(max-distance: f64) -> option<ray-trace-entity-result>;
get-target-entity: func(max-distance: f64) -> option<entity>;
set-custom-data: func(namespace: string, key: string, value: nbt-tree);
get-custom-data: func(namespace: string, key: string) -> option<nbt-tree>;
remove-custom-data: func(namespace: string, key: string);
has-custom-data: func(namespace: string, key: string) -> bool;
as-living: func() -> option<living-entity>;
as-mob: func() -> option<mob>;
is-living: func() -> bool;
is-mob: func() -> bool;
set-persistent: func(persistent: bool);
is-persistent: func() -> bool;
get-spawn-reason: func() -> spawn-reason;
}
enum spawn-reason {
unknown,
natural,
chunk-generation,
spawner,
trial-spawner,
spawner-egg,
dispense-egg,
egg,
bucket,
breeding,
command,
conversion,
reinforcements,
jockey,
rehydration,
nether-portal,
plugin,
other,
}
enum snapshot-error {
too-large,
malformed,
not-allowed,
cancelled,
}
resource living-entity {
as-entity: func() -> entity;
as-mob: func() -> option<mob>;
is-mob: func() -> bool;
get-health: func() -> f32;
set-health: func(health: f32);
get-max-health: func() -> f32;
set-max-health: func(max-health: f32);
damage: func(amount: f32, damage-type: damage-type);
is-dead: func() -> bool;
get-absorption: func() -> f32;
set-absorption: func(amount: f32);
get-attribute-value: func(attr: attribute) -> f64;
get-attribute-base: func(attr: attribute) -> f64;
set-attribute-base: func(attr: attribute, value: f64);
add-attribute-modifier: func(attr: attribute, modifier: attribute-modifier);
remove-attribute-modifier: func(attr: attribute, id: string);
get-attribute-modifiers: func(attr: attribute) -> list<attribute-modifier>;
reset-attribute: func(attr: attribute);
reset-all-attributes: func();
get-equipment: func(slot: equipment-slot) -> option<item-stack>;
set-equipment: func(slot: equipment-slot, stack: option<item-stack>);
clear-equipment: func();
set-equipment-look: func(viewers: equipment-viewers, slot: equipment-slot, look: equipment-look) -> result<_, string>;
clear-equipment-look: func(viewers: equipment-viewers, slot: option<equipment-slot>);
get-equipment-look: func(viewer: uuid, slot: equipment-slot) -> option<equipment-look>;
get-age: func() -> s32;
set-age: func(age: s32);
send-system-message: func(message: text-component);
}
resource mob {
as-entity: func() -> entity;
as-living: func() -> living-entity;
add-ai-goal: func(priority: u8, goal: builtin-ai-goal);
add-custom-ai-goal: func(priority: u8, goal-id: u32);
clear-ai-goals: func();
set-ai-disabled: func(disabled: bool);
is-ai-disabled: func() -> bool;
set-target: func(target: option<entity>);
get-target: func() -> option<entity>;
navigate-to-pos: func(pos: position, speed: f64) -> bool;
navigate-to-entity: func(target: entity, speed: f64) -> bool;
stop-navigation: func();
is-navigating: func() -> bool;
has-reached-destination: func() -> bool;
set-navigation-speed: func(speed: f64);
can-reach: func(pos: position, max-distance: f32) -> bool;
set-pathfinding-malus: func(node-type: path-node-type, malus: f32);
get-pathfinding-malus: func(node-type: path-node-type) -> f32;
look-at: func(pos: position);
look-at-entity: func(target: entity);
get-mob-data: func() -> mob-data;
set-mob-data: func(data: mob-data) -> bool;
villager-type: func() -> option<villager-type>;
set-villager-type: func(kind: villager-type) -> bool;
set-variant-look: func(viewers: equipment-viewers, name: string) -> result<_, string>;
clear-variant-look: func(viewers: equipment-viewers);
get-variant-look: func(viewer: uuid) -> option<string>;
set-freeze-ticks: func(ticks: s32);
get-freeze-ticks: func() -> s32;
}
record raycast-result {
pos: block-pos,
face: block-direction,
}
record ray-trace-block-result {
pos: block-pos,
face: block-direction,
hit-pos: position,
}
record ray-trace-entity-result {
entity: entity,
hit-pos: position,
distance: f64,
}
resource chunk {
get-x: func() -> s32;
get-z: func() -> s32;
get-block-state-id: func(pos: block-pos) -> u16;
get-block-state: func(pos: block-pos) -> block-state;
set-block-state: func(pos: block-pos, state: u16);
get-block: func(pos: block-pos) -> block;
set-block: func(pos: block-pos, block: block);
set-block-by-id: func(pos: block-pos, block-id: u16);
get-biome: func(pos: block-pos) -> biome;
get-biome-name: func(pos: block-pos) -> string;
get-block-entity: func(pos: block-pos) -> option<block-entity-type>;
get-top-block-y: func(x: s32, z: s32) -> s32;
get-sky-light: func(pos: block-pos) -> u8;
get-block-light: func(pos: block-pos) -> u8;
set-custom-data: func(namespace: string, key: string, value: nbt-tree);
get-custom-data: func(namespace: string, key: string) -> option<nbt-tree>;
remove-custom-data: func(namespace: string, key: string);
has-custom-data: func(namespace: string, key: string) -> bool;
get-entities: func() -> list<entity>;
}resource world-border {
get-center-x: func() -> f64;
get-center-z: func() -> f64;
get-center: func() -> position;
set-center: func(x: f64, z: f64);
get-diameter: func() -> f64;
get-size: func() -> f64;
set-diameter: func(diameter: f64, speed: option<u64>);
set-size: func(size: f64);
set-size-transition: func(new-size: f64, time-seconds: u64);
get-target-diameter: func() -> f64;
get-target-speed: func() -> s64;
get-warning-distance: func() -> s32;
set-warning-distance: func(distance: s32);
get-warning-delay: func() -> s32;
set-warning-delay: func(delay: s32);
get-warning-time: func() -> s32;
set-warning-time: func(time: s32);
get-damage-buffer: func() -> f64;
set-damage-buffer: func(buffer: f64);
get-damage-amount: func() -> f64;
set-damage-amount: func(damage: f64);
contains: func(x: f64, z: f64) -> bool;
contains-pos: func(pos: position) -> bool;
reset: func();
}
record bounding-box {
min: position,
max: position,
}
record block-write {
pos: block-pos,
state: u16,
}
record chunk-surface {
colors: list<u8>,
heights: list<s16>,
water-depths: list<u8>,
}
record world-spawn-location {
pos: block-pos,
yaw: f32,
pitch: f32,
}
enum block-direction {
down,
up,
north,
south,
west,
east,
}
resource %world {
get-id: func() -> string;
group: func() -> string;
player-count: func() -> u32;
max-players: func() -> option<u32>;
get-border: func() -> world-border;
get-world-border: func() -> world-border;
get-chunk: func(x: s32, z: s32) -> option<chunk>;
get-block-state-id: func(pos: block-pos) -> u16;
get-block-state: func(pos: block-pos) -> block-state;
set-block-state: func(pos: block-pos, state: u16, update-flags: block-flags);
set-block-states: func(blocks: list<block-write>, update-flags: block-flags) -> result<u32, string>;
fill-cuboid: func(%from: block-pos, to: block-pos, state: u16, update-flags: block-flags) -> result<u32, string>;
get-block-states: func(%from: block-pos, to: block-pos) -> result<list<u16>, string>;
get-block: func(pos: block-pos) -> block;
get-block-id: func(pos: block-pos) -> u16;
set-block: func(pos: block-pos, block: block, update-flags: block-flags);
set-block-by-id: func(pos: block-pos, block-id: u16, update-flags: block-flags);
set-block-by-name: func(pos: block-pos, name: string, update-flags: block-flags) -> bool;
get-time-of-day: func() -> u64;
set-time-of-day: func(time: u64);
get-world-age: func() -> u64;
get-dimension: func() -> string;
get-key: func() -> string;
get-spawn-location: func() -> world-spawn-location;
get-top-block-y: func(x: s32, z: s32) -> s32;
get-motion-blocking-height: func(x: s32, z: s32) -> s32;
get-chunk-surface: func(chunk-x: s32, chunk-z: s32) -> option<chunk-surface>;
is-raining: func() -> bool;
set-raining: func(raining: bool);
is-thundering: func() -> bool;
set-thundering: func(thundering: bool);
broadcast-system-message: func(message: text-component, overlay: bool);
get-scoreboard: func() -> scoreboard;
play-sound: func(sound: sound, category: sound-category, pos: position, volume: f32, pitch: f32);
play-custom-sound: func(sound-name: string, category: sound-category, pos: position, volume: f32, pitch: f32);
play-sound-on-entity: func(entity: borrow<entity>, sound: sound, category: sound-category, volume: f32, pitch: f32) -> result<_, string>;
play-custom-sound-on-entity: func(entity: borrow<entity>, sound-name: string, category: sound-category, volume: f32, pitch: f32) -> result<_, string>;
spawn-particle: func(particle: particle, pos: position, offset: position, max-speed: f32, count: s32);
spawn-particle-with-options: func(options: particle-options, pos: position, offset: position, max-speed: f32, count: u32, long-distance: bool, always-show: bool) -> result<_, string>;
create-explosion: func(pos: position, power: f32, create-fire: bool, interaction: explosion-interaction);
get-sea-level: func() -> s32;
get-min-y: func() -> s32;
get-height: func() -> u32;
get-sky-light: func(pos: block-pos) -> u8;
set-sky-light: func(pos: block-pos, level: u8);
get-block-light: func(pos: block-pos) -> u8;
set-block-light: func(pos: block-pos, level: u8);
get-biome: func(pos: block-pos) -> biome;
get-biome-name: func(pos: block-pos) -> string;
set-biome: func(pos: block-pos, biome: string) -> result<_, string>;
fill-biome: func(%from: block-pos, to: block-pos, biome: string) -> result<u32, string>;
spawn-entity: func(entity-type: entity-type, pos: position) -> entity;
spawn-entity-from-snapshot: func(snapshot: list<u8>, pos: position) -> result<entity, snapshot-error>;
break-block-naturally: func(pos: block-pos) -> bool;
break-block-naturally-with-tool: func(pos: block-pos, tool: borrow<item-stack>) -> bool;
drop-item: func(pos: position, item: borrow<item-stack>, naturally: bool) -> option<entity>;
get-entities: func() -> list<entity>;
get-entities-in-box: func(corner-a: position, corner-b: position) -> result<list<entity>, string>;
get-entity: func(id: uuid) -> option<entity>;
strike-lightning: func(pos: position, effect-only: bool);
ray-trace-blocks: func(start: position, end: position) -> option<position>;
ray-trace-block: func(start: position, end: position, include-fluids: bool) -> option<ray-trace-block-result>;
ray-trace-entity: func(start: position, end: position) -> option<ray-trace-entity-result>;
ray-trace-entities: func(start: position, end: position) -> list<ray-trace-entity-result>;
get-block-entity: func(pos: block-pos) -> option<block-entity-type>;
get-block-entity-nbt: func(pos: block-pos) -> option<list<u8>>;
set-block-entity-nbt: func(pos: block-pos, nbt-data: list<u8>) -> result<_, string>;
get-name: func() -> string;
save: func() -> result<_, string>;
set-chunk-generator: func(generator-id: u32);
set-chunk-generator-scoped: func(generator-id: u32, scope: generator-scope);
set-custom-data: func(namespace: string, key: string, value: nbt-tree);
get-custom-data: func(namespace: string, key: string) -> option<nbt-tree>;
remove-custom-data: func(namespace: string, key: string);
has-custom-data: func(namespace: string, key: string) -> bool;
get-game-rule: func(rule: game-rule) -> game-rule-value;
set-game-rule: func(rule: game-rule, value: game-rule-value);
}
record chunk-area {
min-x: s32,
min-z: s32,
max-x: s32,
max-z: s32,
}
record generator-scope {
area: option<chunk-area>,
phases: list<generation-phase>,
}
register-chunk-generator: func(generator-id: u32, scope: option<generator-scope>) -> result<_, string>;
enum generation-phase {
biomes,
noise,
surface,
features,
}
resource chunk-buffer {
get-x: func() -> s32;
get-z: func() -> s32;
get-min-y: func() -> s32;
get-height: func() -> u32;
set-block-state-id: func(x: u8, y: s32, z: u8, state-id: u16);
get-block-state-id: func(x: u8, y: s32, z: u8) -> u16;
fill-layer: func(y: s32, state-id: u16);
fill-range: func(x: u8, min-y: s32, max-y: s32, z: u8, state-id: u16);
fill-cuboid: func(min-x: u8, min-y: s32, min-z: u8, max-x: u8, max-y: s32, max-z: u8, state-id: u16);
set-biome: func(x: u8, y: s32, z: u8, biome: biome);
fill-biome: func(biome: biome);
fill-biome-cuboid: func(min-x: u8, min-y: s32, min-z: u8, max-x: u8, max-y: s32, max-z: u8, biome: biome);
set-biome-named: func(x: u8, y: s32, z: u8, biome: string) -> bool;
fill-biome-named: func(biome: string) -> bool;
fill-biome-cuboid-named: func(min-x: u8, min-y: s32, min-z: u8, max-x: u8, max-y: s32, max-z: u8, biome: string) -> bool;
}
biome-names: func() -> list<string>;
resolve-block-state: func(name: string, properties: list<tuple<string, string>>) -> option<u16>;
record block-state-info {
name: string,
properties: list<tuple<string, string>>,
}
block-state-to-info: func(state-id: u16) -> option<block-state-info>;
get-block-by-id: func(id: u16) -> option<block>;
get-block-by-name: func(name: string) -> option<block>;
get-all-blocks: func() -> list<block>;
get-all-block-names: func() -> list<string>;
get-block-count: func() -> u32;
get-block-state-count: func() -> u32;
get-states-for-block: func(block: block) -> list<block-state>;
get-states-for-block-id: func(block-id: u16) -> list<block-state>;
get-state-ids-for-block-id: func(block-id: u16) -> list<u16>;
get-block-properties: func(state-id: u16) -> list<tuple<string, string>>;
get-block-from-state-id: func(state-id: u16) -> option<block>;
get-block-from-state: func(state: block-state) -> block;
get-default-state-from-block: func(block: block) -> block-state;
get-default-state-from-block-id: func(block-id: u16) -> option<block-state>;
get-block-state-by-id: func(state-id: u16) -> option<block-state>;