Skip to content

Game Namespace

The Game namespace is Ceremony’s primary API surface. It organizes server-side scripting capabilities into logical sub-namespaces for particles, sounds, combat, entities, scheduling, HUD management, camera control, regions, display entities, events, and state persistence.

All methods are accessed through Game.<namespace>.<method>().


Spawn and shape particle effects in the world. All particle methods accept a level (the server level/world), a particle type (Minecraft particle ID string or a particle type object), a position (Vec3Like), and an optional ParticleOpts object.

PropertyTypeDefaultDescription
countnumber1Number of particles to spawn
speednumber0Particle speed/spread multiplier
dxnumber0X-axis offset/spread
dynumber0Y-axis offset/spread
dznumber0Z-axis offset/spread

Spawns particles at a position, visible to all nearby players.

ParameterTypeDescription
levelanyServer level (world)
typestring | anyParticle type ID or particle object
posVec3LikePosition { x, y, z }
optsParticleOptsOptional particle settings
// Basic particle burst
Game.particles.spawn(level, 'flame', { x: 100, y: 65, z: 200 }, {
count: 30,
speed: 0.1,
dx: 0.5,
dy: 0.5,
dz: 0.5
});
// Smoke cloud at an explosion site
Game.particles.spawn(level, 'large_smoke', pos, {
count: 50,
speed: 0.05,
dx: 1.0,
dy: 0.5,
dz: 1.0
});

Spawns particles visible only to a specific player. Same parameters as spawn, but takes a player instead of level.

ParameterTypeDescription
playeranyTarget ServerPlayer
typestring | anyParticle type ID
posVec3LikePosition { x, y, z }
optsParticleOptsOptional particle settings
// Show a personal waypoint glow to one player
Game.particles.spawnForPlayer(player, 'end_rod', waypointPos, {
count: 10,
speed: 0.02,
dy: 0.3
});

circle(level, type, center, radius, count, opts?)

Section titled “circle(level, type, center, radius, count, opts?)”

Spawns particles in a horizontal circle.

ParameterTypeDescription
levelanyServer level
typestring | anyParticle type ID
centerVec3LikeCenter position
radiusnumberCircle radius in blocks
countnumberNumber of particles around the ring
optsParticleOptsOptional settings
// Summoning circle effect
Game.particles.circle(level, 'enchant', playerPos, 3.0, 40, {
speed: 0.02
});

sphere(level, type, center, radius, count, opts?)

Section titled “sphere(level, type, center, radius, count, opts?)”

Spawns particles in a sphere shape.

ParameterTypeDescription
levelanyServer level
typestring | anyParticle type ID
centerVec3LikeCenter position
radiusnumberSphere radius
countnumberNumber of particles
optsParticleOptsOptional settings
// Protective shield bubble
Game.particles.sphere(level, 'soul_fire_flame', playerPos, 4.0, 80, {
speed: 0.01
});

line(level, type, start, end, count, opts?)

Section titled “line(level, type, start, end, count, opts?)”

Spawns particles along a line between two points.

ParameterTypeDescription
levelanyServer level
typestring | anyParticle type ID
startVec3LikeStart position
endVec3LikeEnd position
countnumberNumber of particles along the line
optsParticleOptsOptional settings
// Laser beam between two points
Game.particles.line(level, 'electric_spark', senderPos, targetPos, 30, {
speed: 0.0
});

spiral(level, type, center, radius, height, count, opts?)

Section titled “spiral(level, type, center, radius, height, count, opts?)”

Spawns particles in a vertical spiral/helix.

ParameterTypeDescription
levelanyServer level
typestring | anyParticle type ID
centerVec3LikeBase center position
radiusnumberSpiral radius
heightnumberTotal spiral height
countnumberNumber of particles
optsParticleOptsOptional settings
// Teleportation effect
Game.particles.spiral(level, 'portal', playerPos, 1.5, 3.0, 60, {
speed: 0.02
});

Spawns a dense beam of particles between two points. Similar to line but optimized for thick, visible beams.

ParameterTypeDescription
levelanyServer level
typestring | anyParticle type ID
startVec3LikeStart position
endVec3LikeEnd position
optsParticleOptsOptional settings
// Beacon-style beam shooting upward
const ground = { x: 100, y: 65, z: 200 };
const sky = { x: 100, y: 120, z: 200 };
Game.particles.beam(level, 'end_rod', ground, sky, {
speed: 0.0
});

Play sounds and sound sequences for players.

Used by Game.sounds.sequence() to define a timed sequence of sounds.

PropertyTypeDefaultDescription
soundstringMinecraft sound identifier
delaynumber0Delay in ticks before playing this sound
volumenumber1.0Volume level
pitchnumber1.0Pitch multiplier

Plays a sound at the player’s location.

ParameterTypeDefaultDescription
playeranyTarget player
soundNamestringMinecraft sound identifier
volumenumber1.0Volume
pitchnumber1.0Pitch
Game.sounds.play(player, 'entity.player.levelup', 0.8, 1.2);

playAt(level, soundName, pos, volume?, pitch?)

Section titled “playAt(level, soundName, pos, volume?, pitch?)”

Plays a sound at a specific world position, audible to all nearby players.

ParameterTypeDefaultDescription
levelanyServer level
soundNamestringMinecraft sound identifier
posVec3LikeWorld position
volumenumber1.0Volume
pitchnumber1.0Pitch
// Explosion sound at a location
Game.sounds.playAt(level, 'entity.generic.explode', { x: 100, y: 65, z: 200 }, 1.0, 0.8);

Plays a timed sequence of sounds for a player. Useful for jingles, fanfares, and musical effects.

ParameterTypeDescription
playeranyTarget player
stepsSoundStep[]Array of sound steps with timing
// Victory jingle
Game.sounds.sequence(player, [
{ sound: 'block.note_block.chime', delay: 0, volume: 0.8, pitch: 1.0 },
{ sound: 'block.note_block.chime', delay: 5, volume: 0.8, pitch: 1.2 },
{ sound: 'block.note_block.chime', delay: 5, volume: 0.8, pitch: 1.5 },
{ sound: 'entity.player.levelup', delay: 10, volume: 1.0, pitch: 1.0 }
]);

Stops a currently playing sound for a player.

ParameterTypeDescription
playeranyTarget player
soundNamestringSound identifier to stop
Game.sounds.stop(player, 'music.creative');

Damage, heal, knockback, and apply effects to entities.

PropertyTypeDefaultDescription
durationnumber200Effect duration in ticks
amplifiernumber0Effect level (0 = level I, 1 = level II, etc.)
ambientbooleanfalseWhether the effect is ambient (translucent particles)
visiblebooleantrueWhether particles are visible
showIconbooleantrueWhether the effect icon appears in the HUD

Deals damage to an entity.

ParameterTypeDescription
entityanyTarget entity
amountnumberDamage amount (in half hearts)
sourceanyOptional damage source
// Deal 4 hearts of damage
Game.combat.damage(targetEntity, 8.0);

Applies knockback to an entity in a direction.

ParameterTypeDescription
entityanyTarget entity
strengthnumberKnockback strength
dirXnumberX direction component
dirZnumberZ direction component
// Knock the entity backward (away from the attacker)
Game.combat.knockback(target, 1.5, directionX, directionZ);

Applies knockback away from a source entity.

ParameterTypeDescription
entityanyTarget entity to knock back
strengthnumberKnockback strength
sourceanyEntity to knock back away from
// Explosive pushback from a boss
Game.combat.knockbackFrom(player, 2.0, bossEntity);

Applies a potion effect to an entity.

ParameterTypeDescription
entityanyTarget entity
effectIdstringEffect ID (e.g., 'speed', 'strength', 'regeneration')
optsEffectOptsOptional effect settings
// Speed boost for 30 seconds (600 ticks), level II
Game.combat.addEffect(player, 'speed', {
duration: 600,
amplifier: 1,
visible: true,
showIcon: true
});
// Invisible glowing effect for tagging
Game.combat.addEffect(target, 'glowing', {
duration: 200,
amplifier: 0,
ambient: true,
visible: false,
showIcon: false
});
// Regeneration for healing over time
Game.combat.addEffect(player, 'regeneration', {
duration: 100,
amplifier: 2,
visible: true
});

Removes a potion effect from an entity.

ParameterTypeDescription
entityanyTarget entity
effectIdstringEffect ID to remove
Game.combat.removeEffect(player, 'poison');

Checks whether an entity has a specific potion effect.

ParameterTypeDescription
entityanyTarget entity
effectIdstringEffect ID to check

Returns: boolean

if (Game.combat.hasEffect(player, 'fire_resistance')) {
msg(player, '<gold>You are immune to fire!');
}

Heals an entity by a specified amount.

ParameterTypeDescription
entityanyTarget entity
amountnumberHeal amount (in half hearts)
// Heal 5 hearts
Game.combat.heal(player, 10.0);

Finds all entities within a spherical radius of a position.

ParameterTypeDescription
levelanyServer level
posVec3LikeCenter position
radiusnumberSearch radius in blocks

Returns: Entity[]

// Area-of-effect damage
const nearby = Game.combat.entitiesInRadius(level, explosionPos, 10);
for (const entity of nearby) {
Game.combat.damage(entity, 6.0);
Game.combat.knockbackFrom(entity, 1.0, explosionPos);
}

Finds all entities within an axis-aligned bounding box.

ParameterTypeDescription
levelanyServer level
minVec3LikeMinimum corner { x, y, z }
maxVec3LikeMaximum corner { x, y, z }

Returns: Entity[]

// Check for entities inside a room
const inRoom = Game.combat.entitiesInBox(level,
{ x: 90, y: 60, z: 190 },
{ x: 110, y: 70, z: 210 }
);
msg(player, `<gray>Entities in room: <white>${inRoom.length}`);

Find, spawn, and query entities and players.

Finds an entity by its UUID.

ParameterTypeDescription
levelanyServer level
uuidstringEntity UUID

Returns: Entity | null

const npc = Game.entities.find(level, 'bb030064-870d-4513-b49b-bba5c92b19c1');
if (npc) {
msg(player, '<gray>Found the NPC!');
}

Finds all entities within a radius of a position.

ParameterTypeDescription
levelanyServer level
posVec3LikeCenter position
radiusnumberSearch radius

Returns: Entity[]

const nearby = Game.entities.near(level, playerPos, 20);

nearOfType(level, pos, radius, entityType)

Section titled “nearOfType(level, pos, radius, entityType)”

Finds entities of a specific type within a radius.

ParameterTypeDescription
levelanyServer level
posVec3LikeCenter position
radiusnumberSearch radius
entityTypestringEntity type ID (e.g., 'minecraft:zombie')

Returns: Entity[]

// Find all nearby zombies
const zombies = Game.entities.nearOfType(level, playerPos, 30, 'minecraft:zombie');
msg(player, `<red>${zombies.length} zombies nearby!`);

Spawns a new entity at a position.

ParameterTypeDescription
levelanyServer level
entityTypestringEntity type ID
posVec3LikeSpawn position

Returns: Entity

// Spawn a villager NPC
const villager = Game.entities.spawn(level, 'minecraft:villager', {
x: 100, y: 65, z: 200
});

Gets all online players, optionally filtered by level/world.

ParameterTypeDescription
levelanyOptional: filter to a specific level/world

Returns: ServerPlayer[]

// All online players
const allPlayers = Game.entities.players();
// Players in a specific world
const overworldPlayers = Game.entities.players(overworldLevel);

Finds an online player by their username.

ParameterTypeDescription
namestringPlayer username (case-insensitive)

Returns: ServerPlayer | null

const target = Game.entities.playerByName('Notch');
if (target) {
msg(target, '<gold>You have been summoned!');
}

Finds an online player by their UUID.

ParameterTypeDescription
uuidstringPlayer UUID

Returns: ServerPlayer | null

