From 11b8bf2d52bbf690bbad6168c57a9d4477478f74 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 8 Apr 2026 13:52:06 +0000 Subject: [PATCH 1/3] Initial plan From fb399c6702bcbe37bf1eb18969f598e806c87728 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 8 Apr 2026 14:37:32 +0000 Subject: [PATCH 2/3] docs: add missing error documentation files and improve existing incomplete docs - Create behaviorpack/entity/components/deprecated.md - Create behaviorpack/biome/components/deprecated.md - Create behaviorpack/biome/components/climate/particles.md - Create behaviorpack/biome/components/pre_1.17_component.md - Create behaviorpack/biome/components/replace_biomes/multiple_dimensions.md - Create behaviorpack/functions/missing.md - Create resourcepack/entities/missing.md - Create minecraft/commands/syntax.md (general command syntax page) - Create minecraft/commands/obsolete.md (general obsolete command page) - Improve general/string/invalid.md with description, examples, and fix guidance - Improve general/integer/invalid.md with description, examples, and fix guidance - Improve general/integer/minimum.md with description, examples, and fix guidance - Improve general/integer/maximum.md with description, examples, and fix guidance - Improve general/float/invalid.md with description, examples, and fix guidance - Improve general/boolean/invalid.md with description, examples, and fix guidance - Improve behaviorpack/entity/event/missing.md with trigger details and examples - Improve behaviorpack/entity/aliases.md with deprecation context and fix guidance - Improve behaviorpack/entity/permutations.md with migration example to entity properties - Improve behaviorpack/mcfunction/empty.md with trigger source and fix guidance - Improve minecraft/format_version.md with version format docs and examples - Improve minecraft/selector/invalid.md with detailed trigger explanation - Improve minecraft/mode/invalid.md with description and example - Improve debugger/internal/exception.md with actionable fix steps - Improve molang/optimization/constant-folding.md with examples and hints - Improve behaviorpack/block/components/deprecated.md with deprecation table - Update README.md with full index, naming convention docs, severity table, and quick reference Agent-Logs-Url: https://github.com/Blockception/Minecraft-Error-Codes/sessions/891ec4e6-be95-46af-bbeb-2fb52f889ee2 Co-authored-by: DaanV2 <2393905+DaanV2@users.noreply.github.com> --- README.md | 112 ++++++++++++++++-- .../biome/components/climate/particles.md | 71 +++++++++++ behaviorpack/biome/components/deprecated.md | 77 ++++++++++++ .../biome/components/pre_1.17_component.md | 50 ++++++++ .../replace_biomes/multiple_dimensions.md | 79 ++++++++++++ behaviorpack/block/components/deprecated.md | 70 ++++++++++- behaviorpack/entity/aliases.md | 55 ++++++++- behaviorpack/entity/components/deprecated.md | 47 ++++++++ behaviorpack/entity/event/missing.md | 73 +++++++++++- behaviorpack/entity/permutations.md | 75 +++++++++++- behaviorpack/functions/missing.md | 50 ++++++++ behaviorpack/mcfunction/empty.md | 44 ++++++- debugger/internal/exception.md | 30 ++++- general/boolean/invalid.md | 55 ++++++++- general/float/invalid.md | 44 +++++++ general/integer/invalid.md | 48 ++++++++ general/integer/maximum.md | 32 ++++- general/integer/minimum.md | 32 ++++- general/string/invalid.md | 51 ++++++++ minecraft/commands/obsolete.md | 56 +++++++++ minecraft/commands/syntax.md | 58 +++++++++ minecraft/format_version.md | 67 ++++++++++- minecraft/mode/invalid.md | 52 ++++++++ minecraft/selector/invalid.md | 40 ++++++- molang/optimization/constant-folding.md | 78 +++++++++++- resourcepack/entities/missing.md | 64 ++++++++++ 26 files changed, 1479 insertions(+), 31 deletions(-) create mode 100644 behaviorpack/biome/components/climate/particles.md create mode 100644 behaviorpack/biome/components/deprecated.md create mode 100644 behaviorpack/biome/components/pre_1.17_component.md create mode 100644 behaviorpack/biome/components/replace_biomes/multiple_dimensions.md create mode 100644 behaviorpack/entity/components/deprecated.md create mode 100644 behaviorpack/functions/missing.md create mode 100644 minecraft/commands/obsolete.md create mode 100644 minecraft/commands/syntax.md create mode 100644 resourcepack/entities/missing.md diff --git a/README.md b/README.md index a74b820..13a11e5 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,104 @@ # Minecraft-Error-Codes -The pages for errors codes that can be generated by a diagnoser and referenced + +Documentation for error codes generated by the [Blockception Minecraft Bedrock Language Server](https://github.com/Blockception/minecraft-bedrock-language-server). When you click on an error code in your IDE, you are directed to the corresponding page in this repository. + +## How Error Code URLs Work + +String error codes use dots as separators and map directly to file paths in this repository: + +``` +behaviorpack.entity.event.missing +→ behaviorpack/entity/event/missing.md +``` + +Numeric error codes link to the [codes/main.md](./codes/main.md) page with a fragment anchor. + +## Error Code Naming Convention + +Error codes follow the pattern `...`: + +- **category** — The top-level area: `behaviorpack`, `resourcepack`, `minecraft`, `general`, `json`, `molang`, `project`, `debugger` +- **subcategory** — The specific pack section or feature area (e.g., `entity`, `block`, `mcfunction`) +- **type** — The kind of issue (e.g., `missing`, `invalid`, `deprecated`) +- **detail** — Optional further specificity (e.g., `components`, `event`) + +## Severity Levels + +| Severity | Description | +|---|---| +| **error** | The content is invalid and will not work correctly in Minecraft | +| **warning** | The content uses deprecated or discouraged features that may stop working | +| **info** | Informational notice about the content | +| **hint** | A suggestion for improvement (e.g., performance optimizations) | ## Categories -- [behaviorpack](./behaviorpack/README.md) -- [codes](./codes/README.md) -- [debugger](./debugger/README.md) -- [diagnostics](./diagnostics/README.md) -- [general](./general/README.md) -- [json](./json/README.md) -- [minecraft](./minecraft/README.md) -- [molang](./molang/README.md) -- [project](./project/README.md) -- [resourcepack](./resourcepack/README.md) + +- [behaviorpack](./behaviorpack/README.md) — Behavior pack errors (entities, blocks, functions, biomes, etc.) +- [codes](./codes/main.md) — Numeric diagnostic codes +- [debugger](./debugger/) — Internal language server diagnostic errors +- [diagnostics](./diagnostics/) — Diagnostic component errors +- [general](./general/) — General value type errors (strings, integers, floats, booleans) +- [json](./json/) — JSON parsing and structure errors +- [minecraft](./minecraft/) — Minecraft-specific errors (selectors, commands, modes, format versions) +- [molang](./molang/) — Molang expression errors and optimizations +- [project](./project/) — Project configuration errors +- [resourcepack](./resourcepack/README.md) — Resource pack errors (animations, entities, sounds, textures, etc.) + +## Common Error Codes Quick Reference + +### General +| Code | Description | +|---|---| +| [`general.string.invalid`](./general/string/invalid.md) | Invalid Minecraft string (e.g., unquoted spaces) | +| [`general.integer.invalid`](./general/integer/invalid.md) | Value is not a valid integer | +| [`general.integer.minimum`](./general/integer/minimum.md) | Integer below the minimum allowed value | +| [`general.integer.maximum`](./general/integer/maximum.md) | Integer above the maximum allowed value | +| [`general.float.invalid`](./general/float/invalid.md) | Value is not a valid float | +| [`general.boolean.invalid`](./general/boolean/invalid.md) | Value is not a valid boolean | + +### JSON +| Code | Description | +|---|---| +| [`json.invalid`](./json/invalid.md) | Invalid JSON structure or syntax | + +### Minecraft +| Code | Description | +|---|---| +| [`minecraft.format_version`](./minecraft/format_version.md) | Format version is missing, invalid, or outdated | +| [`minecraft.selector.invalid`](./minecraft/selector/invalid.md) | Invalid target selector | +| [`minecraft.commands..syntax`](./minecraft/commands/syntax.md) | Command syntax error | +| [`minecraft.commands..obsolete`](./minecraft/commands/obsolete.md) | Obsolete command syntax | + +### Behavior Pack +| Code | Description | +|---|---| +| [`behaviorpack.mcfunction.empty`](./behaviorpack/mcfunction/empty.md) | Empty mcfunction file | +| [`behaviorpack.functions.missing`](./behaviorpack/functions/missing.md) | Cannot find function definition | +| [`behaviorpack.entities.missing`](./behaviorpack/entities/missing.md) | Cannot find entity definition | +| [`behaviorpack.entity.event.missing`](./behaviorpack/entity/event/missing.md) | Entity event not defined | +| [`behaviorpack.entity.permutations`](./behaviorpack/entity/permutations.md) | Deprecated entity permutations | +| [`behaviorpack.entity.aliases`](./behaviorpack/entity/aliases.md) | Deprecated entity aliases | +| [`behaviorpack.entity.components.deprecated`](./behaviorpack/entity/components/deprecated.md) | Deprecated entity component | +| [`behaviorpack.block.components.deprecated`](./behaviorpack/block/components/deprecated.md) | Deprecated block component | +| [`behaviorpack.biome.components.deprecated`](./behaviorpack/biome/components/deprecated.md) | Deprecated biome component | + +### Resource Pack +| Code | Description | +|---|---| +| [`resourcepack.animation.missing`](./resourcepack/animation/missing.md) | Cannot find animation definition | +| [`resourcepack.entities.missing`](./resourcepack/entities/missing.md) | Cannot find resource pack entity definition | + +### Molang +| Code | Description | +|---|---| +| [`molang.optimization.constant-folding`](./molang/optimization/constant-folding.md) | Constant expression can be pre-calculated | + +### Internal +| Code | Description | +|---|---| +| [`debugger.internal.exception`](./debugger/internal/exception.md) | Internal language server exception | +| [`project.settings`](./project/settings.md) | Project configuration issue | ## Documents -- [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) -- [CONTRIBUTING](CONTRIBUTING.md) \ No newline at end of file +- [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) +- [CONTRIBUTING](CONTRIBUTING.md) diff --git a/behaviorpack/biome/components/climate/particles.md b/behaviorpack/biome/components/climate/particles.md new file mode 100644 index 0000000..da62fe6 --- /dev/null +++ b/behaviorpack/biome/components/climate/particles.md @@ -0,0 +1,71 @@ +# Biome - Climate - Particles + +`behaviorpack.biome.components.climate.particles` + +**Severity:** warning + +## Description + +The particle capability inside the `minecraft:climate` biome component has been moved to `client_biome.json` files. Defining particles in the server-side biome definition no longer has any effect. + +## What triggers this error + +This warning is triggered when the language server detects a `particles` property inside the `minecraft:climate` component of a behavior pack biome definition. Since Minecraft moved ambient particle effects to client-side biome definitions, this server-side property is no longer processed. + +## Example + +The following biome definition uses the deprecated climate particles property: + +```jsonc +{ + "format_version": "1.13.0", + "minecraft:biome": { + "description": { + "identifier": "example:my_biome" + }, + "components": { + "minecraft:climate": { + "temperature": 0.8, + "downfall": 0.4, + "particles": [ + { + "id": "minecraft:ambient_block_chance", + "chance": 0.01 + } + ] + } + } + } +} +``` + +## How to fix + +Move the particle definition to the client-side `client_biome.json` file. Create or update the corresponding file in your resource pack: + +```jsonc +// resource_pack/biomes_client/example:my_biome.json +{ + "format_version": "1.21.0", + "minecraft:client_biome": { + "description": { + "identifier": "example:my_biome" + }, + "components": { + "minecraft:ambient_particles": { + "particle": { + "id": "minecraft:ambient_block_chance", + "chance": 0.01 + } + } + } + } +} +``` + +Remove the `particles` property from the `minecraft:climate` component in your behavior pack biome file. + +## Related errors + +- [behaviorpack.biome.components.deprecated](../deprecated.md) +- [behaviorpack.biome.components.pre_1.17_component](../pre_1.17_component.md) diff --git a/behaviorpack/biome/components/deprecated.md b/behaviorpack/biome/components/deprecated.md new file mode 100644 index 0000000..65a9984 --- /dev/null +++ b/behaviorpack/biome/components/deprecated.md @@ -0,0 +1,77 @@ +# Biome - Components - Deprecated + +`behaviorpack.biome.components.deprecated` + +**Severity:** warning + +## Description + +A deprecated biome component is being used in this biome definition. These components have been removed or replaced in newer versions of Minecraft Bedrock and may not work correctly. + +## What triggers this error + +This error is triggered when the language server detects a known deprecated biome component. Known deprecated components include: + +- `minecraft:surface_parameters` — replaced by `minecraft:surface_builder` +- `minecraft:frozen_ocean_surface` — replaced by `minecraft:surface_builder` +- `minecraft:mesa_surface` — replaced by `minecraft:surface_builder` +- `minecraft:overworld_generation_rules` — superseded by newer world generation APIs +- `minecraft:climate` (partially deprecated features) + +## Example + +The following biome definition uses a deprecated surface component: + +```jsonc +{ + "format_version": "1.13.0", + "minecraft:biome": { + "description": { + "identifier": "example:my_biome" + }, + "components": { + "minecraft:surface_parameters": { + "top_material": "minecraft:grass", + "mid_material": "minecraft:dirt", + "sea_floor_material": "minecraft:gravel", + "foundation_material": "minecraft:stone", + "sea_material": "minecraft:water" + } + } + } +} +``` + +## How to fix + +Replace deprecated surface parameter components with `minecraft:surface_builder`: + +```jsonc +{ + "format_version": "1.21.0", + "minecraft:biome": { + "description": { + "identifier": "example:my_biome" + }, + "components": { + "minecraft:surface_builder": { + "identifier": "minecraft:default_surface_builder", + "top_material": "minecraft:grass", + "mid_material": "minecraft:dirt", + "sea_floor_material": "minecraft:gravel", + "foundation_material": "minecraft:stone", + "sea_material": "minecraft:water" + } + } + } +} +``` + +Refer to the [Minecraft Bedrock biome documentation](https://learn.microsoft.com/en-us/minecraft/creator/reference/content/biomereference/) for the current list of supported biome components. + +## Related errors + +- [behaviorpack.biome.components.climate.particles](climate/particles.md) +- [behaviorpack.biome.components.pre_1.17_component](pre_1.17_component.md) +- [behaviorpack.biome.components.replace_biomes.multiple_dimensions](replace_biomes/multiple_dimensions.md) +- [behaviorpack.block.components.deprecated](../../block/components/deprecated.md) diff --git a/behaviorpack/biome/components/pre_1.17_component.md b/behaviorpack/biome/components/pre_1.17_component.md new file mode 100644 index 0000000..532279c --- /dev/null +++ b/behaviorpack/biome/components/pre_1.17_component.md @@ -0,0 +1,50 @@ +# Biome - Pre 1.17 Component + +`behaviorpack.biome.components.pre_1.17_component` + +**Severity:** warning + +## Description + +This biome definition uses a component that predates the Caves and Cliffs update (1.17). These pre-1.17 biome components do not work with custom biomes created using behavior packs and will be silently ignored. + +## What triggers this error + +This warning is triggered when the language server detects biome components that were part of the legacy biome system used before the Caves and Cliffs update. These components were designed for the old world generation pipeline and are incompatible with the custom biome API available to content creators. + +Examples of affected components include older overworld generation components that relied on the pre-1.17 world generation system. + +## Example + +The following biome definition uses a legacy component that is incompatible with custom biomes: + +```jsonc +{ + "format_version": "1.13.0", + "minecraft:biome": { + "description": { + "identifier": "example:my_biome" + }, + "components": { + "minecraft:overworld_generation_rules": { + "hills_transformation": "jungle_hills", + "shore_transformation": "beach", + "generate_for_climates": [ + ["cold", 1] + ] + } + } + } +} +``` + +## How to fix + +Remove or replace the pre-1.17 component with a modern equivalent. For world generation, refer to the current Minecraft Bedrock [custom biomes documentation](https://learn.microsoft.com/en-us/minecraft/creator/documents/custombiomes) to understand which components are supported for add-on biomes. + +Note that not all biome features available to vanilla Minecraft biomes can be replicated through the custom biome API. Some features are restricted to built-in biomes only. + +## Related errors + +- [behaviorpack.biome.components.deprecated](deprecated.md) +- [behaviorpack.biome.components.replace_biomes.multiple_dimensions](replace_biomes/multiple_dimensions.md) diff --git a/behaviorpack/biome/components/replace_biomes/multiple_dimensions.md b/behaviorpack/biome/components/replace_biomes/multiple_dimensions.md new file mode 100644 index 0000000..bad3321 --- /dev/null +++ b/behaviorpack/biome/components/replace_biomes/multiple_dimensions.md @@ -0,0 +1,79 @@ +# Biome - Replace Biomes - Multiple Dimensions + +`behaviorpack.biome.components.replace_biomes.multiple_dimensions` + +**Severity:** warning + +## Description + +This biome definition attempts to replace biomes in both the Overworld and the Nether simultaneously. Using biome replacement for multiple dimensions in a single biome definition is discouraged as it can cause unexpected behavior and conflicts. + +## What triggers this error + +This warning is triggered when the language server detects that a biome's replace biomes component targets more than one dimension. Each biome replacement should target a single dimension to avoid conflicts and ensure predictable behavior. + +## Example + +The following biome definition incorrectly targets multiple dimensions: + +```jsonc +{ + "format_version": "1.16.0", + "minecraft:biome": { + "description": { + "identifier": "example:my_custom_biome" + }, + "components": { + "minecraft:overworld_height": { + "noise_params": [0, 0.1] + }, + "minecraft:nether_generation_rules": { + "target_percentage": 0.1 + } + } + } +} +``` + +## How to fix + +Split the biome definition into separate files, one per dimension: + +```jsonc +// example:my_custom_biome_overworld.json +{ + "format_version": "1.16.0", + "minecraft:biome": { + "description": { + "identifier": "example:my_custom_biome_overworld" + }, + "components": { + "minecraft:overworld_height": { + "noise_params": [0, 0.1] + } + } + } +} +``` + +```jsonc +// example:my_custom_biome_nether.json +{ + "format_version": "1.16.0", + "minecraft:biome": { + "description": { + "identifier": "example:my_custom_biome_nether" + }, + "components": { + "minecraft:nether_generation_rules": { + "target_percentage": 0.1 + } + } + } +} +``` + +## Related errors + +- [behaviorpack.biome.components.deprecated](../deprecated.md) +- [behaviorpack.biome.components.pre_1.17_component](../pre_1.17_component.md) diff --git a/behaviorpack/block/components/deprecated.md b/behaviorpack/block/components/deprecated.md index 878e80a..d28395b 100644 --- a/behaviorpack/block/components/deprecated.md +++ b/behaviorpack/block/components/deprecated.md @@ -1,3 +1,71 @@ # Block - Components - Deprecated -This error is thrown when a deprecated block component has been used. Either the error message reports which components is replacing it, or an entirely new work around is needed +`behaviorpack.block.components.deprecated` + +**Severity:** warning + +## Description + +A deprecated block component is being used in this block definition. The component has been replaced by a newer equivalent and will not work correctly in current versions of Minecraft Bedrock. + +## What triggers this error + +This warning is triggered when the language server detects a known deprecated block component. The diagnoser maintains a list of deprecated components and their replacements. Common deprecated components include: + +| Deprecated Component | Replacement | +|---|---| +| `minecraft:aim_collision` | `minecraft:selection_box` | +| `minecraft:block_light_absorption` | `minecraft:light_dampening` | +| `minecraft:destroy_time` | `minecraft:destructible_by_mining` | +| `minecraft:explosion_resistance` | `minecraft:destructible_by_explosion` | +| `minecraft:immovable` | `minecraft:push_reaction` | +| `minecraft:ticking` | `minecraft:queued_ticking` | +| `minecraft:breathability` | _(removed)_ | + +Source: `packages/bedrock-diagnoser/src/diagnostics/behavior-pack/block/components/diagnose.ts` + +## Example + +The following block definition uses the deprecated `minecraft:destroy_time` component: + +```jsonc +{ + "format_version": "1.16.0", + "minecraft:block": { + "description": { + "identifier": "example:my_block" + }, + "components": { + "minecraft:destroy_time": 2.0 + } + } +} +``` + +## How to fix + +Replace the deprecated component with its modern equivalent: + +```jsonc +{ + "format_version": "1.20.0", + "minecraft:block": { + "description": { + "identifier": "example:my_block" + }, + "components": { + "minecraft:destructible_by_mining": { + "seconds_to_destroy": 2.0 + } + } + } +} +``` + +The error message in your IDE will typically name the replacement component. Refer to the [Minecraft Bedrock block component documentation](https://learn.microsoft.com/en-us/minecraft/creator/reference/content/blockreference/examples/blockcomponents/) for the full list of current block components. + +## Related errors + +- [behaviorpack.block.components.creative_category.deprecated](creative_category/deprecated.md) +- [behaviorpack.entity.components.deprecated](../../entity/components/deprecated.md) +- [behaviorpack.biome.components.deprecated](../../biome/components/deprecated.md) diff --git a/behaviorpack/entity/aliases.md b/behaviorpack/entity/aliases.md index 0ea60b3..d16cbbd 100644 --- a/behaviorpack/entity/aliases.md +++ b/behaviorpack/entity/aliases.md @@ -1,3 +1,56 @@ # Entity - Aliases -Entity aliases have been removed in [1.21.20+](https://feedback.minecraft.net/hc/en-us/articles/29110275666957-Minecraft-1-21-20-Bedrock) +`behaviorpack.entity.aliases` + +**Severity:** warning + +## Description + +Entity aliases have been removed as of Minecraft Bedrock [1.21.20](https://feedback.minecraft.net/hc/en-us/articles/29110275666957-Minecraft-1-21-20-Bedrock). Using the `aliases` section in an entity definition will have no effect in current versions. + +## What triggers this error + +This warning is triggered when the language server detects an `aliases` block in a behavior pack entity definition. The `aliases` feature allowed entities to be referenced by alternative identifiers, but this capability was removed in the 1.21.20 update. + +## Example + +The following entity definition uses the deprecated aliases feature: + +```jsonc +{ + "format_version": "1.16.0", + "minecraft:entity": { + "description": { + "identifier": "example:my_entity", + "aliases": { + "example:my_entity_alias": {} + } + }, + "components": {} + } +} +``` + +## How to fix + +Remove the `aliases` block from the entity's `description`. If you need the entity to be accessible by multiple identifiers, consider: + +1. Creating separate entity definition files for each identifier +2. Using spawn rules to control where each variant spawns +3. Using entity properties and variants instead of aliases + +```jsonc +{ + "format_version": "1.21.20", + "minecraft:entity": { + "description": { + "identifier": "example:my_entity" + }, + "components": {} + } +} +``` + +## Related errors + +- [behaviorpack.entity.permutations](../permutations.md) diff --git a/behaviorpack/entity/components/deprecated.md b/behaviorpack/entity/components/deprecated.md new file mode 100644 index 0000000..5593f46 --- /dev/null +++ b/behaviorpack/entity/components/deprecated.md @@ -0,0 +1,47 @@ +# Entity - Components - Deprecated + +`behaviorpack.entity.components.deprecated` + +**Severity:** warning + +## Description + +A deprecated entity component is being used in this entity definition. The component has been removed or superseded and may not function as expected in current versions of Minecraft Bedrock. + +## What triggers this error + +This error is triggered by the language server when it detects a known deprecated entity component in the entity's `components` or `component_groups` sections. The diagnoser checks a list of deprecated component identifiers and reports this warning for each one found. + +## Example + +The following entity definition uses a deprecated component: + +```jsonc +{ + "format_version": "1.16.0", + "minecraft:entity": { + "description": { + "identifier": "example:my_entity" + }, + "components": { + "minecraft:breathable": { + "totalSupply": 15 + } + } + } +} +``` + +## How to fix + +Replace the deprecated component with its modern equivalent. The error message typically indicates which component should be used as a replacement. Check the [Minecraft Bedrock documentation](https://learn.microsoft.com/en-us/minecraft/creator/reference/content/entityreference/examples/entitycomponents/) for the current list of supported components and their replacements. + +Common replacements: +- Update the component identifier to the current version +- Review the Minecraft release notes for the version where the deprecation was introduced +- If no replacement exists, the feature may need to be re-implemented using a different approach + +## Related errors + +- [behaviorpack.entity.component.missing](../component/missing.md) +- [behaviorpack.block.components.deprecated](../../block/components/deprecated.md) diff --git a/behaviorpack/entity/event/missing.md b/behaviorpack/entity/event/missing.md index fb8099b..d4536a6 100644 --- a/behaviorpack/entity/event/missing.md +++ b/behaviorpack/entity/event/missing.md @@ -2,4 +2,75 @@ `behaviorpack.entity.event.missing` -This event is called on an entity that does not define the event. \ No newline at end of file +**Severity:** warning + +## Description + +An entity event is referenced somewhere in the entity definition, but the event is not defined in that entity's `events` section. + +## What triggers this error + +This warning is triggered by the language server when a reference to an entity event (e.g., in a component's `on_hurt` or `on_death` callback, or in a `minecraft:trigger` component) points to an event identifier that does not exist in the entity's `events` block. The diagnoser reports: `Entity has no event ""`. + +## Example + +The following entity definition references the event `example:do_something` in a trigger, but the event is not defined: + +```jsonc +{ + "format_version": "1.16.0", + "minecraft:entity": { + "description": { + "identifier": "example:my_entity" + }, + "components": { + "minecraft:health": { + "value": 20, + "max": 20 + }, + "minecraft:hurt_on_condition": { + "damage_conditions": [ + { + "filters": { "test": "in_lava" }, + "cause": "lava", + "damage_per_tick": 4 + } + ] + }, + "minecraft:on_death": { + "event": "example:do_something" // Error: this event is not defined below + } + }, + "events": { + // "example:do_something" is missing here + } + } +} +``` + +## How to fix + +Either add the missing event definition to the entity's `events` section: + +```jsonc +"events": { + "example:do_something": { + "add": { + "component_groups": ["example:dead_state"] + } + } +} +``` + +Or correct the event name to match one that is already defined: + +```jsonc +"minecraft:on_death": { + "event": "example:existing_event" +} +``` + +## Related errors + +- [behaviorpack.entity.component_group.missing](../component_group/missing.md) +- [behaviorpack.entity.component.missing](../component/missing.md) \ No newline at end of file diff --git a/behaviorpack/entity/permutations.md b/behaviorpack/entity/permutations.md index b402b82..4752d79 100644 --- a/behaviorpack/entity/permutations.md +++ b/behaviorpack/entity/permutations.md @@ -1,3 +1,76 @@ # Entity - Permutations -Entity permutations have been removed in [1.21.20+](https://feedback.minecraft.net/hc/en-us/articles/29110275666957-Minecraft-1-21-20-Bedrock) +`behaviorpack.entity.permutations` + +**Severity:** warning + +## Description + +Entity permutations have been removed as of Minecraft Bedrock [1.21.20](https://feedback.minecraft.net/hc/en-us/articles/29110275666957-Minecraft-1-21-20-Bedrock). Using the `permutations` section in an entity definition will have no effect in current versions. + +## What triggers this error + +This warning is triggered when the language server detects a `permutations` block in a behavior pack entity definition. Permutations were used to conditionally apply component groups based on Molang queries, but this feature has been superseded by entity properties in newer versions. + +## Example + +The following entity definition uses the deprecated permutations feature: + +```jsonc +{ + "format_version": "1.16.0", + "minecraft:entity": { + "description": { + "identifier": "example:my_entity" + }, + "permutations": [ + { + "condition": "query.is_baby", + "components": { + "minecraft:scale": { "value": 0.5 } + } + } + ], + "components": {} + } +} +``` + +## How to fix + +Replace permutations with entity properties and component groups. Entity properties provide a more explicit and performant way to manage entity variants: + +```jsonc +{ + "format_version": "1.21.20", + "minecraft:entity": { + "description": { + "identifier": "example:my_entity", + "properties": { + "example:is_baby": { + "type": "bool", + "default": false, + "client_sync": true + } + } + }, + "component_groups": { + "example:baby": { + "minecraft:scale": { "value": 0.5 } + } + }, + "components": {}, + "events": { + "example:set_baby": { + "add": { "component_groups": ["example:baby"] }, + "set_property": { "example:is_baby": true } + } + } + } +} +``` + +## Related errors + +- [behaviorpack.entity.aliases](aliases.md) +- [behaviorpack.entity.property.unknown](property/unknown.md) diff --git a/behaviorpack/functions/missing.md b/behaviorpack/functions/missing.md new file mode 100644 index 0000000..c1b53ca --- /dev/null +++ b/behaviorpack/functions/missing.md @@ -0,0 +1,50 @@ +# Functions - Missing + +`behaviorpack.functions.missing` + +**Severity:** error + +## Description + +The language server cannot find the behavior pack function definition that is being referenced. The function file either does not exist or has a path that does not match the reference. + +## What triggers this error + +This error is triggered when a reference to a behavior pack function (`.mcfunction` file) cannot be resolved. This commonly happens in: + +- The `function` command in another `.mcfunction` file +- Tick function lists (`tick.json`) +- Other places that reference function paths + +## Example + +The following mcfunction command references a function that does not exist: + +```mcfunction +# This will trigger the error if "my_pack/setup" doesn't exist +function my_pack/setup +``` + +Or in a `tick.json` file referencing a non-existent function: + +```jsonc +{ + "values": [ + "my_pack/tick_handler" + ] +} +``` + +## How to fix + +1. Verify the function file exists at the correct path within your behavior pack's `functions/` directory +2. Check the path is correct — function paths are relative to the `functions/` folder and use `/` as the separator (not `\`) +3. Ensure the file has the `.mcfunction` extension +4. Check for typos in the function name or path + +For example, the command `function my_pack/setup` requires the file to exist at `/functions/my_pack/setup.mcfunction`. + +## Related errors + +- [behaviorpack.mcfunction.empty](../mcfunction/empty.md) +- [behaviorpack.mcfunction.missing](../mcfunction/missing.md) diff --git a/behaviorpack/mcfunction/empty.md b/behaviorpack/mcfunction/empty.md index 5c9a228..19f96b3 100644 --- a/behaviorpack/mcfunction/empty.md +++ b/behaviorpack/mcfunction/empty.md @@ -2,5 +2,45 @@ `behaviorpack.mcfunction.empty` -This function is called when a function is empty. -Minecraft will not load the function. \ No newline at end of file +**Severity:** error + +## Description + +The `.mcfunction` file is empty. Minecraft will not load empty function files, which means any reference to this function will silently fail at runtime. + +## What triggers this error + +This error is triggered by the language server when it detects that a `.mcfunction` file contains no commands (only blank lines or comments, or is completely empty). Source: `packages/bedrock-diagnoser/src/diagnostics/behavior-pack/mcfunction/document.ts`. + +## Example + +An empty function file or one with only comments: + +```mcfunction +# This file intentionally left blank +``` + +Or a completely empty file with no content at all. + +## How to fix + +Add at least one valid command to the function file: + +```mcfunction +# Example: a simple function that says hello +say Hello from my function! +``` + +If you intend the function to be a placeholder that does nothing, you can use a harmless command: + +```mcfunction +# No-op placeholder +say DEBUG: function called +``` + +Or if the function is no longer needed, remove all references to it and delete the file. + +## Related errors + +- [behaviorpack.functions.missing](../functions/missing.md) +- [behaviorpack.mcfunction.missing](missing.md) \ No newline at end of file diff --git a/debugger/internal/exception.md b/debugger/internal/exception.md index 328efd4..cca4ff6 100644 --- a/debugger/internal/exception.md +++ b/debugger/internal/exception.md @@ -2,4 +2,32 @@ `debugger.internal.exception` -Something has really gone to hell if this is thrown 🤔 +**Severity:** error + +## Description + +An unexpected internal exception occurred while the language server was diagnosing your files. This is a bug in the language server itself, not an error in your Minecraft content. + +## What triggers this error + +This error is triggered when the language server's diagnostic engine encounters an unhandled exception during processing. This can happen when: + +- A file has an unusual or unexpected structure that causes the diagnoser to crash +- A bug in the language server's validation logic is triggered +- Memory or resource constraints are hit during diagnosis + +This error is rarely caused by issues with your content, but the file or content that triggered it may be a useful clue for bug reports. + +## Example + +This error cannot be reliably reproduced with a specific code example, as it reflects an internal crash in the language server. + +## How to fix + +1. **Restart the language server** — In VS Code, use the command palette (`Ctrl+Shift+P`) and run `Restart Extension Host` or reload the window +2. **Check for corrupt files** — The file that was being processed when the exception occurred may be corrupt or have an unusual encoding. Try re-saving it +3. **Report the bug** — If the error persists, please report it to the [Blockception/minecraft-bedrock-language-server](https://github.com/Blockception/minecraft-bedrock-language-server/issues) repository with details about which file triggered the exception + +## Related errors + +- [diagnostics.components.internal.error](../../diagnostics/components/internal/error.md) diff --git a/general/boolean/invalid.md b/general/boolean/invalid.md index 88ccd9d..a66ee25 100644 --- a/general/boolean/invalid.md +++ b/general/boolean/invalid.md @@ -2,6 +2,57 @@ `general.boolean.invalid` -The value specified for a boolean was not considered a valid boolean value. +**Severity:** error -Valid boolean values are `true` and `false`. \ No newline at end of file +## Description + +The value provided is not a valid boolean. The field expects either `true` or `false`, but received a different value. + +## What triggers this error + +This error is triggered by the language server when a value that should be a boolean fails boolean validation. Common causes include: + +- Providing a string like `"true"` or `"yes"` instead of the boolean literal `true` +- Providing a number (e.g., `1` or `0`) instead of `true` or `false` +- Providing `null` where a boolean is required + +## Example + +The following JSON triggers the error because the value is a string instead of a boolean: + +```jsonc +{ + "minecraft:breathable": { + "breathes_air": "true" // Invalid — should be boolean true, not string "true" + } +} +``` + +Or using a number instead of boolean: + +```jsonc +{ + "minecraft:breathable": { + "breathes_air": 1 // Invalid — should be true or false + } +} +``` + +## How to fix + +Use the boolean literals `true` or `false` (without quotes): + +```jsonc +{ + "minecraft:breathable": { + "breathes_air": true + } +} +``` + +Valid boolean values are `true` and `false`. + +## Related errors + +- [general.string.invalid](../string/invalid.md) +- [general.integer.invalid](../integer/invalid.md) \ No newline at end of file diff --git a/general/float/invalid.md b/general/float/invalid.md index 01c0844..c11229f 100644 --- a/general/float/invalid.md +++ b/general/float/invalid.md @@ -1,3 +1,47 @@ # Float - Invalid `general.float.invalid` + +**Severity:** error + +## Description + +The value provided is not a valid floating-point number. The field expects a numeric value (which may include a decimal point) but received something that cannot be interpreted as a number. + +## What triggers this error + +This error is triggered by the language server when a value that should be a float (decimal number) fails numeric validation. This includes: + +- Providing a non-numeric string where a number is expected +- Providing `null` or leaving the field empty when a number is required +- Using an invalid number format (e.g., multiple decimal points) + +## Example + +The following JSON triggers the error because the value is not a number: + +```jsonc +{ + "minecraft:movement": { + "value": "fast" // Invalid — should be a number like 0.25 + } +} +``` + +## How to fix + +Replace the value with a valid number. Float fields accept both whole numbers and decimal numbers: + +```jsonc +{ + "minecraft:movement": { + "value": 0.25 + } +} +``` + +## Related errors + +- [general.float.minimum](minimum.md) +- [general.float.maximum](maximum.md) +- [general.integer.invalid](../integer/invalid.md) diff --git a/general/integer/invalid.md b/general/integer/invalid.md index 06230d8..7a93a24 100644 --- a/general/integer/invalid.md +++ b/general/integer/invalid.md @@ -1,3 +1,51 @@ # Integer - Invalid `general.integer.invalid` + +**Severity:** error + +## Description + +The value provided is not a valid integer. The field expects a whole number but received a value that cannot be interpreted as one — such as a decimal number, a string, or an empty value. + +## What triggers this error + +This error is triggered by the language server when a value that should be an integer fails integer validation. This includes: + +- Providing a floating-point number (e.g., `1.5`) where a whole number is required +- Providing a non-numeric string where a number is expected +- Providing `null` or leaving the field empty when a number is required + +## Example + +The following JSON triggers the error because the value is a decimal where an integer is required: + +```jsonc +{ + "minecraft:health": { + "value": 10.5, // Invalid — should be a whole number like 10 + "max": 20 + } +} +``` + +## How to fix + +Replace the value with a valid whole number (integer). Integers cannot have decimal points: + +```jsonc +{ + "minecraft:health": { + "value": 10, + "max": 20 + } +} +``` + +If you need a fractional value, check whether the field actually accepts a `float` type — some fields accept both integers and floats. + +## Related errors + +- [general.integer.minimum](minimum.md) +- [general.integer.maximum](maximum.md) +- [general.float.invalid](../float/invalid.md) diff --git a/general/integer/maximum.md b/general/integer/maximum.md index 7e9a77e..ca51305 100644 --- a/general/integer/maximum.md +++ b/general/integer/maximum.md @@ -2,4 +2,34 @@ `general.integer.maximum` -The value specified for an integer was more than the maximum value allowed. \ No newline at end of file +**Severity:** error + +## Description + +The integer value provided exceeds the maximum allowed value for this field. Each integer field in Minecraft Bedrock has a defined upper bound, and supplying a value above that bound is invalid. + +## What triggers this error + +This error is triggered when the language server validates an integer value and finds it exceeds the maximum allowed value specified for that field. The maximum value varies by field — for example, a stack size cannot exceed 64, and certain game rule values have caps. + +## Example + +The following triggers the error because the maximum value exceeds the field's allowed range: + +```jsonc +{ + "minecraft:health": { + "value": 10, + "max": 100000 // Invalid — exceeds the maximum allowed health value + } +} +``` + +## How to fix + +Decrease the value to be at or below the maximum allowed for this field. The IDE error message typically indicates what the maximum value is. Refer to the [Minecraft Bedrock documentation](https://learn.microsoft.com/en-us/minecraft/creator/) for the valid range of each field. + +## Related errors + +- [general.integer.invalid](invalid.md) +- [general.integer.minimum](minimum.md) \ No newline at end of file diff --git a/general/integer/minimum.md b/general/integer/minimum.md index 34c4174..8c21c50 100644 --- a/general/integer/minimum.md +++ b/general/integer/minimum.md @@ -2,4 +2,34 @@ `general.integer.minimum` -The value specified for a integer was less than the minimum value allowed. \ No newline at end of file +**Severity:** error + +## Description + +The integer value provided is below the minimum allowed value for this field. Each integer field in Minecraft Bedrock has a defined lower bound, and supplying a value below that bound is invalid. + +## What triggers this error + +This error is triggered when the language server validates an integer value and finds it is less than the minimum allowed value specified for that field. The minimum value varies by field — for example, a health value cannot be negative, and a slot index must be at or above zero. + +## Example + +The following triggers the error because health cannot be negative: + +```jsonc +{ + "minecraft:health": { + "value": -5, // Invalid — health cannot be negative + "max": 20 + } +} +``` + +## How to fix + +Increase the value to be at or above the minimum allowed for this field. The IDE error message typically indicates what the minimum value is. Refer to the [Minecraft Bedrock documentation](https://learn.microsoft.com/en-us/minecraft/creator/) for the valid range of each field. + +## Related errors + +- [general.integer.invalid](invalid.md) +- [general.integer.maximum](maximum.md) \ No newline at end of file diff --git a/general/string/invalid.md b/general/string/invalid.md index f3ef542..a60c3db 100644 --- a/general/string/invalid.md +++ b/general/string/invalid.md @@ -1,3 +1,54 @@ # String - Invalid `general.string.invalid` + +**Severity:** error + +## Description + +The value provided is not a valid Minecraft string. Minecraft strings have specific formatting requirements — they must not contain unquoted spaces, and any quotes used must be properly matched and escaped. + +## What triggers this error + +This error is triggered by the language server when a string value fails Minecraft's string validation. Common causes include: + +- A string contains spaces but is not wrapped in quotes +- A string has mismatched quotes (e.g., opens with `"` but does not close, or vice versa) +- A string contains characters that are not allowed in an unquoted Minecraft string + +The validation is performed by the `general/string.ts` diagnoser which checks each string value against Minecraft's string format rules. + +## Example + +The following will trigger this error because the string contains a space but is not quoted: + +```mcfunction +# Unquoted string with spaces — invalid +tag @s add my tag + +# Correct — quoted string +tag @s add "my tag" +``` + +In JSON, an invalid string value might look like: + +```jsonc +{ + "description": { + // Missing quotes around identifier containing a space + "identifier": "example:my entity" + } +} +``` + +## How to fix + +1. If the string contains spaces, wrap it in double quotes +2. Ensure all opening quotes have a matching closing quote +3. Escape any double quotes within the string using `\"` +4. For Minecraft identifiers (`namespace:name`), avoid using spaces entirely — use underscores instead + +## Related errors + +- [general.keyword.invalid](../keyword/invalid.md) +- [minecraft.name.unquoted](../../minecraft/name/unquoted.md) diff --git a/minecraft/commands/obsolete.md b/minecraft/commands/obsolete.md new file mode 100644 index 0000000..d2a8e24 --- /dev/null +++ b/minecraft/commands/obsolete.md @@ -0,0 +1,56 @@ +# Commands - Obsolete + +`minecraft.commands..obsolete` + +**Severity:** warning + +## Description + +This is the general documentation page for obsolete command syntax warnings. When the language server detects a command or command overload that has been superseded by a newer syntax, it reports a `minecraft.commands..obsolete` warning. + +For example, the old `/execute` syntax has been replaced by a new chained syntax in newer versions of Minecraft Bedrock. Using the old form produces `minecraft.commands.execute.obsolete`. + +## What triggers this error + +Obsolete warnings are triggered when: + +- A command uses a syntax form that was valid in an older version of Minecraft Bedrock but has since been replaced +- A deprecated command overload is used when a better alternative exists +- The command syntax matches a legacy form that Minecraft still supports for backwards compatibility but no longer recommends + +Unlike `syntax` errors (which indicate the command is completely invalid), `obsolete` warnings indicate the command will still work but should be updated to the modern equivalent. + +## Example + +The old `/execute` syntax is obsolete in favor of the new chained form: + +```mcfunction +# Old syntax — triggers minecraft.commands.execute.obsolete +execute @e[type=zombie] ~ ~ ~ detect ~ ~ ~ minecraft:grass 0 say I'm on grass + +# Modern syntax +execute as @e[type=zombie] at @s if block ~ ~ ~ minecraft:grass run say I'm on grass +``` + +Another example with `/replaceitem` (replaced by `/item` in newer versions): + +```mcfunction +# Old syntax +replaceitem entity @s slot.weapon.mainhand 0 minecraft:diamond_sword + +# Modern syntax +item replace entity @s slot.weapon.mainhand with minecraft:diamond_sword +``` + +## How to fix + +1. Check the specific command's documentation page (linked from the warning in your IDE) +2. Update the command to use the modern syntax shown in the command's documentation +3. Test the new syntax in-game to confirm it behaves identically to the old form +4. Some obsolete commands have been fully removed in newer versions — check the [Minecraft changelog](https://feedback.minecraft.net/hc/en-us/sections/360001186971) to confirm the command is still available + +## Related errors + +- [minecraft.commands.syntax](syntax.md) +- [minecraft.commands.execute.deprecated](execute/deprecated.md) +- [minecraft.commands.setblock.obsolete](setblock/obsolete.md) diff --git a/minecraft/commands/syntax.md b/minecraft/commands/syntax.md new file mode 100644 index 0000000..a4afc8e --- /dev/null +++ b/minecraft/commands/syntax.md @@ -0,0 +1,58 @@ +# Commands - Syntax + +`minecraft.commands..syntax` + +**Severity:** error + +## Description + +This is the general documentation page for command syntax errors. When Minecraft Bedrock's language server detects that a command in an `.mcfunction` file does not match the expected syntax, it reports a `minecraft.commands..syntax` error, where `` is the name of the command that failed validation. + +For example, an invalid use of `/say` would produce `minecraft.commands.say.syntax`, and the documentation link would point to [`minecraft/commands/say/syntax.md`](say/syntax.md). + +## What triggers this error + +Syntax errors are triggered when: + +- A required parameter is missing from a command +- A parameter has the wrong type (e.g., a number where a selector is expected) +- An unknown keyword is used in a position that expects a specific keyword +- The overall structure of the command does not match any known valid overload + +The language server validates commands against all known valid overloads for a given command and reports this error when none of them match. + +## Example + +The following mcfunction contains a syntax error in the `give` command (missing required item parameter): + +```mcfunction +# Missing the item parameter — will trigger minecraft.commands.give.syntax +give @a + +# Correct usage +give @a minecraft:apple 1 +``` + +Another example with wrong parameter type: + +```mcfunction +# Using a number where a selector is expected +kill 5 + +# Correct usage +kill @e[type=zombie] +``` + +## How to fix + +1. Check the specific command's documentation page (linked from the error in your IDE) +2. Ensure all required parameters are provided in the correct order +3. Verify parameter types match what the command expects (selectors, numbers, keywords, etc.) +4. Use the command-specific documentation pages in this repository for the exact syntax of each command + +See also the [individual command syntax pages](../commands/) for the full parameter list of each command. + +## Related errors + +- [minecraft.commands.obsolete](obsolete.md) +- [minecraft.commands.invalid](invalid.md) diff --git a/minecraft/format_version.md b/minecraft/format_version.md index 4649f4f..447ae7b 100644 --- a/minecraft/format_version.md +++ b/minecraft/format_version.md @@ -1,12 +1,69 @@ # Minecraft - Format Version -A Minecraft format version is a string of three numbers made out of the major version, followed by the minor version and ends the patch version. All seperated by dots +`minecraft.format_version` + +**Severity:** error | warning + +## Description + +The `format_version` field in a Minecraft Bedrock JSON file is invalid, missing, or out of date. The format version controls which features and syntax are available in the file. + +## What triggers this error + +This error is triggered by the language server when: + +- The `format_version` field is not a string (e.g., it's a number or an array) +- The version string is not in the correct `major.minor.patch` format +- The version specified is not a recognized Minecraft Bedrock version +- The version is older than the recommended minimum for the file type + +Source: `packages/bedrock-diagnoser/src/diagnostics/general/format-version.ts` + +## What is a format version? + +A Minecraft format version is a string of three numbers — the major version, followed by the minor version, followed by the patch version, all separated by dots: -```js -`..` ``` +".." +``` + +For example: `"1.21.0"`, `"1.16.100"`, `"1.10.0"` + +## Example + +The following triggers an error because the format version is a number, not a string: + +```jsonc +{ + "format_version": 1.16, // Invalid — must be a string + "minecraft:entity": { ... } +} +``` + +The following triggers a warning because the version is outdated: + +```jsonc +{ + "format_version": "1.8.0", // Warning — very old format version + "minecraft:entity": { ... } +} +``` + +## How to fix + +Ensure the `format_version` is a valid string in `major.minor.patch` format. Use a version that is appropriate for the features you are using: + +```jsonc +{ + "format_version": "1.21.0", + "minecraft:entity": { ... } +} +``` + +Use the same format version as the current version of Minecraft Bedrock, or the minimum version required by the features your file uses. Refer to the [Minecraft Bedrock documentation](https://learn.microsoft.com/en-us/minecraft/creator/) for recommended format versions per file type. -## Version +## Related errors -It also appropriate to have the version as the same version as minecraft +- [behaviorpack.manifest.min_engine_version](../../behaviorpack/manifest/min_engine_version.md) +- [minecraft.manifest.version.minimum](../manifest/version/minimum.md) diff --git a/minecraft/mode/invalid.md b/minecraft/mode/invalid.md index 53ed0ce..c98119d 100644 --- a/minecraft/mode/invalid.md +++ b/minecraft/mode/invalid.md @@ -1 +1,53 @@ # Mode - Missing + +`minecraft.mode..invalid` + +**Severity:** error + +## Description + +The value provided for this mode field is not one of the accepted values. Mode fields expect a specific keyword from a fixed list of options. + +## What triggers this error + +This error is triggered by the language server when a mode or enum field receives a value that is not in the list of valid options. Each mode field (such as game mode, fill mode, clone mode, etc.) has a fixed set of accepted string values, and providing anything outside that set results in this error. + +For example: +- A `gamemode` field must be one of `survival`, `creative`, `adventure`, `spectator` +- A `fill` command's `fillMode` must be one of `destroy`, `hollow`, `keep`, `outline`, `replace` +- A `clone` command's `maskMode` must be one of `filtered`, `masked`, `replace` + +## Example + +The following triggers the error because `"god"` is not a valid game mode: + +```mcfunction +# Invalid — "god" is not a valid game mode +gamemode god @s + +# Correct +gamemode creative @s +gamemode survival @s +``` + +In JSON: + +```jsonc +{ + "minecraft:movement": { + "type": "flying" // Invalid if "flying" is not an accepted mode value + } +} +``` + +## How to fix + +Replace the invalid mode value with one of the accepted values. Check the specific field's documentation or the command syntax page for the list of valid options: + +- For command mode parameters, see the individual command's syntax page in this repository (e.g., [`minecraft/commands/gamemode/syntax.md`](../commands/gamemode/syntax.md)) +- For JSON mode fields, check the [Minecraft Bedrock documentation](https://learn.microsoft.com/en-us/minecraft/creator/) + +## Related errors + +- [minecraft.commands.syntax](../commands/syntax.md) +- [general.keyword.invalid](../../general/keyword/invalid.md) diff --git a/minecraft/selector/invalid.md b/minecraft/selector/invalid.md index 8bfe107..52f6a9e 100644 --- a/minecraft/selector/invalid.md +++ b/minecraft/selector/invalid.md @@ -2,4 +2,42 @@ `minecraft.selector.invalid` -Throw if a fake entity is used where they are disallowed or if it was only for players. +**Severity:** error + +## Description + +The target selector used in this command is invalid. Either it uses a fake entity (`@fake`) in a context where only real entities or players are allowed, or a player-only selector is used in a context restricted to players. + +## What triggers this error + +This error is triggered by the language server when a target selector fails validation. Common causes include: + +- Using a fake entity selector (`@e[type=]`) in a command that only accepts real Minecraft entities +- Using `@a` (all players) or `@p` (nearest player) in a command context restricted to players, when a non-player entity might be matched +- Using an entity selector in a command that explicitly requires a player + +## Example + +Using a fake entity where a player-only selector is required: + +```mcfunction +# Invalid — xp command requires a player, not a fake entity +xp 10L @e[type=example:fake_npc] + +# Correct — use a player selector +xp 10L @a +xp 10L @p +``` + +## How to fix + +1. Use a player selector (`@a`, `@p`, `@s` when executed as a player) in commands that require players +2. Use `@e[type=player]` to explicitly filter for player entities when needed +3. If using fake entities, ensure the command context supports fake entity selectors +4. Check the specific command's documentation page for what selector types are accepted + +## Related errors + +- [minecraft.selector.attribute.noduplicate](attribute/noduplicate.md) +- [minecraft.selector.type.invalid](type/invalid.md) +- [minecraft.fakeentity.missing](../fakeentity/missing.md) diff --git a/molang/optimization/constant-folding.md b/molang/optimization/constant-folding.md index 162000e..fe59c57 100644 --- a/molang/optimization/constant-folding.md +++ b/molang/optimization/constant-folding.md @@ -1,3 +1,79 @@ # Constant Folding -Sometimes constant can be merged into a single constants, eg: `2 * x * 5` is the same as `x * 10` \ No newline at end of file +`molang.optimization.constant-folding` + +**Severity:** hint + +## Description + +A Molang expression contains a constant sub-expression that can be pre-calculated (folded) into a single constant value. Pre-calculating constant expressions improves performance because Minecraft does not need to evaluate the expression at runtime. + +## What triggers this error + +This hint is triggered by the language server's Molang optimizer when it detects a mathematical expression involving only constant values that could be simplified. For example, `2 * 5` is always `10` and can be replaced with the constant `10`. + +Source: `packages/bedrock-diagnoser/src/diagnostics/molang/optimizations/rules.ts` + +## Example + +The following Molang expressions trigger this hint: + +```molang +# Constant arithmetic can be folded +2 * 5 +# Can be simplified to: 10 + +# Constant in a larger expression +2 * query.anim_time * 5 +# Can be simplified to: query.anim_time * 10 + +# Multiple constants +(10 + 5) * query.life_time +# Can be simplified to: 15 * query.life_time +``` + +In a JSON file: + +```jsonc +{ + "render_controllers": { + "controller.render.my_entity": { + "arrays": { + "textures.my_array": [ + "Texture.default" + ] + }, + "geometry": "Geometry.default", + "materials": [{ "*": "Material.default" }], + "textures": ["Array.my_array[2 * 3]"] + // ^^^^ can be simplified to 6 + } + } +} +``` + +## How to fix + +Pre-calculate the constant expression and replace it with the result: + +```molang +# Before +2 * query.anim_time * 5 + +# After +query.anim_time * 10 +``` + +```jsonc +{ + "textures": ["Array.my_array[6]"] +} +``` + +This is an optimization hint, not a hard error — your content will still work without the fix, but applying it improves performance. + +## Related errors + +- [molang.optimization.constant-condition](constant-condition.md) +- [molang.optimization.constant-result](constant-result.md) +- [molang.optimization.identity-operation](identity-operation.md) \ No newline at end of file diff --git a/resourcepack/entities/missing.md b/resourcepack/entities/missing.md new file mode 100644 index 0000000..1a1280b --- /dev/null +++ b/resourcepack/entities/missing.md @@ -0,0 +1,64 @@ +# Entities - Missing + +`resourcepack.entities.missing` + +**Severity:** error + +## Description + +The language server cannot find the resource pack entity definition that is being referenced. The entity client definition either does not exist in any loaded resource pack or has an identifier that does not match the reference. + +## What triggers this error + +This error is triggered when a resource pack entity identifier is referenced but no matching entity definition file can be found in the resource packs. This is typically a cross-reference check that verifies behavior pack entities have corresponding resource pack definitions, or that an entity identifier used in an animation, render controller, or other resource is actually defined. + +## Example + +If a behavior pack defines an entity `example:my_entity`, the resource pack should have a corresponding entity definition at `entity/example/my_entity.json` (or similar path). If this file is missing, the error will be reported. + +```jsonc +// behavior_pack/entities/my_entity.json +{ + "format_version": "1.16.0", + "minecraft:entity": { + "description": { + "identifier": "example:my_entity", + "is_spawnable": true, + "is_summonable": true + }, + "components": {} + } +} +``` + +If no matching `example:my_entity` resource pack entity definition exists, this error will appear. + +## How to fix + +1. Create the matching resource pack entity definition file in your resource pack's `entity/` folder +2. Ensure the `identifier` in the resource pack entity definition matches the behavior pack entity identifier exactly +3. Check for typos in the namespace or entity name +4. Verify the resource pack is correctly referenced and loaded alongside the behavior pack + +A minimal resource pack entity definition looks like: + +```jsonc +// resource_pack/entity/my_entity.json +{ + "format_version": "1.10.0", + "minecraft:client_entity": { + "description": { + "identifier": "example:my_entity", + "materials": { "default": "entity_alphatest" }, + "textures": { "default": "textures/entity/my_entity" }, + "geometry": { "default": "geometry.my_entity" }, + "render_controllers": ["controller.render.default"] + } + } +} +``` + +## Related errors + +- [resourcepack.entity.missing](../entity/missing.md) +- [behaviorpack.entities.missing](../../behaviorpack/entities/missing.md) From 4186d6ec6cfe4ada504ce2c9d4a42d96704baffd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 8 Apr 2026 14:45:26 +0000 Subject: [PATCH 3/3] docs: fix review comments - snake_case property and biome example correction Agent-Logs-Url: https://github.com/Blockception/Minecraft-Error-Codes/sessions/891ec4e6-be95-46af-bbeb-2fb52f889ee2 Co-authored-by: DaanV2 <2393905+DaanV2@users.noreply.github.com> --- .../biome/components/replace_biomes/multiple_dimensions.md | 7 ++++--- behaviorpack/entity/components/deprecated.md | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/behaviorpack/biome/components/replace_biomes/multiple_dimensions.md b/behaviorpack/biome/components/replace_biomes/multiple_dimensions.md index bad3321..2d46843 100644 --- a/behaviorpack/biome/components/replace_biomes/multiple_dimensions.md +++ b/behaviorpack/biome/components/replace_biomes/multiple_dimensions.md @@ -14,7 +14,7 @@ This warning is triggered when the language server detects that a biome's replac ## Example -The following biome definition incorrectly targets multiple dimensions: +The following biome definition incorrectly targets multiple dimensions using the `replace_biomes` component: ```jsonc { @@ -24,8 +24,9 @@ The following biome definition incorrectly targets multiple dimensions: "identifier": "example:my_custom_biome" }, "components": { - "minecraft:overworld_height": { - "noise_params": [0, 0.1] + "minecraft:overworld_generation_rules": { + "replace_biomes": "minecraft:plains", + "weight": 10 }, "minecraft:nether_generation_rules": { "target_percentage": 0.1 diff --git a/behaviorpack/entity/components/deprecated.md b/behaviorpack/entity/components/deprecated.md index 5593f46..4de3f18 100644 --- a/behaviorpack/entity/components/deprecated.md +++ b/behaviorpack/entity/components/deprecated.md @@ -25,7 +25,7 @@ The following entity definition uses a deprecated component: }, "components": { "minecraft:breathable": { - "totalSupply": 15 + "total_supply": 15 } } }