Datapack Wiki

website·Indexed 32 days ago

https://datapack.wiki

Comprehensive documentation for creating Minecraft datapacks, covering functions, predicates, loot tables, advancements, and custom world generation. Includes detailed guides on command usage (/execute, /data), NBT, target selectors, and performance measurement, with technical references updated for Minecraft versions up to 26.2.

Tokens
44.2K
Snippets
222
Records
355
Agent score
59%

What's inside Datapack Wiki

  1. Overview of Minecraft Scoreboards

    Scoreboards are a key/value system used to store integer values bound to a player (or a 'fake player'—an arbitrary name not attached to a real user). Scores can be modified via /scoreboard or /execute store commands. Objectives can be displayed on the sidebar, under a player's name, or in the tab list.
  2. Overview of Minecraft Predicates

    Predicates are JSON files used to check if specific conditions are true (e.g., if a player is walking, above a certain Y level, or holding a specific item). They are more optimized than complex execute if command chains and can be used in datapacks, advancements, and loot tables. They are invoked using the predicate= selector argument or the execute if predicate command.
  3. Overview of Minecraft Dialogs

    Dialogs are pop-up menus or forms used in Minecraft datapacks to display text, collect user input, and trigger actions. They are stored as JSON files in the /data/<namespace>/dialog/ directory.
  4. Overview of the /data command

    The /data command allows developers to modify and fetch NBT (Named Binary Tag) data from three primary sources: blocks, entities, and storages. Note that player data cannot be modified using these commands; any attempt to do so will result in failure.
  5. Overview of right-click detection methods in Minecraft datapacks

    Depending on the requirements, there are several ways to detect right-clicks in a Minecraft datapack. The choice of method depends on whether you need to detect a specific item being used or a specific location in the world being clicked.

    • Carrot on a Stick: The traditional method using scoreboards. Simple, but may cause pigs to follow the player.
    • Consumable Component (1.20.5+): Versatile detection for any item using the consumable component. Triggers once per tick during use rather than once per click.
    • on_consume Advancement Criteria (1.20.5+): Detects when an item is consumed via advancements.
    • Eye of Ender: A niche method that only works in worlds without strongholds; triggers once per tick.
    • Interaction Entity: Detects right-clicks on a specific interaction entity in the world, rather than detecting the item held by the player.
  6. Overview of the /execute command

    The /execute command allows for the conditional execution of other commands or the modification of the execution context. It consists of multiple subcommands that can be chained in any order. The execution context includes the Position (origin of relative coordinates), Anchor (eyes or feet), Executor (the entity referred to by @s), Rotation, and Dimension.
  7. Understand Minecraft Command Context

    Commands in Minecraft are executed with a specific context consisting of an executor entity, a position (within a dimension), and a rotation. This context determines how relative coordinates (~ ~ ~) and target selectors (like @s) are resolved.

    Context varies based on how the command is triggered:

    • Chat Commands: The player is the executor (@s refers to the player), and the position/rotation are based on where the player is standing and looking.
    • Game-run Functions (tick, load, scheduled): The executor is the game server (@s refers to nothing), the position is the world spawn, and the rotation is 0, 0.
    • Function Inheritance: Functions inherit the context of their caller.
  8. Understand SNBT format for Minecraft datapacks

    SNBT (Stringified Named Binary Tags) is a human-readable, JSON-like tree structure used in datapack development to manipulate NBT data. It consists of key/value pairs (key:value) contained within compounds, which are marked by curly brackets {}. Multiple pairs within a compound are separated by commas.
    {name:"Silabear",age:102,friends:["Flynecraft","Aandeel","Cobblestone"],socials:{discord:"silabear"}}
  9. Use Minecraft Proxies to link multiple servers

    Proxies (such as BungeeCord, Velocity, and Waterfall) are not standalone Minecraft servers but act as 'glue' to connect multiple servers together. They allow a network of servers to handle thousands of concurrent players by distributing them across different dedicated server instances and enabling seamless 'teleportation' between them.
  10. Understand and use Resource Locations in Minecraft datapacks

    A resource location is a unique identifier used to reference a resource (such as a function) within a datapack or resource pack. It typically follows the format namespace:path/to/resource.

    Key rules include:

    • Namespace: The part before the colon. If omitted, it defaults to the minecraft namespace.
    • Path: The part after the colon, which can include folders separated by /.
    • Allowed Characters: Only lowercase letters (a-z), numbers (0-9), underscores (_), dashes (-), and periods (.) are permitted. Forward slashes (/) are used specifically for folder separation.
    /function my_namespace:some_folder/my_function
  11. Understand and manipulate Minecraft Item Components

    Item components are data structures applied to Minecraft items to define special attributes such as custom names, lore, or functionality (e.g., whether an item is edible). Every item has a set of default components; for instance, food items include the minecraft:consumable component. Developers and players can add new components or remove existing ones from items using the /give or /item commands.
  12. Understand Minecraft coordinate systems

    Minecraft positions are represented by x, y, and z decimal values.

    • Block Coordinates: Locked to a grid and must be whole numbers (integers).
    • Entity Coordinates: Not locked to the grid and can be decimal values.
    • Alignment: x.0 y.0 z.0 represents the bottom-left corner of a block. The center of a block is x.5 y.5 z.5.
    • Integer Behavior: When using integer coordinates in commands (e.g., summon creeper 0 0 0), the game interprets the x and z axes as the center of the block (e.g., 0.5 0.0 0.5).
    # Example: Set a block at specific integer coordinates
    /setblock 123 86 94 minecraft:pink_concrete
    
    # Example: Teleport to precise decimal coordinates
    /tp @s 66.2 98 45.7