const player = Game.entities.playerByUUID('069a79f4-44e9-4726-a5be-fca90e38aaf5');

Schedule delayed, repeating, and sequenced tasks on the server tick loop.

Returned by every(). Use it to control repeating tasks.

MethodReturnsDescription
cancel()voidStops the repeating task
isRunning()booleanWhether the task is still active

Used by sequence() to define ordered steps with delays.

PropertyTypeDescription
delaynumberTicks to wait before executing this step
actionfunctionThe callback to run

Runs a callback once after a delay.

ParameterTypeDescription
ticksnumberDelay in ticks
callbackfunctionFunction to execute
// Despawn entity after 10 seconds
Game.scheduler.after(200, () => {
entity.discard();
});

Runs a callback repeatedly at a fixed interval. Returns a SchedulerHandle to control the task.

ParameterTypeDescription
ticksnumberInterval in ticks between executions
callbackfunctionFunction to execute each interval

Returns: SchedulerHandle

// Regeneration aura: heal nearby players every 3 seconds
const healTask = Game.scheduler.every(60, () => {
const nearby = Game.entities.near(level, shrinePos, 10);
for (const entity of nearby) {
Game.combat.heal(entity, 2.0);
Game.particles.spawnForPlayer(entity, 'heart', entity.position(), {
count: 3, dy: 0.5
});
}
});
// Stop after 2 minutes
Game.scheduler.after(2400, () => {
healTask.cancel();
});
// Check if still running
if (healTask.isRunning()) {
msg(player, '<green>Healing aura is active');
}

Executes a series of steps with individual delays between them.

ParameterTypeDescription
stepsSequenceStep[]Array of delay + action pairs
// Boss spawn sequence
Game.scheduler.sequence([
{
delay: 0,
action: () => {
broadcast('<dark_red>The ground begins to tremble...');
Game.sounds.playAt(level, 'entity.wither.ambient', bossSpawnPos, 1.0, 0.5);
}
},
{
delay: 60,
action: () => {
broadcast('<dark_red>A dark presence emerges!');
Game.particles.sphere(level, 'smoke', bossSpawnPos, 5.0, 100);
}
},
{
delay: 40,
action: () => {
const boss = Game.entities.spawn(level, 'minecraft:wither', bossSpawnPos);
broadcast('<dark_red><bold>THE WITHER HAS ARRIVED!');
Game.particles.sphere(level, 'explosion', bossSpawnPos, 3.0, 50);
}
}
]);

Like delay(), returns a Promise that resolves after a number of ticks. Useful inside async functions.

ParameterTypeDescription
ticksnumberTicks to wait

Returns: Promise<void>

async function phaseTransition() {
broadcast('<yellow>Phase 2 starting in 5 seconds...');
await Game.scheduler.afterAsync(100);
broadcast('<red>Phase 2 has begun!');
}

Manage HUD elements: action bars, boss bars, sidebars, and toast notifications.

PropertyTypeDefaultDescription
titlestringBoss bar title (MiniMessage format)
progressnumber1.0Fill amount from 0.0 to 1.0
colorstring'white'Bar color: 'pink', 'blue', 'red', 'green', 'yellow', 'purple', 'white'
durationnumber0Auto-remove after this many ticks (0 = permanent)
PropertyTypeDefaultDescription
idstringUnique identifier for this sidebar
titlestringSidebar title (MiniMessage format)
linesstring[]Array of lines (MiniMessage format)
durationnumber0Auto-remove after ticks (0 = permanent)
PropertyTypeDescription
titlestringToast title (MiniMessage format)
descriptionstringToast description (MiniMessage format)

Displays a persistent action bar message with an optional duration.

ParameterTypeDefaultDescription
playeranyTarget player
textstringMiniMessage text
durationnumber60Duration in ticks
Game.hud.actionBar(player, '<gold>Mining Zone <gray>- <green>2x XP Active', 200);

Creates or updates a boss bar for a player.

