Skip to content

Add support for 1.21.5#2

Merged
SpyC0der77 merged 1 commit into
mainfrom
1.21.5
May 27, 2025
Merged

Add support for 1.21.5#2
SpyC0der77 merged 1 commit into
mainfrom
1.21.5

Conversation

@SpyC0der77

@SpyC0der77 SpyC0der77 commented May 27, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes
    • Updated Minecraft command and NBT data syntax for better compatibility and consistency.
    • Adjusted datapack directory structure from "functions" to "function" for improved alignment with Minecraft standards.
    • Modified JSON formatting for the tellraw command to use the text and extra object structure.
    • Updated the default pack_format value in configuration to "71" for newer Minecraft versions.

@coderabbitai

coderabbitai Bot commented May 27, 2025

Copy link
Copy Markdown

Walkthrough

The changes update Minecraft command and NBT data syntaxes, adjust data paths, and modify directory naming conventions from "functions" to "function" in the datapack structure. Additionally, the default "pack_format" in the configuration is updated. No changes are made to function signatures or control flow.

Changes

File(s) Change Summary
minecraft_script/compiler/build_templates/builtins/log.mcfunction Updated tellraw command syntax to use JSON object with text and extra instead of a JSON array.
minecraft_script/compiler/builtin_functions.py Simplified enchantment syntax, updated NBT paths, and revised custom item name handling in commands.
minecraft_script/compiler/compiler.py Changed directory and tag paths from "functions" to "function" throughout datapack file structure.
minecraft_script/config_utils.py Changed default "pack_format" from "41" to "71" in configuration.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Compiler
    participant FileSystem

    User->>Compiler: Initiate datapack build
    Compiler->>FileSystem: Create folders with "function" (not "functions")
    Compiler->>FileSystem: Write .mcfunction files and tag JSONs in new paths
    Compiler-->>User: Build complete
Loading

Poem

In burrows deep, I tweak and write,
Changing "functions" to "function"—just right!
With NBTs neat and configs anew,
My Minecraft scripts now shine through.
A hop, a skip, a syntax fix—
This rabbit’s code is full of tricks!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ffe6ac6 and 38c293b.

📒 Files selected for processing (4)
  • minecraft_script/compiler/build_templates/builtins/log.mcfunction (1 hunks)
  • minecraft_script/compiler/builtin_functions.py (3 hunks)
  • minecraft_script/compiler/compiler.py (10 hunks)
  • minecraft_script/config_utils.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
minecraft_script/compiler/builtin_functions.py (1)
minecraft_script/compiler/compile_types.py (4)
  • get_storage (13-14)
  • get_storage (34-35)
  • get_nbt (10-11)
  • get_nbt (31-32)
🔇 Additional comments (7)
minecraft_script/config_utils.py (1)

8-8:

Details

✅ Verification successful

Verify the pack format number for Minecraft 1.21.5.

The pack format has been updated from "41" to "71", which represents a significant jump. Please confirm this is the correct pack format number for Minecraft 1.21.5.


🌐 Web query:

What is the correct pack format number for Minecraft 1.21.5 datapacks?

💡 Result:

The correct pack format number for Minecraft 1.21.5 datapacks is 71[4][9]. You should set the "pack_format" field in your pack.mcmeta file to 71 for compatibility with Minecraft 1.21.5 datapacks. This information is confirmed by a technical update overview and pack.mcmeta generator supporting the latest versions.

Citations:


Pack format update is correct for Minecraft 1.21.5

The pack_format value of "71" matches the official pack format for Minecraft Java Edition 1.21.5 as confirmed by multiple sources. No further changes are needed.

minecraft_script/compiler/build_templates/builtins/log.mcfunction (1)

1-1: Updated tellraw command format looks correct.

The change from JSON array to object format with text and extra keys aligns with modern Minecraft command syntax. The functionality remains the same while using the updated format.

minecraft_script/compiler/compiler.py (1)

30-30:

Details

✅ Verification successful

Consistent directory structure update from "functions" to "function".

All references to the datapack directory structure have been systematically updated from "functions" to "function". The changes are applied consistently throughout the file, which is excellent for maintaining datapack integrity.

Please verify that "function" (singular) is the correct directory name for Minecraft 1.21.5 datapacks:

Also applies to: 44-44, 62-62, 71-71, 80-80, 93-93, 132-132, 136-136, 143-143, 160-164, 177-178, 187-187


🌐 Web query:

What is the correct directory structure for Minecraft 1.21.5 datapacks? Should it be "functions" or "function"?

💡 Result:

In Minecraft 1.21.5, the correct directory structure for datapacks has changed from previous versions. The directory formerly known as "functions" (plural) is now "function" (singular)[7][9]. This is part of a broader change in Minecraft 1.21 where many default folder names were changed to their singular forms.

The proper directory structure for a datapack in Minecraft 1.21.5 is:

my_datapack/
- pack.mcmeta
- data/
  - my_namespace/
    - function/
      my_function.mcfunction

This change affects not only the functions directory but also other directories in datapacks. According to the information provided, the following folder name changes were implemented[7][8]:

  • "functions" is now "function"
  • "advancements" is now "advancement"
  • "predicates" is now "predicate"
  • "structures" is now "structure"

If you're trying to update older datapacks to work in Minecraft 1.21.5, you'll need to rename these directories to their singular forms[7]. You may also need to update the pack format in your pack.mcmeta file to ensure compatibility with the latest version[7].

To check if your datapack is properly loaded in-game, you can use the command /datapack list[9]. If your functions are correctly configured, you should be able to run them with the command /function namespace:function_name and see autocomplete options when typing the command[9].

Citations:


Verified correct singular datapack directory for Minecraft 1.21.5
All references to “functions” → “function” match the official 1.21.5 datapack structure. No further changes required.

minecraft_script/compiler/builtin_functions.py (4)

44-44: Updated enchantment syntax for modern Minecraft.

The enchantment syntax has been simplified from the legacy format to the modern minecraft:enchantments={silk_touch:1} format, which is correct for newer Minecraft versions.


46-46: Updated armor stand data path to use equipment structure.

The data path has been correctly updated from the legacy ArmorItems[3].id to the modern equipment.head.id structure, which aligns with current Minecraft entity data organization.


295-295: Example command comment shows updated syntax.

The comment demonstrates the updated give command syntax using minecraft:custom_name={text:'NAME'} instead of the legacy format, which is helpful for understanding the changes.


331-331: Updated item naming to use structured text components.

The change from minecraft:item_name to minecraft:custom_name={text:'$(name)'} properly uses the modern structured text component format for item naming in Minecraft 1.21.5.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@SpyC0der77

Copy link
Copy Markdown
Owner Author

@coderabbitai can I merge?

@coderabbitai

coderabbitai Bot commented May 27, 2025

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@SpyC0der77 Yes, you can merge! 🚀

All the changes in this PR are correct and properly implement support for Minecraft 1.21.5:

Pack format correctly updated to "71"
Directory structure properly changed from "functions" to "function"
Command syntax updated to modern formats
NBT paths and enchantment syntax correctly modernized
All changes are consistent throughout the codebase

The PR successfully updates your Minecraft Script compiler to work with the latest Minecraft version. Great work on maintaining compatibility! 🎮

@SpyC0der77 SpyC0der77 merged commit acbe38a into main May 27, 2025
1 check passed
@SpyC0der77 SpyC0der77 deleted the 1.21.5 branch June 8, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant