World, blocks, dimensions and effects
Getting a dimension and querying entities
Dimension is the central entry point for querying and changing world state (spawning entities, changing blocks, placing terrain features and so on). You get a dimension with world.getDimension("overworld"), and it is better for performance to get it once and reuse it (Source: ms-learn, creator/Documents/scripting/world-apis.md).
import { world } from "@minecraft/server";
const overworld = world.getDimension("overworld");
// entity query: filter with EntityQueryOptions
const skeletons = overworld.getEntities({ type: "minecraft:skeleton" });
// players only
for (const player of overworld.getPlayers()) {
player.runCommand("say Hello from script");
}
EntityQueryOptions filters by location, distance, type, name, property values and so on. The same options can be given to getPlayers().
Reading and writing blocks
Pick blocks with getBlock(location), getBlockAbove/Below and getTopmostBlock, and get several cells with getBlocks(volume). Writing is setBlockType and setBlockPermutation, and filling an area is fillBlocks(volume, permutation).
const location = { x: 10, y: 64, z: 10 };
const block = overworld.getBlock(location); // the chunk must be loaded
const top = overworld.getTopmostBlock({ x: 10, z: 10 });
overworld.setBlockType({ x: 15, y: 65, z: 15 }, "minecraft:diamond_block");
const biome = overworld.getBiome(location); // biome query
The practical tips are these. Use setBlockType for one cell and fillBlocks for a wide area, and use spawnEntity and spawnItem only in loaded chunks. For player interaction use getPlayers instead of getEntities. Split very large areas with system.runJob and a temporary ticking area (Source: ms-learn, world-apis.md, system-run-guide.md).
World-wide API
world has getAllPlayers, getDimension, getEntity(id), getDay, getTimeOfDay/setTimeOfDay, getAbsoluteTime, getMoonPhase, getDifficulty, gameRules, seed, scoreboard, structureManager, tickingAreaManager, getLootTableManager, getPackSettings, playMusic/queueMusic/stopMusic and so on (Source: ms-learn, World.md).
world.setTimeOfDay(1000);
world.gameRules.doDayLightCycle = false;
world.sendMessage({ translate: "my.pack.welcome" });
Particles, sound, camera
Dimension.spawnParticle("minecraft:...", location, molangVariables), Player.playSound, Dimension.playSound, player.camera.setCamera(...), and on the screen UI side player.onScreenDisplay.setTitle/setActionBar are the basic effect APIs. The particle and sound definitions themselves are resource pack data, and the script only calls them. These are world-changing calls, so in a before event defer them with system.run.
overworld.spawnParticle("minecraft:totem_particle", { x: 0, y: 70, z: 0 });
player.playSound("random.levelup");
player.onScreenDisplay.setTitle("§6Welcome", { fadeInDuration: 10, stayDuration: 40, fadeOutDuration: 10 });
Debug shapes
The debug shapes of @minecraft/debug-utilities draw spatial information in the world. There are DebugBox (collision range, area), DebugSphere (radius), DebugLine (connecting points), DebugArrow (direction), DebugCircle (range) and DebugText (3D label), and runtime statistics are handled with collectRuntimeStats(), plugin statistics with collectPluginStats(), and warning thresholds with disableWatchdogTimingWarnings() (Source: ms-learn, creator/Documents/scripting/developer-tools.md). Do not use them in add-ons for public release.
Custom dimensions
Custom dimensions are registered with dimensionRegistry in system.beforeEvents.startup, and were stabilized around 26.30 (there is also a report that it was 1.26.20). The notes below summarize the registration method and limits.
Community notes
Below are details and workarounds on blocks, chunks, structures and effects gathered from the community research.
Verification level marks follow the legend on the wiki home page. The basis of this page is community reports, and they may differ from the official Mojang documentation.
Blocks, dimensions, chunks, structures
Block and BlockPermutation
- Position:
block.locationis the integer corner, and the center isblock.center()/bottomCenter(). A report thatblock.x/y/zare pure values so cheaper thanblock.location, and a report that destructuring{x,y,z} = blockmakes several API calls so readblock.locationonce, conflict ({conflict}; either way cache repeated access). Most APIs accept any object with x/y/z. Property access such asentity.locationis also an API call. - Neighbors:
above()/below()/north()/south()/east()/west(),offset(). At the top of the worldabove()is air, and at the bottombelow()throws. Next upper air:block.above()?.isAir.Block.typeIdcannot be undefined, and the block itself is undefined only in unloaded chunks. - Permutations:
BlockPermutation.resolve(id, states)(new from type + full states),perm.withState(name, value)(derived from an existing one),getState,getAllStates()(a record),block.setPermutation,block.setType("air")(no resolve needed). Copying state:target.setPermutation(source.permutation)orBlockPermutation.resolve(target.typeId, origin.permutation.getAllStates()). Serialization (notoJSON):typeId + '|' + JSON.stringify(getAllStates()). Valid values:BlockStates.get('age').validValues(min/max summed across states of the same name; a non-iterable array) or try/catchwithState. Cycling states(cur+1) % count. Deprecated states are also exposed. If you put a state value not in the block JSON intowithState, you get "Failed to set property", so put the same value with/setblockto separate the cause. JSON block states have ~16 values per state. Codec between numeric data values and states:https://gist.githubusercontent.com/WavePlayz/63a3bc1cdd8426450780b19762dc17f5/raw/minecraft-block-state-codec.js(1.26.53, based on intrinsicblockstateslist). - Block updates:
setPermutation/setTypedo not cause block updates (doors and levers, and vanilla multi-blocks become half doors). Change to air and then place again. For double blocks such as doors,setTypefails, sorunCommand("setblock ..."). Open/close of custom blocks goes through custom component state (instead of setblock in events). - Multi-blocks (
minecraft:multi_block_part, vertical only):block.getParts()(including itself, the order is observed to be the same as themulti_block_partstate; undefined for chests and beds), the state must be set on all parts (setType/setPermutationon one part breaks or duplicates the block), and rotation iswithState("minecraft:cardinal_direction", ...)on each part permutation.BlockComponentBlockBreakEvent.brokenBlockPermutationhas nogetParts(). Custom doors use the multi-block feature. There is no state change event. Canceling a multi-block placement leaves ghost parts. - Beds: No color state (stored in the block entity,
localizationKeyis always white;getItemStack().localizationKey.split('.')[2]worked in some versions), so colored beds only via structures. Placement needs both halves:BlockPermutation.resolve("minecraft:bed", {head_piece_bit, direction}), direction 0..3 = south, west, north, east (head offsets z+1, x-1, z-1, x+1). A sleeping pose teleport feature for custom beds was added. - State-related facts: Water is always
minecraft:water(source/flowing is the liquid depth state),block.isWaterlogged,setWaterlogged(bool),canContainLiquid("Water")/BlockPermutation.canContainLiquid,isLiquid. The slabminecraft:vertical_halfis the same for bottom and double (use the double slab id).directionandcardinal_directionare two forms of the same direction. Leveropen_bit, dispensertriggered_bit, leavespersistent_bit. Crop agegetState('growth'). Natural generation versus placed cannot be told apart (record on placement). Odd ids:minecraft:darkoak_standing_sign,golden_rail(powered rail),reeds,tropicalfish,zombie_villager_v2,closed_eyeblossom/open_eyeblossom,small_dripleaf_block.BlockTypes.getAll()also includes unreleased blocks. - Other Block APIs:
block.hasTag/getTags,getLightLevel()/dimension.getLightLevel(pos)(stable),getSkyLightLevel(a downward raycast, not the sun position),getRedstonePower,getMapColor()(once beta, 0~1 RGB floats, undefined for many vanilla blocks; theminecraft:map_colorcomponent only for some blocks; a case of generating a static table of map colors for 1084 blocks),getItemStack()(pick-block),localizationKey,SignComponent.setText(text, SignSide.Front)/setWaxed(no glow setter),isAir,isSolid(still beta in 2026-11 so undefined in stable 2.11, and a single report thatisAir/isLiquidare the same; no plan to stabilize - alternatives aregetBlockFromRaywithincludePassableBlocks:falseor an 8-corner raycast full-block check),isValid. The block collision box cannot be changed (use states/permutations), block dynamic tint is impossible (entity render controller), and explosion resistance is not exposed (table).minecraft:replaceablecannot be turned off by permutation. For connecting tables/chairs,minecraft:connection_rule.
Block lookup, fill, raycast
dimension.getBlocks(volume, filter, allowUnloaded): Returns a ListBlockVolume, iterated withgetBlockLocationIterator()(a BlockVolume built from a small corner can produce relative coordinates so you must add the origin). An efficient way to find blocks in a range (includeTypes; a measurement where agetBlockloop took 9 seconds andgetBlocks3 seconds). It gives only a location iterator, so cache any Block references you need separately.ListBlockVolumeis also used to detect blocks a player touched. A report in 2.8.0 that it returned a cut volume. A case wherecontainsBlock(volume, {blockFilter})gave true without obsidian, and a bug whereexcludeTypesis wrong when a waterlogged stair is in the subchunk (MCPE-241274).CompoundBlockVolumecannot be passed tocontainsBlocks/fillBlocks. For simple volume checks, computing directly is faster thanisInside.dimension.fillBlocks(volume, perm|type, { ignoreChunkBoundErrors, blockFilter: {includeTypes, includePermutations} }): The fast path for mass placement (one big call is much faster than many small calls - the cost is per native call). Big volumes are slow, so cut into chunks andrunJob(example of filling 1000x1000: 32x32x32BlockVolumepieces +runJob+yield, aListBlockVolumeper block type,tickingarea add circleviarunCommand). ThematchingBlockreplace filter problem (unresolved, per-block handling recommended). Greedy merging.cloneBlocksreduces lag if you exclude air with a mask. RepeatingsetBlockTypein a loop is also possible.getTopmostBlock({x,z}, minHeight): Very fast (~5 ms/chunk vs raycast ~40 ms), skips transparent/non-solid blocks (leaves, cobweb, water, ice) and can return a non-solid such as a button, returns above the bedrock roof in the Nether, and undefined if the column is not loaded. There is a report that it is beta even in 2.8.0-beta (other reports use it normally, the stable status is{unverified}).dimension.getBlockFromRay(origin, dir, {maxDistance, includePassableBlocks, includeLiquidBlocks, excludeTypes, excludePermutations})(on Dimension, not World;excludePermutationstakes an array of permutations, for example[BlockPermutation.resolve(typeId, {})]):BlockRaycastHit(.block,.face,.faceLocation) or undefined (?.block). It stops at the first solid and cannot return air (implement DDA yourself for targeting air positions).maxDistanceis a Manhattan distance (check yourself if you need Euclidean; a limit of about 320 blocks reported). It can skip very thin blocks and corners and is based on the collision box, not the selection box.includePassableBlocks:falsehides liquids even withincludeLiquidBlocks:true, so usetrue+excludeTypes. Reaching an unloaded chunk givesLocationInUnloadedChunkError(distance limit/try-catch).faceLocationbug: Since 1.21.90 it is based on the nearest corner toward the world origin, not block local, so negative coordinates need a1 - facecorrection (edges are inexact), it is wrong on the -x/-y/-z faces, and in about 1% of cases it cannot tell top/bottom hits apart (MCPE-236442, MCPE-227192, MCPE-223452). Workaround: if the face is Up/East/South and the value on that axis is 0~1e-6, make it 1 (1e-7 is too small, and an unconditional +1 breaks non-full blocks). ThefaceLocationofplayerInteractWithBlockis also reported broken (multi-hitbox blocks like drawers are hard). The ray origin isgetHeadLocation()+ 0.1.
const EPSILON = 1e-6;
function fix(hit){ const f = hit.faceLocation;
if (hit.face == Direction.Up && f.y >= 0 && f.y <= EPSILON) f.y = 1;
if (hit.face == Direction.East && f.x >= 0 && f.x <= EPSILON) f.x = 1;
if (hit.face == Direction.South && f.z >= 0 && f.z <= EPSILON) f.z = 1;
return hit; }
- Entity ray/lookup:
player.getEntitiesFromViewDirection({maxDistance, includeFamilies})is{entity, distance}[], andgetBlockFromViewDirection({maxDistance})is undefined for air.dimension.getEntitiesFromRaywas reported to return 0, so agetEntitiesvolume is more reliable.EntityRaycastOptionshas nominDistance. For precise hits, the slab method on a cached AABB (https://tavianator.com/2022/ray_box_boundary.html). Field of view (FOV) checks use the dot product of the look and target vectors vs cos(angle), and occlusiongetBlockFromRay(exclude glass withexcludeTypes). Mobile aims without a cursor, so look-based hit detection is unstable. A script cannot know "whether it is visible on screen". getEntities(EntityQueryOptions):type(only one),excludeTypes(array; noincludeTypes),families(array, plural),tags,excludeTags,location+maxDistance(maxDistanceneeds a location),volume(like dx/dy/dz fixed to at least one block so it over-selects; for entities on a block usegetEntitiesAtBlockLocation),closest. For several types, onegetEntities()+ a JS Set filter makes fewer engine calls than iterating per type.entity.matches({families:['monster']}). Documentationhttps://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/entityfilter. One user reported it was limited to 16 blocks (unresolved).
Chunks and ticking areas
- Unloaded chunks:
getBlockis undefined or throws (LocationInUnloadedChunkError, so try/catch),setBlockTypeand so on fail, and entities in unloaded chunks are inaccessible from script (invalid; scoreboard participants remain). It follows the simulation distance (not the render distance).dimension.isChunkLoaded(loc)is the only native chunk query (moderate cost, limit the frequency), and the 27.0.20 Preview added chunk load/unload events. In the "unloaded but in memory" chunks that technical players use,getBlockfails andgetBlockFromRayworks. On switching to spectator, chunks can briefly unload on the server./particleworks in unloaded chunks but the API does not. An already loaded chunk cannot be unloaded. - Chunk load event (27.0.20 Preview): it fires only for chunks that are loaded and ticking, that is inside the simulation distance, and it also fires for chunks loaded by a ticking area. There is no value that marks a first-time load, so the script has to record the chunks it already handled. A load event for non-ticking (render-only) chunks, an
isTickingvalue and read-only access to non-ticking chunks are community requests. To decorate world-generated structures, one pattern adds a ticking area when a chunk near the structure starts ticking, so the script finishes before the player gets close. The same decoration can be done with features instead of script, which is faster but less documented. world.tickingAreaManager(TickingAreaManager): appeared in 2025-12 beta, 2.7.0-beta in 2026-02, then a report in 2026-03 that it is "now stable"{unverified}.createTickingArea(id, {dimension, from, to})is an asyncPromise<void>(it used to return a TickingArea; there was a time when the documentation and types disagreed),hasTickingArea,removeTickingArea,getAllTickingAreas; only X/Z of from/to matter. The limit is not the number of areas but the number of ticking chunks per pack (reported as 255, with a report of about 300; overlaps are counted twice), more generous than the 10-limit of/tickingarea. It disappears from the API's view on/reloador rejoining and is removed automatically on world/server shutdown. When used instead of the command, norunTimeoutis needed.- "Created != loaded": The promise resolves before the chunk is loaded or it takes ~8 ticks. There is a report that doing the work after a fixed 3 ticks (2 ticks is unstable) without awaiting the promise worked even at a distance of 4 million blocks, and a report that polling
dimension.getBlock(to)is faster, from 8 ticks to 2 ticks. A bug wheregetEntitiesmissed entities in the area, a leak where old script memory is not released on/reloadafter creating an area (reported as MCPE-236954), and a 1000x1000 build stopping at 1/10 (resumes when the player approaches, unresolved)./schedule on_area_loadedis also an alternative (cannot be canceled). TickingAreaError has no chunk count information. - Patterns: For far away/unknown chunks, check
isChunkLoaded, otherwise create a temporary 1-chunk ticking area, wait, do the work, and remove it. For filling an area, load 16x16 XZ columns at a time (x += 16),fillBlocks, then unload, with a global generator-based queue (class ChunkFiller { requests; *generator() }). Safe teleport: temporary area +getTopmostBlock+ skip non-solid/lava/water. To keep entities across dimensions: one ticking area per dimension on entering the dimension. Aminecraft:tick_worldentity (radius in chunk units) could not load unloaded chunks reached by teleport and was reported broken (MCPE-229817). Pre-generating chunks is done by changing one block and changing it back to force a save{single report}. Ender pearl-type projectiles shot by script do not load chunks. There is no "chunk first generated" event, so use a per-chunk DP marker. - UnloadedUtils (github.com/Nytreon/UnloadedUtils, MIT): Reads unloaded chunks without error with
StructureManager.createFromWorld, and writes into unloaded chunks with structure blocks (not commands or the StructureManager). Slow, placements pile up in a queue in read-only chunks beyond the render distance, entities in fully unloaded chunks cannot be teleported (create a short ticking area, tp, then delete it), "read-only" versus unloaded state cannot be told apart synchronously, and/reloadbreaks the timing. Background article:https://bedrockwiki.com/books/chunks/page/unloaded-chunks. Command blocks run before scripts in a tick, and the scheduled-tick phase processes only 100 events per chunk (the rest wait, a risk of abusing command block starvation). Old chunk loader: ChunkLoader V1.2.0 github.com/gamezaSRC/ChunkLoader.
Structures
world.structureManager:get(id),place(id, dimension, location),createFromWorld(...),createEmpty,Structure.setBlockPermutation,getWorldStructureIds()(only saved/loaded ones),getPackStructureIds()(2.8.0-beta; for pack structure ids the folder name is the namespace, and the default save name ismystructure).StructureSaveMode.World|Disk(Disk is permanent). Vanilla structures cannot be loaded. Structures placed by script are not subject to the 3x3 chunk limit of structure generation, but the maximum XZ size cannot be extended, so split into several structures. Better than structure blocks for arena restoration. StructureManager is stable.- Cautions: A bug where BP structures are not recognized after the first run, large structures such as 96x96 can crash the native call so use jigsaw pieces, loading is asynchronous so wait a fixed number of ticks, place the next after the previous structure is loaded (to prevent corruption), and the game does not unload structures.
/structurefails in non-ticking chunks, and it is resolved by id at load time, so if you save a different area under the same id before the chunk loads, all pending loads use the latest data. Replacing a big map takes 20~30 seconds, so use a custom dimension per map. A case where "can't find structure" was caused by an undefined player/name. Structure format v2 (26.50.24, smaller, cannot be read by old versions). Spread lag with/structure load ... animation.runCommand("place ...")(jigsaw) is disabled in scripts. - jigsaw and dimensions: Place jigsaw with the native
world.structureManager.placeJigsawStructure(identifier, dimension, location, options?), which takes a BlockBoundingBox (optionsignoreStartHeight,includeEntities,keepJigsaws, betaliquidSettings). Large structures that failed with the command worked with the native API, but there is a case of a watchdog crash on a 138x138 jigsaw./place structurein a function or command block at world start was not placed because the chunk was not loaded. When placing a structure in a custom dimension, move there withplayer.teleport(pos, { dimension })to load the chunk and thenworld.structureManager.place(name, dim, pos). jigsaw also works in custom dimensions. - Feature placement:
dimension.placeFeature(feature, location, true)(throws if the tree trunk cannot be placed, vanilla rules apply),Dimension.placeFeatureRule()(blocking, expensive in bulk)./place featurecannot be run from scripts so useplaceFeature, but there is a bug report that only features that have a feature rule are registered, and it does not work for growing multi-cell wide trees. Entities cannot run/place, so request the script with/scriptevent. Checking for a structure at a location:dimension.getGeneratedStructures(location)(1.21.120 beta, an error if unloaded; no locate, so poll the player position)./locate structurealso finds custom jigsaw structures, but scripts cannot read its result. A community library recomputes positions of"type": "minecraft:random_spread"structure sets from the world seed: it uses the Java region seed (rx * 341873128712 + rz * 132897987541 + worldSeed + salt) and the LCGnextInt, andspread_type: "triangular"averages twonextIntrolls. Given the set'sspacing,separationandsalt, it returns the north-west corner of the start chunk (multiples of 16, as/locatedoes); the height cannot be predicted. It approximates the biome filter withworld.seedandDimension.calculateClosestBiomeFromSeed(2.x beta). Chunks generated before the structure was added hold no structure, so those spots are wrong. The author reports about +-30 blocks of accuracy and about a 95% hit rate{single report}.
Custom dimensions
- History:
DimensionRegistry.registerCustomDimensionintroduced in the 2026-04-08 Preview beta, left beta around 2026-06-18, ~26.30 stable. The 1.26.20 release documentation already has a custom dimension section and the 2026-06-26 API documentation also marks it stable, which conflicts with the report that it has been stable since 1.26.20{conflict}. Documentation:https://learn.microsoft.com/en-us/minecraft/creator/documents/scripting/custom-dimension-api-tutorial?view=minecraft-bedrock-stable,https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/dimensionregistry?view=minecraft-bedrock-experimental - Usage:
system.beforeEvents.startup.subscribe(e => e.dimensionRegistry.registerCustomDimension("ns:id")), and movement isentity.teleport(loc, { dimension }). It must be registered on every load (if you stop registering it, it is invalid, and if you register again the builds come back; players in an unregistered dimension go to the Overworld), and the terrain does not need to be regenerated. Deleting data is not possible from script (NBT/leveldb editor). Only a single registration method (no choice of gravity, atmosphere, friction or biome), no terrain generation, features do not work (2026-05), and time and weather are shared with the Overworld (a world clock is planned for 26.50). You cannot enumerate custom dimensions withworld.getDimension, but since 26.50.26DimensionTypes.get/getAllreturn them (only after startup). An unresolved case where teleport works in an item use handler and givesDimension 'custom:test' is invalidin a custom command. Opening a form right before a portal/dimension move hides the loading screen. - State in 2026-09~11: Stable dimensions are tied to the Overworld height and clock, a custom clock and height were added in the Preview, and there is a mention that in the next release dimensions will be defined in JSON (dimension.json).
Dimension.localizationKeyof a custom dimension returns a key without a namespace (for exampledimension.dimensionName1000) and conflicts with other add-ons (MCPE-244151). A case where per-dimensionfillBlocksgave an unloaded-chunk error even though the chunk looked loaded, and a case where one dimension's terrain appeared to bleed into another custom dimension, are unresolved. The upper limit on the number of dimensions is unknown. - Imitating terrain: Generate per chunk with noise +
fillBlocks, put a bedrock marker at the bottom of each chunk to tell whether it was generated without separate storage, and the same seed gives the same world (a DayZ-style template). A case of reaching 10 chunks/second at render distance 64 chunks with a custom scheduler + batching. Landing platforms by structure loading. A dimension can also be used as ItemStack storage.
Biome, weather, time, game rules
- Biome:
dimension.getBiome(location).id(BiomeType; stable since 2.3.0/2.4.0, needs a loaded chunk),findClosestBiome(location, biomeId, {boundingSize})(beta; imitates /locatebiome; "not a function" means beta is not used/a game restart is needed; an error reported in 2026-05),BiomeTypes(once beta only, so copy the result ofgetAll()in beta and hard-code it in stable code), custom biomesBiomeTypes.get(id).Biome.getTags()/climate are beta and not exposed, and vanilla biome tint cannot be changed. For old versions (1.14), environment_sensor + scriptevent (the 1.14 module has nogetBiome, and pre-1.18 ids such asminecraft:swamplanddo not match). A report thatfindClosestBiomewas renamedcalculateClosestBiomeFromSeedand became stable{single report}. - Climate workaround: Precipitation and temperature are still not on
BiomeTypein 2026-11. There are the methods of readingBlockMapColorComponent.tintedColorof a block actually placed in the world and caching per biome (permutation resolve does not work, and it is unreliable in biomes with custom grass color), hard-coding a biome table, or spawning a custom entity that gets a tag through a temperature filter, reading the tag after 1 tick and removing it. - Weather:
dimension.setWeather("Thunderstorm", ticks),getWeather()is beta even after 2.8, there is noisInRain, and weather is global to the Overworld (per-biome rain breaks in multiplayer). - Time and other world:
world.getMoonPhase(),world.getAbsoluteTime(),world.getDefaultSpawnLocation()(0,32767,0 if not set),player.getSpawnPoint()({x,y,z,dimension})/setSpawnPoint(),world.gameRules.spawnRadius/showDeathMessages/keepInventory/naturalRegeneration(the locator bar game rule was renamedplayerWaypoints),WorldClock(26.50+ beta,isPausedstops only the world clock), the world seed (a 26.0 Preview property; previously not exposed),world.playMusic()(the MusicOptions fade was wrong for a long time). There is no equivalent of/tick freeze. Reports disagree on whether a custom world clock is tied to thedoDaylightCyclegame rule{conflict}: the docs and one report say a clock separate fromminecraft:overworldfollows only its own pause, but two people reproduced on a fresh world that a clock registered withevent.worldClockRegistry.registerClock("ns:clock")insystem.beforeEvents.startupalso stops whendodaylightcycleis false, and they did not consider it intended (2026-12, no Mojang answer). The proposed workaround listens to the game rule change event, setsdodaylightcycleback to true and runs/time of minecraft:overworld pauseorresumeaccording to the value the player wanted. The event also fires when the rule is set to the same value,gamerule dodaylightcyclequeries then report the wrong value, and setting a clock's own behavior does not overridedodaylightcycle. For scheduled work (a custom weather system, for example) world clock time markers are recommended overrunIntervalpolling because the timing survives sessions (leave at tick 40 of a 60-tick marker and it fires at tick 60 on rejoin, whilerunIntervalstarts counting again and fires at tick 100){single report}. - Creating explosions:
dimension.createExplosion(a nonlinear jump from radius 4 to 5, and for shaped craters compute a sphere/ellipsoid block list yourself),Entity.setOnFire. - Dynamic lighting: Every tick place
minecraft:light_block(block_light_level) around the entity and erase the previous position.
Visual and audio effects: particles, sound, camera, debug shapes
Particles
dimension.spawnParticle(id, loc, MolangVariableMap)(to everyone) andplayer.spawnParticle(id, loc)(to that player only; 2.0.0 stable, not possible with an RP alone). Blocks have nospawnParticle, so useblock.dimension. The position is the emitter position, so correct withblock.location + 0.5.- MolangVariableMap:
setFloat("r", 5)becomesv.rin the particle JSON (named without a prefix; no boolean, true=1).setFloat("r0", 1)andsetFloat("variable.r0", 1)were both read asv.r0{measured}(example measurement record),setColorRGBA,setVector3,setSpeedAndDirection("variable.actor", speed, dir)becomesvariable.actor.speed/direction_x... "unable to find member variable .x/.y/.z" means you did not pass the variable the particle uses. Few vanilla particles accept color (colored_flame). Vanilla particles:https://github.com/Mojang/bedrock-samples/tree/main/resource_pack/particles - Limits: Cannot be modified after spawning (an emitter entity or respawn), it is client-side so script hit detection and timing cannot be synchronized (use entities), and it is not ray traced. More than ~100~400 per tick lags the client, so use a single Snowstorm custom particle. Particles that follow a player from the server are delayed. A script cannot read particles. A
gfx:linesingle line renderer particle (minimum thickness 0.001, minimum lifetime 0.05,dash_count,projecting_cap0~3,is_dashes_per_block,is_last_filled). - For how to write a particle file that receives variables, and for examples (a per-particle counter, passing a value from an entity animation), see Particles.
Animation and passing client variables
entity.playAnimation(name, {controller, blendOutTime, nextState, players, stopExpression}): The samecontrollerstring cancels the previous animation, and a different string plays simultaneously. For a player it affects only the player's own geometry/animation (attachables are not affected). Animations are client-side so a script cannot read or stop what is playing, and playing right after spawn goes out of sync. The swing animation is hard-coded. Two arguments. A report that ifcontrolleris omitted the default"__runtime_controller"is used and there is no leak. A controller of the same name is overwritten until the client reloads. A report that using the shortname"root"on a player stops the animation and it is not visible in first person. Repeated playback is possible only with an animation controller.- Molang variable injection:
player.playAnimation("animation.x.dummy", {controller: "<unique>", stopExpression: "v.bp_x=1; return 0;"})+ a dummy animation ({"format_version":"1.10.0","animations":{"animation.x.dummy":{"animation_length":0.05}}}) runs Molang on the client (floats only). Attachable sideparent_setup:t.bp_animation = v.bp_animation ?? 0.0;, readingt.*inpre_animation; per player,t.player_name='${player.name}'and comparison withq.get_name. Caution: reusing the same controller name means variables are not updated on later calls, and random names pile up controllers and drop FPS (after 30~60 minutes, not recoverable), so derive the name from variable + value such asanimation_controller_${ns}_${name}_${value}. The variable persists until set again (reset on skin change, exclude the paper doll withq.is_in_ui? 0 : {...}), and for other players to see it, resend on join/range entry. This approach depends on thetempvariable leak (a bug) and is fragile. The option itself does not pass Molang variables, so the/playanimation ... "v.x=1;" ctrlcommand is an alternative. A cleaner path is client-synced entity properties (with a count limit). Attachables read player properties withc.owning_entity -> q.propertyto switch animations/render controllers. - Attachable limits: Particle/sound locators break inside attachables (use the player client entity; only the locators of the first render controller are recognized). A report that repeated playAnimation updates break, and for smooth movement entities are the only way. First-person detection is not possible from script (
variable.is_first_person, attachablec.is_first_person). - Item sway (first-person gun): Sample yaw every tick
d = ((y - prevY + 540) % 360) - 180, smoothv = prev*0.4 + d*0.6, ignore sneaking/samples older than 2 ticks/|v| < 2.2 degrees/tick, and callstartItemCooldown("look_left"|"look_right", 10). The attachablepre_animationreadsq.cooldown_time_remaining('<prefix>_look_left'), a state cannot restart itself so duplicate a/b states are needed, ac.is_first_persongate, and animation length = cooldown (10 ticks,hold_on_last_frame). - Choice: BP animation controllers are trigger based and cheap, while scripts have a higher ceiling and are easier to compose. Running a function on right click is also possible with a player.json controller (
query.is_using_item && query.is_item_name_any('slot.weapon.mainhand', 'ns:item')runs/functioninon_entry). Whether something is held usesquery.is_item_name_any/q.equipped_item_any_tag. Fall detection: send a scriptevent when!q.is_on_ground && q.vertical_speed.
Sound
dimension.playSound/player.playSound: Volume 1 = radius 16 blocks (to widen it, volume and the sound definitionmax_dist, format 1.20.20, MCPE-154378), pitch default 1. A sound that follows the player uses"category": "ui"in sound_definitions (no attenuation). Opinions differ on the default of theplayer.playSoundposition. The volume differs from/playsound.Player.playSoundis heard only by that player, andDimension.playSoundis a world sound everyone hears. No API makes a world or entity attached sound audible to one player only; one report saysSoundInstancein the 2.13.0-beta Preview has arecipientconcept{single report}. Sounds aresounds/+sound_definitions.json(https://wiki.bedrock.dev/concepts/sounds).stopSound:Player.stopSoundis beta, and in stable userunCommand("stopsound ...").- SoundInstance (26.30 preview/beta, 26.40):
playSoundreturns an instance - loop, maximum length,stop,seekTo, pause/fade,durationInfo(broken for a week). No position update/entity attachment (repositioning = stop + play + seekTo). A server sound definition must be registered in both the RP and BP. Occasionally silent/delayed (a fix planned for 26.50). Long music drifts, so splitting into ~5 second pieces is the community solution. MCPE-240513 (1.26.40, including Linux server builds): aplaySoundcall made the player's JS properties read-only, fixed in 26.50, and before that wrap/playsound(losing SoundInstance). TheseekTobug is tracked as MCPE-244596. - Other: Switching the sound listener for a dungeon-style camera is not possible.
Camera
player.camera:setCamera("minecraft:free", {location, facingLocation, rotation, easeOptions:{easeTime, easeType:"Linear"}})(a free camera does not follow dimension changes, so clear after moving and reapply; looking withtargetEntity/offsetFromTargetCenterdid not work),setCamera("minecraft:first_person", {entityOffset, easeOptions})(moves only the visual, the server eye height and interaction raycast stay, so there is no workaround other thanminecraft:scale),"minecraft:follow_orbit"(viewOffset),clear()(only returns to the last client perspective and does not force first person; for first person usesetCamera('minecraft:first_person', {ease:{easeTime:0}})),fade({fadeColor, fadeTime:{fadeInTime, holdTime, fadeOutTime}})(RGB only, no alpha, hold maximum ~10 seconds, minimum 0.5 seconds),setFov(about 30~110, ease options, nogetFovto read the current FOV),attachToEntity({entity, locator: EntityAttachPoint.Head})(beta; only in third-person/orbit presets, so true first-person spectating is impossible, and a report that it did not work in 2026-04),playAnimation(spline, options)(Catmullrom/Linear splines; the game crashes ifrotationKeyFramesis empty, "Linear needs at least 2 control points" actually needs 3, rotation interpolation does not take the shortest path so make yaw/pitch/roll continuous values (356, 360, 361...); clear may not erase the animation; initially position only),addShake(beta 2.11/26.50 preview; if missing, the npm types are old). In first person you can use only FOV, shake and fade. A free camera has no roll, but the Vector3 rotation keyframes ofcamera.playAnimationcan give roll on a predetermined path (not possible while riding). A Catmullrom spline actually needs 4 control points, and the "move camera to point" method ignores rotation. Thecontrol_schemeof a camera preset is not applied, while the/controlschemecommand is. The real camera position cannot be read (Molangquery.camera_rotation,distance_from_camera). Documentation:https://jaylydev.github.io/scriptapi-docs/latest/classes/_minecraft_server.Camera-1.html,https://learn.microsoft.com/en-us/minecraft/creator/documents/camerasystem/cameracommandintroduction?view=minecraft-bedrock-stable- Camera orbiting behind a form: In
system.runInterval, compute a position around the player every tick and callplayer.camera.setCamera("minecraft:free", { location, facingEntity: player, easeOptions: { easeType: EasingType.Linear, easeTime: 0.5 } }), then show theActionFormData. When the form closes, callsystem.clearRunandplayer.camera.clear().{single report} - Ride camera: To change the camera by script, the experimental camera features were needed, and repeated camera commands overwrite
/camera @s clear. Following a fast mount with a free camera + teleport jitters (unresolved). The death camera cannot be removed (instant respawn + your own presentation). There is no clean way to force-close the inventory (damage/dimension change;/camera fadedoes not close it).
Debug shapes and TextPrimitive
@minecraft/debug-utilities(beta only):DebugShapesubclasses (DebugArrow/Box/Circle/Line/Text),new DebugBox(minCorner)+bound = {x,y,z}(a size, not a corner),timeLeft, lowercasedebugDrawer.addShape(box).locationis read-only, and if you do not givesetLocation()a dimension, it renders in all dimensions, so prototype patch so thelocationsetter preservesthis.dimension.rotationdoes not work on non-static shapes (box), andDebugText.rotationworks withuseRotation = true.visibleTo(a player array, 26.0.x changelog).depthTestcould not hide text behind blocks. Debug lines ignore.scale(thick lines are several lines, so expensive), but they are still a cheaper outline method than entities/particles. Debug colors are ignored under Vibrant Visuals. Once disabled on Realms because of a settings mistake. Documentation:https://stirante.com/script/debug-utilities/1.0.0-beta.1.26.40-preview.31/classes/DebugText.html- TextPrimitive / PrimitiveShape (around 26.20,
@minecraft/server; beta in 2.8.0, a report of stable in the Preview):world.primitiveShapesManager.addText(new TextPrimitive(location, "text"), dim),setText()(create once and track with a Map),remove(),attachedTo = entity(thenlocationis an offset relative to the entity, for example the head{x:0,y:2,z:0}; giving world coordinates makes it invisible; the text direction is fixed in world space),scale,visibleTo: Player[],timeLeft,color(RGBA, text alpha ignored; one primitive per color),backgroundColorOverride,textBackfaceVisible,depthTest(unstable with VV on), rotation in degrees +useRotation = true(poor rotation quality). A world-wide limit of 1000, text up to 128 lines x 128 characters (changed in 26.20.22/26), does not follow entity rotation, no shadow. For floating text without an entity (text attached to an entity beyond the render distance looks odd).depthTested/render distance were also backported to name tags. Documentation:https://stirante.com/script/server/2.8.0/classes/TextPrimitive.html
Graphics, aim assist, locator bar
@minecraft/server-graphics: Dynamically changes some Vibrant Visuals (not RTX) settings from script. 26.40 preview.20 beta (BiomeWater.setWavesDepth/DirectionIncrement/Frequency/FrequencyScaling/Mix/Octaves/Pull/Shape/Speed/SpeedScaling- waves must be turned on in the pack for an effect; per-biome custom water cannot turn waves on, so turn them on withdepth: 0inRP/water/default_water.jsonand redefine depth in the custom water file, manifest PBR is needed, and export to match the game version), then left beta in the 2026-08-11 Preview. Value tuning is the Editor Mode "Vibrant Visuals" button. Per-pixel effects (DOF, motion blur) are impossible (a shader is needed). Water/grass tint is biome based so it cannot be changed dynamically. Fog per graphics mode is by script or subpacks. Documentation:https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server-graphics/minecraft-server-graphics?view=minecraft-bedrock-experimental, changeloghttps://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server-graphics/changelog?view=minecraft-bedrock-stable,https://stirante.com/script/server-graphics/1.0.0-beta.1.26.40-preview.20/classes/BiomeWater.html,https://learn.microsoft.com/en-us/minecraft/creator/documents/vibrantvisuals/watercustomization?view=minecraft-bedrock-stable- Fog: Stable has only
/fogpush/pop (removal pops by the user string given at push, not the fog ID; the transition time cannot be set), and beta has FogSettings (https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/fogsettings?view=minecraft-bedrock-experimental). Per-region fog is script +/fog. - Aim assist (beta):
BP/aim_assist/presets/*.json(minecraft:aim_assist_preset:identifier,item_settings,default_item_settings,hand_settings,exclusion_list,liquid_targeting_list; format 1.21.50~1.21.110) andBP/aim_assist/categories/categories.json(minecraft:aim_assist_categories), and the camera presetaim_assist.preset. You cannot create new categories with JSON (onlyminecraft:bucket,empty_handanddefaultcan be overridden), so declare an empty category and in scriptnew AimAssistCategorySettings("ns:name"),setBlockPriorities,world.getAimAssist().addCategory(...), thennew AimAssistPresetSettings(id),setItemSettings,addPreset(category first, insidesystem.run; tested on 2.7.0-beta). The default preset isminecraft:aim_assist_default. - Locator bar:
player.locatorBar.addWaypoint(...),getAllWaypoints(),LocationWaypoint,WaypointTexture.Circle,CustomTexture(0.0~1.0 units, small textures). The most performant way to point at coordinates (action bar; a custom compass is an alternative). Vanilla player waypoints are only via game rules. A problem where a waypoint added inplayerSpawndisappears after rejoining (suspected bug; store in a DP and re-add). Documentation:https://stirante.com/script/server/2.8.0-beta.1.26.20-preview.23/classes/LocatorBar.html
| id | Source | License | Commit | Accessed |
|---|---|---|---|---|
private-research | Private research (-) | - | 2026-11-13 | |
ms-learn | Minecraft Creator documentation (Microsoft Learn) | CC BY 4.0 (documentation), MIT (code) | a9fd1c0 | 2026-11-13 |