ParameterTypeDescription
playeranyTarget player
idstringUnique ID for this boss bar
optsBossBarOptsBoss bar configuration
// Event timer boss bar
Game.hud.bossBar(player, 'event-timer', {
title: '<gold>Legendary Raid <gray>- <white>4:59 remaining',
progress: 1.0,
color: 'yellow',
duration: 0
});
// Update progress over time
let timeLeft = 6000; // 5 minutes in ticks
const timerHandle = Game.scheduler.every(20, () => {
timeLeft -= 20;
const progress = timeLeft / 6000;
const seconds = Math.floor(timeLeft / 20);
const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
const timeStr = `${mins}:${String(secs).padStart(2, '0')}`;
Game.hud.bossBar(player, 'event-timer', {
title: `<gold>Legendary Raid <gray>- <white>${timeStr} remaining`,
progress: Math.max(0, progress),
color: progress > 0.3 ? 'yellow' : 'red'
});
if (timeLeft <= 0) {
timerHandle.cancel();
Game.hud.removeBossBar(player, 'event-timer');
}
});

Removes a boss bar by ID.

ParameterTypeDescription
playeranyTarget player
idstringBoss bar ID to remove
Game.hud.removeBossBar(player, 'event-timer');

Displays a scoreboard-style sidebar for a player.

ParameterTypeDescription
playeranyTarget player
optsSidebarOptsSidebar configuration
// Quest progress sidebar
Game.hud.sidebar(player, {
id: 'quest-progress',
title: '<gold><bold>Active Quest',
lines: [
'<gray>Catch 3 Water Pokemon',
`<white>Progress: <aqua>${caught}/3`,
'',
'<gray>Reward: <yellow>500 Coins'
],
duration: 0
});
// Update it as progress changes
Game.hud.sidebar(player, {
id: 'quest-progress',
title: '<gold><bold>Active Quest',
lines: [
'<gray>Catch 3 Water Pokemon',
`<white>Progress: <green>${caught}/3 <green>COMPLETE`,
'',
'<gray>Reward: <yellow>500 Coins'
]
});

Removes a sidebar by ID.

ParameterTypeDescription
playeranyTarget player
idstringSidebar ID to remove
Game.hud.removeSidebar(player, 'quest-progress');

Displays a toast notification (the popup that appears in the upper-right corner, like advancement notifications).

ParameterTypeDescription
playeranyTarget player
optsToastOptsToast configuration
// Achievement unlocked toast
Game.hud.toast(player, {
title: '<gold>Achievement Unlocked!',
description: '<gray>Caught your first Shiny Pokemon'
});
// Quest complete toast
Game.hud.toast(player, {
title: '<green>Quest Complete',
description: '<white>Viridian Forest Explorer'
});

Removes all HUD elements (boss bars, sidebars, action bars) from a player.

ParameterTypeDescription
playeranyTarget player
// Clean slate
Game.hud.clear(player);

Control cinematic camera paths and orbits for players.

PropertyTypeDefaultDescription
radiusnumber5.0Orbit radius in blocks
heightnumber2.0Camera height above the target
speednumber1.0Orbit speed multiplier
startAnglenumber0Starting angle in degrees

Plays a predefined camera path for a player.

ParameterTypeDescription
playeranyTarget player
pathIdstringCamera path identifier
// Play a cutscene camera path
Game.camera.play(player, 'intro-flyover');

Stops the current camera path and returns control to the player.

ParameterTypeDescription
playeranyTarget player
Game.camera.stop(player);

Checks if a camera path is currently playing for a player.

ParameterTypeDescription
playeranyTarget player

Returns: boolean

if (Game.camera.isPlaying(player)) {
msg(player, '<gray>Press SHIFT to skip cutscene');
}

Starts an orbiting camera around a target position.

ParameterTypeDescription
playeranyTarget player
targetVec3LikePosition to orbit around
optsOrbitOptsOrbit settings
// Cinematic orbit around a boss arena
Game.camera.orbit(player, arenaCenter, {
radius: 15.0,
height: 8.0,
speed: 0.5,
startAngle: 0
});
// Slow dramatic reveal
Game.camera.orbit(player, monumentPos, {
radius: 25.0,
height: 12.0,
speed: 0.3,
startAngle: 90
});

