Commands
Kore provides type-safe builders for all Minecraft commands. This page covers both simple and complex command usage with examples.
Commands are used inside Functions to perform actions in the game. For dynamic command arguments, see Macros.
Simple Commands
Simple commands are straightforward and take basic arguments like strings, numbers, or selectors.
Say Command
The say command broadcasts a message to all players in the chat. The message appears with the sender's name (the entity executing the command). For more advanced chat formatting, see Chat Components.
Generated output:
Teleport Command
The teleport (or tp) command instantly moves entities to a new location. You can teleport to absolute coordinates, relative positions, or another entity's location. Optionally specify rotation (yaw/pitch) for the entity to face after teleporting.
Generated output:
Give Command
The give command adds items directly to a player's inventory. If the inventory is full, items drop on the ground. You can specify item count and use Components for custom item data.
Generated output:
Kill Command
The kill command instantly removes entities from the world. Killed entities trigger death events (drops, death messages for players). Use selectors to target specific entity types.
Generated output:
Effect Command
The effect command applies or removes status effects (like Speed, Regeneration, Poison) from entities. Effects have duration (in seconds or infinite) and amplifier levels (0 = level I, 1 = level II, etc.).
Generated output:
Gamemode Command
The gamemode command changes a player's game mode (Survival, Creative, Adventure, Spectator). Each mode has different abilities and restrictions.
Generated output:
Time Command
The time command controls world clocks. Time is measured in ticks (20 ticks = 1 second, 24 000 ticks = 1 Minecraft day). The time property on a Function returns a Time DSL scope.
For a full reference covering world clocks, timelines, time markers, and the timeCheck predicate, see World Clocks.
Basic Time Operations
Generated output:
Querying Timelines
Use query(timeline) to read a timeline's progress, and queryRepetitions(timeline) to read how many times it has looped:
Generated output:
Setting the Day-Night Cycle Rate
Use rate(rate) to control how fast the day-night cycle progresses. 1 is the default speed, 0 freezes the cycle, and the maximum is 1000. This is independent of the server tick rate:
Generated output:
Setting to a Time Marker
TimeMarkerArgument (created with the timeMarker() factory) references a named tick position defined inside a timeline. Pass it to time.set() to jump the clock to that position:
Generated output:
Targeting a Specific Clock with time.of(clock)
When your datapack defines multiple world clocks, use time.of(clock) to scope every subcommand to that clock. It returns a TimeWithClock instance that mirrors the full Time API:
Generated output:
Weather Command
The weather command changes the world's weather state. Clear weather has full sunlight, rain reduces light and affects mob spawning, thunder enables lightning strikes and charged creeper creation.
Generated output:
Summon Command
The summon command spawns a new entity at the specified location. You can provide NBT data to customize the entity's properties (name, AI, equipment, etc.).
Generated output:
The trailing block is the raw NBT builder, so entity tags are written by name and are not type-checked against the entity type.
For item entities, the oop module provides a typed alternative: itemStack(...).summon { } builds the Item compound for you and exposes the common entity tags (Motion, Rotation, Tags, Glowing, NoGravity, PickupDelay, Age, …) as named properties on ItemEntitySummonData instead of string keys. See Items → Configuring the spawned entity.
Higher-level spawning options:
- Spawners - reusable named spawner handles with a fixed type and position.
- Display Entities - block, item, and text displays with transformations and interpolation.
- Mannequins - posable player-model entities.
SetBlock Command
The setblock command places a single block at the specified coordinates. Use modes to control behavior: destroy (drops items), keep (only if air), or replace (default).
Generated output:
Fill Command
The fill command fills a rectangular region with blocks. Modes include: replace (all blocks), hollow (only outer shell), outline (shell without clearing inside), keep (only air blocks), and destroy (drops items).
Generated output:
Enchant Command
The enchant command adds an enchantment to the item held by the target entity. The enchantment must be compatible with the item type. For more control over enchantments, see Enchantments.
Generated output:
Difficulty Command
The difficulty command gets or sets the world's difficulty level (Peaceful, Easy, Normal, Hard). Difficulty affects mob damage, hunger depletion, and whether hostile mobs spawn. Called without arguments it queries the current value.
Generated output:
SpawnPoint Command
The spawnpoint command sets where a player respawns after death. Each player can have their own spawn point. Called without a position it uses the executor's current one, and an optional rotation sets the facing direction on respawn.
Generated output:
SetWorldSpawn Command
The setworldspawn command sets the default spawn point for all new players and players without a personal spawn point. This is where the world compass points to.
Generated output:
StopSound Command
The stopsound command stops currently playing sounds for players. You can filter by sound source (master, music, weather, etc.) and specific sound. Useful for stopping looping sounds or music.
Generated output:
Stopwatch Command
The stopwatch command manages server-side timers that count game ticks. Stopwatches persist across sessions and can be queried in execute conditions. Useful for cooldowns, timed events, and measuring durations.
Generated output:
You can also use stopwatches in execute conditions:
Generated output:
Message Commands
The msg command sends a private message to a specific player, and teammsg sends a message to all members of the sender's team. tell and w are aliases of msg, tm is an alias of teamMsg - each pair emits the same command. See Scoreboards for team management.
Generated output:
Spectate Command
The spectate command makes a player in Spectator mode view the game from another entity's perspective. Call it without arguments to stop spectating, with one argument for the target to spectate, and with two to also name the spectator.
Generated output:
Debug Commands
These commands are server debugging utilities. debug starts/stops profiling and creates a report. perf captures performance metrics for 10 seconds. jfr starts/stops Java Flight Recorder profiling.
Generated output:
Complex Commands
Complex commands have nested structures and multiple sub-commands. Kore provides specialized builders for these.
Execute Command
The execute command is one of the most powerful commands in Minecraft. It allows you to:
- Change the execution context (who/where the command runs)
- Add conditions (only run if criteria are met)
- Store command results in scores or NBT
- Chain multiple modifiers together
The examples below cover the basics. For the full subcommand, condition, store, and run reference, see the dedicated Execute page. Use execute with Predicates for complex conditions.
Basic Execute
Generated output:
Conditions (if/unless), score comparisons, position/dimension/anchoring context, entity relations, and the full subcommand list are documented on the dedicated Execute page. A quick conditional example:
Generated output:
Execute Store
Store command results in scores or NBT:
Generated output:
Data Command
The data command reads and writes NBT (Named Binary Tag) data on entities, block entities (chests, signs, etc.), and command storage. NBT stores complex data like inventory contents, entity attributes, and custom tags. Operations include get (read), merge (combine), modify (change specific paths), and remove (delete).
Basic Data Operations
Generated output:
Data Merge
This merge { ... } block uses the same NBT builder described in NBTs, so you can reuse the same assignment patterns in commands, predicates, and chat-related APIs.
Generated output:
Data Modify
Generated output:
data modify ... <op> string ... [start] [end] is also supported for every string-capable operation (set, append, insert, merge, prepend):
Generated output:
Data Remove
Generated output:
Scoreboard Command
The scoreboard command manages objectives (score types) and player/entity scores. Scoreboards are essential for tracking game state, creating timers, and building game mechanics. See Scoreboards for detailed usage.
Criteria come from the ScoreboardCriteria enum, or from the builders for compound criteria: criteriaKilled(EntityTypes.ZOMBIE), criteriaMined(Blocks.STONE), criteriaTeamKill(FormattingColor.RED), criteriaCustom(...), and friends. Passing a raw string does not compile - ScoreboardCriterion is an interface.
scoreboard.objective(target, "objective") returns a PlayerObjective handle when you want to run several operations on the same score, including the +=, -=, ++, -- operators and the min / max infix operations:
Generated output:
Bossbar Command
The bossbar command creates and controls boss bars - the progress bars normally shown during boss fights. Boss bars can display custom text, colors, and progress values. They're useful for timers, progress indicators, and UI elements.
Team Command
The team command creates and manages teams for players and entities. Teams control PvP (friendly fire), name tag visibility, collision, and chat colors. See Scoreboards for more on teams.
Attribute Command
The attribute command reads and modifies entity attributes like max health, movement speed, attack damage, and armor. You can get/set base values or add temporary modifiers that stack.
Schedule Command
The schedule command delays function execution by a specified time. Useful for timers, cooldowns, and delayed effects. Time can be specified in ticks, seconds, or days. See Scheduler Helper for advanced scheduling patterns.
Loot Command
The loot command generates items from Loot Tables and distributes them to players, containers, or the world. Sources include fishing, killing entities, mining blocks, or direct loot table references.
Generated output:
The target block chooses where items go (give, insert into a container, replaceBlock, replaceEntity) and the source block chooses where they come from (loot, fish, kill, mine). Slot constants come from the item slot types: CONTAINER[n] for block inventories, ARMOR.HEAD and friends for equipment, and MOB.INVENTORY[n] for mobs that carry their own inventory such as villagers and piglins. The last example shows that source { loot { ... } } also accepts an inline loot table instead of a reference.
Particle Command
The particle command spawns visual particle effects in the world. Particles have position, spread (delta), speed, and count. Use force mode to make particles visible from far away or through blocks.
Generated output:
Special Particle Types
Some particles carry extra data beyond a position. The particles { } block exposes one builder per such type:
| Builder | Extra data |
|---|---|
block |
A block state, so the particle matches that block |
blockCrumble |
A block state, for the crumbling effect |
blockMarker |
A block state, used to visualise invisible blocks |
dragonBreath |
A power value |
dust |
A color and a scale |
dustColorTransition |
A start color, a scale, and an end color |
entityEffect |
A color tint |
fallingDust |
A block state |
flash |
An ARGB color |
instantEffect |
A color tint |
item |
An item stack, components included |
sculkCharge |
A roll angle in radians |
shriek |
A delay in ticks |
tintedLeaves |
A color tint |
trail |
A color, a target position, and a duration |
vibration |
A destination position and a travel duration |
Every builder also takes an optional trailing position, and particle(Particles.X) inside the block emits a plain particle with no extra data.
Generated output:
Clone Command
The clone command copies blocks from one region to another. Supports cross-dimension cloning, filtering by block type, and different modes: replace (all blocks), masked (non-air only), move (removes source). Use strict to fail if regions overlap incorrectly.
Generated output:
WorldBorder Command
The worldborder command controls the world border size, position, damage, and warning settings. The time parameter for add and set is specified in ticks.
Generated output:
Selectors
Selectors target entities in the world. Kore provides type-safe selector builders with filters for entity type, distance, scores, NBT, and more. If you want a selector-focused walkthrough beyond the command examples below, read the Selectors page alongside this reference:
Macros
Macros allow dynamic command arguments that are substituted at runtime. They're useful for creating reusable functions with parameters.
Generated output:
For detailed macro usage including macro classes and validation, see Macros.
Raw Commands
For commands not yet supported by Kore or for special cases, use addLine. This is also useful when working with Macros for fully dynamic commands:
Note: Using raw commands bypasses type safety. Prefer the DSL builders when available.
Custom Commands
Create your own command builders for mods or custom functionality. See Functions for more details on the Function context:
Generated output:
For broader composition patterns such as extracting reusable wrappers around commands, the Cookbook gives more realistic project-scale examples.
See Also
- Functions - Create and organize command functions
- Macros - Dynamic command arguments
- Chat Components - Formatted text in commands
- Cookbook - Practical command composition patterns in real datapacks
- World Clocks - World clocks, timelines, time markers, and
timeCheck
External Resources
- Minecraft Wiki: Commands - Complete command reference
- Minecraft Wiki: Target selectors - Selector syntax