Stops the orbiting camera for a player.

ParameterTypeDescription
playeranyTarget player
Game.camera.stopOrbit(player);

Checks if the camera is currently orbiting for a player.

ParameterTypeDescription
playeranyTarget player

Returns: boolean

if (Game.camera.isOrbiting(player)) {
Game.camera.stopOrbit(player);
}

Lists all registered camera path IDs.

Returns: string[]

const allPaths = Game.camera.paths();
console.log('Available camera paths:', allPaths.join(', '));

Query Ceremony’s region system. Regions are defined in Ceremony’s configuration and can represent areas like towns, arenas, dungeons, and more.

Gets a region by its ID.

ParameterTypeDescription
regionIdstringRegion identifier

Returns: Region | null

const spawn = Game.regions.get('spawn-area');

Checks if a player is inside a specific region.

ParameterTypeDescription
playeranyTarget player
regionIdstringRegion identifier

Returns: boolean

if (Game.regions.isPlayerIn(player, 'pvp-arena')) {
msg(player, '<red>PvP is enabled in this area!');
}

Checks if a player is inside any region with a specific tag.

ParameterTypeDescription
playeranyTarget player
tagstringRegion tag to check

Returns: boolean

// Check if the player is in any "safe-zone" tagged region
if (Game.regions.isPlayerInTagged(player, 'safe-zone')) {
Game.combat.heal(player, 1.0);
}

Gets all regions the player is currently inside.

ParameterTypeDescription
playeranyTarget player

Returns: Region[]

const regions = Game.regions.getPlayerRegions(player);
for (const region of regions) {
console.log(`Player is in region: ${region.getId()}`);
}

Lists all registered regions.

Returns: Region[]

const allRegions = Game.regions.list();
msg(player, `<gray>Total regions: <white>${allRegions.length}`);

Create and manage floating hologram text displays in the world.

Creates a hologram visible to all players.

ParameterTypeDescription
levelanyServer level
posVec3LikeWorld position
textstringDisplay text (MiniMessage format)

Returns: string — Hologram ID

// Floating label above a shop
const shopLabel = Game.display.hologram(level, { x: 100, y: 67, z: 200 },
'<gold><bold>Pokemon Mart\n<gray>Right-click to open'
);

Creates a hologram visible only to a specific player.

ParameterTypeDescription
playeranyTarget player
posVec3LikeWorld position
textstringDisplay text (MiniMessage format)

Returns: string — Hologram ID

// Personal quest marker
const markerId = Game.display.hologramForPlayer(player,
{ x: 250, y: 70, z: 100 },
'<yellow>Quest Objective\n<gray>Talk to Professor Oak'
);

Removes a hologram by its ID.

ParameterTypeDescription
idstringHologram ID to remove
Game.display.remove(shopLabel);

Gets a hologram by its ID.

ParameterTypeDescription
idstringHologram ID

Returns: Display | null

const display = Game.display.get(shopLabel);

Lists all active holograms.

Returns: Display[]

const displays = Game.display.list();
msg(player, `<gray>Active holograms: <white>${displays.length}`);

Subscribe to and unsubscribe from game events. This is the same API available as the top-level Events global.

Registers an event listener.

ParameterTypeDescription
eventstringEvent name (e.g., 'PlayerJoinEvent')
callbackfunctionFunction to call when the event fires

Returns: string — Subscription ID

const subId = Game.events.on('PlayerJoinEvent', (event) => {
const player = wrapPlayer(event.getEntity());
msg(player, '<green>Welcome!');
});

Unregisters an event listener by its subscription ID.

ParameterTypeDescription
subscriptionIdstringID returned by on()
Game.events.off(subId);

One-shot event pattern:

// Listen for a single event, then unsubscribe
const subId = Events.on('PlayerJoinEvent', (event) => {
const player = wrapPlayer(event.getEntity());
msg(player, '<gold>You are the first player to join!');
Events.off(subId);
});

Persistent global key-value storage that survives server restarts. This is the same API available as the top-level State global.

Retrieves a value from state storage.

ParameterTypeDescription
keystringStorage key

Returns: string | null

const eventActive = Game.state.get('legendary-event-active');

Stores a key-value pair.

ParameterTypeDescription
keystringStorage key
valuestringValue to store
Game.state.set('legendary-event-active', 'true');
Game.state.set('server-launch-date', '2025-01-15');

Checks if a key exists in state storage.

ParameterTypeDescription
keystringStorage key

Returns: boolean

if (!Game.state.has('server-initialized')) {
// First-time server setup
Game.state.set('server-initialized', 'true');
broadcast('<gold>Server initialized for the first time!');
}

Removes a key-value pair from state storage.

ParameterTypeDescription
keystringStorage key to remove
Game.state.remove('legendary-event-active');

Gets all keys currently in state storage.

Returns: string[]

const allKeys = Game.state.keys();
console.log('State keys:', allKeys.join(', '));

Practical example — server-wide kill counter:

function onEnable() {
Events.on('PlayerKillEntityEvent', (event) => {
const current = parseInt(Game.state.get('total-mob-kills') || '0');
Game.state.set('total-mob-kills', (current + 1).toString());
// Milestone announcement every 1000 kills
if ((current + 1) % 1000 === 0) {
broadcast(`<gold>Server Milestone: <white>${current + 1} <gold>total mob kills!`);
}
});
}

The Game.world namespace provides methods for interacting with the world — placing blocks, reading block states, controlling time and weather, and creating environmental effects.

Get the block state at a position.

Parameters: level (ServerLevel), pos (BlockPos) Returns: BlockState

const state = Game.world.getBlock(level, pos);
const blockId = state.getBlock().toString();

Set a block at a position by its registry ID.

Parameters: level (ServerLevel), pos (BlockPos), blockId (string)

Game.world.setBlock(level, pos, 'minecraft:diamond_block');

Game.world.fillBlocks(level, from, to, blockId)

Section titled “Game.world.fillBlocks(level, from, to, blockId)”

Fill a rectangular region with a block type.

Parameters: level (ServerLevel), from (BlockPos), to (BlockPos), blockId (string)

// Fill a 5x5x1 platform with stone
Game.world.fillBlocks(level, from, to, 'minecraft:stone');

Get the current world time in ticks.

Parameters: level (ServerLevel) Returns: number

const time = Game.world.getTime(level);
const isNight = time > 13000 && time < 23000;

Set the world time.

Parameters: level (ServerLevel), ticks (number)

Game.world.setTime(level, 6000); // Set to noon

Get the current weather state as a string.

Parameters: level (ServerLevel) Returns: string"clear", "rain", or "thunder"

const weather = Game.world.getWeather(level);
if (weather === 'thunder') {
broadcast('<yellow>A storm is raging!');
}

Set the world weather.

Parameters: level (ServerLevel), weather (string) — "clear", "rain", or "thunder"

Game.world.setWeather(level, 'rain');

Create an explosion at a position.

Parameters: level (ServerLevel), pos (Vec3), power (number)

Game.world.explosion(level, player.position(), 4.0);

Play a sound at a world position (audible to all nearby players).

Parameters: level (ServerLevel), pos (Vec3), sound (string)

Game.world.playSound(level, pos, 'minecraft:entity.wither.spawn');

The Game.items namespace provides methods for creating, giving, taking, and inspecting items in player inventories.

Create an ItemStack from a registry ID and count.

Parameters: itemId (string), count (number) Returns: ItemStack

const stack = Game.items.create('minecraft:diamond', 64);

Give an item to a player’s inventory.

Parameters: player (ServerPlayer), itemId (string), count (number)

Game.items.give(player, 'minecraft:golden_apple', 5);

Remove items from a player’s inventory.

Parameters: player (ServerPlayer), itemId (string), count (number)

Game.items.take(player, 'minecraft:diamond', 3);

Check if a player has a specific item in their inventory.

Parameters: player (ServerPlayer), itemId (string) Returns: boolean

if (Game.items.has(player, 'minecraft:nether_star')) {
msg(player, '<green>You have the key!');
}

Get the item currently in the player’s main hand.

Parameters: player (ServerPlayer) Returns: ItemStack

const held = Game.items.getMainHand(player);

Get the item in the player’s off hand.

Parameters: player (ServerPlayer) Returns: ItemStack

const shield = Game.items.getOffHand(player);

Get the armor item in a specific slot.

Parameters: player (ServerPlayer), slot (string) — "HEAD", "CHEST", "LEGS", or "FEET" Returns: ItemStack

const helmet = Game.items.getArmor(player, 'HEAD');

Get the full inventory contents as an array of ItemStacks.

Parameters: player (ServerPlayer) Returns: ItemStack[]

const inv = Game.items.getInventory(player);
const diamondCount = inv.filter(s => s.toString().includes('diamond')).length;

Game.items.drop(level, pos, itemId, count)

Section titled “Game.items.drop(level, pos, itemId, count)”

Drop an item entity at a world position.

Parameters: level (ServerLevel), pos (Vec3), itemId (string), count (number)

Game.items.drop(level, player.position(), 'minecraft:emerald', 10);

The Game.http namespace provides methods for making HTTP requests from scripts. All methods return Promises and must be used with .then() or async/await.

Send an HTTP GET request.

Parameters: url (string) Returns: Promise<Response>

Game.http.get('https://api.example.com/data').then((response) => {
const data = JSON.parse(response.body);
Logger.info('Received: ' + data.message);
});

Send an HTTP POST request with a JSON body.

Parameters: url (string), body (string) Returns: Promise<Response>

const payload = JSON.stringify({ player: player.getName(), score: 100 });
Game.http.post('https://api.example.com/scores', payload).then((response) => {
Logger.info('Score submitted: ' + response.status);
});

Send an HTTP PUT request with a JSON body.

Parameters: url (string), body (string) Returns: Promise<Response>

Game.http.put('https://api.example.com/players/1', JSON.stringify({ rank: 'elite' })).then((response) => {
Logger.info('Updated: ' + response.status);
});

Send an HTTP DELETE request.

Parameters: url (string) Returns: Promise<Response>

Game.http.delete('https://api.example.com/sessions/expired').then((response) => {
Logger.info('Cleanup: ' + response.status);
});

Async/await pattern:

async function fetchLeaderboard() {
const response = await Game.http.get('https://api.example.com/leaderboard');
const data = JSON.parse(response.body);
return data.top10;
}

NamespaceMethodsPurpose
Game.particlesspawn, spawnForPlayer, circle, sphere, line, spiral, beamParticle effects and shapes
Game.soundsplay, playAt, sequence, stopSound playback and sequencing
Game.combatdamage, knockback, knockbackFrom, addEffect, removeEffect, hasEffect, heal, entitiesInRadius, entitiesInBoxCombat, effects, and AOE queries
Game.entitiesfind, near, nearOfType, spawn, players, playerByName, playerByUUIDEntity lookup, spawning, and queries
Game.schedulerafter, every, sequence, afterAsyncTick-based scheduling and sequencing
Game.hudactionBar, bossBar, removeBossBar, sidebar, removeSidebar, toast, clearHUD element management
Game.cameraplay, stop, isPlaying, orbit, stopOrbit, isOrbiting, pathsCamera paths and orbits
Game.regionsget, isPlayerIn, isPlayerInTagged, getPlayerRegions, listRegion queries
Game.displayhologram, hologramForPlayer, remove, get, listFloating text displays
Game.eventson, offEvent subscription (same as Events)
Game.stateget, set, has, remove, keysPersistent state (same as State)
Game.worldgetBlock, setBlock, fillBlocks, getTime, setTime, getWeather, setWeather, explosion, playSoundWorld manipulation
Game.itemscreate, give, take, has, getMainHand, getOffHand, getArmor, getInventory, dropItem management
Game.httpget, post, put, deleteHTTP requests (async)