diff --git a/package-lock.json b/package-lock.json index b6e8fcef..1560e989 100644 --- a/package-lock.json +++ b/package-lock.json @@ -319,9 +319,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -338,9 +335,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -357,9 +351,6 @@ "cpu": [ "ppc64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -376,9 +367,6 @@ "cpu": [ "s390x" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -395,9 +383,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -414,9 +399,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -813,9 +795,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -832,9 +811,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -851,9 +827,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -870,9 +843,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1884,9 +1854,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1907,9 +1874,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1930,9 +1894,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1953,9 +1914,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ diff --git a/src/lib/sidebar/tabs/latest/Guides.svelte b/src/lib/sidebar/tabs/latest/Guides.svelte index e1eb24c4..135adf45 100644 --- a/src/lib/sidebar/tabs/latest/Guides.svelte +++ b/src/lib/sidebar/tabs/latest/Guides.svelte @@ -5,7 +5,7 @@ import SidebarHeading from "$lib/sidebar/navigation/SidebarHeading.svelte"; // Icon imports - // https://tabler-icons.io + // https://tabler.io // import Icon from "~icons/tabler/" import IconHome from "~icons/tabler/home"; import IconPennant from "~icons/tabler/pennant"; @@ -44,6 +44,7 @@ import IconCat from "~icons/tabler/cat"; import IconBaguette from "~icons/tabler/baguette"; import SidebarPlaceholder from "../../navigation/SidebarPlaceholder.svelte"; + import IconPick from '~icons/tabler/pick'; @@ -66,10 +67,7 @@ - + @@ -88,6 +86,7 @@ + diff --git a/src/routes/credits/+page.svx b/src/routes/credits/+page.svx index bd7b2038..d7fe6334 100644 --- a/src/routes/credits/+page.svx +++ b/src/routes/credits/+page.svx @@ -39,6 +39,7 @@ These people have written or edited pages for the wiki or guides. - Kraggle09 - Amandin - Subzeroditto +- theblackswitch :::note diff --git a/src/routes/guide/nbt-and-scores/get-default-item-components/+page.svx b/src/routes/guide/nbt-and-scores/get-default-item-components/+page.svx new file mode 100644 index 00000000..b97b4bfd --- /dev/null +++ b/src/routes/guide/nbt-and-scores/get-default-item-components/+page.svx @@ -0,0 +1,101 @@ +--- +title: Get default item components +description: + This section explains how you would collect the default data components from an item using a + Minecraft datapack. +version: 26.2 +--- + +# Get Default Item Components +This method will explain how to get the default **data components** (commonly referred to as item components) from an item. These default components are usually hidden from a datapack but aquiring them can be really useful. We could, for example, use this to read the `max_stack_size` from any item. + +The method relies on the `minecraft:copy_components` loot table function which copies item components from a source item, but also **includes** the (hidden) default components. We can use this functionality in a datapack to easily access the default components of any item. + +## Method + +To start, we make a loot table that drops a dummy item and applies the `copy_components` loot function. This function requires a source to copy the components from. This, unfortunatly, can only be one of `block_entity`, any entity from context (for example `this` or `attacker`) or a `tool`. The only source that can be an item is `tool` so we'll use that. + +Now we need to "tell" the loot table what the `tool` is. This can be done through [loot context](https://minecraft.wiki/w/Loot_context). In this case we'll use fishing loot context. + +```json:copy_default_components.json +{ + "type": "minecraft:fishing", + "pools": [{ + "rolls": 1, + "entries": [{ + "type": "minecraft:item", + "name": "minecraft:poisonous_potato", + "functions": [{ + "function": "minecraft:copy_components", + "source": "tool" + }] + }] + }] +} +``` + +The fishing loot context allows us to use the `mainhand` slot as a `tool`. This leads us to the following command: +```mcfunction +loot replace entity @s weapon.offhand fish namespace:copy_default_components ~ ~ ~ mainhand +``` + +This command will place a dummy item (from the loot table) into the player's offhand slot. (Since we don't want to replace the offhand slot or any other inventory slot, we'll have to summon a temporary entity to store the dummy item. More on that later.) Then, the loot table will also copy all components from the item in the `mainhand` to the dummy item in the offhand slot, even the default (hidden) components. + +To check this worked, you can access the item components data manually using the command `/data get entity @s equipment.offhand.components` - you should see all the default components that are usually hidden. + +:::info + +The `/loot` command requires a position when you access a fishing-type loot table. In our case, this can be any position since we're not using said context. + +::: + +### Read any slot + +Unfortunately, Minecraft only lets us use the `mainhand` slot as "tool" context. If we want to read from any slot, we need a small workaround. + +To solve both this issue and the target slot issue (explained in the previous section), we can summon a temporary armor stand. + +```mcfunction:get_default_components/init.mcfunction +# Tag the player here so we can find it without the execution context +tag @s add target_player +execute summon minecraft:armor_stand run function namespace:get_default_components/process +tag @s remove target_player +``` + +Next we copy the desired item to its mainhand. After that, we can use this mainhand slot to provide the "tool" context and copy the dummy item to it's offhand. Then the only thing we need to do is store the data from the armor stand and kill it. + +```mcfunction:get_default_components/process.mcfunction +# Move the item from the desired player slot onto the armor stand +item replace entity @s weapon.mainhand from entity @a[tag=target_player,limit=1] armor.head + +# Run the loot table +loot replace entity @s weapon.offhand fish namespace:get_default_components ~ ~ ~ mainhand + +# Copy the components to a result storage +data remove storage namespace:temp default_components +data modify storage namespace:temp default_components set from entity @s equipment.offhand.components + +# Kill the armor stand +kill @s +``` + +Now we can run the function `namespace:get_default_components/init` as a player to get the components from the chosen slot (in this case the head slot). The source slot can be changed by modifying `armor.head` on line 2. The item data components will be stored to the `namespace:default_components` storage, and from here you can access them in your datapack. + +:::tip + +In addition, you can also filter for or filter out any components using the `include` and `exclude` fields in your loot table function. +```json +{ + "function": "minecraft:copy_components", + "source": "tool", + "include": [ + "minecraft:max_stack_size" + ] +} +``` + +::: + +## Credits + +This method was originally discovered by [baphomet42 on the Minecraft Commands discord server](https://discord.com/channels/154777837382008833/157097006500806656/1418032607215620096) and finalized by [Arkiitekk](https://discord.com/channels/935560260725379143/1435909929754955796/1538472517558083624). diff --git a/src/routes/search.json/meta.json b/src/routes/search.json/meta.json index ba29f091..e34c6652 100644 --- a/src/routes/search.json/meta.json +++ b/src/routes/search.json/meta.json @@ -1 +1 @@ -[{"title":"Home","content":"Welcome to the Datapack Wiki!Welcome to the Datapack Wiki, a resource for everything related to Minecraft\nDatapacks. This community-built wiki has got guides, tutorials, and\ndocumentation to help you create and modify Minecraft Datapacks.New to Minecraft Datapacks?Don't worry! You're in the right place. We've got a guide on\nhow to make a datapack for those of you with no or\nlittle experience. If you get stuck, don't hesitate to ask in our Discord\nServer. Pages on this wiki have been written with beginners in mind - you should\nhave no trouble working through these resources.What are Minecraft Datapacks?Minecraft Datapacks are like addons - they are a Minecraft feature that lets you\ncustomize Minecraft worlds without mods. They allow you to modify and enhance\nthe game by adding new features and mechanics by using Minecraft commands,\nadvancements, worldgen, and more!With datapacks, you can:Add and modify custom recipesModify existing or create new loot tablesAdd new advancements and enchantmentsCreate unique structuresAnd much more!ContributeThis project wouldn't be possible without the support of community members. We\nencourage you to contribute to this wiki if you want to write any pages, correct\nany mistakes, or share any of your knowledge!You can hit the Edit button on any page to open the GitHub page for the\ncurrent wiki page. All our contributions are done via GitHub and are written in\nMarkdown. For more information, find the Contribution section of this page, or\nread our contribution guide on our\nGitHub repo.","description":"Welcome to the Datapack Wiki, a resource for everything related to Minecraft Datapacks. We've got guides, tutorials, and documentation to help you build your knowledge about data packs.","url":"/","tags":[]},{"title":"Page Formatting","content":"Page FormattingLast Updated: 05-26-2026This section goes over how we format wiki pages. We like to be consistent, so\nplease read through this section carefully and use these features to your\nadvantage:Basic Writing GuidelinesWhen writing for the wiki, write in a way that is easy to understand and easy\nfor beginners to understand. Put yourself in the viewer's shoes. What\nconfused you when you first learned about the topic? What new terms did you\nlearn? Avoid using technical terms without explaining them or point to a\nresource that explains them.Documentation and tutorials are a great way to learn, but sometimes you don't\nneed to read every part of a page to understand it. When writing for the wiki,\nwrite in a way that makes it easy to scan and understand quickly. Some\nrecommendations are using white space to your advantage to break your page into\neasily digestible chunks.When learning a concept, it is helpful to have concrete examples that people can\nrefer to instead of just using a concept. This will help wiki-goers understand\nthe concept better and make it easier to remember.Writing StyleThe datapacking community is a diverse group of people with different\nbackgrounds; many people don't speak English as their first language or may feel\nintimidated!When writing, try to follow these guidelines:Use the active voice. For example, instead of\nThe pig is teleported by the command, write\nThe command teleported the pig.Don't use unnecessary adverbs or adjectivesTry not to use the words: obvious, simple, basic, easy, actual, just,\nclear, and however, as these can come off as intimidating; our goal is to\nteach, not degradeExplicitly reference what you are explaining (don't do: \"it says\", do: \"the\nplayer says\")Use 's for indicating possessionUse the \"Oxford comma\"Technical informationAll content on the website (except a few small exceptions) are made using a\ntechnology called mdsvex. This technology enables people like you to insert\nMarkdown with svelte components. For most wiki writers,\nthis detail is not important and can be ignoredIt is recommended to know what the proper way to format Markdown is in order to\nstay consistent and prevent confusion.The front matter title is the same as the title in the sidebar and the title\non the page (heading 1 or single #)Use bold and italics sparingly and only when emphasis is neededUse headings to break up the page into sectionsCode blocks are used to show code snippets or commandsAdmonitions are used to show important information\nunrelated to the content of the pageTables are used to show large amounts of dataEach page is made of 3 parts:front matter (metadata about the page such as title, description, tags,\nversion, etc.)content (the actual content of the page)components (custom components that allow for interactivity or other features\nnot able to be reproduced with markdown)Each is crucial to making the page look and feel how it does.FrontmatterWe try to keep the front matter as minimal as possible, but it is still\nrequired. Without it, the page will not display correctly on search engines or\nother sites. The front matter for this page looks like this:title: \"Site Development\" description: \"This page is meant to be an introduction\nto formatting a page for the wiki. In it is multiple examples which you can\nexamine raw in the [site source code](https://github.com/Datapack-Hub/wiki).\"\nversion: 26.2\nFront matter is denoted with triple hyphens (---) at the top of the page and\nthe end of the front matter.The title should be the same as the title in the sidebar in order to reduce\nconfusion.The description should be a short summary of the content of the page in\norder to show people what all is covered in the article.The version should be set to the latest version that the page has been and\nworks in. If the page works in 1.21.4 but not in 1.21.5 or later, this should\nbe set to 1.21.4.Custom ElementsOur markdown system adds unlimited customizability to the way we format our\npages. As of the time of writing, we have the following features:AdmonitionsCode TitlesMCFunction Formatting (Thanks Snave!)HighlightingAdmonitions are a way to warnings, info or tips, or other important information\nto your page.\n\nThis is an example of an info box.\n\n\nCode blocks are a way to format code in your page. These code blocks come with\nthe option to add a title to the code block for clarity. The Datapack Wiki\nsupports syntax highlighting for MCFunction which should be used for code\nsamples whenever possible.function example() {\nconsole.log(\"Hello World!\");\n}\nHighlighting is a way to highlight specific text. It isn't commonly used, but\nexists.Highlighted Text like this.Highlighted Text\nStandardized ElementsThe wiki uses a few elements that are standardized across the entire wiki. Right\nnow this only consists of command syntax. You can find the command syntax we use\nin the commands page.","description":"This page is an introduction to formatting page content, and details about how the wiki handles formatting.","url":"/contribute/formatting/","tags":[]},{"title":"Git Practices","content":"Git PracticesLast Updated: 05-26-2026This page is an introduction to how we use Git in the\nwiki repository. In order to keep the\nwiki consistent and reputable, we have a few rules that we follow.Git provides a lot of features that are great for collaboration, and we try to\nuse them as much as possible.\nand changes to main. You can click the\n\"Fork\" button in the top right\ncorner of the repository to create a fork of the repository. This will create a\ncomplete copy of the repository that you can work on.Once you have forked the repository, you can clone it to your local machine.When it comes time to merge your changes, you can create a pull request, and a\nwiki contributor will review your contribution, hopefully in a speedy manner (we\napologize if it's not in reality).BranchesBranches are useful additions to help separate features in your fork. We use\nkebab-case for branch names meaning the branch name should be all lowercase\nwith hyphens to separate words. For example, if you are working on a page called\n\"Adding New Features\", the branch name should be adding-new-features.We do not recommend you use branches on the main repository for single one-off\npages or changes, even if you have permissions to. Branches in the repository\nare mainly for upcoming Minecraft versions or huge upcoming reworks, if you\nbelieve you have a reason to add a branch to the main repository, let a wiki\nadmin know.Commit MessagesCommit messages are a great way to keep track of what changes have been made to\nthe wiki. Summarize the changes in the commit message and use the imperative\nmood.For example, if you are adding a new page called \"Adding New Features\", the\ncommit message should be Add new page for adding new features. If you are\nfixing a typo on a page, the commit message could be\nFix typo in page about adding new features.Optionally, you can add a short description of the changes in the commit\nmessage. This is not required, but it is recommended.MergingWhenever you start working on a new branch or features, pull the latest changes\nfrom the main branch. This will ensure that you have the most up-to-date\nchanges.You will likely run into an issue with the search.json file, which is used to\ngenerate the search index. This file is generated automatically and should not\nbe manually edited. A solution to this is to remove the search.json file and\noptionally run the search index generation script. This will regenerate the file\nand you can commit it.node run ./gen_search_indexes_node.js\n\nOR\n\nbun ./gen_search_indexes.js\nOther Important InformationMake a description of your changes in your PR.Reviewers: Proofread changes before approving them.Reviewers: It's not required, but it's recommended the changes follow American\nEnglish for consistency sake.","description":"This page is an introduction to our Git practices a page for the wiki.","url":"/contribute/git-practices/","tags":[]},{"title":"Resources","content":"ResourcesListed here are links to credible and reliable places and libraries to aid in\ncommand/datapack support and creation.\nexternal sites or Discord Servers, so proceed with caution. However, they're all\nsafe to use and have amazingly useful content and tools for creating Minecraft\nDatapacks.\nDatapack Hub - Get help with\nMinecraft Datapacks, resource packs, commands and more.Website\nSmithed - A general (but non-help) datapack\ncommunity for sharing projects.Discord\nMinecraft Commands - Get help with\nJava datapacks/commands or Bedrock addons.Discord\nShaderLABS - Get help with vanilla\nshaders.Discord\nBlockbench - Support for the\nBlockbench (3D model editor) app.Discord\nFabricMC - Get help with Fabric\nand Fabric mods.Discord\nMinecraft - Discuss Minecraft\ngenerally with people from around the world.Discord\nAnimated Java - Support for\nthe Animated Java Blockbench plugin.Discord\nDataworld (French) - A French discord\nserver for help with datapacks.Discord\nAnthill\n(Russian) - A russian-speaking discord server for help with datapacks,\nresource packs and commands.GeneratorsWebsite\nMCStacker - Generate commands such as\n/summon, /give, and more.Website\nMisode - Generate files such as\nadvancements, predicates, recipes, worldgen, and more.Website\nTheDestruc7i0n Recipe\nGenerator - Generate simple recipes.Website\nMinecraft JSON - Generate JSON Text.Website\nBlock Display Engine - Create models with\ndisplay entities and export as commands.Website\nhaselkern's\nArmorStand - Generate summon commands for armor stands in any pose.Website\nDatapack Hub's Text Editor -\nCreate /tellraw commands and text components (JSON text) for Minecraft Java\nEdition with our easy-to-use, modern online tool!ToolsTool\nWeld - The fastest data and resource\npack merger in the west.Templates/ReferenceWebsite\nMinecraft Wiki - A detailed technical\nwiki covering all Minecraft mechanics.Website\nMisode's MCMeta - A GitHub\nrepository with every vanilla file (compiled by Misode).Website\ninventivetalent's Minecraft assets -\nWebsite with every vanilla file.Website\nCCCode's version-diff -\nShows all the differences in vanilla files between two versions.Website\nMisode's\nTick Order - A detailed sequence of events that occur during a Minecraft\nserver tick.Tutorials/Content CreationYouTube\nCloud Wolf - Datapack\ntutorials, especially advanced concepts.YouTube\nSlicedlime - Covers all the\ntechnical changes in recent snapshots.YouTube\nConure - Small, but\ninformative datapack tutorials.YouTube\nLegitimoose - Easy to\nunderstand datapack and command tutorials.PMC Guide\nStructure\nGeneration GuidePMC Guide\nWorld\nGeneration GuideWebsite\nMCC's FAQs -\nA list of common questions along with tutorials for answers.LibrariesLibrary\nTagLib - A curated\nlist of useful tag files.Library\nSmithed (Libraries) - A\ncollection of useful technical and compatibility libraries.Library\nPlayer Motion -\nAllows manipulating player's motion.Library\nBlockstate - Extracts\nthe BlockState data of any block at given position.Library\nBookshelf - A\nuser-friendly modular library datapack with lots of useful modules.Library\nIris - A raycasting library\nwith micrometric precision and taking into account individual block\ngeometries.Library\nAjjGUI - A Data-Driven GUI\nlibrary.Library\nMcfunction\nLogger - A library for logging things to the server console.Library\nMoxvallix's Library - The\nultimate Minecraft Datapack Library, constantly updated with new helpful\nfunctions.ModsMod\nDatamancer - A tool for\ndatapack devs with several features, such as function profiling &\nbenchmarking, marker goggles, datapack autoreloading and more.Mod\nDatapack debugger -\nSet breakpoints in the functions to \"freeze\" the game when the breakpoint is\nreached.Mod\nBetter Suggestions -\nProvides more/better suggestions for Minecraft commands.Mod\nNBT Autocomplete -\nAdds suggestions for NBT tags in commands.","description":"Listed here are links to credible and reliable places to aid in command support and creation.","url":"/resources/","tags":[]},{"title":"Credits","content":"CreditsThe Datapack Wiki is managed by Datapack Hub, based\non an original design and idea by Aandeel. All of the\ncontent on this wiki is made possible thanks to the dedication of our awesome\ncontributors! You can contribute to this wiki on our GitHub - click the Edit\nbutton on any page.AdministratorsThese people run and develop the site, making any and all important decisions.SilabearCobblestoneAandeelEditorsThese people are in charge of what contributions are added to the site, as well\nas planning and writing new pages.GearsContributorsThese people have written or edited pages for the wiki or guides.DiamondHeDeAnSuperAnt_SwitchedCubeKraggle09AmandinSubzeroditto\ncontribute by clicking the Edit button on any page.","description":"The Datapack Wiki is brought to you by [Datapack Hub](https://datapackhub.net) in collaboration with Aandeel.","url":"/credits/","tags":[]},{"title":"Cooldown checks","content":"Cooldown checksA cooldown restricts how frequently a player triggers a custom action. In most\ndatapacks, these actions involve running functions or commands.For example, consider a custom wand that shoots fireballs when a player\nright clicks. Without a cooldown, players could spam the wand, resulting\nin lag or unbalanced gameplay. Adding a cooldown ensures the player waits a few\nseconds before shooting another fireball.Core conceptsCooldown: A timer that prevents an action from running again until a specified\namount of time has elapsed since the last execution.Action: The command or function the cooldown restricts.Implementation methodsThere are two main ways to implement a cooldown mechanic in your project:Scoreboard-based cooldown - Uses a scoreboard objective to store how \nmuch time remaining until the cooldown expires. This is the simplest and the easiest to understand version, \nbut if you're creating a larger datapack, or intend on using it with multiple players, you may prefer to use an alternative version to minimise system lag.Worldclock-based cooldown - Uses the time on a worldclock to measure the elapsed time since an action was last used. This is a non-ticking approach that works well for large datapacks, or any project that uses many cooldown timers.","description":"Learn how to create and check cooldown timers using several common methods.","url":"/guide/cooldown/","tags":[]},{"title":"Scoreboard-based cooldown","content":"Scoreboard-based cooldownA scoreboard-based cooldown stores a number on each player (or entity) and\nchanges that number over time.This guide uses a ticking approach, which means the datapack updates the\ncooldown every game tick (20 ticks per second). This works well \nfor small projects with only a few cooldowns and short durations. If you track many cooldowns or \nmany entities, this negatively affects performance, because the game has to run loads of commands.In summary, this approach sets a player's score on a scoreboard, and then decreases that score every \ntick. This means that, when we need to do something which requires a cooldown, we can just check the \nscore to see if the player has an active cooldown or not.What you will createA my_cd scoreboard objective (this tracks the actual cooldown for each plalyer)A tick function (this reduces each player's cooldown score)A check_cooldown function (this will be used to check and reset the player's cooldown)\nRight-click menu guide.\nobjective is just a scoreboard which can only be changed by commands.scoreboard objectives add my_cd dummy\n2. Reduce the score in the tick functionIn your tick function (which runs every tick), reduce the my_cd\nscore by 1 for any player with my_cd ≥ 1.scoreboard players remove @a[scores={my_cd=1..}] my_cd 1\n\nit only runs the command when the player has an active cooldown. To do this, you would need a tick advancement which runs a function - \nin that function, you would decrease the player's score and then revoke the advancement only if their score is 1 or more. This would replace \nthe commands in the tick function, and slightly help to minimise lag.\nif you have a special item which you only want the player to be able to use once every 5 seconds, \nyou would run this function to check if the player is on cooldown or not.In this function, we check the executor's my_cd score to tell whether they have an active cooldown.If the score is 1 or higher (i.e. they haven't reached the end of the cooldown), then the function will return a failure..If the score is 0 or doesn't exist yet (i.e. they do not have an active cooldown), then the function will return a success.# If the player is still on cooldown, tell the player and stop here.\nexecute if score @s my_cd matches 1.. run tellraw @s {color:\"red\",text:\"This is on cooldown! Wait before you try again.\"}\nexecute if score @s my_cd matches 1.. run return fail\n\n# If the function hasn't yet been stopped, then the player is not on a cooldown\n# so we can set the cooldown and then return a success. \n\nscoreboard players set @s my_cd 100\nreturn 1\n4. Using the check_cooldown functionWhenever the player does something that needs a cooldown, you can use execute if function with the check_cooldown function. If the \nplayer still is on a cooldown, then the function will fail and the command will not run. If the player isn't on a cooldown, then \nthe function will set the cooldown and then return a success, so the command WILL run.In this example, a creeper will only be summoned when the player has no active cooldown (in which case, the cooldown will be set).\nIf the player has an active cooldown, then the creeper will not be summoned, and instead the error message in check_cooldown.mcfunction \nwill be sent.execute as if function :check_cooldown run summon creeper\nUsing multiple cooldownsIf you want to have multiple different cooldowns for different items, then you will need a different cooldown scoreboard and check_cooldown\nfunction for each cooldown. You will also need to decrease the score for each cooldown in the tick function.","description":"Learn how to create and check cooldown timers using a scoreboard objective.","url":"/guide/cooldown/scoreboard/","tags":[]},{"title":"Worldclock-based cooldown","content":"Worldclock-based cooldownA worldclock cooldown works by storing a timestamp of when an action was last used in a scoreboard objective.\nYour datapack compares this stored time with the current time to determine if the cooldown has ended.Although this is more complicated, this function doesn't rely on any ticking commands. This is especially\ngood for much larger datapacks because it is the most performance-efficient method.What you will createA cooldown.json clock in the world clock folder.A last_used scoreboard objective (this stores when the action was last used).A:check_cooldown function (this is used to check the cooldown)1. Setup the world clockIn your datapack namespace, create a folder named world_clock. Then, create a file named cooldown.json inside the folder. This \nbasically just registers a new world clock (think of this as a special type of stopwatch). This file needs no data, other than {}.{}\nRestart your world/server (/reload isn't enough here), then run /time of :cooldown query time to verify that the clock exists.2. Create the scoreboard objectiveYou will need a scoreboard objective stores the last time the action was used in the cooldown world clock. You can call this scoreboard\nanything - for simplicity, here we will call it last_used. You should create this scoreboard objective in your load function.scoreboard objectives add last_used dummy\n3. Create the check_cooldown functionYou will run this function whenever you want to do something which is on a cooldown. For example, \nif you have a special item which you only want the player to be able to use once every 5 seconds,\nyou would run this function to check if the player is on cooldown or not.In this function, we check the executor's last_used score against the current time on the cooldown clock. If the\ndifference between the times is less than 100 ticks (5 seconds), then the function will return a failure. If not,\nthen the function will return a success and the last_used will be set to the current time.# Temporarily store the current time on the cooldown clock\nexecute store result score #current_time last_used run time of :cooldown query time\n\n# Calculate the difference in times (i.e. the time since the action was last used)\n# basically: \"#current_time\" = \"#current_time\" - time of last use\nscoreboard players operation #current_time last_used -= @s last_used\n\n# If the difference is less than 100 ticks, then not enough time has passed, so we tell the player and then return a failure\nexecute if score #current_time last_used matches ..100 run tellraw @s {color:\"red\",text:\"This is on cooldown! Wait before you try again.\"}\nexecute if score #current_time last_used matches ..100 run return fail\n\n# If the function hasn't yet been stopped, then the player is not on a cooldown\n# so we can update the last_used time and then return a success. \n\nexecute store result score @s last_used run time of :cooldown query time\nreturn 1\n\nDon't modify the cooldown world clock; it will break the cooldown calculations.\n\nplayer still is on a cooldown, then the function will fail and the command will not run. If the player isn't on a cooldown, then\nthe function will set the cooldown and then return a success, so the command WILL run.In this example, a creeper will only be summoned when the player has no active cooldown (in which case, the cooldown will be set).\nIf the player has an active cooldown, then the creeper will not be summoned, and instead the error message in check_cooldown.mcfunction \nwill be sent.execute as if function :check_cooldown run summon creeper\nUsing multiple cooldownsIf you want to have multiple different cooldowns for different items, then you will need a different last_used scoreboard and check_cooldown\nfunction for each cooldown. However, you can re-use the cooldown world clock for as many cooldowns as you wish.","description":"Learn how to create and check cooldown timers using the world clock.","url":"/guide/cooldown/worldclock/","tags":[]},{"title":"Debugging your Datapacks","content":"Debugging your datapacksThere will come times when your datapack won't work, and you will have to figure\nout what exactly doesn't work in it. Don't worry if this happens to you, if\nyou're like any of the rest of us, this will happen often. Code will almost\nnever work the first time you try it. An error in your code is referred to as a\nbug. Removing these bugs is called debugging. This guide will teach you the best\nmethods for debugging datapacks.What are bugs?Bugs are a fancy programmer term for an error in your code. There are two main\ntypes of bugs:Syntax error: This is a bug in the actual written code. This is caused by\nthe code you write being incorrectly written so that the computer literally\ncan't read it. For example, writing executr as @a would be a syntax error\nbecause executr isn't a command.Logic error: This is a bug where the written code is correctly written,\nbut the code doesn't do what you want it to. This is caused by a mistake in\nthe code logic. In the simplest example, if you want to give a player 32\ndiamonds, but you accidentally wrote 322.Finding and debugging syntax errorsSyntax errors are pretty easy to spot and fix, due to Minecraft's output logs,\nwhich literally tell you if your code is incorrect. When you're coding\ndatapacks, its a good idea to always have the logs open if you need to double\ncheck it. You can open the logs by opening the default Minecraft launcher and\nclicking \"Settings\", and then enabling \"Open output log when Minecraft: Java\nEdition starts\", then just starting the game.A guide on how to open the Minecraft launchers output logsSyntax errors will show up in red text when you /reload your datapack. But\nsometimes other errors can also show in yellow text instead.Lets take this image as an example:\nOutput log with an error. Here, the\nerror tells you exactly where the error is - in this case it's in the function\n\"be:give\" at line 1 after \".... give @s\". And indeed I did spell \"loot\" as\n\"lot\", which caused the error.\nCode with a syntax errorFinding logic errorsLogic errors are more difficult to find because there's nothing actually\nincorrect with the code you wrote, it just does something other than what you\nwant it to do.An easy way to find where a logic error is in the code is to make use of the\nsay or tellraw command. These commands will send any message to the\nchat, making it easy for you to know when and if your code actually runs as\nyou expect it to. You can easily put a\nsay Function ran correctly command in your function - If the\nfunction runs, then it will send a message to the chat. It will also send the\nname of the entity that ran the function to the chat, so you can see if your\nfunction is executed by the correct entity.Similarly, you can use the tellraw command for more advanced debugging. The\ntellraw command also has the capability to show you the value of scoreboards and\nNBT values, so you can check what data your code is using. For instance, if you\nwant to check the value of a scoreboard, you could use the following command:tellraw @a {\"score\":{\"name\":\"@s\",\"objective\":\"some_scoreboard_objective\"}}\nBased on the output of these commands in chat, you can use this to tell where\nyour code goes wrong. (Just make sure to remove them after you've found the\nerror, otherwise it can get annoying).You may want to keep the debug messages in the datapack, but you don't want it\nto be sent to every player. Fortunately for us, with the tellraw command, you\ncan specify to who the message will be sent. This means you could only send the\ndebug messages to those who have the tag debug:tellraw @a[tag=debug] {\"text\":\"Debug message sent only to people with the debug tag!\"}\nDebugging logic errorsUnfortunately, debugging logic errors in your code isn't as easy as fixing one\nspelling mistake. But yet there are still techniques that we can use.One way to solve logic errors is to recreate the error in a separate project.\nWhen you remove all the other context of the pack, you can focus just on the bit\nwhich doesn't work. You can just copy out the code you want to fix into a\nseparate datapack, then fix it there. Once you've identified and fixed the\nproblem, you'll know how to fix it in the real project.SummaryThe first main method for debugging datapacks is using Minecraft's output logs,\nwe've already learnt how to use those in the first part of this guide. The\nsecond method is using the in-game commands, like /say and /tellraw to print\ninformation in real-time about how your datapack works. But those are not the\nonly ones, you can use the /scoreboard objectives setdisplay \ncommand to show the values of a scoreboard on your screen in real-time, or you\ncan use /data get ..., which will print the value of any NBT data in chat.A scoreboard on screenYou might also find that some other methods that suit you the best, for example\nyou might find the Data Reload mod\nuseful for displaying errors in chat, or a completely different method, that is\nup to you.","description":"Sometimes your datapack won't work, and you will have to figure out what exactly doesn't work in them. And this guide will help you with exactly that!","url":"/guide/misc/debugging/","tags":[]},{"title":"Slowcast","content":"SlowcastingA Slowcast is similar to a raycast, but unlike a standard Raycast, it is not\ninstant.In some cases it is enough to use a simple tp command that teleports a marker a\nbit forward every tick. If you wanted it to move faster, however, you have to\nincrease the distance it teleports and this could result in skipping over\nentities or blocks you might want to detect.A slowcast solves this problem by teleporting multiple times within a single\ntick to travel faster but still checking if it hits something on its way.\nfunction is a function that runs itself over and over again.\non its way.Slowcasts can be useful if you want to create fast but not instantaneous moving\nprojectiles for magic spells for example.To make a slowcast, you need:To set up a projectile with all the data it needs.A duration function to manage the travel distance.A step function that teleports the projectile and checks if it hit something.A temporary loop that calls the step function for all active projectiles.Let's start by creating all the necessary scoreboards in the load function.scoreboard objectives add temp dummy\nscoreboard objectives add slowcast.steps dummy\nscoreboard objectives add slowcast.duration dummy\nThe next step is to initialize the projectile. This is done by running the\nfollowing function as and at the player. It summons a new marker entity (any\nother entity works too) and runs the setup function as that entity.execute anchored eyes positioned ^ ^ ^.3 summon minecraft:marker run function :setup\nSadly it is not possible to add nbt data in the summon sub-command so we have to\nadd it in the setup function too. We will give it a tag that marks it as a\nslowcast projectile. After that, we set all the scores it needs to function\nproperly. In this example, you will see that instead of setting the scores\ndirectly it copies from temporary scoreboards. This is so that the values are\nnot hardcoded and can be different for different projectiles without having to\ncreate a new setup function for each projectile. At the end, we then call the\ntemporary loop function.tag @s add slowcast\n\nscoreboard players operation @s slowcast.steps = maxSteps temp\nscoreboard players operation @s slowcast.duration = duration temp\n\nfunction :temp_tick\nThe projectile is all set up and the loop function is called. The loop function\nis the part of this whole system that keeps everything running as long as there\nare active slowcast projectiles.execute as @e[type=marker,tag=slowcast,scores={slowcast.duration=1..}] at @s run function :duration\n\nexecute if entity @n[type=marker,tag=slowcast] run schedule function :temp_tick 1t\nNow the actual slowcast logic which handles the movement, travel distance, and\nhit detection.In the looping function the duration function is called, let's make this one\nfirst. This function is responsible for the slowcasts travel distance and\ncalling the step function for the actual movement.Decrease the duration score.Store the projectile step count in a temporary scoreboard.Call the step function 0.2 blocks further in the facing direction.Kill the projectile should it have a distance score of below 1 at the end of\nthe function.scoreboard players remove @s slowcast.duration 1\n\nscoreboard players operation steps temp = @s slowcast.steps\nexecute positioned ^ ^ ^.1 run function :step\n\nexecute unless score @s slowcast.duration matches 1.. run kill\nIn the called step function we handle the teleportation between the current and\ntarget position and check if the projectile has hit something on its way there.Decrement the step score in the temporary scoreboard (we still need the step\nscore stored in the projectile for the next time we call the step function).Make some particles for the visuals (you could replace the particle command\nwith another function call that does more complex stuff).Execute a command as every entity (excluding entities with the slowcast tag\nand players) whose hit box intersects with both\nvirtual volumes\nrun the hit function and kill the projectile.Tp the projectile to the current position (until now it only executed the\ncommand at this position but is still 0.1 block further back).Execute this function again one 0.1 block step forward should the temporary\nstep counter still be over 1 (recursion).scoreboard players remove steps temp 1\n\nparticle flame ~ ~ ~ .1 .1 .1 0 1\n\nexecute as @e[type=!player,type=!marker,dx=0] positioned ~-.99 ~-.99 ~-.99 if entity @s[dx=0] positioned ~.99 ~.99 ~.99 unless function :hit run kill @n[tag=slowcast]\n\ntp ~ ~ ~\n\nexecute if score steps temp matches 1.. positioned ^ ^ ^.1 run function :step\nThe hit function called in the hit detection does whatever you want it to do\nwhen hitting an entity. It could spawn an explosion, apply an effect, or simply\ndeal some damage.\nthe projectile in the step function. You could use this to make a piercing\nprojectile for example.","description":"Like a raycast but in slow. Useful if simply using tp every tick skips over too much when making it fast.","url":"/guide/misc/slowcasts/","tags":[]},{"title":"Raycasts","content":"RaycastingRaycasting is when we shoot a line from the player's eyes in the direction they\nare looking. We use this to get what the player is looking at and do something\nto it, such as spawning an explosion.\nfunction is a function that runs itself over and over again.\nare always run at a position and rotation. This means that we can run a function\nat a postition, move it forward in the direction, and run it again, over and\nover again. This is how we can make a raycast.MethodThis method will show you how to find what entity that a player is looking at.\nThis is useful for many reasons - if you wanted to make a gun datapack, you'd\nneed to damage the entity that a player is looking at in order to damage them.To do this, you have to run a recursive function which will start at the eyes of\nthe player and keep running itself 0.1 blocks forward until it hits an\nentity. When it does hit an entity, you can easily get the entity and do\nsomething to it.Firstly, we'll make the function which, when you run it, will start the\nraycast. In this function, we'll want to:Set the maximum distance for the raycast, so it won't go on forever if it\nnever hits an entity.Run the function at the eyes of the player.To set a maximum distance, we store the maximum amount of times we want the\nfunction to run in a scoreboard. Every time the recursive function runs, we want\nto subtract one from that scoreboard, and only continue if the score is more\nthan 0.First, you need to create a scoreboard in your load function. This scoreboard\nwill store the maximum amount of times the raycast function can run:# Create the scoreboard\nscoreboard objectives add raycast dummy\nThen, when we want to start the raycast, we just do the following:Tag the entity or player that starts the raycast, so we can refer back to\nthem.Set the maximum distance for the raycast.Call the raycast function in the facing direction.Remove the tag at the end, so it doesn't interfere with other raycasts.# Tag the raycaster\ntag @s add raycaster\n\n# Set the maximum distance\nscoreboard players set .raycastLimit raycast 1000\n\n# Begin the raycast function\nexecute at @s anchored eyes positioned ^ ^ ^.1 run function :raycast\n\n# Remove the tag from the raycaster\ntag @s remove raycaster\nIn the raycast function, we just want to check if the function has hit an\nentity, and if not, run it again until it does, hits a wall, or reaches the\nraycasts limit, moving slightly each time.The next step is a bit more complex. We execute a command as every entity that\nis not the caster and whose hitbox intersects with the current path of the\nraycast (using\nvirtual volumes).\nThe command will return run :hit if the raycast hits an entity. The\nreturn run will stop the raycast from running further, and then will run the\nhit function as the entity it has hit.The last command checks if the raycast hit a wall. If it does, the raycast will\nend. If it doesn't, it will then check if the limit is reached, again ending if\nit is. Should the limit not be reached yet, it will move 0.1 blocks forward\nand call the raycast function again (recursion).# Remove one from the raycast limit\nscoreboard players remove .raycastLimit raycast 1\n\n# Optional: display a particle\nparticle minecraft:flame\n\n# Check if the raycast has hit an entity's hitbox\nexecute positioned ~-.99 ~-.99 ~-.99 as @e[dx=0,tag=!raycaster] positioned ~.99 ~.99 ~.99 as @s[dx=0] run return run function :hit\n\n# If the raycast has not hit a wall, and the limit has not been reached, move the raycast forward and run the function again\nexecute if block ~ ~ ~ #minecraft:replaceable if score .raycastLimit raycast matches 1.. positioned ^ ^ ^0.1 run function :raycast\n","description":"Raycasting is when we shoot a line from the player's eyes in the direction they are looking. We use this to get what the player is looking at, and do something to it, such as spawning an explosion.","url":"/guide/misc/raycasts/","tags":[]},{"title":"Mods vs Datapacks","content":"Mods vs DatapacksMods and datapacks are two commonly confused topics in Minecraft, and knowing\nthe difference between them could help you decide which better fits your use\ncase. While both mods and datapacks extend Minecraft's capabilities, mods\ngenerally offer more control and customization, while datapacks are more\nintegrated with the base game and rely on the server.What is a mod?Simply put, mods are modifications to the base game, which includes\nJava code mods, datapacks, resource packs and\nBukkit plugins. In this guide, we will only address two of these topics, Java\ncode mods and datapacks. For the remainder of this guide, when you read \"mod\", we\nwill be referring to Java code mods.DatapacksDatapacks are extensions to vanilla features and are officially supported by\nMojang Studios. Datapacks are becoming increasingly powerful with the advent of\nnew data-driven features, commands and technical additions. For these reasons, \ndatapacks make an excellent addition for a vanilla server or even some modded servers, \nwho don't want to worry about incompatibilities or dealing with broken plugins/mods.Datapacks can be used to define custom world generation,\nadvancements, enchantments, loot tables,\nrecipes and many contain\ncommand functions; small scripts which run Minecraft\ncommands (with some small caveats). Datapacks use these functions to create\nunique mod-like features or add interactivity in maps. Many impressive datapacks\ncan be so well made they are confused for mods, which is where some of the\nconfusion between them and mods stem from.Due to how they work, datapacks can be more limited compared to mods. New\nfeatures have to be added by Mojang themselves before they can be used in\ndatapacks and many custom features such as custom entities and custom blocks\nhave yet to be implemented. In addition to this, anything that requires the\nMinecraft client such as rendering changes or key input is not possible, as\ndatapacks are installed on the server/world.ModMods are unofficial changes to the game's code using Java and in most cases a\nmod loader such as Fabric, Forge, NeoForge, etc. Mods are not supported by\nMojang Studios, while Mojang usually doesn't interact with the modding scene \n(and sometimes, even helps it as with the example of deobfuscation in 26.1), \nthey do not natively support mods and likely never will. Mods allow you to do \nanything you want with the game on both the client and the server. They give you \nfull control of everything in the game from game rendering, to blocks, to key input, \nto even networking. They allow for much more complex interactions with some minor caveats.\nDo not install mods from suspicious sources, as they can have near full access to\nanything on your computer including sensitive files.Always download from a reputable distributor such as\nModrinth or\nCurseForge!\n\nMods can include data and asset files alongside code. This includes shipping\nmodel/texture files in the resource pack format, recipe files in the datapack\nformat, and more.In some cases, mods can simply be datapacks in a specially formatted JAR file!\n\neveryone on the server uses the required mods, which can be hard to manage\nespecially with larger packs. Mods can also be harder to debug and troubleshoot,\nespecially if they utilize parts of Minecraft's obfuscated code (pre-26.1). A strength of\ndatapacks is that anyone can join a server that uses them since they are fully\nvanilla.Summary of DifferencesAs you may have read, datapacks and mods are very different and can be used for\nvery different use cases. Below we've summarized some of the important points\ninto a handy-dandy list!ModsDatapacksAllow for full control over all of Minecraft's codeModify the base systems of the gameCan contain datapacks in the form of data foldersMay contain command functions along with system modifications such as recipes or world generationFull control over everything in game/server and out of game (could be a security risk)Limited to server-side changes of game mechanics, malicious datapacks are much safer than malicious modsGenerally faster and can improve game and server performance due to high level of controlGenerally slower but more lightweight and less resource hungryIdeal for modifying the game in ways datapacks cannot (e.g custom blocks, new mobs) or adding new mechanics/systemsIdeal for small mods that modify existing systems, \"vanilla\" looking mods and map makingServer owners must verify mod compatibility between clientsAny client can use datapacks, making them easy to manageMay require some knowledge of Java to use and debug effectivelyIn most cases, easier to debugIf you would like to learn how to install datapacks, see our guide!","description":"Learn the differences between mods and datapacks","url":"/guide/datapacks-for-mods/mods-vs-datapacks/","tags":[]},{"title":"MCFunction vs Coding","content":"MCFunction vs Traditional CodingMany people will join the datapack community with experience with traditional\nprogramming languages. While this can be helpful for understanding topics, there\nare a lot of differences between the two, many of which can seem confusing when\nyou are used to a more traditional programming language. In this guide we touch\non some common questions and problems people run into when trying to apply\ntraditional coding logic to MCFunction.Q: How do you do variables in MCFunction?MCFunction isn't like most programming languages, MCFunction uses scoreboards,\nstorages and macros (1.20.2+) as their variables.Scoreboards are like a table. They store a\nname and a value which you can then retrieve and modify later. You can use both\nentity names/UUIDs and \"fake player\" names (names not associated with any\nplayer), allowing for easy combination of variables and entity scores.\nScoreboards can only hold 32-bit integers and other data types (such as floats,\ndoubles or strings) can not be stored this way.Storages are a way of storing\nNBT data without attaching it to an entity or\nblock. Storages are stored globally per world and unlike scoreboards, don't need\nto be initialized beforehand. Unlike entity and block NBT, storages have no\nfixed structure, and can contain whichever arbitrary keys are added to it.Macros are like fancy string\ntemplating, when a function is supplied with macros, it will go through the\nfunction file and replace the macro with its value (block, entity, storage).\nInterestingly, this also works function-wide, meaning you could use them as mock\narguments.\nMacros can be significantly slower than other methods, it is best to only use\nthem when necessary or in non-performance-critical code.\n\n# creates a new table called storage\n# (dummy means it does not track any statistic)\nscoreboard objectives add storage dummy\n\n# adds a fake player named \"$steps\" to storage (using prefix \"$\" to avoid collisions with real players, good practice)\nscoreboard players set $steps storage 41\n\n# sets the value of a player to 42\nscoreboard players set Cbble_ storage 42\n\n# Macros\n# Run cool function with a macro\nfunction dph:cool_function with block ~ ~ ~ Items\nfunction dph:cool_function with entity @e[type=minecraft:squid,limit=1,sort=nearest] CustomName\nfunction dph:cool_function {Potato:true}\n\n# Usage with entity NBT:\nexecute as @p run dph:cool_function with entity @s SelectedItem\n\n# this is in the dph:cool_function function\n$say The player running this function is holding $(count) items with ID $(id)!\n\n# Storages\ndata merge storage example:main {number: 1, message: \"Hello!\"}\ndata modify storage example:main other_number set from storage example:main number\ndata modify storage example:main compound.array append value 42\n(Get more info on storages on\nthe wiki page)Q: How do you loop in MCFunction?Looping in most cases is done with 1 of 2 methods, depending on the use case:Recursive Function Calls: This is when a function calls itself which will\nloop until some end condition is met, or forever, if one is never met.Tick Functions (#minecraft:tick): This is a special tag you can declare\nthat will run every function declared in it every tick, it is best practice\nto only have one of these function in a datapack at a time.Q: How do you make functions/methods?Every MCFunction file is its own function which you can run with the function\ncommand. MCFunction does not support inheritance and inherited functions, but\nyou can call any function from anywhere in your datapack.function [...]\nQ: How do I do conditionals?You can also do some basic conditionals with\nselectors, but most if not all conditionals\nare done with the\nexecute if\nsubcommand, which accepts a variety of different inputs and check if they\nmatch/are equal. You can learn more about execute if on the\nexecute page.Q: How do you do math/expressions?MCFunction does math in an interesting way; it uses scoreboard operations in\norder to do math. Using the scoreboard players operation subcommand, you can\ndo a\nvariety of math operations.\nMCFunction does not come with complex math operations like trig functions, absolutes, a\npre-defined Pi, or even square root! These all must be implemented either by\nhand or with a third-party library.\n","description":"Learn the differences between using MCFunctions and traditional coding.","url":"/guide/mcf-vs-code/","tags":[]},{"title":"Generating Random Numbers","content":"Generating Random Numbers using Datapacks!Generating a random number is very useful in programming for many reasons.\nMinecraft 1.20.2 added the /random command, which lets us do this very easily.\nHowever, if you are using an older version, you can still generate random\nnumbers using loot tables.1.20.2 and newerBecause of the /random added in 1.20.2, it is much simpler to generate random\nnumbers. It now only requires a single command:execute store result ... run random value 1..10\nIn the command you can change the values 1 and 10 to change the range. You can\nfill in ... to specify where you want to store the random number. For example,\nto store the random number in the player's scoreboard:execute store result score @s run random value 1..10\n1.20.1 and belowIn earlier versions, a loot table can be used to generate a random number. This\nworks by summoning a loot table which will drop a random amount of air items,\nand storing the result of that summon.This template loot table can be used to generate a random number between 1 and\n10:{\n\"pools\": [\n{\n\"rolls\": {\n\"min\": 1,\n\"max\": 10\n},\n\"entries\": [\n{\n\"type\": \"minecraft:item\",\n\"name\": \"minecraft:stone\",\n\"functions\": [\n{\n\"function\": \"minecraft:set_count\",\n\"count\": 0\n}\n]\n}\n]\n}\n]\n}\nYou can change the values 1 and 10 to change the range. If you leave it as\nit is, it generates a random number between 1-10.To use this, you will just have to store the result of summoning this loot\ntable:execute store result ... run loot spawn ~ ~ ~ loot :rng\n","description":"Generate a random number in a datapack using the /random command, or alternatively, a loot table.","url":"/guide/nbt-and-scores/random-numbers/","tags":[]},{"title":"Floating Point Division","content":"Division with floating pointsTypically, we can use scoreboard players operation to divide two numbers in\nMinecraft. However, this command will only output an integer. If the result of\nthe division is a decimal number, it is always rounded down. To divide numbers\nwith decimal points, we need to use a workaround:Multiply the dividend by a large factor of 10 (e.g 1000000).Divide the numbers using scoreboard players operation.Store the result to a data storage, scaling it down by the same factor of 10.Here is an example of how to divide two arbitrary integer numbers:# Define the numbers we want to divide (in this case, 10 / 3)\nscoreboard players set #dividend math 10\nscoreboard players set #divisor math 3\n\n# Multiply the dividend by 1000000\nexecute store result storage minecraft:math temp int 1000000 run scoreboard players get #dividend math\nexecute store result score #dividend math run data get storage minecraft:math temp\n\n# Divide the numbers\nscoreboard players operation #dividend math /= #divisor math\n\n# Store the result to a data storage\nexecute store result storage minecraft:math result float 0.000001 run scoreboard players get #dividend math\n\n# Display the result\ntellraw @a {\"nbt\":\"result\",\"storage\":\"minecraft:math\"}\nAlternatively, you can scale by 1/n to divide by n. For instance, if you\nwant to divide by 2, you can scale by 1/2 which is 0.5:# Define the numbers we want to divide (in this case, 10 / 2)\nscoreboard players set #dividend math 10\n\n# Scale down by 0.5 (divide by 2)\nexecute store result storage minecraft:math result float 0.5 run scoreboard players get #dividend math\n\n# Display the result\ntellraw @a {\"nbt\":\"result\",\"storage\":\"minecraft:math\"}\n","description":"Learn how to divide numbers in Minecraft which have decimal points.","url":"/guide/nbt-and-scores/division/","tags":[]},{"title":"Player ID System","content":"Player ID SystemThis guide will explain how to create a player ID system within a datapack. A\nplayer ID system gives each player a unique score on a scoreboard, which can\nthen be used to link players to entities, or for the player to be able to select\nanother player easily.Assigning player IDsFirstly, we need to create a scoreboard objective to store the players' IDs.\nThis scoreboard will also hold a counter of the IDs given in a fake player so\nthat no two players end up with the same ID.# Create the playerid scoreboard\nscoreboard objectives add playerid dummy\nNext, we need to assign an ID to the player when they first join the world.\nCreate a function which assigns the value of the max player ID counter to the\nplayer, and then increments it by one.# Assign the max player ID to the player\n# (When this is first ran, .max playerid is not set and read as 0, so the first player gets the ID 0)\nscoreboard players operation @s playerid = .max playerid\n\n# Increment the max player ID by one\nscoreboard players add .max playerid 1\nFinally, we need to make this function run when a player first joins the world.\nWe can do this using a tick advancement - it will only trigger when the player\nfirst joins the world.{\n\"criteria\": {\n\"requirement\": {\n\"trigger\": \"minecraft:tick\"\n}\n},\n\"rewards\": {\n\"function\": \":assign_id\"\n}\n}\nFind the player/entity with a specific IDWe can use a predicate to check if the player has the same ID as the specified\nID (stored in a fake player on a scoreboard). In this case, this predicate will\nonly trigger if the player's playerid score is equal to the playerid score\nof the fake player (#this).{\n\"condition\": \"minecraft:entity_scores\",\n\"entity\": \"this\",\n\"scores\": {\n\"playerid\": {\n\"min\": { \"type\": \"minecraft:score\", \"target\": { \"type\": \"minecraft:fixed\", \"name\": \"#this\" }, \"score\": \"playerid\" },\n\"max\": { \"type\": \"minecraft:score\", \"target\": { \"type\": \"minecraft:fixed\", \"name\": \"#this\" }, \"score\": \"playerid\" }\n}\n}\n}\nWe can call this predicate any time we want to find the player or entity with a\nspecific ID - just set the #this fake player to the score you want to match,\nand then call the predicate as all entities or players. This function will\nreturn all the entities with the same ID as the executor:# Set #this to the current entity's ID\nscoreboard players operation #this playerid = @s playerid\n\n# Find all entities which have the same ID\nexecute as @e[predicate= :match_id] run say I have the same ID.\n","description":"Create a player ID system in a Minecraft datapack for linking players to entities.","url":"/guide/nbt-and-scores/player-id-system/","tags":[]},{"title":"Array Iteration","content":"Array IterationArray Iteration allows us to loop through an array and do something with each\nitem individually (for example, add every item in an array, output each array\nitem individually, modify all elements in an array, combine strings in an array,\netc.)MethodFor this guide, imagine our array is defined with the following:data modify storage minecraft:example ExampleArray set value [\"Array Item 1\", \"Array Item 2\", \"Array Item 3\"]\nThe steps to iterate through the array are:Store the length of the array in a score.Do something with the first element in the array (array[0]) - you can\neither just read the element, or modify it.Copy the first element to the end of the array, then remove the first\nelement.Decrease the length score by 1.If the length score is 1 or more, repeat from step 2 until it isn't.First, we need a function which will begin the process. This is where we do step\n1 and then run the loop function:# Get the length of the array, and store it in a fake player in a scoreboard\n# (we assume you already have created a scoreboard - do this in your load function)\nexecute store result $length run data get storage minecraft:example ExampleArray\n\n# If the length is at least 1, run the loop function\nexecute if score $length matches 1.. run function :array_loop\nIn the array_loop function, you can do whatever you want to the array item,\nincluding modifying it. In this example, we will send the array item to chat,\nand then replace it with \"Iterated\".# We can access the current array item with \"storage minecraft:example ExampleArray[0]\"\n\n# Send the current array element to chat\ntellraw @a {\"nbt\":\"ExampleArray[0]\",\"storage\":\"minecraft:example\"}\n\n# Replace the current array element with \"Iterated\"\ndata modify storage minecraft:example ExampleArray[0] set value \"Iterated\"\n\n# Copy the current element to the end of the array then remove the current element (so the loop will work)\ndata modify storage minecraft:example ExampleArray append from storage minecraft:example ExampleArray[0]\ndata remove storage minecraft:example ExampleArray[0]\n\n# Decrease the length score\nscoreboard players remove $length 1\n\n# If there are still items left (length is not 0), run the loop again\nexecute if score $length matches 1.. run function :array_loop\nThe chat output should be as follows:Array Item 1\nArray Item 2\nArray Item 3\n\n# /data get storage minecraft:example ExampleArray\nOutput: [\"Iterated\", \"Iterated\", \"Iterated\"]\n","description":"This guide explains how to loop through an array's items in a Minecraft datapack","url":"/guide/nbt-and-scores/array-iteration/","tags":[]},{"title":"Adding Paintings","content":"How to add custom paintingsBy the end of this guide, you will be able to implement your own custom\npaintings, which will show up in the creative inventory.This will only work in 1.21+, as custom painting variants were added in the\nsnapshot 24w18a.\nyou don't understand this guide, you can read the\nGetting Started guide.\nthe Getting Started guide.Firstly, we are going to create the main painting variant file in the directory\ndata/ /painting_variant/. You can name the file whatever you want,\nbut it has to be in the .json file format. For the purposes of this tutorial,\nwe're going to call it example_painting.json. Inside, we will put and\nconfigure these settings:{\n\"asset_id\": \":example_painting-texture\",\n\"title\": \"Example Painting\",\n\"author\": \"Datapack Hub\",\n\"height\": 1,\n\"width\": 1\n}\nThis is a run-down of the fields in that file:title: A text component to use as this paintings title.author: A text component to use as this paintings author.height: A value between 1 and 16, represents the height of the painting when\nplaced.width: A value between 1 and 16, represents the width of the painting when\nplaced.asset_id: The resource location of the paintings texture to use. In this\nexample, example:texture_name would direct to\nassets/example/textures/painting/texture_name.png.If you are not sure what to put in asset_id, don't worry, the resource pack\npart is going to focus on that!To finish with the datapack, we are going to have to add the newly created\npainting into Minecraft's #minecraft:placeable painting variant tag. This will\nallow the painting to be placed via the Painting item, and to be added to the\ncreative inventory. To do this, create a new file called placeable.json under\ndata/minecraft/tags/painting_variant/placeable.json. Please note that the\nexact spelling and the use of the Minecraft namespace is required here!{\n\"values\": [\n\":example_painting\"\n]\n}\nFinish off with the Resource PackLastly, we are going to add the actual painting texture file. This has to be\nplaced in assets/example/textures/painting/.png This\ntexture, of course, has to have the same dimensions as the width and height you\npreviously entered into the painting variant definition file.Optionally, you can change the author and title in the datapack definition to\nuse a resourcepack translation file. Which can be added into\nassets/example/lang/.json under\n\"painting..example_painting.\".See it in actionOnce you save the above files, you need to reload the resource pack with the\nkeybind F3 + T in-game. You will also need to leave and rejoin the world to\nupdate the datapack.\n/reload command won't do the trick here!\ninto a 1x1 spot, or by searching for \"Example Painting\" in the creative\ninventory.","description":"Learn how to add custom paitings to Minecraft just with a datapack and a resourcepack!","url":"/guide/adding-new-features/painting-variants/","tags":[]},{"title":"Recipes for your Custom Items","content":"Creating Recipes for your Custom ItemsThere are two ways to add recipes to your custom items, they differentiate based\non what Minecraft version you are developing for. The first one is for the\nMinecraft version 1.20.5+ (Datapack format 34+), here items can be directly\nspecified in the output with item components.\nThe second method is for all version before 1.20.5.1.20.5 and newerThis is the easier method of the two, only requiring you to put the item id and\ncomponents into the recipe output.\ninput items, only in the result. Meaning your custom item can't (easily) be\ncrafted out of different custom items.\nfile, that being the actual crafting recipe file. This file can be named\nwhatever, but has to end in the .json file format.Here is an example of a recipe with the output of a custom item:{\n\"type\": \"minecraft:crafting_shaped\",\n\"pattern\": [\n\"ttt\",\n\" s \",\n\" s \"\n],\n\"key\": {\n\"t\": {\n\"item\": \"minecraft:turtle_scute\"\n},\n\"s\": {\n\"item\": \"minecraft:stick\"\n}\n},\n\"result\": {\n\"id\": \"minecraft:iron_pickaxe\",\n\"count\": 1,\n\"components\": {\n\"minecraft:tool\": {\n\"rules\": [\n{\n\"blocks\": \"minecraft:turtle_egg\",\n\"speed\": 6,\n\"correct_for_drops\": true\n}\n],\n\"default_mining_speed\": 3,\n\"damage_per_block\": 1\n},\n\"minecraft:item_name\": \"{\\\\\\\"text\\\\\\\":\\\\\\\"sCUTE-axe\\\\\\\"}\"\n}\n}\n}\nIn the example, you can see that the result has a \"components\" field, where\nyou can list the components that your custom item should have. I can also\nrecommend a useful site for generating recipes with specified components:\nhttps://misode.github.io/recipe/1.20.4 and belowThis part of the guide assumes that you already knowledge some basic commands\nand how crafting recipes and advancements work.To create a crafting recipe for one of your custom items, you need just a little\nbit more than for a normal recipe. This is because of the fact that you couldn't\nuse NBT in recipes before 1.20.5 dropped, so that's why we need a small\nworkaround.Lets create the recipe first:{\n\"type\": \"minecraft:crafting_shaped\",\n\"pattern\": [\n\"ttt\",\n\" s \",\n\" s \"\n],\n\"key\": {\n\"t\": {\n\"item\": \"minecraft:turtle_scute\"\n},\n\"s\": {\n\"item\": \"minecraft:stick\"\n}\n},\n\"result\": {\n\"item\": \"minecraft:knowledge_book\"\n}\n}\nAs mentioned before, we can't use the custom item as output, so we use the\nknowledge book as a placeholder.To switch the knowledge book with our custom item, we need an advancement to\nreact when we craft the recipe. For this we use the recipe_crafted trigger.\nWith some trickery, here it is also possible to make the ingredients require\ncertain nbt.{\n\"criteria\": {\n\"requirement\": {\n\"trigger\": \"minecraft:recipe_crafted\",\n\"conditions\": {\n\"recipe_id\": \":scuteaxe\"\n}\n}\n},\n\"rewards\": {\n\"function\": \":craft_scuteaxe\"\n}\n}\nLastly we have to make the actual function that handles the item switching. You\ncan either use a give command or, what I recommend more, define the item in a\nseparate loot table and then use the loot command.clear @s knowledge_book\nadvancement revoke @s only :craft_scuteaxe\n# Any code can go here, this will run when the player crafts the item.\nloot give @s loot :\n# You can also you a give command here instead\n\nthe files we've just created.","description":"Learn how to make custom crafting recipes for custom items in Minecraft Datapacks.","url":"/guide/adding-new-features/custom-items/crafting/","tags":[]},{"title":"Creating Custom Items","content":"Creating Custom ItemsIn this guide, we will go over the basics explaining how custom items work, as\nwell as how to make your own using item components. This guide will not go over\nhow to give your custom items a texture or model.Since 1.21, it has been easy to create custom items in Minecraft. 1.21\nintroduced item components, which are like\ntags you can put on items to change their appearance or functionality. This is\nthe basis for how custom items work - we take an item which already exists, then\nadd or remove item components from that item to give it the desired feel and\nfunctionality.In this guide, we will create a custom edible item which can mine sand instantly\nand makes the player who eats it glow.How do custom items work?Custom items are items with a unique set of item components to change their\nappearance and functionality. As of 1.21, we cannot create fully custom items -\ninstead, we need to take an item which exists, and add, remove, or edit their\nitem components to customise it.Item components cannot cover every desired functionality. An example of this is\ndoing something when the item is right clicked. We still have to use workarounds\nfor this, such as giving the item a food component to make it edible, then\ndetecting when a player starts eating it. You can read more about this in our\nright click detection summary.Creating our custom itemWe are going to create a custom item with the following properties:It can mine sand very quicklyIt is edible, and players who eat it will start glowingIt will be called Sandy McDesertfaceWe will use item components to give the item those properties. Item components\nare put after the item in our item's give command. For example:/give @s flint[minecraft:item_name=\"Sharp Rock\"]\nThese are all the item components which we are going to use.PropertyComponent neededOur componentMines sand very quicklyminecraft:tool is used to make items mine different blocks quickly[tool={default_mining_speed:1.5,damage_per_block:0,rules:[{blocks:\"minecraft:sand\",speed:100}]}]Is edible, makes the player glowminecraft:consumable makes items edible. We can also use it to specify an effect for the player to recieve.[consumable={on_consume_effects:[{type:\"minecraft:apply_effects\",effects:[{id:\"minecraft:glowing\",amplifier:1,duration:100}]}]}]Gives the player saturation and nutrition stats on consumptionminecraft:food gives the player saturation and nutrition after consuming it.[food={nutrition:3,saturation:1,can_always_eat:true}]Is called Sandy McDesertfaceminecraft:item_name overrides our item name.[item_name=\"Sandy McDesertface\"]Combining all of these together, we can create a give command for our custom\nitem:/give @s stick[tool={default_mining_speed:1.5,damage_per_block:0,rules:[{speed:100,blocks:\"sand\"}]},food={nutrition:3,saturation:1,can_always_eat:true},consumable={on_consume_effects:[{type:\"minecraft:apply_effects\",effects:[{id:\"minecraft:glowing\",amplifier:1,duration:100}]}]},item_name='\"Sandy McDesertface\"'] 1\n\nan existing item. We do not yet have the functionality to create our own item\nIDs. However, we can make use of the item_model component to change the model\nor texture of an item as explained in\nthis guide.","description":"Learn how to make custom items with Minecraft Java datapacks","url":"/guide/adding-new-features/custom-items/intro/","tags":["beginner","guide","custom_items","item_components"]},{"title":"Creating Custom Item Models and Textures","content":"Creating Custom Item Models and TexturesThis guide uses the item_model item component to change the model and texture\nof items with that component. It does not replace any vanilla items. It also\ngoes over\nspawning custom models in your world as an entity.\nitems. It was replaced with item models in Minecraft version 1.21.4, so it won't\nwork in later versions. Item Models use a completely different method\ncompared to Custom Model Data.\nyou already have a resource pack or know how to create one, you can skip to\nAdding custom items. If not, just continue reading.Creating an empty resource packBefore creating your custom item, you will have to create a basic resource pack.\nFor that, create an empty folder in your minecraft/resourcepacks directory.\nCreate a new file in that folder called pack.mcmeta and add the following\ntext:{\n\"pack\": {\n\"pack_format\": 69,\n\"description\": \"\"\n}\n}\nAdd a new folder named assets, and a folder inside with the name of your\nnamespace. This should be the name of your resource pack, in small letters\nand with underscores (_) as spaces.Now to the fun part.Adding custom itemsYou will now have to decide it you want a simple,\n2d item (like for example a Totem of Undying) or a\ncustom 3d model.Adding custom 2d itemsTo add a custom texture, make sure it's a png and place it in the\nassets/namespace/textures/item directory. You can give it any name, but it\nmakes sense to keep it lowercase and without spaces. Your texture will also have\nto have a 16x16 size.Now, you will add the default Minecraft model for 2-dimensional items to your\ncustom item. To do that, create a file in\nassets/namespace/models/item/your_item.json with the following contents:{\n\"parent\": \"item/generated\",\n\"textures\": {\n\"layer0\": \"namespace:item/your_texture\"\n}\n}\nYou can now continue reading at\nAdding the item_modelAdding custom 3d modelsFor creating your custom model, I recommend using\nBlockbench. It's the most popular Minecraft model\ncreation tool and even used by Minecraft itself. Export both the texture and the\nmodel as a Block/Item model.When you have your model and texture file, you will have to place your model in\nthe assets/namespace/models/item/your_model.json folder and your texture in\nassets/namespace/textures/item/your_item.json. You can use any name, but it\nmakes sense to keep it lowercase and with underscores (_) instead of\nspaces.TexturesYour model file will now probably look like this:JSON of the model fileReplace all the values inside the textures bracket with\nnamespace:item/your_texture.\ncreate this file in assets/namespace/items/your_item.json:{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"namespace:item/your_item_model\"\n}\n}\nThis binds your model to the item_model component.You can now add your texture to any item using this command:/give @s [item_model=\"namespace:your_item\"]\n\nvanilla item texture without a resource pack nor a data pack using a command\nlike this:/give @s [item_model=\"minecraft:vanilla_item\"]\n\nDisplay. An item display does what the name suggests: It displays items. And\nsince you can change the model and texture of an item, you can also change them\non an item display. You can spawn an item displays with your custom\nmodel/texture like this:/summon item_display ~ ~ ~ {item:{id:\"minecraft:paper\",count:1,components:{\"minecraft:item_model\":\"namespace:your_item\"}}}\n\nyour models. The best you can do is using multiple item displays and teleporting\nthem/changing their transformation data. ","description":"Learn how to make custom item models and textures with Minecraft Java resource packs","url":"/guide/adding-new-features/custom-items/models/","tags":[]},{"title":"Adding Jukebox Songs","content":"How to add custom jukebox songsIn this guide, we will not only learn how to create custom jukebox songs, but\nalso how to give yourself a custom music disc item and implement custom sounds!This will only work in 1.21+, as custom jukebox songs were added in the snapshot\n24w21a.\nyou don't understand this guide, you can read the\nGetting Started guide.\nthe Getting Started guide.Firstly, we are going to create the actual jukebox song file in the directory\ndata/ /jukebox_song/. The file can be named whatever, but\nit has to be in the .json file format. For the purposes of this tutorial,\nwe're gonna call it example_jukebox_song.json. Inside, we will put and\nconfigure this:{\n\"comparator_output\": 13,\n\"description\": {\n\"text\": \"ARTIST - SONG NAME\"\n},\n\"length_in_seconds\": 69.0,\n\"sound_event\": {\n\"sound_id\": \":\"\n}\n}\nThis is a run-down of the fields in that file:comparator_output: A value between 1 and 15, representing the redstone\noutput when a comparator is placed next to the jukebox playing this song.description: The description of the enchantment (should be a JSON text\ncomponent).length_in_seconds: The length of the song (in seconds).sound_event: The ID of the sound (from the resource pack) to play.If you don't understand what to put in sound_event, don't worry, the next part\nis going to focus specifically on this!Adding custom music - Resource PackThis part is going to be optional in the case, that you only want a vanilla\nMinecraft sound to play from the jukebox. In that case, change the sound_id in\nthe example_jukebox_song.json file from the datapack to the sounds ID. (for\nexample: \"sound_id\": \"minecraft:music_disc.cat\").If you don't want to use a default Minecraft sound, then a resource pack is\nrequired to add the custom sound (in this case, the music on the disc) to\nMinecraft, so that the datapack can read it.\ncan use to convert an MP3, WAV, or other audio file to .ogg.\nassets/ /sounds/.ogg. Make sure thatand\nare the same values you put in the datapack's JSON file (the\nexample_jukebox_song.json file in our case).Then, if you haven't already, you need to create a sounds.json file at the\nposition assets/ /sounds.json. This file tells Minecraft what audio\nfiles map to what IDs. Put this inside:{\n\"music_disc.\": {\n\"sounds\": [\n{\n\"name\": \":\",\n\"stream\": true\n}\n]\n}\n}\nSee it in actionOnce you save the above files, you need to activate the resource pack with the\nkeybind F3 + T in-game. You will also need to leave and rejoin the world to\nupdate the datapack.\n/reload command won't do the trick here!\nminecraft:jukebox_playable component. This can be any item - it doesn't have\nto necessarily be an already existing music disc (but you can if you want).give @s minecraft:YOUR_ITEM[minecraft:jukebox_playable=\":example_jukebox_song\"]\nThen, you can use this item on a jukebox, and it should start playing your song!","description":"Learn how to create custom music discs and custom jukebox songs with Minecraft datapacks","url":"/guide/adding-new-features/jukebox-songs/","tags":[]},{"title":"Adding Smithing Trims","content":"How to add custom Smithing TrimsThis guide is split into three parts, adding a custom smithing trim pattern,\nadding a custom smithing trim color palette and adding a custom trimmable item.\nThese parts can be seperately without following each other.\nyou don't understand this guide, you can read the\nGetting Started guide.\nthe Getting Started guide.Adding a smithing trim patternSetting up the datapack - Smithing Trim PatternTo start, we are going to create the main trim pattern file in the directory\ndata/ /trim_pattern/. You can name the file whatever you want, but\nit has to be in the .json file format. For the purposes of this tutorial,\nwe're going to call it example_pattern.json. Inside, we will put and configure\nthese settings:{\n\"asset_id\": \":example_template\",\n\"description\": \"Example Trim\",\n\"decal\": false\n}\nThis is a run-down of the fields in that file:description: A text component to use as this trim's description name.asset_id: The resource location which is used in the resourcepack.decal: Whether or not the pattern texture should be masked based on the\nunderlying armor. Optional, defaults to false.If you are not sure what to put in asset_id, don't worry, the resource pack\npart is going to focus on that!Now, we are going to add the recipe file into data/ /recipe/. You\ncan see more about the recipe's format\nhere.{\n\"type\": \"minecraft:smithing_trim\",\n\"addition\": \"#minecraft:trim_materials\",\n\"base\": \"#minecraft:trimmable_armor\",\n\"template\": \"minecraft:diamond_block\",\n\"pattern\": \":example_template\"\n}\nHere we have to specify the template item which is going to be used for the\npattern, and the trim pattern ID itself.Finishing up with the resourcepack - Smithing Trim PatternTo finish off, we'll need to add the actual definition for all the different\ncolors and armor types. This can be done by changing the armor trim's atlas\nfile. This file can be found in assets/minecraft/atlases/armor_trims.json.\nPlease note that the exact spelling and the use of the Minecraft namespace is\nrequired here!{\n\"sources\": [\n{\n\"type\": \"minecraft:paletted_permutations\",\n\"textures\": [\n\":trims/entity/humanoid/example_template\",\n\":trims/entity/humanoid_leggings/example_template\"\n],\n\"palette_key\": \"trims/color_palettes/trim_palette\",\n\"permutations\": {\n\"quartz\": \"trims/color_palettes/quartz\",\n\"iron\": \"trims/color_palettes/iron\",\n\"gold\": \"trims/color_palettes/gold\",\n\"diamond\": \"trims/color_palettes/diamond\",\n\"netherite\": \"trims/color_palettes/netherite\",\n\"redstone\": \"trims/color_palettes/redstone\",\n\"copper\": \"trims/color_palettes/copper\",\n\"emerald\": \"trims/color_palettes/emerald\",\n\"lapis\": \"trims/color_palettes/lapis\",\n\"amethyst\": \"trims/color_palettes/amethyst\",\n\"iron_darker\": \"trims/color_palettes/iron_darker\",\n\"gold_darker\": \"trims/color_palettes/gold_darker\",\n\"diamond_darker\": \"trims/color_palettes/diamond_darker\",\n\"netherite_darker\": \"trims/color_palettes/netherite_darker\",\n\"resin\": \"trims/color_palettes/resin\"\n}\n}\n]\n}\nAnd now to finish, we'll need the actual trim textures. These should be\ngrayscale images using the same colors as\ntextures/trims/color_palettes/trim_palette (can be seen below).These black-and-white colors will be automatically replaced by the game when a\ntrim color palette is applied. An example file of\n /textures/trims/entity/humanoid/example_template and\n /textures/trims/entity/humanoid_leggings/example_template can also\nbe found below.Once you save the above files, you need to reload the resource pack with the\nkeybind F3 + T in-game. You will also need to leave and rejoin the world to\nupdate the datapack.\n/reload command won't do the trick here!\ngoing to create the main trim color palette file in the directory\ndata/ /trim_material/. Once again, you can name the file whatever\nyou want, but it has to be in the .json file format. For the purposes of this\ntutorial, we're going to call it matexample.json. Inside, we will put and\nconfigure these settings:{\n\"asset_name\": \"matexample\",\n\"description\": {\n\"text\": \"Example Material\",\n\"color\": \"#00e09d\"\n}\n}\nThis is a run-down of the fields in that file:description: A text component to use as this trim's material description\nname.asset_name: The resource location which is used in the resourcepack.override_armor_materials: A list of optional armors which should have a\ndifferent color palette. (E.g. Gold trim on gold armor has a darker color\npalette.)Next, we are going to add the ingredient item to the\n#minecraft:trim_materials item tag. This ensures the item can be used as an\ningredient in the smithing table. This file is located in\ndata/minecraft/tags/item/. Please note that the exact spelling and the use of\nthe Minecraft namespace is required here!{\n\"values\": [\n\"minecraft:barrier\"\n]\n}\nAs of 1.21.5, every item you want to work as a trim material, needs to have the\nprovides_trim_material\nitem component. So to give ourselfs a barrier which provides our custom trim\nmaterial, we can use this /give command:/give @s barrier[provides_trim_material=\":matexample\"] 1\nFinishing up with the resourcepack - Smithing Trim MaterialTo finish off, we'll need to add the material definition in the resourcepack.\nThis can be done by changing the armor trim's atlas file. This file can be found\nin assets/minecraft/atlases/armor_trims.json. Please note that the exact\nspelling and the use of the Minecraft namespace is required here!{\n\"sources\": [\n{\n\"type\": \"paletted_permutations\",\n\"textures\": [\n\"trims/entity/humanoid/bolt\",\n\"trims/entity/humanoid_leggings/bolt\",\n\"trims/entity/humanoid/flow\",\n\"trims/entity/humanoid_leggings/flow\",\n\"trims/entity/humanoid/coast\",\n\"trims/entity/humanoid_leggings/coast\",\n\"trims/entity/humanoid/sentry\",\n\"trims/entity/humanoid_leggings/sentry\",\n\"trims/entity/humanoid/dune\",\n\"trims/entity/humanoid_leggings/dune\",\n\"trims/entity/humanoid/wild\",\n\"trims/entity/humanoid_leggings/wild\",\n\"trims/entity/humanoid/ward\",\n\"trims/entity/humanoid_leggings/ward\",\n\"trims/entity/humanoid/eye\",\n\"trims/entity/humanoid_leggings/eye\",\n\"trims/entity/humanoid/vex\",\n\"trims/entity/humanoid_leggings/vex\",\n\"trims/entity/humanoid/tide\",\n\"trims/entity/humanoid_leggings/tide\",\n\"trims/entity/humanoid/snout\",\n\"trims/entity/humanoid_leggings/snout\",\n\"trims/entity/humanoid/rib\",\n\"trims/entity/humanoid_leggings/rib\",\n\"trims/entity/humanoid/spire\",\n\"trims/entity/humanoid_leggings/spire\",\n\"trims/entity/humanoid/silence\",\n\"trims/entity/humanoid_leggings/silence\",\n\"trims/entity/humanoid/wayfinder\",\n\"trims/entity/humanoid_leggings/wayfinder\",\n\"trims/entity/humanoid/raiser\",\n\"trims/entity/humanoid_leggings/raiser\",\n\"trims/entity/humanoid/shaper\",\n\"trims/entity/humanoid_leggings/shaper\",\n\"trims/entity/humanoid/host\",\n\"trims/entity/humanoid_leggings/host\"\n],\n\"palette_key\": \"trims/color_palettes/trim_palette\",\n\"permutations\": {\n\"matexample\": \":trims/color_palettes/matexample\"\n}\n}\n]\n}\nAnd next, we are going to modify assets/minecraft/atlases/blocks.json:{\n\"sources\": [\n{\n\"type\": \"paletted_permutations\",\n\"textures\": [\n\"trims/items/leggings_trim\",\n\"trims/items/chestplate_trim\",\n\"trims/items/helmet_trim\",\n\"trims/items/boots_trim\"\n],\n\"palette_key\": \"trims/color_palettes/trim_palette\",\n\"permutations\": {\n\"matexample\": \":trims/color_palettes/matexample\"\n}\n}\n]\n}\nHere, the key-value pair under permutations should be the same as the\nasset_name field from the datapack file we created before.Now, we will need to create the actual material color palette texture. Since we\nare using Vanilla's default palette_key, this image needs to have a width of 8\nand a height of 1. You can see an example palette below. This image should be\nsaved in assets/ /textures/trims/color_palettes/ as\nmatexample.png.Now comes the last and also hardest part, adding the item models and their\ndefinition for all the armor pieces. I will only show this on the diamond\nchestplate but you will have to create a file for every single armor pieces!To do this, create a new file in assets/minecraft/models/item/ called\ndiamond_chestplate_matexample_trim.json, where matexample is the name of\nyour trim material. Inside that file, put this:{\n\"parent\": \"minecraft:item/generated\",\n\"textures\": {\n\"layer0\": \"minecraft:item/diamond_chestplate\",\n\"layer1\": \"minecraft:trims/items/diamond_chestplate_matexample_trim\"\n}\n}\nAnd inside assets/minecraft/items/diamond_chestplate.json put and configure\nthis:{\n\"model\": {\n\"type\": \"minecraft:select\",\n\"cases\": [\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_quartz_trim\"\n},\n\"when\": \"minecraft:quartz\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_iron_trim\"\n},\n\"when\": \"minecraft:iron\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_netherite_trim\"\n},\n\"when\": \"minecraft:netherite\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_redstone_trim\"\n},\n\"when\": \"minecraft:redstone\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_copper_trim\"\n},\n\"when\": \"minecraft:copper\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_gold_trim\"\n},\n\"when\": \"minecraft:gold\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_emerald_trim\"\n},\n\"when\": \"minecraft:emerald\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_diamond_trim\"\n},\n\"when\": \"minecraft:diamond\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_lapis_trim\"\n},\n\"when\": \"minecraft:lapis\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_amethyst_trim\"\n},\n\"when\": \"minecraft:amethyst\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_resin_trim\"\n},\n\"when\": \"minecraft:resin\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_matexample_trim\"\n},\n\"when\": \":matexample\"\n}\n],\n\"fallback\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate\"\n},\n\"property\": \"minecraft:trim_material\"\n}\n}\nHere, the majority of the file remains the same as default, only the last trim\nmodel definition was added.Once you save the above files, you need to reload the resource pack with the\nkeybind F3 + T in-game. You will also need to leave and rejoin the world to\nupdate the datapack.\n/reload command won't do the trick here!\ndatapack side of things is very simple. We only need to add the\ndiamond_pickaxe to the #minecraft:trimmable_armor item tag, which is located\nin data/minecraft/tags/item/. Once again, the Minecraft directory is required\nhere.{\n\"values\": [\n\"minecraft:diamond_pickaxe\"\n]\n}\nFinishing up with the resourcepack - Smithable ItemIn the resourcepack, we'll need to customize the diamond pickaxe's item model\ndefinition. This is located inside of assets/minecraft/items/.{\n\"model\": {\n\"type\": \"minecraft:select\",\n\"cases\": [\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_quartz_trim\"\n},\n\"when\": \"minecraft:quartz\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_iron_trim\"\n},\n\"when\": \"minecraft:iron\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_netherite_trim\"\n},\n\"when\": \"minecraft:netherite\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_redstone_trim\"\n},\n\"when\": \"minecraft:redstone\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_copper_trim\"\n},\n\"when\": \"minecraft:copper\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_gold_trim\"\n},\n\"when\": \"minecraft:gold\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_emerald_trim\"\n},\n\"when\": \"minecraft:emerald\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_diamond_trim\"\n},\n\"when\": \"minecraft:diamond\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_lapis_trim\"\n},\n\"when\": \"minecraft:lapis\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_amethyst_trim\"\n},\n\"when\": \"minecraft:amethyst\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_resin_trim\"\n},\n\"when\": \"minecraft:resin\"\n}\n],\n\"fallback\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe\"\n},\n\"property\": \"minecraft:trim_material\"\n}\n}\nNext we will need to create the following file for every single material\nlisted in the file above. All of the files need to be located inside\nassets/minecraft/models/item/ directory. For the purpose of this guide, i will\nonly create one for the resin material.{\n\"parent\": \"minecraft:item/generated\",\n\"textures\": {\n\"layer0\": \"minecraft:item/diamond_pickaxe\",\n\"layer1\": \"minecraft:trims/items/pickaxe_trim_resin\"\n}\n}\nYou might have noticed that the file above mentions a pickaxe_trim_resin\ntexture. Fortunately, we do not need to create this texture file as it is\ngenerated automatically by the game. But for it to work, we need to create the\natlas file inside assets/minecraft/atlases/blocks.json.{\n\"sources\": [\n{\n\"type\": \"paletted_permutations\",\n\"textures\": [\n\"trims/items/pickaxe_trim\"\n],\n\"palette_key\": \"trims/color_palettes/trim_palette\",\n\"permutations\": {\n\"quartz\": \"trims/color_palettes/quartz\",\n\"iron\": \"trims/color_palettes/iron\",\n\"gold\": \"trims/color_palettes/gold\",\n\"diamond\": \"trims/color_palettes/diamond\",\n\"netherite\": \"trims/color_palettes/netherite\",\n\"redstone\": \"trims/color_palettes/redstone\",\n\"copper\": \"trims/color_palettes/copper\",\n\"emerald\": \"trims/color_palettes/emerald\",\n\"lapis\": \"trims/color_palettes/lapis\",\n\"amethyst\": \"trims/color_palettes/amethyst\",\n\"resin\": \"trims/color_palettes/resin\"\n}\n}\n]\n}\nNow for the last step, we will need to create the pickaxe_trim texture. This\nis a black-and-white mask which is applied on-top of the diamond pickaxe when it\nhas a trim applied. Please note that the file has to use the same colors as\nVanillas textures/trims/color_palettes/trim_palette (this file can be seen in\nthe\nSmithing Trim Pattern\nchapter.) This image has to be located in\nassets/minecraft/textures/trims/items/ with the name pickaxe_trim.png The\ntexture I used can be found below:Once you save the above files, you need to reload the resource pack with the\nkeybind F3 + T in-game. You will also need to leave and rejoin the world to\nupdate the datapack.\n/reload command won't do the trick here!","description":"Learn how to add custom smithing trims patterns to Minecraft just with a datapack and a resourcepack!","url":"/guide/adding-new-features/smithing-trims/","tags":[]},{"title":"Adding Mob Variants","content":"How to add custom mob variantsBy the end of this guide, you will be able to add your own naturally spawning\nmob variants, including custom spawn conditions.This will only work in 1.21.5+, as data-driven mob variants were added in the\nsnapshot 25w04a. \nunderstanding of datapacks. If you don't understand this guide, you can read the\nGetting Started guide. \nthe Getting Started guide.Firstly, we are going to create the main cat variant file in the directory\ndata/ /cat_variant/. You can name the file whatever you want, but it\nhas to be in the .json file format. For the purposes of this tutorial, we're\ngoing to call it example_cat.json. Inside, we will put and configure these\nsettings:{\n\"asset_id\": \"example:entity/cat/example_cat\",\n\"baby_asset_id\": \"example:entity/cat/custom_baby_cat\",\n\"spawn_conditions\": [\n{\n\"priority\": 0\n}\n]\n}\nThis is a run-down of the fields in that file:asset_id: The resource location of the paintings texture to use. In this\nexample, example:entity/cat/example_cat directs to\nassets/example/textures/entity/cat/example_cat.png.spawn_conditions: A list of spawn conditions, each with a priority. Right\nnow we only have one, with a priority of 0. This means it will spawn like any\nother cat texture.Settings up the resource packNext we are going to add the actual texture file for the cat variant. This needs\nto be placed in assets/ /textures/entity/cat/, and match the name\nyou specified in the asset_id field earlier. In this example that is\nexample_cat.png.TestingIf you load the datapack and the resource pack, you should now be able to spawn\nyour cat using /summon minecraft:cat ~ ~ ~ {variant:\"example:example_cat\"}\nusing the /reload command won't do the trick here! \nfield in the .json file you created earlier.{\n\"asset_id\": \"example:entity/cat/custom\",\n\"baby_asset_id\": \"example:entity/cat/custom_baby_cat\",\n\"spawn_conditions\": [\n{\n\"condition\": {\n\"type\": \"minecraft:structure\",\n\"structures\": \"minecraft:village_snowy\"\n},\n\"priority\": 1\n},\n{\n\"condition\": {\n\"type\": \"minecraft:biome\",\n\"biomes\": \"snowy_taiga\"\n},\n\"priority\": 1\n},\n{\n\"priority\": 0\n}\n]\n}\nThis cat variant will spawn with a priority level of 1 if it spawns in a snowy\nvillage or a snowy taiga. If another cat variant were to meet its spawn\nconditions, the game would randomly select a variant.For more spawn conditions, see\nthis page on\nthe minecraft wiki.Other mobs with variantsYou can also add variants for these mobs:chickencowfrogpigwolfzombie nautilusFor example, if you wanted to add a frog variant, you would:Create a variant file in data/ /frog_variantAdd something like the following to the file:{\n\"asset_id\": \"example:entity/frog/example_frog\",\n\"spawn_conditions\": [\n{\n\"priority\": 0\n}\n]\n}\nAdd the texture to assets/ /textures/entity/frog/example_frogMobs with additional fieldsIf you want to add a chicken, cow, or pig variant, you'll also need to specify\nthe model field, like this:{\n\"asset_id\": \"example:entity/cow/example_cow\",\n\"baby_asset_id\": \"example:entity/cow/example_cow_baby\",\n\"model\": \"normal\",\n\"spawn_conditions\": [\n{\n\"priority\": 0\n}\n]\n}\nThe model field can be:normal, cold or warm for cowsnormal or cold for chickens and pigsnormal or warm for zombie nautiliIf you want to add a wolf variant, you'll need to specify 3 textures, like this:{\n\"assets\": {\n\"angry\": \"example:entity/wolf/example_wolf_angry\",\n\"tame\": \"minecraft:entity/wolf/example_wolf_tame\",\n\"wild\": \"minecraft:entity/wolf/example_wolf\"\n},\n\"baby_assets\": {\n\"angry\": \"example:entity/wolf/example_baby_wolf_angry\",\n\"tame\": \"minecraft:entity/wolf/example_baby_wolf_tame\",\n\"wild\": \"minecraft:entity/wolf/example_baby_wolf\"\n},\n\"spawn_conditions\": [\n{\n\"priority\": 0\n}\n]\n}\nIt's worth noting that you can't add custom variants for some mobs like Horses\nand Rabbits. If it's not in the list mentioned earlier, then it can't be added\nusing a datapack.","description":"Learn how to add custom mob variants with Minecraft datapacks","url":"/guide/adding-new-features/mob-variants/","tags":[]},{"title":"How to Make a Minecraft Datapack - Beginner's Guide","content":"How to make a Minecraft DatapackDatapacks are a Minecraft feature that lets you customize Minecraft worlds\nwithout mods. They allow you to modify and enhance the game by adding new\nfeatures and mechanics by using Minecraft commands, advancements, worldgen, and\nmore! This guide will walk you through the process of creating your first\nMinecraft datapack from scratch in the latest version.\nessentially add-ons to Minecraft which can change the game, whether by adding a\nsimple game mechanic, or creating completely new experiences! The best part is\nthat they're really easy to create, even if you have little coding knowledge\ntried coding before or if you've got loads of experience. The process of coding\na datapack is a bit different to other typical programs. By the end of this\ntutorial, you'll have made a simple datapack which makes arrows explode when\nthey land!PrerequisitesMinecraft Datapacks basically just consist of text files inside folders. For\nthis reason, you can technically make a datapack with just the default text\neditor and a file explorer. However, if you are able to, we highly suggest\ndownloading a code editor such as Visual Studio Code.With VS Code, you will be able to view errors in your datapack, autocomplete\ncommands, and highlight syntax with different colours so that making datapacks\nisn't as painful as using Notepad.Download Visual Studio Code: https://code.visualstudio.com/downloadGet the VS Code extensions for datapack development:\nhttps://marketplace.visualstudio.com/items?itemName=amandin.dpc-pack\nStudio Code which essentially has all the same features, except it can be slower\nor more difficult to work with. https://vscode.dev/\nin. Go ahead and do that now - make sure that your world has cheats enabled\nand it is set to creative mode. In the world, you will need to run the\n/datapack create command - it will create your datapack folder as well as the\nnecessary metadata for you, which saves you a bunch of time.For example, to make a datapack with the ID example_datapack and the\ndescription \"This is an example datapack\", you would run the following command:/datapack create example_datapack \"This is an example datapack\"\nOnce you've created your empty datapack, the next step is to find and open the\nworld folder:Save and quit your worldGo to your world in the Singleplayer menu and hit \"Edit\"Press \"Open World Folder\"The folder that opens contains your Minecraft world's data. There will be loads\nof subfolders in this folder: find the one which is called datapacks, and open\nit. This folder is where the world's datapacks are stored. If you used\n/datapack create, you should see your datapack's folder here already. (If not,\nyou'll have to create it yourself. This is explained in the \"NOTE\" box below)\nOpen Folder, and open the newly created folder. Navigating through your\ndatapack will be so much easier!\nopen folder location\npack.mcmeta tells Minecraft that the folder is a datapack, as well as\ncontaining the basic information about the pack, such as what versions it works\nin. /datapack create made this file automatically, but you can open the file\nlike normal and view it if you want:{\n\"pack\": {\n\"description\": \"This is an example datapack\",\n\"pack_format\": 94\n}\n}\nIf you're interested, here's what this file means:pack is an object containing the metadata of the file.description is the name of your datapack, usually along with a short\ndescription of what your pack does.pack_format tells Minecraft what versions this datapack works in. 94 (or\n94.0) for 1.21.11 (Most recent pack_format for the latest Minecraft Release\ncan be found at the bottom of the nav bar).\n/datapack create doesn't exist. You will have to create your datapack folder\n(inside datapacks) yourself. Just make a folder, and then inside that folder,\ncreate pack.mcmeta (as shown above) and the data folder.\ndatapacks. A function is a file containing Minecraft commands. When a function\nis ran, every command in the function is ran in order. Functions are always ran\nas an entity (or as the Server) and at a position\nfashion, let's make a function which sends \"Hello World\" to chat.Open your empty data folder.In the data folder, create a new folder. This folder is your\nnamespace - it will contain all the data specific to your datapack.\nUsually this needs to have a unique name (one which other people would\nnot have picked), but for this tutorial just call it example.In the example folder, create a folder called function. This folder will\ncontain all the .mcfunction files.You should now have a folder structure that looks something like this:/world/datapacks/example_datapack/data/example/function\n\ndue to some pesky name changes Mojang introduced in a recent update.\nhello_world.mcfunction. Open this file with any text editor (we recommend\nVisual Studio Code)Inside hello_world.mcfunction, put the following:# Show the player Hello World on their screen\ntitle @s title \"Hello World!\"\n\n# Give the player a diamond\ngive @s diamond\n\ncommands have! Having the / before a command will make the mcfunction invalid\nand fail when it tries to run\nthat doesn't work, rejoin your world), you should be able to use the following\ncommand to run the function:/function example:hello_world\nWhat's next?Now you know how to create a basic function and run it, we'll next start to\nthink about how to create our project. For more advanced projects, this can\nsometimes be the most difficult part. Luckily for us, what we want to create\nwon't be too difficult.Let's break down the idea into smaller steps. Remember, we want to create a\ndatapack which makes arrows explode.Detect when an arrow lands on the ground. We can do this by running a\ncommand on a loop which will select any arrow on the ground and then run a\nfunction.Create an explosion. This is as simple as summoning a TNT at the position\nof the arrow.Remove the arrow. If you don't do this, then it will keep on exploding\nforever.The next steps of this guide will guide you through the typical process of each\nof those steps.Running functions on a loopThe first step on our list is to detect arrows which land on the ground. To do\nthis, we need to run a command on a loop. Luckily, Minecraft makes this pretty\neasy for us.Firstly, let's make the function which you want to run on a loop. In the\nfunction folder, create a new mcfunction file - call this one\nloop.mcfunction.For now, let's just make it say \"Hi\" every time it loops. You can do this by\nputting this in the new function:say Hi\nTo make this function run on a loop, we need to create a JSON file which tells\nMinecraft \"run this command every tick\" (every tick = 20 times per second)In the data folder, create the minecraft folder.In the minecraft folder, create a tags folderIn the tags folder, create a function folderIn the new function folder, create a new text file: tick.jsonThe final path would look like this:/world/datapacks/example_datapack/data/minecraft/tags/function/tick.json\ntick.json is NOT a function. In tick.json, we are going to put a list\nof functions which we want to run every tick. If you put any commands in\ntick.json, it will break your pack.In tick.json, put the following:{\n\"values\": [\"example:loop\"]\n}\nvalues is a list of function references which will be run on a loop.example:loop is a reference to the loop.mcfunction file we created\nearlier. example refers to the namespace (the folder in data), and loop\nrefers to the mcfunction file name.If you save this file, go back to your world, and run /reload, you should see\nthat the chat is being spammed with \"Hi\" over and over again!Selecting the arrowsNow we've created a function which will run infinitely on a loop, we can move on\nto detecting when an arrow is in the ground.As far as the game is concerned, an arrow is an entity, just like a pig, cow\nor zombie. Minecraft gives us a special way to select any types of entities\nwith target selectors. Once we've selected an\nentity, we can use the /execute command to run a\ncommand as the entity.We can use these to select all arrows which are in the ground, and then run a\ncommand to make them explode (and then remove themselves).As mentioned, to select an entity, we need to use a target selectors. I'm going\nto teach you a bit about target selectors. You should pay attention here, but if\nyou only want the code, scroll past this section.What are target selectors?Target selectors are a special bit of code we can use to find an entity in the\nworld. They all start with an @ symbol. There are 6 base target selectors:Target SelectorDescription@eAll Entities - By itself, this selector will select every single entity which is currently loaded in the world.@sThis Entity - This selector will select the entity which is currently running the command. For example, if I run a command as @s, then it will run the commands as me.@aAll Players - This selects all currently online players. (All players are always loaded in the world).@rRandom Player - This selects one random player.@pNearest Player - This selects the nearest player to the position this command is ran from.@nNearest Entity - This selects the nearest entity (player or non-player) to the position this command is ran from.On it's own, a base target selector (like in the table) does not do much. We can\nnarrow down the selection even more by using criteria. Criteria are put in\nsquare brackets after the base selector.For example, we can use @e with a type criteria to select all entities of a\ncertain type - for example, @e[type=minecraft:cow] would select all cow\nentities.I'm not going to explain every single criteria you can use - you can view a list\nhere. These are the\nbasic ones which you might see quite often:CriteriaDescription[type=minecraft:arrow]Entity Type - This criteria will narrow down the selection to only include entities of a certain type. For good pack optimisation, you should use this often.[distance=..5]Distance to entity - This criteria will only include entities based on their distance to their distance to the current position. .. can be used to represent a greater/less than symbol - for example, ..5 means less than 5 blocks away.[limit=2]Limit selection - Using the limit criteria, you can make specify a max amount of entities to be selected. This is often used in conjunction with the sort criteria. For example, @e[sort=nearest,limit=1] would select the nearest entity of any type.[nbt={key:value}]Entity Data - This criteria will select entities if their NBT (entity data) matches a pattern. (note: if you do this loads of times, it might start to be a bit laggy!)How are we going to use them?We can use these selectors to only select arrows which are in the ground. We can\nselect all arrows with @e[type=arrow], but this will also include arrows in\nthe air. To select arrows in the ground, we can check if they have the data\n{inGround:1b}, so we would use @e[type=arrow,nbt={inGround:1b}]This target selector can be used in an execute command to run a command as the\nentity. Try putting this in your loop.mcfunction:execute as @e[type=arrow,nbt={inGround:1b}] run say I'm an arrow, I'm in the ground!\n/reload your datapack and fire an arrow at at a block. You should see that\nyour chat is spammed with messages, meaning that we successfully selected arrows\nin the ground, and executed a command as them!Make it go boomNow we can move onto the fun part! We have a simple command which will run\nanother command as any arrow in the ground. We only need to do two things with\nthis command:Get the arrow's positionSpawn an explosion at the position of the arrowKill the arrow so that it only explodes onceTo create an explosion in Minecraft, we can simply summon a TNT entity that has\nan instant fuse length - we can do this by summoning tnt with the data\n{fuse:0} at the position of the arrow. We can do this using the execute at\ncommand, which tells the game that the summon command should be ran at the\nposition of the entity, instead of at the world spawn (because all commands are\nrun at a position in the world). This way, when we summon an entity at ~ ~ ~,\nthe game knows that it's referring to the position of the arrow. This sounds\ncomplicated, but in reality, its a really easy and intuitive system when you\nunderstand it :Pexecute at @e[type=arrow,nbt={inGround:1b}] run summon tnt ~ ~ ~ {fuse:0}\nThen, we just need to copy this command and make it kill the arrow after the\nexplosion has happened. This is as simple as it sounds - we can use /kill to\nremove the arrow. Your finished loop.mcfunction should look like this:execute as @e[type=arrow,nbt={inGround:1b}] at @s run summon tnt ~ ~ ~ {fuse:0}\nkill @e[type=arrow,nbt={inGround:1b}]\n\nthe world. A better system would involve creating a function which referenced\n@s (the \"current\" entity) instead of @e[...], and then runnning that\nfunction as all arrows in the ground. This way, we only use @e[...] once,\nwhich is a lot more efficient. However, for the purposes of this tutorial, it\ndoesn't matter at all.\nwith a simple exploding arrows datapack which you made with the help of this\ntutorial. Take a break to play around with it - you deserve one!And when you want to move on to other datapack ideas you might have, feel free\nto join our Discord server for extra support from our team of helpers. We're\nmore than happy to help you on your journey to creating awesome Minecraft\ndatapacks!","description":"Learn how to create a Minecraft datapack with our beginner's guide. This step-by-step tutorial will help you understand the basics of datapack creation, even if you have little coding knowledge. Start enhancing your Minecraft experience today!","url":"/guide/getting-started/","tags":["guide","beginner","Minecraft","datapack","tutorial","step-by-step"]},{"title":"Choosing a Server","content":"Choosing a ServerWhen you join a Minecraft server, you are playing on a computer running a\nspecial software. This software allows you to interact with other players on the\nserver and play the game. There are so many different choices when it comes to\nchoosing Minecraft server JARs that it can easily become overwhelming.In this guide, we focus on multiple aspects of the various servers, from\nperformance, to datapack support to even features that are exclusive to certain\nserver softwares.Background InformationBefore we dive into the different server JARs, we need to talk about the\ndifferent types of Minecraft servers. Throughout this guide, we will be using\nthe term \"server JAR\" to refer to the actual Minecraft server file. These JARs\nare Java executable files that run the Minecraft server.There are a few common types of Minecraft servers:Vanilla: The vanilla server is the most basic server software, it's just\nthe vanilla game.Bukkit-based: Bukkit is a plugin-based server software that is used by\nmost Minecraft servers. It is the most popular of the server softwares as it\nprovides a wide range of plugins and features.Modded: Modded servers are based on the Fabric or Forge, which are\nmod-based server softwares. They are more customizable than Bukkit-based\nservers, but are not as popular. The use of modded servers is still very\nlimited, making it hard to find a mod for some purposes.Sponge-based: Sponge is a plugin-based server software that is used by\nmany Minecraft servers. It is similar to Bukkit-based servers, but is more\ncustomizable and has support for mods with SpongeForge.VanillaThe vanilla server is the most basic server software, and is the one that you\nget when you download the jar file from the\nofficial website. It does not\ncome with mod or plugin support. Beyond datapacks, it is not customizable at\nall.ProsConsEasy to set upNo mod supportFastest to update (comes out with every update)Lackluster performanceDesigned with exclusively datapacks in mindLimited customizationsNo additional bug fixesNo additional bug fixes\nFor some, a lack of bug fixes can be both positive and negative. Mileage may\nvary!\n\nEven though the list mentions bad performace, the vanilla server still performs well. \nFor small servers on decent hardware, it doesn't really matter what you choose.\n\nwith some basic performance optimizations, Bukkit plugin support, and some customization.\nIt can cause some issues with datapacks but mitigating datapack-related bugs is\nsignificantly easier when compared to Paper. If you want plugins and\ndatapacks, this is likely the one you want.ProsConsPopular and well-supportedBad datapack support by default (but fixable)Comes with some performance optimizationsMay be lacking Bukkit APIs other servers haveDatapack bugs are less commonNot as customizable as other server softwaresPaperPaper is a fork of Spigot, and it's the most popular\nBukkit server JAR according to bStats. It is\none of the most customizable server software on this list and comes with\nexcellent plugin support and amazing performance optimizations. Unfortunately,\nit is notorious for breaking datapacks and even some plugins for the sake of\nperformance, modernity and bug fixes.ProsConsPopular and well-supportedBreaks many datapacks due to destructive performance optimizationsNumerous performance optimizationsOnly designed for pluginsModern and forward-looking, provides many new Bukkit APIsSome useful bugs are fixed by default (TNT duping, sand duping, etc.)Comes with extensive documentation and configuration options\nUntil recently, Paper was based Spigot, but recently, the devs converted the project\ninto a hard fork (no longer based on Spigot), allowing for quicker update times, \nhowever, stable releases can still be slow to release.\n\nprimarily by older Minecraft servers. Forge is the gold standard for mods for\nversions >1.13 while still offering support for latest versions. Many mods and modpacks\nsuch as RLCraft, Pixelmon, ATM (All The Mods) will only run on Forge. Forge\nis still updated to latest versions, however, newer loaders are recommended.ProsConsGreat for older Minecraft versionsBy choosing older versions, you miss out on datapack featuresLarge mod catalog spanning many yearsDifferent mod loaders are recommended and used nowadaysMany mods do not affect DP features\nIt's recommended to use NeoForge on the latest version when\npossible. This will offer the bestest of Datapack features and the most modern\nmods\n\nMinecraft servers. It is a fork of Forge designed to be cleaner and more modern,\nwith significant reworks to many bloated parts of Forge. It is designed to be\nused with new versions of Minecraft and many mods that did target the latest\nversion of Forge will now target both or exclusively NeoForge!ProsConsGreat for newer Minecraft versionsMany mods (especially QoL mods) are exclusively built for FabricGreat modding communityForge and NeoForge are sometimes considered bloatedMost mods do not affect DP featuresFabricFabric is another mod-based server software. Fabric is\nused by most modern modded servers due to its fast boot time, advanced injection\nand great mods. Fabric is likely the best modded server for use with datapacks\ndue to how it injects its code.ProsConsPopular and well-supportedFinding server-side mods are hardMods rarely affect datapacksHard to troubleshoot mod errors sometimesGreat for newer Minecraft versionsSupport for older Minecraft versions is limited\nYou may see people talk about Cardboard. It's a mod that can add the Paper API\nto your Fabric server, however the actual functionality is limited and its slow\nto update.We do not recommend you use it! Instead, try find native Fabric alternatives!\n\nvanilla version of Sponge. It is an alternative to Bukkit-based server jars with\nincredible extensibility. It is very rarely used due to the lack of mods/plugins\nsupporting it.ProsConsHigh quality plugins are commonSupport for newer Minecraft versions is experimentalGenerally fastServer support is hard to findGreat for older Minecraft versionsFinding Sponge mods are hardSpongeForgeSpongeForge is a version of\nSponge with support for Forge mods. Similarly to SpongeVanilla, it is very\nrarely used due to the lack of mods supporting it.ProsConsSupport for plugins and modsSupport for newer Minecraft versions is experimentalPlugins are well integratedGenerally not as popular as Bukkit-based serversGreat for older Minecraft versionsFinding Sponge mods are hard, support for Forge mods is pinned at lower versionsHonorable MentionsMinestomMinestom is a very high performance, lightweight server jar designed for extreme\ncustomizability at the expense of doing everything yourself.\nThis server jar is basically an empty shell and is only recommended for highly\ntechnical purposes. You need to program everything you want into this server\nyourself, including features you may expect to come with the jar (lighting). You\nhave been warned!\n\nbut rather proxies.Most Minecraft servers can't handle more than a hundred-or-so people at once, so\nhow do giant servers like Hypixel have tens of thousands of people on at one\ntime? Imagine a large server with many mini games. Every time you teleport to a\ngame, a proxy is sending you to a completely different server, usually dedicated\nto running just that game. Larger servers can have thousands of people\nonline at a time because not everyone is in one server, they are split between\ntens or hundreds of servers. Simply put, the proxy is like glue, sticking\nservers together and allowing people to \"teleport\" between them.","description":"Learn the differences, pros and cons of different Minecraft server softwares, and which one you should use for datapacks, mods and/or plugins.","url":"/guide/choosing-a-server/","tags":[]},{"title":"Installing a Datapack","content":"IntroductionSo you've found a nice datapack for Minecraft, and the next step is to get it\ninto your game. This guide will explain how to install a datapack onto a world\nwhich exists, a new world.Installing a datapack to an existing worldIn your world menu, find the world which you want to install the datapack on.\nClick Edit.\nThe singleplayer menuOpen the world folder.\nThe edit menuIn the world folder, open the datapacks folder.\nWorld folder with datapacks highlightedPut the datapack zip file into the folder.\nzip folder in datapacks folderIf the zip folder contains a folder which contains data and\npack.mcmeta, then put that folder in the datapacks folder instead of the\nfull zip. Putting the zip in the datapacks folder only works when\ndata and pack.mcmeta are directly in the root folder of the zip.Rejoin the world and run /reload.\nReload command in chatInstalling a datapack to an new worldGo to the Create New World screen. Make sure that you enable cheats.\nCreate new world screenNavigate to the Data Packs screen. This is under the \"More\" tab in the latest\nversions.\nThe Data Packs screen optionDrag and drop the datapack zip into this screen.\nThe Data Packs screen after I dragged and dropped something inIf it doesn't show up, then it's likely that the zip file contains a folder\nwhich contains the datapack, and not the zip file just containing the\ndatapack. You need to take the folder out of the datapack, and put it in\nthe datapacks folder (click the \"Open Packs Folder\" button to open it.)Click on the datapack icon to apply it to the world.\nThe Data Packs screen after I clicked the iconCreate the world, and then run /reload in chat.\nReload command in chatInstalling a datapack to a realmTo install a datapack to a realm, you need to basically do this:Download the world from the realm into your singleplayer worlds.Follow the steps in \"Installing a datapack to an existing world\" to\ninstall a datapack on that world.Upload that world to your realm.","description":"So you've found a nice datapack for Minecraft, and the next step is to get it into your game. This guide will explain how to install a datapack onto a world which exists, a new world.","url":"/guide/installing-a-datapack/","tags":[]},{"title":"Right Click Detection Summary","content":"Right Click DetectionThere a few ways we can detect right clicks in a Minecraft datapack, depending\non your situation. Here are the methods we can use:Using a Carrot on a stickThis method is the \"traditional\" right click detection method. We can use a\nscoreboard to detect when a player right clicks a carrot on a stick item.This is the most straightforward method for simple right click detection, but it\nhas certain drawbacks - including making pigs follow the player.Using an item with the consumable componentWith the item changes added in 1.20.5, we can now detect right clicks on any\nitem using the consumable component. This method is much more versatile.\nHowever, this method triggers once per tick, not just once per right click.Using the on_consume advancement criteriaWith the item changes added in 1.20.5, we can now detect right clicks on any\nitem using the on_consume advancement criteria, which detects when an item is consumed.\nThis method is quite similar to the consumable component method, with a few advantages and disadvantages.Using an Eye of EnderThis method is a bit more niche, as it only works in worlds without strongholds.\nThis method also triggers once per tick, not just once per right click.Clicking an Interaction EntityThis method detects when the player right clicks on an interaction entity.\nUnlike the other methods, which all detect right clicks while holding specific\nitems, this method lets you detect when a player right clicks on a specific area\nof the world.","description":"This section goes over the various ways of detecting right clicks with a Minecraft datapack.","url":"/guide/right-click/","tags":[]},{"title":"Using an Eye of Ender for RC detection","content":"Eye of Ender Right Click Detection\neither use a similiar method that works everywhere (using the Food Component\nmethod) or do some changes to these functions, as specified at the end of this\nguide.\nthe Carrot on a Stick method, we can detect when an eye of ender item is being\nused by the player as a result of right clicking it.Unlike the Carrot on a Stick method, this method will be trigger every tick that\nright click is being held, instead of just once when right click is pressed.MethodTo detect when an eye of ender is being used, you must create a using_item\nadvancement, and specify the item data you want to trigger the advancement.\nThen, you can specify a reward function which will be run when the advancement\nis triggered.{\n\"criteria\": {\n\"requirement\": {\n\"trigger\": \"minecraft:using_item\",\n\"conditions\": {\n\"item\": {\n\"items\": [\n\"minecraft:ender_eye\"\n],\n\"predicates\": {\n\"minecraft:custom_data\": {\"custom_id\": \"your_custom_item_id\"}\n}\n}\n}\n}\n},\n\"rewards\": {\n\"function\": \":rightclick_run\"\n}\n}\nIn the function (in this case,\n/data/ /functions/rightclick_run.mcfunction), you can put commands\nthat you want to run when the item is clicked. Make sure that this function also\nrevokes the advancement so that it can be triggered again next tick.# Revoke the advancement from the player so it can be used again\nadvancement revoke @s only :used_eye_of_ender\n\n# Custom logic\nsay I successfully used EoE detection!\nIf you want this method to work in worlds with strongholds, you can either block\nthe target of ender eyes in the pack.mcmeta or killing the eye and giving it\nback after it being used.","description":"An intresting right click detection method for sure, due to the fact that it can only be used in worlds without strongholds!","url":"/guide/right-click/eoe/","tags":[]},{"title":"Using COAS/WFOAS for RC detection","content":"Carrot on a Stick Right Click DetectionUsing a carrot on a stick (or a warped fungus on a stick) is perhaps one of the\nsimplest methods of right-click detection, requiring only a single tick command\nand a scoreboard. This method works due to the used:carrot_on_a_stick\nstatistic detecting right clicks on any carrot_on_a_stick item.\nCOAS. This method also works with warped fungus on a stick (WFOAS) items.\nitem counts as \"using\" an item, and will therefore increase the\nused:carrot_on_a_stick statistic. We can track changes to this statistic using\na scoreboard. When it goes up, we know that the player has right clicked a COAS,\nand we can run a command when that happens.MethodTo get started, we need to create a scoreboard with the criteria\nminecraft.used:minecraft.carrot_on_a_stick, so that we can later detect when a\nplayer uses the COAS (by right clicking on it).If you don't already have it, you'll need to create a load function with a\ncommand that creates a new scoreboard objective. You can name the objective\nwhatever you want. We recommend naming it something like .rc_coas.\nIn your load function, put a scoreboard command such as this:scoreboard objectives add.rc_coas minecraft.used:minecraft.carrot_on_a_stick\nThis scoreboard will go up by 1 every time a player right clicks a COAS -\nwhen this happens we can execute our function. Note that this command must run\nevery tick, otherwise it won't be able to detect right clicking. Put this in\nyour tick/loop function:# This will run the \"rc_run\" function as the player who uses the COAS.\nexecute as @a[scores={.rc_coas=1..}] run function :rc_run\nscoreboard players reset @a[scores={.rc_coas=1..}].rc_coas\nIn the rc_run.mcfunction file, you can do whatever you like as a result of\nright clicking the COAS. As an example, putting this in rc_run.mcfunction will\nmake the player say Used COAS when they right click a COAS item.say Used COAS\nDetecting specific itemsThe above method will detect when any carrot on a stick item is right clicked,\nwhich by itself isn't useful. Instead, we want to detect when a specific carrot\non a stick item is clicked.We can give our carrot on a stick item a special custom_data component which\nis unique to our custom item. The custom_data component can support any NBT\ndata, but the simplest value would be {item:\"my_custom_item\"}:# Give the player the custom item\ngive @s carrot_on_a_stick[custom_data={item:\"my_custom_item\"}]\nThen, we can just add an extra check to our execute command in\ntick.mcfunction to only run the function when the player is holding our custom\nitem:# Replace the previous execute command in tick.mcfunction with this:\nexecute as @a[scores={.rc_coas=1..}] if items entity @s weapon.mainhand carrot_on_a_stick[custom_data~{item:\"my_custom_item\"}] run function :rc_run\n# If you want more than one custom item, simply copy the above command, and just change \"my_custom_item\"\n","description":"Using a carrot on a stick for right click detection is an easy way to detect right clicks with a datapack.","url":"/guide/right-click/coas/","tags":[]},{"title":"Using the Consumable component for RC detection","content":"Consumable Component Right Click DetectionThe minecraft:consumable component can be a helpful indicator of when an item\nis right clicked by the player in a Minecraft datapack. We can detect usage of\nan item with the consumable and food components with an advancement which\ncan trigger a function. This method can be used on almost any type of item.\nhas a default rightclick functionality (such as placing a block), it will keep\nthat functionality. This method is best used for items that don't have a default\nrightclick functionality.\nmust create a using_item advancement, and specify the item data you want to\ntrigger the advancement. Then, you can specify a reward function which will be\nrun when the advancement is triggered.{\n\"criteria\": {\n\"requirement\": {\n\"trigger\": \"minecraft:using_item\",\n\"conditions\": {\n\"item\": {\n\"items\": [\n\"minecraft:\"\n],\n\"predicates\": {\n\"minecraft:custom_data\": {\"custom_id\": \"your_custom_item_id\"}\n}\n}\n}\n}\n},\n\"rewards\": {\n\"function\": \":rightclick_run\"\n}\n}\nIn the function (in this case,\n/data/ /function/rightclick_run.mcfunction), you can put commands\nthat you want to run when the item is clicked. Make sure that this function also\nrevokes the advancement so that it can be triggered again next tick.# Revoke the advancement from the player so it can be used again\nadvancement revoke @s only :click\n\n# Custom logic\nsay I right clicked the item!\nAfter /reloading the datapack, we will now need to give the player the item\nwith the custom food and data components.give @p [consumable={consume_seconds:999999999,animation:\"none\"},food={nutrition:0,saturation:0,can_always_eat:true},custom_data={custom_id:\"your_custom_item_id\"}] 1\nNow, when you right click this item, it should send a message to the chat saying\nI right clicked the item!.","description":"Using the minecraft:consumable component to detect when the user right clicks an item in a datapack.","url":"/guide/right-click/consumable_component/","tags":[]},{"title":"Using the on_consume advancement criteria for right click detection.","content":"On Consume Right Click DetectionA second method for right click detection using the consumable components is the on_consume method, which requires the player to actually consume the item before using it.\nhas a default right click functionality (such as placing a block), it will keep\nthat functionality. This method is best used for items that don't have a default\nright click functionality.\nAny item can be used here, but it is recommended to not already have a right click function. The custom data is the value we will be using to separate our item. If you wish to give your item a windup time, change the consume seconds (it can be 0 for no windup). The cooldown group is the global group used for the item cooldown, any item in this group will go on cooldown for the value of seconds set after it is used.Now that we have the item, we must write the right click detection.\nThis method uses the on_consume advancement criteria, which detects when an item is consumed, we then check if the item has the custom data value we assigned.{\n\"criteria\": {\n\"right_click\": {\n\"trigger\": \"minecraft:consume_item\",\n\"conditions\": {\n\"item\": {\n\"components\": {\n\"minecraft:custom_data\": {\n\"tutorial\": \"item\"\n}\n}\n}\n}\n}\n},\n\"requirements\": [\n[\n\"right_click\"\n]\n],\n\"rewards\": {\n\"function\": \"tutorial:right_click\"\n}\n}\nFinally, let's write the function that will run on right click.# Custom logic\nsay Right click detected.\n\n# Give back the item as it was consumed\ngive @s echo_shard[consumable={consume_seconds:1,animation:\"eat\"},custom_data={tutorial:\"item\"},use_cooldown={seconds:5,cooldown_group:\"tutorial_item\"}] 1\n\n# Revoke the advancement\nadvancement revoke @s only tutorial:consume\n","description":"Using the on_consume advancement criteria to detect when a player right clicks in a datapack.","url":"/guide/right-click/on_consume/","tags":[]},{"title":"Using an Interaction Entity for RC detection","content":"Interaction Right (and left) Click DetectionAn interaction entity can detect clicks in a specific area, instead of on an\nitem. Interaction entities can detect both right and left clicks (although this\nguide will go over right clicks specifically). There are two methods to detect\nright clicks using interaction entities, depending on what you want to do\nafterwards.Method 1: Detect when a player right clicks an interaction entityThis method works best when you want to do something to the player when they\nright click the interaction entity.To detect when the interaction entity has been interacted with, you must create\na player_interacted_with_entity advancement, and specify the entity data you\nwant to trigger the advancement. Then, you can specify a reward function which\nwill be run when the advancement is triggered.{\n\"criteria\": {\n\"requirement\": {\n\"trigger\": \"minecraft:player_interacted_with_entity\",\n\"conditions\": {\n\"entity\": {\n\"type\": \"minecraft:interaction\",\n\"nbt\": \"{Tags:[\\\\\"my_interaction\\\\\"]}\"\n}\n}\n}\n},\n\"rewards\": {\n\"function\": \":rightclick_run\"\n}\n}\nIn the function (in this case, you will need to create it:\n/data/ /functions/rightclick_run.mcfunction), you can put commands\nthat you want to run when the interaction entity is right clicked. Make sure\nthat this function also revokes the advancement so that it can be triggered\nagain next tick.# Revoke the advancement so we can detect the click again\nadvancement revoke @s only namespace:interacted_with_interaction\n\n# Custom logic\nsay I clicked the interaction entity!\nNow you can summon the interaction entity by doing\n/summon interaction ~ ~ ~ {Tags:[\"my_interaction\"]} - you may want to enable\nhitboxes with F3 + B in order to see the hitbox of the interaction entity (it\nis invisible without it).Method 2: Detect when an interaction entity is right clickedThis method works best when you want to do something to the interaction when it\nis right clicked, ignoring which player did it.The interaction entity will have an interaction NBT tag when it has been right\nclicked by a player. You can use a tick function to detect this easily using\nexecute if entity, and run a function as the interaction entity when it has\nbeen triggered:execute as @e[type=interaction,tag=my_interaction] if data entity @s interaction run function :rightclick_run\nIn the rightclick_run function, you will need to remove the interaction NBT\nfrom the entity so that it resets, and then you can add custom logic:# Remove the interaction tag so it can be used again\ndata remove entity @s interaction\n\n# Custom logic\nsay I was right clicked!\n\nthe interaction NBT, use the attack NBT.","description":"Interaction entities can be used to detect when a player rightclicks or leftclicks in a specific area of the world.","url":"/guide/right-click/interaction/","tags":[]},{"title":"Write Optimized Code","content":"How To Write Optimized CodePoorly written code might cause major lag and ruin user experience. To ensure\nseamless user experience, you should write optimized code.Identify the BottlenecksFirst step to writing optimized code is to identify the bottlenecks. A\nbottleneck is a specific part of your code that hinders performance. Then, you\nneed to replace performance heavy implementations with faster variations.\nBelow - we will identify and address every major performance bottleneck.Forking\nThe concept of forking is explained on\nthe execute page itself.\n\nexecute as fork the command execution into multiple branches, executing every\nbranch one by one.Minimize the Amount of ForkingIf you want to run multiple commands using the same selector and condition, you\nshould avoid writing code in the following way:execute as @a[tag=!already_acquired_apple] if items entity @s weapon apple run say I acquired my first apple\nexecute as @a[tag=!already_acquired_apple] if items entity @s weapon apple run give @s diamond[item_name=\"Reward\"]\nexecute as @a[tag=!already_acquired_apple] if items entity @s weapon apple run tag @s add already_acquired_apple\nThis code above forks multiple times for the same selector and condition.\nThis is very inefficient. Instead, you should fork once, and call a function.\nLike this:execute as @a[tag=!already_acquired_apple] if items entity @s weapon apple run function acquired_apple\nsay I acquired my first apple\ngive @s diamond[item_name=\"Rewards\"]\ntag @s add already_acquired_apple\nMinimize the Amount of BranchesTo optimize forking, you need to minimize the amount of branches. Forking\ncreates one branch per entity, so you need to write very specific selectors that\nselect few entities.Use many selector arguments to narrow down the amount of branches. You should\nespecially make use of tag= argument by adding tags to specific entities\nfirst, and then using them. As well as distance=, limit=, type= and other\narguments.Nested ForkingSometimes, every branch that was already forked, gets forked again. That is\ncalled nested forking. If forking is nested, the total amount of branches is\ngoing to be equal to *.execute as @e[type=pig] at @e[type=cow] run say hello\nLet's explore an example where in a world with 100 pigs and 200 cows you run the\ncommand above. Since the execution forks twice, first after as @e and then\nafter at @e that leads to nested forking. Resulting in a total of\n100 * 200 = 20,000 branches. That is equivalent of 20.000 say commands ran\nat the same time.Notice how rapidly that amplifies the amount of commands. This is precisely why\nyou should always keep track of execute subcommands that fork the execution,\nbecause even the smallest mistake can cause exponential growth.That also means, you shouldn't\nID search\nfor all entities. ID search itself already forks once. Therefore, running an ID\nsearch for all entities, would result in nested forking.Slow OperationsMacro functions and entity / block\nNBT operations are two of the slowest operations in\nthe game.Macro functions are very slow, because they have to be re-evaluated every time\nyou run them. It is best that you avoid any macro functions, unless absolutely\nnecessary.All NBT operations on a block or an entity\nwhether a modifying, copying or using in a condition are slow. You should always\navoid running block / entity NBT operations every tick.It is okay to perform those operations on rarely occuring events. That way, the\nbrief lag spike does not ruin user experience.If a slow operation is unavoidable, you can put it behind a condition. That way,\nthe slow operation does not get executed all the time, but only when that\ncondition is met. For example, if you wanted to modify every pig's NoAI data,\nyou can do the following.execute as @e[type=pig] unless entity @s[tag=disabled_ai] run function example:disable_ai\ndata modify entity @s NoAI set value true\ntag @s add disabled_ai\nIn this example, to avoid mindlessly modifying NBT of every pig, we tag all pigs\nwith modified NBT. Then we add a condition to only modify NBT of pigs without\nthe tag, so that we dont run the NBT operations twice on the same pig.Scoreboard Event DetectionUsing scoreboards to detect events (such as breaking a block), requires running\na condition check every tick. Detecting many events like this may cause lag.Instead,\nuse advancements to detect events\nwhenever possible. Advancements do not have to check for condition every tick to\ndetect an event, unlike scoreboards.Recursion\nloop,\nraycast, or an\narray iteration should be used\ncarefully.Avoid the following:Combining recursive functions with forking.Recursive functions within recursive functions (Nested recursion).Running recursive functions every tick or upon often occuring eventsToo many recursion calls. For example a long distance raycast, large loop, or\niteration over a long array.\n","description":"Learn how to optimize a minecraft datapack.","url":"/guide/performance/write-optimized-code/","tags":[]},{"title":"How to Measure Performance","content":"How to Measure PerformanceDatapacks are server side - they run on the server. The \"server\" is the brain of\nthe world. It handles all the logic of the world.Generating new chunks as players explore the world.Validating player interactions such as mining blocks.Mob behaviour. All mob AI, pathfinding, targeting, etc.And so on...Server performance is measured in TPS - ticks per second.\nServer updates the game state every tick. Calculates mobs' positions and state,\nvalidating player actions like breaking and placing blocks, and processes all\nother game logic.Server normally runs at 20 TPS. However, if the server is overloaded with\ncomputations - it makes the individual tick longer, to keep up with all the\ncomputations. That leads to lower TPS, which causes lag and delay for all\nplayers. Blocks disappearing, or breaking too slowly, mobs behaviour slowing\ndown, this is all due to low TPS.Measure Overall PerformanceYou can toggle the TPS graph using F3 + 2.TPS graph showcaseGraph shows the last 240 ticks, each tick represented as a thin colored line.\nThere are a total of 4 possible colors, stacked onto each other like layers.\nEach color serves it's own purpose.Layer 1 Dark red is time spent for the main logic of the tick. Bottom layer.Layer 2 Light brown is time spent running scheduled tasks.Layer 3 Purple is time spent executing all other code.Layer 4 Green / Yellow / Red (depending on lag) is time spent waiting for the next tick. Top layer.Then, on top of the graph you can see 3 numbers: min, avg, max. They show the\nhow much time in milliseconds it took to compute for the shortest, average and\nlongest tick, currently visible on the graph.If the longest tick (max) on the graph took less than 50ms (length of a single\ntick) the TPS is good. The server is able to process all logic in time. Otherwise,\nif max is above 50 and the lines high enough to cross over the border, the TPS is\nsuffering.BenchmarkingBenchmarking is also a way of measuring performance. However, unlike the TPS\ngraph, benchmarking measures the performance of a specific chunk of code in a\ndatapack, rather than general performance of the server.Benchmarking results are inconsistent across PCs due to different hardware\nspecifications. However, the difference in results between two different\nbenchmarks is usually somewhat consistent, even across different PCs. This is\nwhy benchmarking is generally used for comparing the performance of different\nimplementations.How Benchmarking Works\nA recursive function is a function that runs itself repeatedly. A single\nrecursive function call is called an iteration.\n\npossible, for 40ms every tick.High level overview of the implementation:Move world border by a 1000 blocks in 1 second.Start recursively running the function, until the world border has moved by 40\nblocksRepeat this cycle for a 100 more ticks (5 seconds)Then, measure the average amount of iterations across the 100 ticks. This works,\nbecause world border movement does not depend on ticks, and moves in real time.Benchmark ToolsWhile you could write your own benchmark,\nwe recommend using Kragast's Benchmark datapack,\nsince it makes benchmarking easier.The following section will explain how to\nuse Kragast's Benchmark datapack using an example. This datapack measures the\nperformance of a function by running it repeatedly as many times as possible\nbefore the game starts to lag. The more times your function ran - the more\nperformant it is.To start, download the datapack, unzip, and open it. In the function folder\nunder the benchmark namespace you will notice a few functions for you to use.📄 config.mcfunction📄 order.mcfunctionFunctions above are used to customize the behavior of the benchmark datapack.\nThere are many settings, every option is documented within the config function\nusing comments. For this example, the default settings are good enough so we\nwill not change anything.📄 test.mcfunction📄 test2.mcfunctionFunctions above will both be running repeatedly to test their performance.\nFor this example, let's compare a scoreboard check with an entity NBT check.\nBut you can write your own tests, and compare anything you want. First, create a\nbunch of armor_stand entities in an empty world. Then put the following code in\ntest and test2 functions.execute as @e[type=armor_stand] if score @s test matches 1.. \nexecute as @e[type=armor_stand] if data entity @s {ShowArms:false}\nNow, all that is left is to run function #benchmark:get_profile and wait for\nthe result.Reading ResultsBenchmark ResultsWith the previously mentioned setup, and a total of 300 armor stands in the\nworld, these are the results i ended up with. Yellow number is the amount of\ntime a function was ran. Bigger number - faster execution, better performance.Function 0: This is the control function. It is always empty, and is only\nhere to provide a baseline to compare to.Function 1: This is the test function, the one with scoreboard check.Function 2: This is the test2 function, the one with entity NBT check.Since the test function executed more frequently, it has better\nperformance compared to test2.","description":"Learn about the performance impact of a datapack.","url":"/guide/performance/how-to-measure/","tags":[]},{"title":"Breaking Changes","content":"List of breaking changesThis is a list of all breaking changes to datapacks (excluding resource packs). Special thanks to Conure's How To Upgrade Your Datapacks Series, Misode's Technical Changelog and the Minecraft Wiki for the source of many of these.26.1OtherThe default value of the rotation property on banners and signs has been changed from 0 to 8.To fix this, just add a [rotation=0].The villager.* slots have been removed. You can now access them using mob.inventory.*.The field ignore_fall_damage_from_current_explosion field on players has been removed.The minecraft:post_piercing_attack no longer requires the player to have 7+ hunger to work. If you want it to retain its previous functionality, you must now add a predicate testing for the player's hunger.A new required field has_ender_dragon_fight has been added to Dimension Type files.TimeThere have been multiple changes to the /time.The time command now affects time per dimension, as there is now no universal time for all dimensions. Previously, it affected the time of the overworld, no matter where it was ran from.To fix this, add of minecraft:overworld to all time commands. (e.g. /time of minecraft:overworld set 1500). This only applies if the command is not being run from the overworld./time (of minecraft:overworld) setnow advanced the time to the next day/night/moon/midnight, instead of setting it to a constant value (e.g. 18000 was previous midnight)/time query daytime is now /time query minecraft:day/time query day is now /time query minecraft:day repetitionA new field default_clock has been added to Dimension Type files, and while it isn't required, omitting it will result in there being no time in that dimension.You can just set default_clock to minecraft:overworld to restore its previous behaviour.The time_check predicate condition, Timelines and time_of_day Game Test environments now have a required field clock.You can just set clock to minecraft:overworld to restore its previous behaviour.Mob VariationsFor cats, chickens, cows and pigs, a new field baby_asset_id is now required.For wolfs, a new field baby_asset is now required. It has the same format as the asset field.Wolf sound variants in wolf_sound_variant have been moved into a new field adult_sounds, as a new field baby_sounds was added.WorldgenSeveral worldgen features have been renamed and are now configurableThe forest_rock configured feature has been renamed to block_blob.Has a new required block predicate field can_place_on.The ice_spike configured feature has been renamed to spike.Has new required block state provider field state.Has new required block predicate fields can_place_on and can_replace.The huge_red_mushroom and huge_brown_mushroom configured features have a new required block predicate field can_place_on.In the tree feature the force_dirt and dirt_provider parameters were replaced with a below_trunk_provider rule-based block state provider.The state_provider under the disk feature is now a block state provider. This means you must add a \"type\": \"minecraft:rule_based_state_provider\" to it.Features spawned from Bone Meal are no longer restricted to the flower feature type, and instead controlled by the #can_spawn_from_bone_meal configured feature tag.The flower, flower_no_bonemeal, and random_patch feature types have been removed, instead patches can now be expressed as a sequence of count and random_offset placement modifiers.The alter_ground tree decorator configuration has changed so that provider is now a rule-based block state provider.Block Tags#dry_vegetation_may_place_on has been renamed to #supports_dry_vegetation#bamboo_plantable_on has been renamed to #supports_bamboo#small_dripleaf_placeable has been renamed to #supports_small_dripleaf#big_dripleaf_placeable has been renamed to #supports_big_dripleaf#mushroom_grow_block has been renamed to #overrides_mushroom_light_requirement (Mushrooms cannot survive without a light level below 13 if not in the above tag.)#snow_layer_can_survive_on has been renamed to #support_override_snow_layer (Snow layers can be placed on blocks in this tag even if they do not have a top full face.)#snow_layer_cannot_survive_on has been renamed to #cannot_support_snow_layer#dirt has been split into multiple other tags, and now only contains dirt blocks. To keep its previous functionality, use the new #substrate_overworld block tag.Item TagsThe #dyeable item tag has been removed, as it's now controlled by the crafting_dye recipe type.Enchantment TagsRemoved the #trades/desert_special, #trades/jungle_special, #trades/plains_special, #trades/savanna_special, #trades/snow_special, #trades/swamp_special, #trades/taiga_special.These only exist if you are using the \"Villager Trade Rebalance\" experimental datapack.RecipesRenamed the following stonecutter recipes, alongside their relevant advancementsminecraft:chiseled_stone_bricks_stone_from_stonecutting → minecraft:chiseled_stone_bricks_from_stone_stonecuttingminecraft:end_stone_brick_slab_from_end_stone_brick_stonecutting → minecraft:end_stone_brick_slab_from_end_stone_bricks_stonecuttingminecraft:end_stone_brick_stairs_from_end_stone_brick_stonecutting → minecraft:end_stone_brick_stairs_from_end_stone_bricks_stonecuttingminecraft:end_stone_brick_wall_from_end_stone_brick_stonecutting → minecraft:end_stone_brick_wall_from_end_stone_bricks_stonecuttingminecraft:mossy_stone_brick_slab_from_mossy_stone_brick_stonecutting → minecraft:mossy_stone_brick_slab_from_mossy_stone_bricks_stonecuttingminecraft:mossy_stone_brick_stairs_from_mossy_stone_brick_stonecutting → minecraft:mossy_stone_brick_stairs_from_mossy_stone_bricks_stonecuttingminecraft:mossy_stone_brick_wall_from_mossy_stone_brick_stonecutting → minecraft:mossy_stone_brick_wall_from_mossy_stone_bricks_stonecuttingminecraft:prismarine_brick_slab_from_prismarine_stonecutting → minecraft:prismarine_brick_slab_from_prismarine_bricks_stonecuttingminecraft:prismarine_brick_stairs_from_prismarine_stonecutting → minecraft:prismarine_brick_stairs_from_prismarine_bricks_stonecuttingminecraft:quartz_slab_from_stonecutting → minecraft:quartz_slab_from_quartz_block_stonecuttingminecraft:stone_brick_walls_from_stone_stonecutting → minecraft:stone_brick_wall_from_stone_stonecutting1.21.11You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21.11CommandsAll gamerules have been moved to a registry, this mainly means that they now use the minecraft: prefix and are now in snake_case, though some have been renamed.There are some exceptions to the generic renames. Click to see them all.disableElytraMovementCheck → minecraft:elytra_movement_check (the value was inverted)\ndisablePlayerMovementCheck → minecraft:player_movement_check (the value was inverted)\ndisableRaids → minecraft:raids (the value was inverted)\ncommand_modification_block_limit → minecraft:max_block_modifications\ndoDaylightCycle → minecraft:advance_time\ndoMobLoot → minecraft:mob_drops\nannounceAdvancements → minecraft:show_advancement_messages\ncommandBlocksEnabled → minecraft:command_blocks_work\ndoEntityDrops → minecraft:entity_drops\ndoImmediateRespawn → minecraft:immediate_respawn\ndoInsomnia → minecraft:spawn_phantoms\ndoLimitedCrafting → minecraft:limited_crafting\ndoMobSpawning → minecraft:spawn_mobs\ndoPatrolSpawning → minecraft:spawn_patrols\ndoTileDrops → minecraft:block_drops\ndoTraderSpawning → minecraft:spawn_wandering_traders\ndoVinesSpread → minecraft:spread_vines\ndoWardenSpawning → minecraft:spawn_wardens\ndoWeatherCycle → minecraft:advance_weather\nmaxCommandChainLength → minecraft:max_command_sequence_length\nmaxCommandForkCount → minecraft:max_command_forks\nnaturalRegeneration → minecraft:natural_health_regeneration\nsnowAccumulationHeight → minecraft:max_snow_accumulation_height\nspawnRadius → minecraft:respawn_radius\nspawnerBlocksEnabled → minecraft:spawner_blocks_workSome gamerules now have a limited value range. Click to see them all.max_block_modifications - Minimum 1\nmax_command_forks - Minimum 1\nmax_command_sequence_length - Minimum 0\nmax_entity_cramming - Minimum 0\nmax_snow_accumulation_height - Minimum 0 | Maximum 8\nplayers_nether_portal_creative_delay - Minimum 0\nplayers_nether_portal_default_delay - Minimum 0\nplayers_sleeping_percentage - Minimum 0\nrandom_tick_speed - Minimum 0\nrespawn_radius - Minimum 0The gamerule doFireTick and allowFireTicksAwayFromPlayer have been removed and replaced with minecraft:fire_spread_radius_around_player, which controls the maximum distance in blocks that fire can spread around the player.Setting it to 0 disables fire spreading.Setting it to -1 will allow fire to spread even without players around.In Game Tests, in the game_rules test environment the bool_rule and int_rule have been replaced with a single rules field.The rules field is a list of key-value pairs with the key being the gamerule's name and the value being the value (bool or int). (\"minecraft:random_tick_speed\": 62)Many fields from Biome and Dimension Type files have been removed and replaced by Environment Attributes.Because this change is so huge, and covers so many fields, I won't list out all the changes here. I recommend just reading the wiki page about them.If you were using the world border to track real time, it won't work now, as it uses game time now.You can now get the real time using the (/stopwatch)[https://minecraft.wiki/w/Commands/stopwatch] command.The /worldborder command is now specified in ticks by default, rather than the previous seconds.To restore its previous functionality, add an s suffix to the end. (/worldborder set 620 20s)ItemsThe spear animation in the consumable item component has been renamed to trident, the spear animation still exists, but now uses a different animation. (the same as vanilla spears)If you are using the filtered item modifier, rename the field modifier with on_pass. (as a new on_fail field was also added)TagsRenamed item tag #enchantable/sword to #enchantable/sweeping.This only controls enchantability for the sweeping edge enchant. May be preferable to use the #minecraft:enchantable/meele_weapon, which includes spears and swords.Removed some biome tags, depending on your use for them, follow the steps below:If you were only referencing them in your code, and not editing them:Create these tags yourself with their previous values.If you were using them to edit biome properties, this funcionality has been replaced with new Environment Attributes.Removed #snow_golem_melts biome tag - replaced by gameplay/snow_golem_melts environment attribute.Removed #increased_fire_burnout biome tag - replaced by gameplay/increased_fire_burnout environment attribute.Removed #plays_underwater_music biome tag - replaced by only_underwater field in the audio/background_music environment Attribute.Removed #has_closer_water_fog biome tag - replaced by visual/water_fog_radius environment Attribute.Removed #without_patrol_spawns biome tag - replaced by gameplay/can_pillager_patrol_spawn environment Attribute.Entity DataThe AngryAt field has been renamed to angry_at.The AngerTime field has been removed, as it has been replaced by an anger_end_time field, stored as a long, which is the number of the tick the anger ends at.If you NEED to only make the mob angry for a certain amount of time, you will have to get the game's tick number with /time query gametime, store that, add to it the amount of ticks you want and then set the anger_end_time to that.OtherThe minecraft texture atlas minecraft:blocks no longer stores blocks & items, as items are now stored in the minecraft:items atlas.1.21.9 - 10You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21.9OtherThe pack.mcmeta format has been completely changed. Pack versions now have major and minor changes. Based on which versions you plan to support, folow the steps below to update it. (also applied to resource packs)If you only plan to support 1.21.9 and newer:The supported_formats field has been removed and replaced by min_format and max_format, which are specified as a list of two integers ([major, minor]) or one integer (makes it support any minor version).The same applies for the formats field in the overlay section, it has also been replaced by min_format and max_formatIf you plan to support older versions too (1.21.8 and below):You must keep the supported_formats field in addition to the new min_format and max_format, which are specified as a list of two integers ([major, minor]) or one integer (makes it support any minor version).The same applies for the formats field in the overlay section, which you must also keep in addition to the new min_format and max_format.The flash particle now requires a color parameter.To fix this, and restore its original white, just add {color:[1.000,1.000,1.000,1.00]} to the end, like any other particle parameter.The item and block minecarft:chain has been renamed to minecraft:iron_chainThe field respawn.angle on the player has been renamed to respawn.yaw (now you can also get respawn.pitch)CommandsThe gamerule spawnChunkRadius has been removed, as \"loaded\" spawn chunks no longer exist.The spawnpoint and setworldspawn commands require an additional pitch parameter, IF you also specified the yaw parameter.If you didn't specify any, you can just ignore this, if you did have yaw, just add a 0 to the end of the command.WorldgenThe initial_density_without_jaggedness field in noise_settings definitions has been replaced with a preliminary_surface_level field.The minecraft:find_top_surface density function can be used to replicate the previous scanning.1.21.6 - 8You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21.6-8OtherIf you are using an item which renders bigger than its inventory size is (most\nlikely for a barrel/custom GUI), it will break with this version. You can\nchange the item model to behave like previously by changing the newly added\noversized_in_gui item model field in the resource pack.The sound event id block.sand.wind has been renamed to\nblock.dry_grass.ambientAll JSON files (in worlds, packs, configuration, etc.) are now parsed in\nstrict modeUsers will now be prompted for confirmation before executing a command from\nthe run_command click action in books and chat if the command requires\npermissions higher than 0. This is not a breaking change, just a warning which\nshows to the player.Item ComponenentsThe painting/variant component no longer accepts inline variantsEntity DataThe Particle field in the area_effect_cloud entity has been renamed to\ncustom_particle, and now always functions as an exact override for the\ndefault colored entity_effect particleTagsRenamed #plays_ambient_desert_block_sounds block tag to\n#triggers_ambient_desert_sand_block_sounds1.21.5You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21.5OtherTrim pattern and trim material items are no longer specified in the trim\nregistries, but instead in the recipes and items respectively🛠️ To fix this:Trim Pattern - delete the field template_item from your trim pattern\nfile, and add a new field containing your trim pattern id into your\nsmithing trim pattern recipe. See the\nSmithing Trims guide\nfor an example.Trim Material - delete the field ingredient from your trim material\nfile, and add the\nprovides_trim_material\nitem component to your item. (E.g.\nbarrier[provides_trim_material='minecraft:iron']) See the\nSmithing Trims guide\nfor an example.Field background in advancement definition no longer contains textures/\nprefix and .png suffixWolf VariantsIn the wold variants file, the fields angry_texture, tame_texture and\nwild_texture have been grouped in field assets and renamed to angry,\ntame and wild.Added field spawn_conditions, which describes where the variant can spawn.\nSee more in the changelog under \"Spawn conditions\".Data TypesThe data format of Text Components was changed from JSON to\nSNBT.With that, all the special formats and values were changed. You can read\nmore about it on the changelog.For example, minecraft:custom_name=\"{\"text\":\\\"Renamed item\\\"}\" is now\nminecraft:custom_name={text:'Renamed item'}. Or the previous\n/tellraw @s \"\"text\":\"Hello world\"\" is now\n/tellraw @s {text:'Hello world'}TagsRemoved #default_spawns and #full_moon_spawns in cat variant tagsRenamed #dead_bush_may_place_on block tag to #dry_vegetation_may_place_onEntities & Entity DataThe potion entity type has been split into splash_potion and\nlingering_potionA lot of fields will no longer be preserved, or have been removed (You can see\nthem all on https://www.minecraft.net/en-us/article/minecraft-snapshot-25w07a)The ArmorDropChances, HandDropChances, and body_armor_drop_chance fields\nhave been merged into a drop_chances field.The format is a list of equipment_slot:value variables. E.g.\ndrop_chances:{chest:0.1,feet:1.0}And drop chances with a default value are no longer stored. The\ndrop_chances field is removed entirely if all defaults.The ArmorItems, HandItems, and body_armor_item fields have been merged\ninto an equipment fieldThe format is a list of equipment_slot:item_stack variables. E.g.\nequipment:{chest:{id:'minecraft:diamond_chestplate'}}.This affects all mobs and Armor Stands, but not players.The format of saddles has been unified between mobs, becoming a new equipment\nslot, stored in the equipment.saddle field.This is a pure rename from the previous SaddleItem in horse-like mobs. In\nstriders and pigs this replaces the old Saddle boolean.The Saddle dropping on death is now affected by the drop_chances field.The FallDistance field has been changed from float to double and is now\ncalled fall_distanceThe armor and off-hand equipment of Players is now also stored in the\nequipment field (although items written into the Inventory using armor and\noff-hand slot numbers still work)Pos, Motion, and Rotation values without the correct number of\ncomponents (3, 3, and 2 respectively) will now be fully discarded, instead of\nonly selecting the specified componentsThe SleepingX, SleepingY, and SleepingZ fields have been merged into a\nsingle sleeping_pos field (e.g. sleeping_pos: [I;1,2,3])Block States in the entity data of Arrows, Minecarts, Block Displays,\nEndermen, Falling Blocks, Primed TNT, or Piston Moving Blocks are no longer\nallowed to be specified as an empty objectLots of entity and block entity data fields now have a new default value. Click to see them allEntity Datacreeper - Fuse defaults to 30; ExplosionRadius defaults to 3;tnt - block_state defaults to tnt; fuse defaults to 80;\nexplosion_power defaults to 4;goat - HasLeftHorn and HasRightHorn fields default to true;interaction - width and height fields default to 1;allay - CanDuplicate field removed (now controlled by\nDuplicationCooldown);cat - CollarColor defaults to 14 (red);dolphin - TreasurePosX, TreasurePosY, TreasurePosZ fields removed;\nMoistness defaults to 2400;falling_block - BlockState defaults to sand; HurtEntities defaults to\nfalse (or true if BlockState is anvil); FallHurtAmount defaults to 0;\nFallHurtMax defaults to 40; DropItem defaults to true;fox - Trusted field defaults to empty;phantom - Size renamed to size; AX, AY, and AZ fields collected\ninto a single anchor_pos field;player - SpawnX, SpawnY, SpawnZ, SpawnAngle, SpawnDimension, and\nSpawnForced fields collected into a single respawn field;\nenteredNetherPosition renamed to entered_nether_pos;turtle - HomePosX, HomePosY, and HomePosZ fields collected into a\nsingle home_pos field; HasEgg renamed to has_egg;vex - LifeTicks renamed to life_ticks; BoundX, BoundY, and BoundZ\nfields collected into a single bound_pos field;wolf - CollarColor defaults to 14 (red);area_effect_cloud - Duration defaults to -1 (infinite);ender_dragon - DragonDeathTime defaults to 0;firework_rocket - ShotAtAngle defaults to false;ghast - ExplosionPower defaults to 1;item - Health defaults to 5; PickupDelay defaults to 0; Age defaults\nto 0;item_frame and glow_item_frame - ItemDropChance defaults to 1.0;shulker - Color defaults to 16 (no color);skeleton - StrayConversionTime field removed;spectral_arrow - Duration defaults to 200;snow_golem - Pumpkin defaults to true;tnt_minecart - fuse defaults to 80; explosion_power defaults to 4;\nexplosion_speed_factor defaults to 1;trader_llama - DespawnDelay defaults to 47999;villager - FoodLevel and Xp fields default to 0;wandering_trader - DespawnDelay defaults to 0;zombie - DrownedConversionTime field removed;zombie_villager - Xp defaults to 0;arrow, spectral_arrow, trident - damage defaults to 2;dragon_fireball, wind_charge, breeze_wind_charge, wither_skull,\nsmall_fireball, and large_fireball - acceleration_power defaults to 0.1;small_fireball and large_fireball - ExplosionPower defaults to 1;block_display, item_display, and text_display -\ninterpolation_duration, teleport_duration, and start_interpolation\nfields default to 0; view_range defaults to 1; shadow_radius defaults to\n0; shadow_strength defaults to 1; width and height fields default to 0;Block Entity Datacampfire - CookingTimes and CookingTotalTimes fields removed;chiseled_bookshelf - last_interacted_slot defaults to -1;hopper - TransferCooldown defaults to -1;jigsaw - name, target, and pool fields default to minecraft:empty;\nfinal_state defaults to minecraft:air;sculk_shrieker - warning_level defaults to 0;structure_block - ignoreEntities and showboundingbox fields default to\ntrue; posY defaults to 1;CommandsThe horse.saddle item slot has been renamed to saddle, and now supports\nany entity that can equip a Saddle.The behavior of setblock and fill commands have changed in how they handle\nblock entity data:If the block entity data is not specified, and the existing block has data,\nthe block entity data will be preservedIf the block entity data is specified, the block entity data will be set to\nthe specified valueTo clear the block entity data explicitly, you must now specify the block\nentity data as {}The operation is now successful if either the block state changed or the\nblock entity data changedItem ComponenentsEntities now have a set of components fro changing variants and other\napperance like stuff.Mob buckets and paintings available in creative menu will now use new entity\nvariant components instead of\nentity_data\ncomponentCustom tooltips for Bucket of Tropical Fish and Painting items are now based\non new components instead of\nbucket_entity_data\nand\nentity_dataThe hide_additional_tooltip and hide_tooltip component were removed, and\nreplaced by the new\ntooltip_display\ncomponent. This means that all the items which used this will now need to be\nhidden using the new component.All item components which had a show_in_tooltip field, had this field\nremoved. The old behaviours can be done using the new tooltip_display\ncomponent.In the dyed\ncomponent, the color field now always uses its simplified form, with the rgb\nfield inlined to top-level (e.g. dyed_color={rgb:12345} →\ndyed_color=12345).In the\ncan_place_on\nand can_break,\nthe predicates field has been inlined to top-level, and supports either a\nsingle element or list. (e.g.\ncan_place_on={predicates:[{blocks:'stone'},{blocks:'dirt'}]} →\ncan_place_on=[{blocks:'stone'},{blocks:'dirt'}])The\nenchantments\nand\nstored_enchantments\ncomponents, will now always use their simplified form, with the levels field\ninlined to top-level (e.g. enchantments={levels:{sharpness:2}} →\nenchantments={sharpness:2})RecipesThe base ingredient field is no longer optional in the\nsmithing_transform recipe type.The base, template, and addition ingredient fields are no longer\noptional in the smithing_trim recipe\ntype.Added a new field pattern in the\nsmithing_trim recipe type.PredicatesSome entity sub-predicates have been removed and replaced by a combination of\ncomponents predicate and variant entity componentsThese include: axolotl, fox, mooshroom, rabbit, horse, llama,\nvillager, parrot, salmon, tropical fish, painting, cat, frog,\nwolf, pigField color has been removed from minecraft:sheep sub-predicateThe stepping_on entity predicate can now only evaluate to true if the entity\nis on ground1.21.4You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21.4Item ComponentsField model in\nequippable\ncomponent has been renamed to asset_id.The dyed\ncomponent now tint's based on the model, not item ID.The\ncustom_model_data\ncomponent has new fields floats, flags, strings, colors.Item blocks with\nblock_entity_data\ncomponent will now set block entity data only if id tag matches type of placed\nblock entityRenamesThe TNTFuse field of TNT Minecarts has been renamed to fuseChanged some Furnace, Smoker and Blast Furnace data. From camelCase to\nsnake_case.Renamed CookTime to cooking_time_spentRenamed CookTimeTotal to cooking_total_timeRenamed BurnTime to lit_time_remainingOtherRemoved #tall_flowers block tag. And also removed the #flowers and\n#tall_flowers item tags.The trail particle has a new required field: duration - Indicates, in\nticks, for how long the particles should travel to its destination.🎨 The item model resource pack format got completely changed, now allowing\nfor tinting, layered, conditional, and much more!1.21.2You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21.2Item ComponentsThe food item\ncomponent no longer automatically allows for consumption of food, and now only\nholds the data relating to it (meaning nutrition, saturation and\ncan_always_eat are the only fields left in the component)🛠️ To fix this, just add the\nconsumable\ncomponent: consumable={}. This component is very customizable, you can\nread about it\nhere.The lock has been\nchanged into an item predicate, with a format of lock={ITEM_PREDICATE}🛠️ The previous lock=\"MyKey\" would now look like\nlock={components:{\"minecraft:custom_name\":\"'MyKey'\"}}The fire_resistant component has been renamed to\ndamage_resistant,\nwith a new fieldtypes - A # damage type tag. Items in entity form or worn by players\nwith this component will be resistant to the damage types included in the\ntag.Loot TablesThe /loot command now returns an error when trying to drop from block\nwithout loot table (like air)The special loot table empty has been removed.Sheep now always use a single loot table entities/sheep, but wool drops are\nstill defined in sub-tables in entities/sheep/ OtherAttribute IDs now don't have the generic., player. or zombie. prefixes\nanymore (generic.scale → scale).boat and chest_boat entity types have been split into separate types, one\nper variant (Type=oak → minecraft:oak_boat,...)With that the minecraft:boat entity sub-predicate has been removed.The previous Lock field of containers has been renamed to lock and is now\nan item predicate.You now cannot ride Leash Knots, Lighting Bolts and Fishing Bobbers with\n/ride command.The killed_by_crossbow advancement was renamed to killed_by_arrow, and\nwill now trigger whenever an arrow kills an entity, not just when fired from a\ncrossbow.Renamed effect type damage_item to change_item_damage, which now also\nsupports negative amounts.Removed liquid carvers and changed biome format (the carvers field is now\njust a list of carvers)1.21You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21General RenamesAll folders which previously had plural names (except tags) now have\nsingular names. A list of all changed folders can be found below:structures → structureadvancements → advancementrecipes → recipeloot_tables → loot_tablepredicates → predicateitem_modifiers → item_modifierfunctions → functiontags/functions → tags/functiontags/items → tags/itemtags/blocks → tags/blocktags/entity_types → tags/entity_typetags/fluids → tags/fluidtags/game_events → tags/game_eventThe uuid and name arguments have been replaced with a singular namespaced\nid argument.🛠️ For example: attribute ... modifier add 0.5 add_value\nwould now look like\nattribute ... modifier add 0.5 add_valueEntity NBTEntity attribute format has changed:Attributes → attributesName → idBase → baseModifiers → modifiers (Now stores modifiers in the same format as\nmodifiers in the\nminecraft:attribute_modifiers\nitem component)UUID → uuidName → idAmount → amountOperation → operation (This is now a named constant instead of an\nint)add_value - now a string, previously 0add_multiplied_base - now a string, previously 1add_multiplied_total - now a string, previously 2🛠️ For example:\nsummon ... {Attributes:[{Name:\"generic.scale\",Base:2,Modifiers:[{UUID:[I;1,0,0,0],Name:\"example_modifier\",Amount:1,Operation:0}]}]}\nwould now look like\nsummon ... {attributes:[{id:\"generic.scale\",base:2,modifiers:[{id:\"tutorial:example_modifier\",amount:1,operation:\"add_value\"}]}]}Replaced the power NBT tag with an acceleration_power tag. This controls\nthe projectile's acceleration (and maximum speed).This applies to: dragon_fireball, large_fireball, small_fireball,\nfireball, breeze_wind_charge, wind_charge, wither_skull.The field ShotFromCrossbow from projectile NBT has been removed. A new\nweapon field has been added to replace this feature.🛠️ For example: @e[type=arrow,nbt={ShotFromCrossbow:1b}] would now look\nlike @e[type=arrow,nbt={weapon:{id:\"minecraft:crossbow\"}}]TagsRemoved the #minecraft:music_discs item tagPredicatesSome predicate fields have been renamed:killer → attackerdirect_killer → direct_attackerkiller_player → attacking_playerThe random_chance_with_looting has been renamed (because its now controlled\nby enchantments) to random_chance_with_enchanted_bonus. The fields were\nupdated accordingly:The looting_multiplier field has been removedThe chance field has been removed.enchantment - is a new field containing the namespaced:id of the\nEnchantment that grants the bonus chanceenchanted_chance is a new field for the chance for an enchanted item. A\nlevel-based value.unenchanted_chance - is a new field specifying the chance for an\nunenchanted item.If you are testing for an enchantment on your item, the field enchantment →\nenchantments. Can be either an Enchantment, a list of Enchantments or an\n#Enchantment Tag.Item ModifiersThe looting_enchant field has been replaced by enchanted_count_increase.\nThis has a new field enchantment (specifies which enchantment).Under enchant_randomly the field enchantments is now called options.Under enchant_with_levels the field treasure was removed.Under copy_name the field killer → attacking_entity and killer_player\n→ last_damage_player1.20.2Entity effects in NBT now use namespaced IDs instead of numbers.The structure for entity effects in NBT has been changed from PascalCase to\nsnake_case.For mob effect instances:Id → idAmbient → ambientAmplifier → amplifierDuration → durationShowParticles → show_particlesShowIcon → show_iconHiddenEffect → hidden_effectFactorCalculationData → factor_calculation_dataFor others:CustomPotionEffects → custom_potion_effects (potion, lingering_potion,\nsplash_potion, tipped_arrow, arrow)Effects → effects (suspicious_stew, area_effect_cloud)EffectId → id` (suspicious_stew)EffectDuration → duration (suspicious_stew)EffectId and EffectDuration → stew_effects (mooshroom)ActiveEffects → active_effects (player, armor_stand, mobs)Primary → primary_effect (beacon)Secondary → secondary_effect (beacon)","description":"A list of breaking changes to datapacks.","url":"/wiki/info/breaking-changes/","tags":[]},{"title":"JSON","content":"JSON FormatJSON is a data storage type used by Minecraft Datapacks for files such as predicates and tags, as well as in Styled Text. JSON is a way of storing data, usually used in .json files but is also seen in .mcmeta files too.How JSON worksJSON stands for JavaScript Object Notation. It was originally created as a\nway of writing objects in Javascript. These days, JSON is used in almost every\nprogramming environment, datapacks included.JSON is a way of storing information so that both a computer and a human can\nunderstand it. It stores data as key-value pairs - this means that a key\n(such as name) can store any value (such as Aron Aronson). The code can ask\nfor name, and it will get the result Aron Aronson.A .json file usually is itself just a JSON object (aka a JSON dictionary). A\nJSON dictionary is like a real dictionary because it holds sets of key/value\npairs - just like how a dictionary consists of word/definition pairs. In a JSON\ndictionary, the key and value are separated by a colon (\"key\":value), and each\nkey/value pair is separated by a comma.Example JSON{\n\"name\": \"Aron Aronson\",\n\"age\": 83,\n\"alive\": true,\n\"family_members\": [\"James Aronson\", \"Catherine Aronson\"],\n\"login_details\": {\n\"email\": \"aron.aronson@gmail.com\",\n\"password\": \"MyNameIsAron12345\"\n}\n}\nAn explanation of this file:Everything is contained within curly brackets {...}, which means that the\nwhole file is a JSON dictionary.The first key/value pair is \"name\":\"Aron Aronson\". The key here is name,\nand it has a string (text) value: \"Aron Aronson\"The second key/value pair is \"age\":83. The key here is age, and it has a\ninteger (whole number) value of 83. The number isn't \" signs, because\nif a value is in \" signs, it is considered to be text.The third key/value pair is \"alive\":true. The key here is alive, and it\nhas a boolean (true/false) value of true.The fourth key/value pair is \"family_members:[...]\". The key here is\nfamily_members, and it has a list value (indicated by the square\nbrackets []). This list has two string (text) values. The list does\nnot contain key/value pairs, just values.The final key/value pair is \"login_details\":{...}. The key here is\nlogin_details, and it has a dictionary value. The dictionary itself\ncontains two key/value pairs.Note that the key in a key/value pair is contained within \" signs - don't\nconfuse this with the string data type seen in the first key/value pair. The key\nis always on the left of the colon, and is always in \" signs. The\nvalue is always on the right of the colon, and should only use \" signs if\nit is a text value.Types of valuesYou can use the following data types for JSON values:String (e.g \"Hi! I am text\"): A string is plain text. Everything inside\nthe string should be contained within \" or ' signs. If you want to use one\nof those signs within the string without making the computer think the string\nhas ended, put a \\ before the character (e.g \"Dave said \\\"Hello\\\".\")Integer (e.g 42): An integer (often called an int) is a whole number.\nThis is also often used to store date and time values (seconds since\nJan 1 1970)Float (e.g 12.5): A float (short for \"floating point number\") is any\ndecimal number. The decimal point needs to be a . symbol.Boolean (e.g true or false): A boolean is either true or false. In\nsome circumstances, these are just easier ways to write 1 or 0.List (e.g [123, \"hello\", 456, \"goodbye\"]): A list is an ordered\ncollection of values (not key/value pairs). List items should be contained\nwithin square brackets ([]) and separated with a comma. Confusingly, the\nfirst item in a list is \"item 0\", the second one is \"item 1\", etc.Dictionary (e.g {\"name\":\"Aron\", \"age\":94}): A dictionary contains\nkey/value pairs, separated by commas. The key needs to be inside \" signs,\nand followed by a colon.JSON PathsA JSON path is basically the address of a specific value within a JSON\nstructure. Nested dictionaries (if the value of a key is a dictionary) are\nseparated by . signs, otherwise it's pretty straightforward how they work.If we assume that root contains the entirety of the example file (remember\nthat the contents of the file itself is just a JSON dictionary), then the\nfollowing paths can be used:root.name would return \"Aron Aronson\"root.alive would return trueroot.family_members[0] would return \"James Aronson\" (the first item in the\narray)root.login_detiails.password would return \"MyNameIsAron12345\"In datapacks, you will not use JSON paths often, but you will use\nNBT paths, which are very similar.\nlanguages, such as Python, use a different format, such as:root[\"login_details\"][\"password\"]\n","description":"A rough guide to the JSON format used in Minecraft Datapacks (among other places)","url":"/wiki/info/json/","tags":[]},{"title":"/data","content":"/data commandThe /data command is used to modify and fetch NBT data of\nblocks,\nentities and\nstorages.\nto modify player data.\nresulting value by scale, if specified.\nsource is a data source, path is an\nnbt path and scale is a number.\nIf scale is set, and the data at that path it not a number, the command fails.After fetching the NBT at the path, if it exists, it prints the data in\nSNBT format in the chat. Therefore, its\nmain use is manually inspecting NBT data. However, it also returns the integer\nrepresentation of the\nfetched data, so it can be used in combination with execute store or\nreturn run to convert NBT into an integer.Examplesdata get entity @s SelectedItem.id data get block ~ ~ ~ Itemsmerge Merges data with the given data source.\ntarget is a data source and nbt is an\nSNBT compound.\nThis command fails if the given entity or block does exist, or if the block is\nnot a block entity and cannot hold NBT data. However, if the data source is a\nstorage, and that storage does no exist yet, the storage is automatically\ncreated.Examplesdata merge entity @n[type=creeper] {Fuse: 10s, ignited: true, ExplosionRadius: 8}\ndata merge storage example:data {a: 1, b: \"b\", c: [41b, 0b]}modify Modifies the NBT data at the specified path of the given data source. This gives\nmore fine-grained control that data merge.\ntarget is the data source to modify and path is an\nNBT path, the specific sub-path of that\ndata source.\naction determines what kind of modification occurs. There are 5 possible\nactions, as below.\nsource determines the source of the data being used to modify the target.\nSee source below.appendAppends an NBT value to a\nlist or a typed array, making the value\nthe last element.\nIf the specified path does not exist in the data source, it is created and\ninitialized as a list containing the value just appended.\nThis is equivalent to data modify ... insert 0 ....insert Inserts an NBT value into a\nlist or array at a specific index,\nshifting all proceeding elements to the right. Negative indices may be used to\nindicate inserting values from the end.\nIf the index specified would cause the inserted item to be further than one\nafter the first or last element of the list, the command fails.\nInserting creates list if it doesn't exist in the same way as append.mergeMerges source into target at path. This is similar to\ndata merge, but allows modifying a sub-path of a data source, and allows\nmerging from more than just hardcoded NBT values.prependPrepends an NBT value to a\nlist or a typed array, making the value\nthe first element.\nLists are created in the same wat as append.\nThis is equivalent to data modify ... insert -1 ....setSets the value of target at path, discarding any previously present value.\nThis will create keys in a compound if not present, but cannot be used to add\nelements to an array or list, only modify existing ones.\nset can create a chain of nested compounds if they don't already exist.\nFor example, if the storage example:main does not yet exist, after the\nfollowing command:data modify storage example:main a.b.c.d set value 10\nThe example:main storage looks like this: {a: {b: {c: {d: 10}}}}.sourcesource determines the value modifying target. It can be one of:value- Gets the value from an\nSNBT literal.from [path] - Gets the data from the specified\ndata source and path.string [path] [start] [end] - Gets the data from the specified\ndata source and ensures that it's a string. If start or\nend is specified, truncates the string using those values. start is\ninclusive, while end is exclusive. Both numbers are allowed to be negative,\ncounting from the end of the string. For example, the indices 1 -1 remove\none character from each end of the string, while 0 1 takes the first\ncharacter.remove Removes the NBT data from source at path. source is a\ndata source and path is an\nNBT path.\nThis deletes compound keys, and removes array and list elements, shifting\nproceeding elements left. It cannot, however, be used to delete an entire\nstorage using the special {} path; only single keys of the root storage.\nNBT data in a sub-path of it, for example:data modify storage example:main temp.a set value 1\ndata modify storage example:main temp.b set value 2\n# Removes both keys\ndata remove storage example:main temp\n\nNBT of an entity.block- The NBT of a block entity.storage- The NBT from a\ndata storage.Data mergingData merging is a process of merging two data values into one another.\nThere are two values: The left side and the right side. The left side is the\nbase of the operation, with the right being merged into the left.If both sides of the operation are compounds, each key of the right compound is\nmerged into the matching key of the left compound. If the key does not exist in\nthe left compound, it is created and set to the value of the right.If both sides are not a compound, the left is simply set to the right.","description":"The data command is used to modify and fetch NBT data of blocks, entities and storages.","url":"/wiki/command/data/","tags":[]},{"title":"All Commands List","content":"List of all commandsThis is a list of all commands along with what they do basically, organised by\npermission level.SyntaxWe use the following syntax to make it easier to understand which arguments are\nneeded.VariableMeaning An argument.[ ]An optional entry. Pick one of these. This is required.[entryA│entryB│entryC]Pick one of these. This is optional....Some syntax is left out, you can find more about the command on its dedicated pageCommon ParametersParameters that show up commonlyVariableMeaningtarget(s)A Target Selector.rangeA Range.timeIndicates time (1s = 1 second, 1t = 1 game tick)List of commands by Permission LevelPermission level 0These commands can be run by any player, no matter their permission level./help [command] - Shows the help menu for commands/list [uuids] - Lists players on the server/random- Creates a random value (requires\nPermission Level 2+)/seed - Displays the world's seed, permission level 0 only in singleplayer/teammsg- Sends a message to all players in the same team of the\ncommand runner. (Alias /tm)/me- Displays: *in chat/msg- Sends a private message to a player. (Alias\n/tell and /w)/trigger [add|set] [ ] - Triggers a scoreboard objective\n(see Scoreboards)Permission level 1There are currently no commands with the permission level 1 in Java Edition.Permission level 2These commands require a permission level same or bigger than 2 to run them./advancement-\nGives, removes or checks players advancements/attribute get|base|modifier|reset ... - Can change or\nread attributes. See more on the\nMinecraft Wiki/bossbar list|add|remove|set|get [ ] ... - Changes or creates bossbars/clear [ ] [ ] [ ] - Clears items from the players\ninventory/clone <... | from ...> -\nCopies blocks in an area from one place to another, or from one dimension to\nanother/damage [ ] [at ]|[by ] [from ] -\nDamages selected entities/players./data... - Changes block entity or entity NBT\ndata. See more on its dedicated page./datapack disable |enable |list [available|enabled]|create-\nEnables, disables or creates a datapack/defaultgamemode- Sets the default\ngamemode of a world/dialog |clear- Shows and hides\ndialog screens from players/difficulty [peaceful|easy|normal|hard] - Sets or gets the difficulty of a\nworld/effect ] [ ]|give [ |infinite] [ ] [ ]> -\nChanges the entity's active effects/enchant [ ] - Adds enchantments onto held\nitem. (Note that you can't enchant items with a level higher than what is\npossible in survival)/execute ... - Executes a different command (See more here:\n/execute)/experience ... - Adds, removes or gets the\nplayers experience points. (ALIAS: /xp)/fetchprofile |id |entity- Fetches the profile of the target. It works asynchronously as the operation might take some time.\nAfter successful completion, a message will be printed that lets users copy the contents of a fully resolved minecraft:profile component or /give @s minecraft:player_head with said component.\nFor the entity subcommand, the player must be online, and will fail if they are not./fill [destroy|hollow|keep|outline|replace [filter]] -\nFills the defined region with selected blocks/fillbiome [replace [filter]] - Fills the\ndefined region with a specific biome/forceload add [ ]- Forces chunks to be\nloaded constantly/function |with |entity |storage [ ] -\nTriggers a function/gamemode [ ] - Changes or checks the player's gamemode/gamerule [ ] - Changes or checks a gamerule/give [ ] - Gives an item to the player/item |entity ... - Modifies\nor copies items from inventories of entities/blocks/kill [ ] - Kills selected entities/locate- Displays the coordinates or returns the\ndistance of the nearest biome, structure or point of interest./loot |insert |spawn |replace |kill |mine ...> ... -\nSpawns or inserts the selected loot table into an inventory or the world/particle [ ] [force|normal] [ ] -\nSpawns a selected particle with specified parameters/place... - Places a structure, a\nfeature, a structure template or a template pool on a selected location/playsound [ ] [ ] [ ] [ ] [ ] [ ] -\nPlays a specified sound to a player/random... - Rolls a random number/recipe- Gives or takes recipes from a\nplayer/reload - Reloads all datapacks in a world. (If there is an error in any of\nthe files, it won't reload it)/return |fail|run- Returns a number from a function, while\nalso stopping it/ride |dismount> - Make an entity ride or dismount\na different entity/rotate [ ]>> -\nUsed to rotate an entity, works similarly to /teleport but doesn't dismount\nthe entity it's riding./say- Sends a message into chat to all players/schedule [append|replace]|clear-\nSchedules a function or clears it. Note that this will not transfer over\nselectors/scoreboard... - Manages\nscoreboard objectives and players/seed - Displays the world's seed, permission level 2 only in multiplayer./setblock [destroy|keep|replace] - Changes or replaces a\nspecified block with a different one/setworldspawn [ ] [ ] - Sets the world's spawn/spawnpoint [ ] [ ] [ ] - Changes the spawn point for a\nplayer/spectate [ ] - Makes a player spectate an entity, note that\nthe spectator has to be in spectator mode/spreadplayers [under ]-\nTeleport entities randomly across a specified area/stopsound [ ] [ ] - Stops any playing sound/stopwatch |query |restart |remove- Keeps track of real time (not game time), and is not affected by game tick rates or speeds. \nTime is calculated to millisecond precision/summon [ ] [ ] - Summons an entity/swing- Swings (animation only) the hand of an entity, mostly used for mannequins/tag add |remove | list - Adds, removes or lists\nentities tags/team... - Modifies and creates teams/teleport [ ] |facing [ ]>]> ... - Teleport entities to a specified location. (ALIAS: /tp)/tellraw- Sends a JSON message to players/time |query |set- Controls or checks the time/title (times clear|reset|title |subtitle |actionbar ) -\nDisplays text on the player's screen/weather weather [ ] - Changes the weather/worldborder add|center|damage|get|set|warning ... - Controls the\nworldborderPermission level 3These commands require a permission level same or bigger than 3 to run them./ban [ ] - Adds the player's profile into the server's\nbanlist/ban-ip [ ] - Adds the player's IP address into the server's\nbanlist/banlist [ips|players] - Displays the server's banlist/debug- Starts or stops a debug/deop- Removes a player operator status/kick [ ] - Kicks a player off a server. (Note, a player in\nsingle player / the host of the world can't be kicked!)/op- Makes a player operator/pardon- Removes player's profile from the server's banlist/pardon-ip- Removes player's IP address from the server's banlist/tick |freeze|unfreeze|step [|stop]|sprint [|stop]> -\nControls or checks the tick rate of a world/transfer [ ] [ ] - Transfers a player to a\ndifferent server/whitelist... - Modifies the server's\nwhitelistPermission level 4These commands require a permission level same or bigger than 4 to run them./jfr start|stop - Starts or stops JFR(Java FlightRecorder & other custom\nevents) profiling/perf- Captures info and metrics about the game for 10 seconds/publish [ ] [ ] [ ] - Opens a singleplayer\nworld to your local network/save-all [ ] - Saves the server to a disk/save-on - Enables automatic server saves/save-off - Disables automatic server saves/setidletimeout- Used to set the time before idle players are\nkicked (If 0 - disabled)/stop - Stops the server/version - Sends the server's version info (the name, protocol version and\nthe resourcepack and datapack formats).List of commands by Server TypeMultiplayer Only CommandsThese commands can only be run only on a server./ban [ ] - Adds the player's profile into the server's\nbanlist/ban-ip [ ] - Adds the player's IP address into the server's\nbanlist/banlist [ips|players] - Displays the server's banlist/deop- Removes a player operator status/op- Makes a player operator/pardon- Removes player's profile from the server's banlist/pardon-ip- Removes player's IP address from the server's banlist/perf- Captures info and metrics about the game for 10 seconds/save-all [ ] - Saves the server to a disk/save-on - Enables automatic server saves/save-off - Disables automatic server saves/setidletimeout- Used to set the time before idle players are\nkicked (If 0 - disabled)/stop - Stops the server/transfer [ ] [ ] - Transfers a player to a\ndifferent server/whitelist... - Modifies the server's\nwhitelistSingleplayer Only CommandsThis command can only be run in singleplayer, not on a server./publish [ ] [ ] [ ] - Opens a singleplayer\nworld to your local network","description":null,"url":"/wiki/command/all/","tags":[]},{"title":"/summon","content":"/summon commandThe /summon command is used to summon an entity at a position, along with any\nentity NBT.SyntaxThe syntax of the /summon command is as follows:summon [position] [nbt data]\n : an ID of a minecraft entity. For example: minecraft:cow,\nmarker, zombie. If the namespace (minecraft:) is omitted, it will\ndefault to the minecraft namespace.[position] (optional): the coordinates at\nwhich the entity should be spawned. (Defaults to the current position).[nbt data] (optional): a compound containing the NBT (in\nSNBT format) which the entity should\nbe spawned with. For example: {NoAI:1b}.Examplessummon minecraft:cow - Summons a cow at the current position.summon minecraft:ender_dragon ~ ~50 ~ - Summons an ender dragon 50 blocks\nabove the current positionsummon minecraft:wither 29 372 121 - Summons a wither at the coordinates\nx=29, y=372, z=121summon minecraft:zombie ~ ~ ~ {NoAI:1b} - Summons a zombie at the current\nposition with the NoAI NBT, meaning it will not move around or attack\nplayers.AlternativesThe execute summoncommand can also be used to summon an entity.\nUsing this\nexecute subcommand will\nsummon an entity at the current position, and then run the specified command as\nthe newly summoned entity.However, execute summon cannot provide any NBT to give the entity upon being\nspawned. You will have to edit the nbt in the command/function which is\nexecuted, which can be a bit tedious. An alternative to\nexecute summon minecraft:cow run function custom_function would be the\nfollowing:summon minecraft:cow ~ ~ ~ {Tags:[\"newly_summoned_cow\"]}\nexecute as @n[type=cow,tag=newly_summoned_cow] at @s run function custom_function\ntag @n[type=cow,tag=newly_summoned_cow] remove newly_summoned_cow\n","description":"The /summon command is used to summon an entity at a position, along with any entity NBT.","url":"/wiki/command/summon/","tags":[]},{"title":"/execute","content":"/execute commandThe execute command is used to execute other commands conditionally, or in a\ndifferent context. The execute command is made up of multiple subcommands, which\ncan be chained repeatedly and in any order to modify context in various ways.Each subcommand has its own syntax, and most allow/require another subcommand to\nfollow.ContextEvery command is executed in a context. Various execute subcommands can modify\nthe context in which other commands are run. The context includes:Position: The position at which the command is executed (the origin of\nrelative coordinates)Anchor: Either eyes or feet. Specifies the origin of local coordinates to\neither the eyes or feet of an entity.Executor: The entity executing the command (which entity the @s selector\nrefers to)Rotation: The rotation of the commandDimension: The dimension in which the command is executedForkingSome subcommands can split the command execution into multiple branches. This is\ncalled forking. This means any subcommands that follow will be executed multiple\ntimes, once for each branch. Minecraft will finish executing all subcommands in\nthe first branch before moving on to the next.For example, if there are two markers A and B, and the following command is run:\nexecute as @e[type=marker] run function example\nAnd the example function contained the following commands:say first command\nsay second command\nThe chat output would look like this:[A] first command\n[A] second command\n[B] first command\n[B] second command\nSubcommands\ndenotes that another subcommand is optional.\n(rounding down coordinates to integers).can be any subset of xyz, in\nany order.Examples:execute align xz ...\nexecute align yxz ...execute anchored (eyes|feet) ...Changes the execution anchor to the eyes or feet of the entity.Examples:execute anchored eyes ...\nYou can lock this though by using positioned ^ ^ ^ after it.\nany other context such as location).\nIfrefers to multiple entities, the following subcommand gets\nexecuted once for each referenced entity, with that entity as the executor.\nIfrefers to no entities, the execute chain terminates and no further\nsubcommands are run.Examples:execute as @a[distance=10..] ...\nexecute as @e[type=pig] ...execute at...Changes the position and rotation of the following subcommand to that of\n(Executor remains the same).\nForking rules apply the same as execute as.Examples:execute at @s ...\nexecute at @p ...execute facing...Changes the rotation of the following subcommand to face.\ncan either be a set of coordinates, or\nentity (eyes|feet), which targets the eyes or feet of the given\nentity.Examples:execute facing 0 0 0 ...\nexecute facing entity @e[type=marker,limit=1] feetexecute in...Changes the dimension of the following subcommand to.\nApplies dimension scaling, meaning coordinates are divided by 8 when\ntransferring from the overworld to the nether.Examplesexecute in minecraft:nether ...execute on...Changes executor to other entities based on their relation with the current\nexecutor. Same forking rules apply as execute as.\nPossible values forare:attacker - The most recent entity to damage the current entity in the last 5\nseconds.controller - The entity which is riding and in control of the current\nentity.leasher - The entity holding the the current entity on a lead.origin - The entity the current entity originated from, such as the player\nthat shot an arrow.passengers - All entities riding the current entity (not including entities\nriding the passengers).target - The entity the current entity is trying to attack (angry at).vehicle - The entity that the current entity is riding.Examplesexecute on passengers ...\nexecute on target ...execute positioned...Changes the position (but not rotation) of the following subcommand to\n . Also resets anchor.\ncan be a set of coordinates, as , or\nover .\npositioned as... is equivalent to at..., except that it\ndoesn't change rotation or dimension.\npositioned oversets the y coordinate of the position to be one\nabove the specified heightmap.Examples:execute position ~ 0 ~-10 ...\nexecute positioned as @s ...\nexecute over world_surface ...execute rotated...Changes the rotation of the following subcommand to.\ncan either be rotation coordinates, or as , which changes\nthe rotation to that of the specified entity. For rotated as , forking\nrules apply the same as as entity.Examples:execute rotated ~10 0 ...\nexecute rotated as @e[tag=rotate] ...execute summon...Summons the specified entity at the current position, and executes the following\nsubcommand as that entity.\nNote: You cannot specify NBT data for the summoned entity.Examples:execute summon iron_golem ...\nexecute summon marker ...execute run Runs the specified command with the current context. Takes no further\nsubcommands.\nexecute at @e[type=sheep] run setblock ~ ~ ~ stoneexecute store (result|success)...Stores an integer value somewhere. If storing result, this numeric value is\ntaken from the output of the final subcommand (Either a run subcommand or a\ncondition). If storing success, the value is either 1 if the final\nsubcommand succeeds (condition passes or command successfully performs its\nfunction), or 0 otherwise.target can be one of the following:block : Stores the value in the\nspecified path of the given block in the format specified by type (Any\nnumeric NBT type), and multiplied by scale. Note: Even if type is a\ndecimal type (float or double), the value is still rounded down.entity : Stores the value in the specified\npath of the target entity, the same way as block. entity must only refer\nto a single entity.storage : Stores the value in the given\npath of the target storage in the same way as block and entity.score : Stores the value for the target entity in\nthe provided scoreboard. target can refer to more than one entity.bossbar (value|max): Stores the value in a bossbar, changing either\nthe current value or the maximum value.Examples:execute store result entity @s Pos[1] double 1.5 ...\nexecute store success score $foo my_objective ...\nexecute store result bossbar foo_bar value ...execute (if|unless) [...]Executes the following subcommand under a given condition. unless inverts the\ncondition, meaning the chain only continues if the condition not met.Possible values for condition:biome : Checks whether a specific biome is at the given\nposition.block : Checks whether the given position is a certain\nblock.blocks (all|masked): Compares two volumes of\nblocks: from start to end, and from destination such that the second\nvolume is the same dimensions as the first. If all is specified, it checks\nall blocks. If mask is specified, air blocks are ignored.data (block|entity|storage) : Checks if the specified\npath matches the NBT data of target.dimension : Checks if the execution is in the specified\ndimension.entity : Checks whether target resolves to one or more\nentities.function : Runs the specified function and tests the return\nvalue. If the function did not run the return command, or if it returns\nzero, the condition is not met. Must be followed by another subcommand.items (block|entity) : Checks if the given item\nmatches the specified slot of the target block or entity. item is in the\nformat[ ].loaded : Checks if the specified position is loaded.predicate : Checks whether a predicate succeeds.score (matches | ):\nChecks whether a score is within a range (matches), or has a specified\ncomparison to another score. operator can be on of:=,\n>.stopwatch : Checks if the specified stopwatch matches the\nspecified range.Examples:execute if biome ~ ~ ~ minecraft:snowy_taiga ...\nexecute if block 16 -42 83 #minecraft:logs ...\nexecute if blocks ~ ~ ~ ~10 ~10 ~10 0 64 0 all ...\nexecute if data storage example:store path{thing:1} ...\nexecute if dimension minecraft:the_end ...\nexecute if entity @e[tag=existent] ...\nexecute if function example:my_fn ...\nexecute if items entity @s weapon.mainhand #minecraft:swords[minecraft:custom_data={foo:\"bar\"}] ...\nexecute if loaded 0 0 0 ...\nexecute if predicate example:check ...\nexecute if score @s score = @r score ...\nexecute if stopwatch example:timer 10 ...","description":"The execute command is used to execute other commands conditionally, or in a different context. The execute command is made up of multiple subcommands, which can be chained repeatedly and in any order to modify context in various ways.","url":"/wiki/command/execute/","tags":[]},{"title":"/function","content":"/function commandThis command runs any .mcfunction file when called. You can also pass in a NBT\ncompound or NBT source path if the function is a macro function. All functions\nare run independently and one after another - for example, if you run\nfunction1 and then function2, then function2 will only run once\nfunction1 has finished.Syntaxfunction : : Runs the .mcfunction file at\ndata/ /function/ function : {key:value}: Runs the .mcfunction file\nat data/ /function/ , and uses the {key:value} if the\nfunction is a macro function.function : with (block |entity |storage ) :\nRuns the .mcfunction file at data/ /function/ , and\nuses the NBT source if the function is a macro function.","description":"This command runs any `.mcfunction` file when called. You can also pass in a NBT compound or NBT source path if the function is a macro function. All functions are run independently and one after another - for example, if you run `function1` and then `function2`, then `function2` will only run once `function1` has finished.","url":"/wiki/command/function/","tags":[]},{"title":"Custom World Generation","content":"Custom World GenerationCustom World Generation is an experimental feature, allowing a data pack to\ngenerate custom features, biomes, or dimensions, primarily by way of a series of\nJSON files rather than by using commands.This guide goes over how to create every step of a custom dimension, which\nitself comprises all of the following. If you only want to achieve one or some\nof these things, you can generally skip to those respective sections.Modifying and defining dimension settingsGenerating terrainCreating biomesArranging biomesCreating features (ores, trees, etc.)Many sub-tasks related to the aboveAt the same time, this documentation will express some of the major limitations\nthat come with Custom World Generation. There are many aspects of worldgen that\nwe will go over here in brief, but that could fill entire guides of their own to\nexplore in detail. Many of the tasks involved in creating Custom World\nGeneration can be extremely time-intensive and require a lot of trial and error.What is Custom World Generation?Custom Worldgen can take the form of anything from a completely separate\ndimension, an override of vanilla dimensions or biomes, like the Overworld at\nlarge or Swamps in particular, or individual features that are placed via\ncommands. The following are all things that Custom World Generation can include,\nirrespective of difficulty.Custom TerrainCustom Dimension Settings, such as:UltrawarmPiglin zombificationRespawn Anchors vs BedsLight levelDaylight cycle (on/off)etc.Custom Biomes (Surface and Cave)Natural features (Trees, ores, flowers, etc.)Custom colors and ambient particlesCustom Biome layout (including of vanilla biomes)Custom Structures, and changes related to structures, are also a sub-feature of\nCustom World Generation. We already have documentation for creating Custom\nStructures, which you can find\nhere.Folder StructureTo begin creating a Custom Dimension, there are a few folders you should create\nin a data pack. If you’re unfamiliar with the general structure of a data pack,\nyou should check out our Data Pack Starter Guide.In your namespace folder, you will create the following folders, organized as\nsuch:/\n├── dimension/\n├── dimension_type/\n└── worldgen/\n├── biome/\n├── configured_carver/\n├── configured_feature/\n├── density_function/\n├── noise/\n├── noise_settings/\n└── placed_feature/\nYou may not need all of these folders depending on the degree of configurability\nyou want or the scope of your project, so which folders are needed or optional\nfor any particular task will be listed at the top of each section.Because Custom World Generation requires so many different JSON files, many with\na variety of required vs. optional fields, it is strongly recommended that you\ngenerate most or all of these files using\nMisode’s generators. Furthermore, frequent\nreference to the wiki pages for\ncustom dimensions and their respective subcategories will likely be necessary,\nif only to determine what type of data some fields are expecting, when Misode or\nthis guide do not specify.\nreference don’t exist or are in the wrong folder, when in fact they are,\ndepending on the version you are working in. This is most common for\nconfigured_features, but be on the lookout for this behavior elsewhere.\nstart with the Dimension Type. The Dimension Type is what defines the very broad\ndetails about the dimension, such as whether water evaporates instantly like the\nNether (Ultrawarm), whether Beds and/or Respawn Anchors work or explode, and\nwhat light level Hostile Mobs need to spawn. Most of these fields are self\nexplanatory, and most of them are required.dimension_type/overworld.json{\n\"ambient_light\": 0.0,\n\"bed_works\": true,\n\"coordinate_scale\": 1.0,\n\"effects\": \"minecraft:overworld\",\n\"has_ceiling\": false,\n\"has_raids\": true,\n\"has_skylight\": true,\n\"height\": 384,\n\"infiniburn\": \"#minecraft:infiniburn_overworld\",\n\"logical_height\": 384,\n\"min_y\": -64,\n\"monster_spawn_block_light_limit\": 0,\n\"monster_spawn_light_level\": {\n\"type\": \"minecraft:uniform\",\n\"max_inclusive\": 7,\n\"min_inclusive\": 0\n},\n\"natural\": true,\n\"piglin_safe\": false,\n\"respawn_anchor_works\": false,\n\"ultrawarm\": false\n}\nTo create this, simply add a .json file to the dimension_type folder, and set\nthe name to that of the dimension you are creating/modifying. Like all file\nnames, it must have no capital letters, and no special characters except\nunderscores. Then generate the list of fields with\nMisode.Note that some fields, like “has ceiling”, don’t do what you would expect – this\nfield doesn’t actually give the dimension a physical ceiling, that’s handled in\nthe terrain. Similarly, “Effects” pretty much just changes the skybox and\ndetermines whether the time affects the light level.Noise SettingsFolders: noise_settings\nOptional Folders: density_function, noiseThe Noise Settings are one of the largest files you will create. This single\nfile per dimension controls all of the following:What base block the dimension’s terrain is made of (Stone, Netherrack, etc.)What base fluid is used for the sea level (Water, Lava, etc. Does not need to\nbe a fluid)Some global settings, such as:Whether “Creatures” (passive mobs) spawn during chunk generationBiome noise parameters that the worldspawn is allowed to be set in during\nworld creationWhether large ore veins generate, and their general size and shape via\nDensity Functions. Only applies to Copper and Iron veinsWhether aquifers generate. Not configurable beyond true/false. If false,\nmost caves below sea level will be filled with the base fluid.Noise Router (The shape of the terrain, which is determined by a few further\nfields)Surface Rules (What blocks the surface is made up of, typically broken down by\nbiome)Note that the sea level also determines the level that caves become filled with\nLava, so a higher sea level will also raise the cave Lava level, and a deeper\nworld with a default sea level will result in all caves being filled with lava\nbelow the same point (about Y=-50).Noise Router (Terrain)The Noise Router is responsible for most factors relating to the terrain, which\nis to say, whether a given block is air/fluid or the default_block, before\nsurface_rules or biome features are added. In addition, the Noise Router\nincludes several fields that don’t directly influence the terrain, but may\napproximate it for use in making biome distribution conform to the terrain.The Noise Router contains several fields. All of these fields are density\nfunctions, which can be defined in-line or referenced from the density_function\nfolder. These are essentially formulas of variable length and complexity, that\nuse a variety of functions to determine a value between 0 and 1 for every\ncoordinate. For density functions that affect terrain, this determines whether\nthe block is air/fluid (respecting sea level), or the default_block,\nrespectively.Let’s look at what each of these density functions are responsible for.barrier, fluid_level_floodedness, fluid_level_spreadThese all relate to some facet of Aquifer generation, if they are enabled.lavaUsed to determine whether an aquifer is lava or not. Does not affect the lava\nthat floods the bottom of the world.vein_toggle, vein_ridged, vein_gapUsed to control the shape, density, and rarity of both Iron and Copper Large Ore\nVeins. Cannot change what these blocks are made of, but whether the vein is\nCopper or Iron is based on the vein_toggle noise range.temperature, vegetationCorrespond to the “temperature,” and “humidity,” parameters in the dimension’s\nbiome source, respectively. Ostensibly create the noise maps that biomes are\nplaced relative to. These density functions don’t affect terrain at all.continents, erosion, depth, ridgesCorrespond to the “continentalness,” “erosion,” “depth”, and \"weirdness\"\nparameters in the dimension’s biome source, respectively. Like the temperature\nand vegetation density functions, whatever is put in these fields will not\ndirectly affect terrain, and ostensibly just create noise maps for the biome\nsource to use. However, in the vanilla overworld, these fields are used to\nreference separate density function files that also get referenced elsewhere, to\ninform the terrain. This means that unlike the temperate and vegetation density\nfunctions, these correspond to certain parts of the terrain.For example, high erosion parameter values match up with where the terrain is\nmore flat, because of how it gets referenced by other density functions that\nimpact terrain.\ncontinents, erosion, and depth, but it’s generally not necessary to have so many\nparameters that conform to terrain, and can in fact make biome distribution\nharder and more time consuming.\nthe surface of the world is so that neither can generate above that surface.\nTypically, will be similar to the final_density, but with the surface slightly\nlowered, and with noise caves unaccounted for. Similar to the above few\nfunctions, it does not affect terrain at all.final_densityThis is the density function that actually creates the bulk of the terrain. As\nsuch, it’s often the largest and most complex part of the noise_settings file,\nbarring surface_rules. It controls not only the surface, including hills,\nmountains, valleys, and oceans, but also the large noise caves and noodle caves\nintroduced in the Caves and Cliffs update. And, as alluded to above, you still\nneed at least the continents and erosion density functions to align with the\ngeneral shape of this density function if you plan to have ocean biomes generate\nonly where the terrain dips below sea level, or mountain biomes generate only\nwhere the terrain spikes up to look like mountains.In the\nvanilla Overworld,\nthe final_density is split into two distinct parts: The part that handles the\nshape of the surface, including mountains, hills, rivers, and oceans; and the\npart that handles the large noise caves underground. These are separated by an\nin-line range_choice density function.Density functions are very complex, and being very math-heavy, difficult to dive\ninto and learn about; an in-depth understanding of them and how to apply them is\noutside the scope of this guide. Generally, a lot of trial and error is\nrequired, and there are minimal resources for getting particularly good at\napplying them. These are primarily\nthe wiki page which lists them all\nand what they do to the inputs/arguments,\nthis brief tutorial\nwritten by Misode and now hosted on the wiki, which explains how the Final\nDensity affects the terrain, and provides some basic steps to manipulate it, and\nof course\nMisode’s generator to help\nvisualize individual density functions or chains of them. However, as a brief\nintroduction, this guide will attempt to describe, roughly, how the vanilla\noverworld's final_density applies important density functions to shape the\nworld's surface.sloped_cheeseUsed as the input in the aforementioned range_choice density function to\ndistinguish between the surface and underground (for noise caves), as well as\nthe main density function that gets applied to the surface. It multiplies the\ndepth and the jaggedness density functions with the factor density function,\ncombining the various shapes they create into one coherent surface shape.factorContains a complex spline that functionally combines the continents, erosion,\nand ridges_folded density functions. These three on their own are ostensibly\nnoise maps like temperature and vegetation, but this spline translates them into\nterrain. Continents is used to create a transition between high and low terrain,\nwith erosion added to flatten the terrain, and ridges_folded (which just\nreferences ridges with some multipliers) to carve rivers or raise peaks on\nmountains.depthCreates a gradient from the surface of the world down, where the surface and\neverything above it is assigned a value of 0, and ascends towards 1 as the world\nheight decreases. It gets the coordinates of the surface by referencing the\noffset density function.offsetSimilar to factor, and uses the continents, erosion, and ridges_folded density\nfunctions in a similar way to create a shape similar to the terrain's surface,\nbut slightly offset so that the depth density function doesn't start the\ngradient until a little below the surface (generally).jaggednessSimilar to factor, and uses the continents, erosion, and ridges_folded density\nfunctions in a similar way to create a more jagged version of the surface shape.\nThis gets diluted some due to being combined with both offset and factor higher\nup the chain, but results in some hills populating flatter areas, which also\nhelps to break up otherwise smooth or flat mountains so they look more natural\nand rolling.Surface RulesSurface Rules are what add the surface layers to terrain. This is\nhighly-configurable, but at its most basic level, it’s what decides that the\nground in Forests is made up of Grass Blocks and Dirt, and that Deserts have\nSand and Sandstone. Surface Rules can also allow for different blocks to make up\nthe ground depending on height, steepness, or even based on random noise.Notably, the Surface Rule also places the Bedrock on the bottom (or top) of the\nworld, and handles the transition from Stone to Deepslate at Y=0. This means\nboth of these features can be edited or removed, and in fact it’s fairly easy to\ndo so compared to handling the actual surface.Creating surface rules is relatively easy. You’ll start with something like this\nin your Noise Settings:{\n\"surface_rule\": {\n\"type\": \"minecraft:sequence\",\n\"sequence\": []\n}\n}\nInside the sequence brackets, you can add yet more objects. There are four\ndifferent types:Sequence: Allows you to add a new nested list. Generally, it’s good\npractice to nest sequences inside of a condition that will apply to multiple\nchild conditions or blocks.Block: Defines the block that gets placed. Usually used at the end of a\nseries of conditions.Bandlands: Not a typo. Just places the hardcoded Badlands terracotta\npattern, and doesn’t have any additional fields.Condition: This is the most prominent part of Surface Rules. There are\nmultiple kinds of conditions, including biome, Y level, steep, and more.\nRegardless of the condition you select, it will always have the additional\nfield “then run”, which just accepts another object type from the above list.You may find yourself using combinations of conditions, with or without\nsequences, to get a satisfying surface. This guide won't go over every surface\nrule condition, but here are some common ones and how they are often used.above_preliminary_surfaceUses the initial_density_without_jaggedness density function to determine where\nthe surface of the world is. Not using this would just mean that the surface\nrule would apply in noise caves as well. If you’re not using an\ninitial_density_without_jaggedness density function, there’s no other real harm\nin choosing not to use this condition.stone_depthThis condition finds the blocks that are actually on the surface via heightmap,\nignoring water, and works even if there was no preliminary surface condition\nused. This is one of the most common conditions, in that every dimension will\nuse it, but it is also a fairly resource-intensive condition, and the one most\nlikely to cause chunk generation lag. It’s best to use it minimally, as high up\nin the Surface Rule as you can. Oftentimes, you will need at least two of these:\nOne for the top surface, and one for the secondary surface.waterCan be used to have its child conditions apply based on the fluid level at that\nlocation, including not being in fluid. The vanilla Overworld surface rule uses\nthis a lot, and it’s a great way to alleviate the impact of an earlier\nstone_depth condition.biomeSpecifies which biome(s) to apply the rest of the rule to.y_aboveCauses the rest of the rule to only apply to blocks above the specified Y value.\nYou can add an optional multiplier for this value, or choose to add the\nstone_depth from previous conditions to this calculation.It’s best to look at how the Overworld’s surface rule uses combinations of\nconditions to produce a surface of, for example, Grass Blocks with 2-4 layers of\nDirt underneath. The vanilla Overworld Surface Rule is not as extreme as the\nvanilla Overworld Dimension file (up next), but it is a little more lengthy and\nsophisticated than can reasonably be pasted here.\nMisode’s generator has a\nfeature to view the vanilla Overworld Noise Settings as a preset, which includes\nthe Surface Rule; this may be useful to get a more user-friendly view of how the\nconditions fit together.DimensionFolders: dimensionThe Dimension file is where you reference both the Dimension Type and Noise\nSettings you would like this dimension to use by their namespaced ID. The name\nof this file is also what will become the namespaced ID of this dimension for\ncommands such as /execute in, regardless of the names of the noise_settings or\ndimension_type files referenced. Lastly, this is where you will list all of the\nbiomes you want to appear in the world, using parameters to define which biomes\ncan appear where on several noise maps.Biome SourceBesides Terrain, the Biome Source is where you may find yourself spending the\nmost time. It is highly configurable, and has the potential to integrate with\nthe Continents and Erosion density functions defined in the Noise Router to help\nplace biomes in a way that appears to conform to the terrain (Mountain biomes on\nelevated terrain, Plains biomes on flatter terrain, etc.). Biome Layout is much\nmore approachable than terrain in terms of configurability, but making them work\nhand-in-hand in this way can be time consuming.To put things in perspective, you may have noticed above that the vanilla\nOverworld’s Dimension file is over 200,000 lines long. Every biome has dozens of\nrepeat entries, each with slightly different parameters to get the biome\ndistribution and terrain conformity just right. This is because the six primary\nparameters (temperature, humidity, continentalness, erosion, and depth)\nbasically work to create a 6-dimension noise map. Making a biome source that\nplaces biomes according to terrain by hand is borderline impossible, and indeed,\nthis file gets generated by the game using a system similar to\nSnowcapped, a tool by jacobsjo that uses\ngrids to simplify the visualization of a 6D grid.The Nether is far easier to work with and add new biomes to, as those biomes do\nnot conform to the terrain, and each vanilla biome has only one entry.The End’s biome source is hardcoded; this is because Mojang needs to ensure that\nthe central End Island is always the default “minecraft:the_end” biome, which\ncannot be guaranteed with current tools. However, if you don’t mind making the\ncentral End Island a different biome, you can approach a custom biome layout\nsimilarly to how you would the Nether.For a custom dimension, the complexity is up to you. If you aim to have your\nbiomes conform to terrain, then you may end up with a biome layout of comparable\ncomplexity and time commitment to the vanilla Overworld’s. If not, then it’s\njust a matter of determining which biomes you do or do not want to appear next\nto each other, and then setting the parameters appropriately.Each entry in the “biomes” list should look something like this:{\n\"biome\": \"minecraft:plains\",\n\"parameters\": {\n\"temperature\": [-0.45, -0.15],\n\"humidity\": [-1, -0.35],\n\"continentalness\": [-0.11, 0.3],\n\"erosion\": [-0.7799, -0.375],\n\"weirdness\": [-1, -0.9333],\n\"depth\": 0,\n\"offset\": 0\n}\n}\nMore biomes can be added by including more entries in the “biomes” list. It can\nand often may include repeats. Each entry must also contain all of the\nparameters listed above. Unless otherwise specified, all of these parameters can\neither be a single constant, or a list of two constants, which serves as a min\nand max range of values. These must be in order from min to max; failure to do\nso will cause the data pack to not validate.temperature, humidityThese are named completely arbitrarily, and have no bearing on the actual\ntemperature or humidity of the biome that impacts gameplay in any way. You can\nmake both a “desert” and “snowy” biome have a temperature of 0, and all it will\nmean is that they will be placed near each other (unless other parameters forbid\nthis). These parameters just refer to different noise maps that are available.\nThese should each be a value between -1.0 and 1.0. The closer a value is to 0,\nthe more frequently that biome will appear, or the larger.depthUsed exclusively for cave biomes, and is otherwise 0. Positive values cause that\nbiome to be placed deeper in the world, and the area above it to be filled with\nother biomes of lower depth values that meet the other parameters of that space.\nIn the vanilla depth density function, a depth of 1.0 corresponds to\napproximately 128 blocks below the surface, but this can vary if you've changed\nthe Final Density or the depth density function in your Noise Router.offsetHelps to limit the relative size of the biome. Accepts a value between 0 and\n1.0, and must be a single constant, not a list. Larger values reduce the size of\nthe biome, and allow biomes of neighboring parameter values to fill the space.\nThis can also result in the biome becoming rarer, if it was already small enough\nthat a positive offset causes some of its placements to disappear.weirdnessThis parameter corresponds to the ridges density function, which is responsible\nfor rivers and mountain peaks. Values closer to 0 tend to correspond to rivers,\nand values further from 0 tend to correspond to peaks, before dipping back to\nmore level terrain. The vanilla overworld also uses this parameter to place\n\"variant\" biomes like Bamboo Jungles or Pale Gardens, which otherwise might\nshare similar parameters to their base biomes (Jungles and Dark Forests)continentalness, erosionThese are the two parameters that influence a biome’s placement on the density\nfunctions of the same names used for Terrain. In the vanilla Overworld, only\nthese values will affect biome position relative to the shape of the terrain.\nFor the vanilla Overworld:High continentalness corresponds to inlands terrain.Low continentalness corresponds to ocean terrain.High erosion corresponds to flat terrain.Low erosion corresponds to jagged terrain.The above rules may not necessarily hold true if you have a Final Density that\ndiffers from the vanilla Overworld.The best way to view and manipulate the biome source and how it may look in the\nworld is with Misode’s generator.\nHowever, it may not show completely accurate biome placement if you are taking\nadvantage of continentalness and/or erosion.BiomesFolders: biome\nOptional Folders: configured_carver, placed_feature,\nconfigured_featureThis is where the most configurability and excitement, and least limitations,\ncomes into play. Biomes are really just designated areas that can have the\nfollowing things defined:Precipitation (True/False)TemperatureUsed to determine rain or snow if Precipitation is trueAlso influences natural grass and foliage coloration, along with DownfallOverride colors for grass, foliage, sky, fog, water, and water fogFor grass and foliage, this color is added to the color determined by\nTemperature and Downfall, which references the respective colormaps in the\nResource Pack.Particles, if any (such as in many Nether biomes)Music and ambient soundsCave and canyon (ravine) typesNaturally spawning mobsFeaturesNot all of these need to be defined, but they all need to be present, even if\nempty. As always, it’s best to use\nMisode’s generator to ensure all\nrequired fields are accounted for. It also has useful tools for selecting\ncolors, where appropriate.\nyour biome will necessarily be incompatible with any other data packs that\nmodify that biome, too. This means you can’t, for example, add more Diamonds to\nthe vanilla Swamp biome, and then also include Terralith -- you would need to\ninstead use Terralith’s Swamp biome as a base and add more diamonds to that, if\nyou want to use both in the same world.\nspawn in this biome, at what rarities and in what quantities.\ncan’t change that. Passive Mobs will always need Grass Blocks and light to\nspawn, and Hostile Mobs will still need a low enough light level as defined in\nthe Dimension Type. Some mobs, like Sniffers and Camels, don’t have as strict\nspawning conditions because they don’t spawn naturally in vanilla. This means\nthey can spawn anywhere in the biome, even if it doesn’t make sense.\n\"spawners\": {\n\"ambient\": [\n{\n\"type\": \"minecraft:bat\",\n\"maxCount\": 8,\n\"minCount\": 8,\n\"weight\": 10\n}\n],\n\"axolotls\": [],\n\"creature\": [\n{\n\"type\": \"minecraft:sheep\",\n\"maxCount\": 4,\n\"minCount\": 4,\n\"weight\": 12\n},\n{\n\"type\": \"minecraft:pig\",\n\"maxCount\": 4,\n\"minCount\": 4,\n\"weight\": 10\n},\n{\n\"type\": \"minecraft:chicken\",\n\"maxCount\": 4,\n\"minCount\": 4,\n\"weight\": 10\n},\n{\n\"type\": \"minecraft:cow\",\n\"maxCount\": 4,\n\"minCount\": 4,\n\"weight\": 8\n},\n{\n\"type\": \"minecraft:horse\",\n\"maxCount\": 6,\n\"minCount\": 2,\n\"weight\": 5\n},\n{\n\"type\": \"minecraft:donkey\",\n\"maxCount\": 3,\n\"minCount\": 1,\n\"weight\": 1\n}\n],\n\"misc\": [],\n\"monster\": [\n{\n\"type\": \"minecraft:spider\",\n\"maxCount\": 4,\n\"minCount\": 4,\n\"weight\": 100\n},\n{\n\"type\": \"minecraft:zombie\",\n\"maxCount\": 4,\n\"minCount\": 4,\n\"weight\": 95\n}\n]\n}\n}\nSpawners are defined by first opening up a list of one of several categories,\nsuch as Monster, Creature, Water Ambient, or Axolotl. You can make mobs spawn in\nwhatever category you want, but if you put it in the wrong category than it\nbelongs (generally, Creature for passive mobs, Monster for hostile mobs, etc.),\nthey may either fail to spawn entirely, or overspawn and exceed the mobcap. For\nthis reason, it is advised that you only spawn mobs in their correct category;\nif you don’t know which it belongs to, refer to a vanilla biome that spawns that\nmob and see where it’s placed.An individual mob spawner entry includes the mob type, its weight (which works\njust like loot tables) and a min and max count. These latter values determine\nhow many mobs will spawn within a group as one successful spawn attempt of that\nmob type. The min must be greater than 0.Spawn CostsSpawn Costs are an optional field within the biome file, and are used to limit\nthe frequency of spawns around mobs of a certain type, within that biome only.\nIn vanilla, this is used to limit the number of Endermen that appear in Warped\nForests, and Skeletons that appear in Soul Sand Valleys.{\n\"spawn_costs\": {\n\"minecraft:enderman\": {\n\"charge\": 1.0,\n\"energy_budget\": 0.12\n}\n}\n}\nA Spawn Cost for an individual mob consists of an energy_budget, and a charge,\nwhich are both float values. These are a little hard to explain, but\nessentially, the “charge” is used to calculate an individual mob’s contribution\nto the overall “energy budget” shared by all mobs of that type in the biome. If\nthe value calculated from that charge would exceed that energy budget, it fails\nto spawn. This is very simplified, and indeed somewhat unintuitive, as the\ncharge will generally be higher than the energy budget.If you’d like to learn more about how this works, see the wiki entry relating to\nit here.CarversThis is where the legacy caves and ravines are defined for the biome. They are\nsplit into two steps: air and liquid, which behave as you would expect; either\nproducing regular air caves, or flooded caves.You can define custom caves or canyons with a configured_carver, including\ndefining what types of blocks the cave will be allowed to replace (which is why\nit’s called a carver), their frequency, size, and other values. To explore this\nfully, it’s recommended to mess with the various fields using\nMisode’s generator.FeaturesFeatures are the real meat of a biome. These are everything that actually fills\nup the biome and gives it character beyond the terrain and surface. Trees,\nflowers, ores, geodes, granite deposits, and sometimes small structures like\nDesert Wells are all features. There is a lot you can do here, but the options\naren’t limitless.For one, there’s the issue of performance. Larger and more common features make\nloading new chunks slower, as do features that have hyper-specific location\nrequirements to spawn.For two, some specific shapes are harder to achieve, and some common features\naren’t as configurable as others. Trees are some of the most configurable\nfeatures in the game, able to use any block or combination of blocks for their\ntrunks, leaves, roots, and more, and can be used to make elaborate shapes and\nfeatures that don’t even look like trees. Conversely, the coral reefs in Warm\nOceans are easy to replicate and adjust the frequency and location of, but their\nshapes and the blocks they’re made of cannot be changed at all.As such, it’s often better to have some broad strokes for the “feel” or\natmosphere you want for a biome in mind, rather than planning everything down to\nthe shape, as flexibility may be necessary.{\n\"features\": [\n[],\n[\"minecraft:lake_lava_underground\", \"minecraft:lake_lava_surface\"],\n[\"minecraft:amethyst_geode\"],\n[\"minecraft:monster_room\", \"minecraft:monster_room_deep\"],\n[],\n[],\n[\n\"minecraft:ore_dirt\",\n\"minecraft:ore_gravel\",\n\"minecraft:ore_granite_upper\",\n\"minecraft:ore_granite_lower\",\n\"minecraft:ore_diorite_upper\",\n\"minecraft:ore_diorite_lower\",\n\"minecraft:ore_andesite_upper\",\n\"minecraft:ore_andesite_lower\",\n\"minecraft:ore_tuff\",\n\"minecraft:ore_coal_upper\",\n\"minecraft:ore_coal_lower\",\n\"minecraft:ore_iron_upper\",\n\"minecraft:ore_iron_middle\",\n\"minecraft:ore_iron_small\",\n\"minecraft:ore_gold\",\n\"minecraft:ore_gold_lower\",\n\"minecraft:ore_redstone\",\n\"minecraft:ore_redstone_lower\",\n\"minecraft:ore_diamond\",\n\"minecraft:ore_diamond_medium\",\n\"minecraft:ore_diamond_large\",\n\"minecraft:ore_diamond_buried\",\n\"minecraft:ore_lapis\",\n\"minecraft:ore_lapis_buried\",\n\"minecraft:ore_copper\",\n\"minecraft:underwater_magma\",\n\"minecraft:disk_sand\",\n\"minecraft:disk_clay\",\n\"minecraft:disk_gravel\"\n],\n[],\n[\"minecraft:spring_water\", \"minecraft:spring_lava\"],\n[\n\"minecraft:glow_lichen\",\n\"minecraft:patch_tall_grass_2\",\n\"minecraft:patch_bush\",\n\"minecraft:trees_plains\",\n\"minecraft:flower_plains\",\n\"minecraft:patch_grass_plain\",\n\"minecraft:brown_mushroom_normal\",\n\"minecraft:red_mushroom_normal\",\n\"minecraft:patch_pumpkin\",\n\"minecraft:patch_sugar_cane\",\n\"minecraft:patch_firefly_bush_near_water\"\n],\n[\"minecraft:freeze_top_layer\"]\n]\n}\nBest practice is to have the “features” section of your biome consist of 11\nlists (defined with square brackets: [ ]), called “steps”, but you can have any\nnumber of steps, fewer or greater. Generally, features will be placed in order\nbased on which step they appear in, from top to bottom. So, if you want to place\nTree features with leaves made of Stone, and then place Ore features that get\nplaced in the stone, you would put those features in separate steps, with the\nOre feature in a later step from the Tree.Other parts of the game refer to these steps by name, representative of the\norder they generate in, specifically for things like Custom Structure Generation\nto reference which step of generation those should appear in. However, the names\nthemselves are arbitrary and just reflect which steps vanilla chooses to put its\nfeatures in; any feature type can go in any step. For interest’s sake, these\ndesignations are, in order from first step to last:RAW_GENERATION: Where End biomes place the small circular endstone\nislandsLAKES: Where Overworld biomes place lava lakes, and used to place water\nlakesLOCAL_MODIFICATIONS: Where Overworld Biomes place Amethyst Geodes, and\nthe Frozen Ocean biome places IcebergsUNDERGROUND_STRUCTURES: Where Overworld Biomes place Dungeons and FossilsSURFACE_STRUCTURES: Where the Desert biome places Desert WellsSTRONGHOLDS: No vanilla biomes place features here, but you can and it’ll\nwork fineUNDERGROUND_ORES: Where all Overworld biomes place ores (which includes\nactual ore blocks, as well as the blobs of Dirt, Gravel, and Stone variants),\nas well as discs that generate on the floor underwaterUNDERGROUND_DECORATION: Where all Nether biomes place ores (which\nincludes actual ore blocks, as well as the blobs of Gravel and Blackstone),\nand where Overworld mountain biomes place blobs of Infested StoneFLUID_SPRINGS: Where all Overworld and Nether biomes place water and/or\nlava springs (individual fluid blocks that may or may not spill out of walls\nor ceilings)VEGETAL_DECORATION: Where all biomes place features such as trees,\nflowers, cacti, Huge Fungi, Chorus Plants and similar featuresTOP_LAYER_MODIFICATION: Where all Overworld biomes place a feature that\ncauses snow or ice to cover the top blocks if the temperature is\nsufficiently low at that altitudeNote that there are some exceptions to generation order. For example, Deltas\nwill generally spawn after everything else regardless of which step they’re\nplaced in. Conversely, Lakes often spawn before other features, even if they are\nin a later step.\nwhich step it is) in multiple biomes, they must always be in the same order, or\nthe game will throw an error and fail to load (this is called a feature order\ncycle error). For the same reason, you can't repeat a feature in the same step,\neven one after the other, if that feature is used in a different biome.\nconfigured_features. A configured_feature defines what type of feature it is,\nphysically, such as an ore or a tree. The placed_feature determines under what\nconditions it spawns, such as in or on what blocks, at what Y level, or other\nfactors. The placed_feature is what the biome file references.Technically, the configured_feature can be defined in-line in the\nplaced_feature, however it’s good practice to separate these files. This allows\neasier delineation when creating and editing -- as some configured_feature types\ninclude in-line placements like a placed_feature -- and also makes it easier to\nreuse a configured_feature in multiple placed_features.Configured FeaturesThere are many configured_feature types, each with different required fields.\nListing each in detail would be unhelpful, outside the scope of this guide, and\na duplication of efforts --\nthe wiki serves as a great\nreference to become familiar with the available feature types. As always,\nutilizing Misode to keep track of\nrequired fields is highly recommended. Furthermore, if you do have an idea of a\nvanilla feature that looks similar to what you want to create, referencing it or\nstarting from it as a base, and then modifying it, is a completely valid\nstrategy.Instead, what this section of the guide will go over is point out which features\nare best for what purpose, and which features are surprisingly difficult to work\nwith, primarily as this knowledge may help keep you from becoming frustrated\nthat you can’t figure out how to do something that is, in fact, not possible.{\n\"type\": \"minecraft:tree\",\n\"config\": {\n\"decorators\": [],\n\"dirt_provider\": {\n\"type\": \"minecraft:simple_state_provider\",\n\"state\": {\n\"Name\": \"minecraft:dirt\"\n}\n},\n\"foliage_placer\": {\n\"type\": \"minecraft:blob_foliage_placer\",\n\"height\": 3,\n\"offset\": 0,\n\"radius\": 2\n},\n\"foliage_provider\": {\n\"type\": \"minecraft:simple_state_provider\",\n\"state\": {\n\"Name\": \"minecraft:oak_leaves\",\n\"Properties\": {\n\"distance\": \"7\",\n\"persistent\": \"false\",\n\"waterlogged\": \"false\"\n}\n}\n},\n\"force_dirt\": false,\n\"ignore_vines\": true,\n\"minimum_size\": {\n\"type\": \"minecraft:two_layers_feature_size\",\n\"limit\": 1,\n\"lower_size\": 0,\n\"upper_size\": 1\n},\n\"trunk_placer\": {\n\"type\": \"minecraft:straight_trunk_placer\",\n\"base_height\": 4,\n\"height_rand_a\": 2,\n\"height_rand_b\": 0\n},\n\"trunk_provider\": {\n\"type\": \"minecraft:simple_state_provider\",\n\"state\": {\n\"Name\": \"minecraft:oak_log\",\n\"Properties\": {\n\"axis\": \"y\"\n}\n}\n}\n}\n}\nAs mentioned above, some configured_features, like trees, offer a lot of control\nand flexibility. Trees have several different shapes to choose from for their\ntrunks and leaves, as well as optional roots (such as what Mangroves have),\noptions for decorations on any face of leaves, and can accept one or multiple\ndifferent blocks to make up each of these facets.The Ore feature type does not have quite as many fields, but still presents a\ngood deal of configurability. Making a new ore configured_feature entails\ndetermining what the block being placed is (the state) and what blocks it tries\nto get placed in (the target), which can be a block tag. As you can see in the\nbelow example for Coal, you can also list multiple state and target pairs in one\nfeature, which vanilla uses to place the appropriate Deepslate variant if the\nblock it gets placed in is a Deepslate or Tuff Block rather than Stone or a\nstone variant.{\n\"type\": \"minecraft:ore\",\n\"config\": {\n\"discard_chance_on_air_exposure\": 0.0,\n\"size\": 17,\n\"targets\": [\n{\n\"state\": {\n\"Name\": \"minecraft:coal_ore\"\n},\n\"target\": {\n\"predicate_type\": \"minecraft:tag_match\",\n\"tag\": \"minecraft:stone_ore_replaceables\"\n}\n},\n{\n\"state\": {\n\"Name\": \"minecraft:deepslate_coal_ore\"\n},\n\"target\": {\n\"predicate_type\": \"minecraft:tag_match\",\n\"tag\": \"minecraft:deepslate_ore_replaceables\"\n}\n}\n]\n}\n}\nThe size is self-explanatory but is not indicative of the actual quantity of the\nstate blocks that will be placed. More info on that relationship can be found on\nthe wiki.\nDiscard_chance_on_air_exposure is a chance between 0.0 and 1.0 to intentionally\nfail to spawn the feature if it touches air, such as in a cave. This is used in\nvanilla for so-called “buried” ore features like Iron and Diamonds, to encourage\nother forms of mining than just caving.The Ore feature type is also what is used for the blobs of dirt, gravel,\ngranite, tuff, and other blocks in the Overworld.Moving into feature types that are not configurable and what you can do about\nit. End Islands, Basalt Pillars, Ice Spikes, Glowstone Blobs, and Coral Claws\nare all examples of features that have no configuration at all, meaning their\nshape and block palette is hardcoded. You can still change how they get placed\nwith a placed_feature later, but you can’t change what these features physically\nare.For cases like these where you may want to make use of those specific shapes,\nbut can’t recreate them with other features (End Islands are a good example),\nyou can create features to replace those blocks with other blocks in a later\nstep. A good feature to use for this is geodes, because they can define a list\nof blocks that they are not able to replace, which can include all blocks except\nthe desired replaceables.This just allows you to replace a target block with a state block in a\n3D-diamond with a defined radius. It unfortunately doesn’t support block tags.\nIt also has a maximum radius of 12, so you may need a higher quantity of them\nusing your placed_feauture later to get consistent coverage.Placed FeaturesA placed_feature typically references a configured_feature, and determines how\nit gets placed in the world. For some features, like Trees, they will obey\nwherever your placements happen to define as valid. For other features, like Ice\nSpikes, they need to adhere to hardcoded conditions of the feature type, which\nare not always obvious. Ice Spikes for example can only spawn on Snow Blocks,\nregardless of what the placed_feature says.As with the previous section, this guide will not go over every type of\nplacement that can be included, nor every field they contain. These are all\ncovered in detail on the wiki, and\ngenerating them can be aided using\nMisode.However, there are a handful of placement types that are used extremely\ncommonly, and so we will go over what those are, how to use them, and when they\nmay not be needed.{\n\"type\": \"minecraft:ore\",\n\"config\": {\n\"discard_chance_on_air_exposure\": 0.0,\n\"size\": 10,\n\"targets\": [\n{\n\"state\": {\n\"Name\": \"minecraft:copper_ore\"\n},\n\"target\": {\n\"predicate_type\": \"minecraft:tag_match\",\n\"tag\": \"minecraft:stone_ore_replaceables\"\n}\n},\n{\n\"state\": {\n\"Name\": \"minecraft:deepslate_copper_ore\"\n},\n\"target\": {\n\"predicate_type\": \"minecraft:tag_match\",\n\"tag\": \"minecraft:deepslate_ore_replaceables\"\n}\n}\n]\n}\n}\nGenerally, placements are calculated in order from first to last. For some\nplacement types, this is irrelevant, while for others, being listed before or\nafter another placement can dramatically alter the spawning behavior. The\nfollowing placement types are the most commonly used; a majority of\nplaced_features will use some combination of these placements:countThe number of spawn attempts this feature will make per chunk. Accepts a\nconstant, or other number providers like uniform or trapezoid. If excluded, the\nplaced_feature will make only 1 spawn attempt per chunk.count_on_every_layerAn alternative to count. A little hard to explain, but essentially includes some\nrandom X and Z distribution, and Y distribution based on layers of air or fluid.rarity_filterAccepts a positive integer. Essentially divides any previous count-type\nplacements by this value. For example, a rarity of 1 will cause no change, a\nrarity of 2 will make the feature half as common, a rarity of 5 will make it 5\ntimes less common, etc. If no count-type placement was specified before this\nplacement, the count is assumed to be 1.in_squareThis is used to include some random distribution within the chunk. Without this\nplacement, all of the spawn attempts would be made at the chunk’s 0x, 0z\ncoordinate. If you are using count_on_every_layer, you do not need to use\nin_square.height_rangeDetermines the height this feature will try to spawn in. Accepts a constant, or\nother number providers like uniform or trapezoid. Whether using a constant or a\nnumber provider, each value must also be defined as “absolute” (this exact Y\nlevel), “above_bottom” (this many blocks above the lowest Y level of this\ndimension) or “below_top” (this many blocks below the highest Y level of this\ndimension, always a positive number). This allows some flexibility for\nsituations such as if the height of the dimension may change or is unknown.heightmapAccepts one of a few different heightmaps, including MOTION_BLOCKING,\nOCEAN_FLOOR, and WORLD_SURFACE_WG. This causes the feature to attempt to spawn\nat the highest block in the chosen X and Z coordinate, according to the selected\nheightmap. Unsurprisingly, this can cause undesired behavior if the dimension\nhas a roof, like the Nether.biomeDoesn’t have any other fields. Ensures that this feature won’t be allowed to\nspawn if the spawn attempt would be inside a biome that does not contain this\nplaced_feature in its listed features. Without it, if a chunk contains two\nbiomes, the feature would be allowed to “bleed” into the neighboring biome, even\nif it doesn’t belong there, as long as all other conditions are met (for\nexample, a Desert’s Cactus feature spawning in an adjacent Beach biome).block_predicate_filterCan be used to apply one or more conditions based on nearby blocks, including\nthe block that has been selected for the spawn attempt. This can include details\nlike if the block below is solid or in a block tag, whether it has a sturdy\nface, or is a valid location for a sapling or mushroom to be placed.One of the most important things to keep in mind when creating placed_features\nin particular is performance. More than anything else in worldgen, the\nplaced_features are going to have the greatest impact on the speed of your chunk\ngeneration. Features that have a high count, or hyper-specific\nblock_predicate_filters, can cause chunks to load more slowly. Similarly,\nincluding a height range for a feature that includes a lot of space that the\nfeature can’t spawn in can impact this chunk generation, as all of those failed\nspawn attempts still have to be calculated.","description":"This guide goes over how to create every step of a custom dimension, which includes custom biomes, terrain, and features.","url":"/wiki/worldgen/custom-worldgen/","tags":[]},{"title":"Scoreboards","content":"ScoreboardsScoreboards are a key/value system for storing numbers bound to a player in\nMinecraft. On a scoreboard objective, each player can have a score, which is an\ninteger value. This player does not need to exist - fake players can be used\nto store a number without attaching it to a player but rather an arbitrary name.You can modify objectives with the /scoreboard or /execute store commands.\nSome objectives can automatically change based on player statistics.Scoreboard objectives can also be optionally displayed on the sidebar, under a\nplayer's name, and/or in the tab list - although only one objective can be shown\nin each slot at a time.Types of scoreboard objectivesThere are three main types of scoreboard objectives in Minecraft.Dummy objectivesThese are objectives which can only be modified with commands, like a \"blank\"\nscoreboard which you can modify however you want. They are useful for storing\narbitrary numbers, or tracking custom values within your datapack.You can create this scoreboard with the command:\n/scoreboard objectives add objective_name dummy. For a better example, take a\nlook at the following function:scoreboard objectives add intelligence dummy\nscoreboard players set @a intelligence 100\nexecute store result score Silabear intelligence run data get entity Silabear Health\nThis would create the following scoreboard:PlayerintelligencePlayer1100Player2100Silabear20You can also put fake players on a dummy objective. These work just like\nnormal players on an objective, except they don't exist. You can specify a fake\nplayer by using a special character such as a #, $, ., etc. before the\nname. For example:scoreboard players set #max intelligence 150\nCriteria-based objectivesThese are read-only objectives which are automatically updated based on player\nstatistics. They are usually used to track player events or progress. For\nexample, the criteria minecraft.custom:minecraft.sneak_time will store the\namount of ticks a player has been sneaking on the objective.scoreboard objectives add sneaking_duration minecraft.custom:minecraft.sneak_time\nAfter sneaking for one second, the objective will look like this:Playersneaking_durationPlayer120Trigger objectives:These are objectives which allow the player to manually set their score using\nthe /trigger command. This is especially useful for creating chat UIs, as it\nis the closest thing we have to creating \"custom commands\" with datapacks. Any\nplayer can run /trigger, regardless of their operator status.A player may only run /trigger if that trigger objective has been enabled for\nthat user. Once a user has used /trigger on an objective, they cannot use it\nagain until it is re-enabled.scoreboard objectives add option trigger\nscoreboard players enable @a option\nPlayers will now be able to use the /trigger command to modify their score on\nthe option objective./trigger option will set the player's score to 1./trigger option set 5 will set the player's score to 5./trigger option add 3 will add 3 to the player's score.\ncannot trigger it until it is re-enabled:scoreboard players reset @a option\n","description":"Scoreboards are a way of storing numerical data attributed to a player or entity in a Minecraft Datapack.","url":"/wiki/nbt-scoreboards/scoreboards/","tags":[]},{"title":"NBT","content":"NBTNBT (Named Binary Tags) is a structured (key/value) data format used by\nMinecraft to store data about entities, items, blocks, structures, player data,\nworldgen, and more. You can use it to store custom data in items and NBT\nstorages.SNBT FormatSNBT (Stringified Named Binary Tags) format is a JSON-like tree structure used\nin datapack development to manipulate the NBT data of an entity. SNBT is a\nhuman-readable version of NBT (Named Binary Tags), which is a format used by\nMinecraft to store data. NBT is used to store data about entities, items,\nblocks, structures, game saves, and more.SNBT consists of key/value pairs, which are represented as key:value.\nThese are contained with compounds, marked with curly brackets ({}).\nCompounds can contain multiple key/value pairs, which are separated with commas,\nlike so: key:value,key:value,key:valueAn example SNBT structure looks like:\n{name:\"Silabear\",age:102,friends:[\"Flynecraft\",\"Aandeel\",\"Cobblestone\"],socials:{discord:\"silabear\"}}NBT pathsNBT paths are used to reference a specific location within an NBT structure.\nThey are used in commands like /data get and /data modify to access or\nmodify NBT data.NBT paths are made up of a series of keys, separated by dots (.). Square\nbrackets ([]) can be used to access items in an array, either by index\narray[0] or by object value (array[{age:102}])Imagine the following NBT structure:{\nroot: {\nversion: 1,\ntitle: \"Targets\",\npeople: [\n{name: \"Silabear\", age: 102},\n{name: \"Aandeel\", age: 100}\n]\n}\n}\nThe following are examples of NBT paths:root.version: would give the value 1.root.title: would give the value \"Targets\".root.people[0]: would give the value {name: \"Silabear\", age: 102}.root.people[0].name: would give the value \"Silabear\".root.people[{name:\"Aandeel\"}]: would give the value\n{name: \"Aandeel\", age: 100}.root.people[{name:\"Aandeel\"}].age: would give the value 100.NBT storagesStorages allow you to store NBT data in a world without binding it to a physical\nobject (item, entity, block), but rather storing it under a namespaced ID (e.g\nexample:main). Storages are stored globally per world, and can only be\naccessed with /data. Storages don't need to be initialized beforehand, unlike\nscoreboards.Unlike entity and block NBT, storages have no fixed structure, and can contain\nwhichever arbitrary keys are added to it.Storage exampleStorages are defined when a /data command modifies them. Unlike scoreboards,\nstorages do not need to be \"created\" - the only code needed to initialize a\nstorage is a /data modify or /data merge command to that storage, for\nexample:data merge storage example:main {number: 1, message: \"Hello!\"}\ndata modify storage example:main other_number set from storage example:main number\ndata modify storage example:main compound.array append value 42\nThe example:main storage would now contain the following data:{\nnumber: 1,\nmessage: \"Hello!\",\nother_number: 1,\ncompound: {\narray: [42]\n}\n}\nData TypesThere are a few data types you can use to represent different types of data,\nincluding whole numbers, decimal numbers, string, text, booleans, and more.StringsStrings can store any text value, or more technically, any sequence of unicode\ncharacters.Format: Strings are stored within either double or single quotes. For\nstrings containing standard characters (A-Z, a-z, 0-9, -,_,+,.), the quotes\nare optional (as long as the text starts with a letter), but recommended.\n\"\" or ' ' orExample: name:\"Silabear\", name:'Cobblestone', name:AandeelWhole NumbersShort, Int, and Long data types all represent integers (whole\nnumbers).Byte is an 8 bit integer, it can be any value from 0 to 255Short is a 16 bit integer, it can be any value from -32,768 to 32,767Int is a 32 bit integer, it can be any value from -2,147,483,648 to\n2,147,483,647Long is a 64 bit integer, it can be any value from\n-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807Format: By default, numbers are stored as integers. To store a number in the other formats, you need to use the appropriate suffix. For shorts, ints, and longs, the suffixes are s, i, and l respectively.The suffix can be extended with u or s to say whether it is unsigned (only a\npositive number) or signed (can be positive or negative) - for example, 402ub.It is also possible to write using E notation (e.g 1.2E3 would be 1200),\nhexadecimals (e.g 0xBC would be 188), and binary (e.g 0b110 would be 6)Example: count:1234s, bigNumber:1200000,\nreallyBigNumber:12123023687234L, byte:112bDecimal NumbersFloat and Double data types both represent decimal numbers.Float is a signed 32 bit floating point number, it can be any value from\n-3.4028235E38 to 3.4028235E38. It is precise to 7 decimal places.Double is a signed 64 bit floating point number, it can be any value from\n-1.7976931348623157E308 to 1.7976931348623157E308. It is precise to 15\ndecimal places.Format: By default, decimal numbers are stored as doubles. To store a number\nin the other formats, you need to use the appropriate suffix. For floats, the\nsuffix is f. For doubles, the suffix is d.Example: pi:3.1415926535d, e:2.718281828459045d, phi:1.6180fBytes or BooleansIn older versions of Minecraft, booleans were stored as bytes with 0b\nrepresenting false and 1b representing true. In newer versions, booleans\nwere introduced. Essentially, booleans represent the old 0b and 1b with a\nmore descriptive name. It's recommended to use booleans instead of bytes\nwhenever possible, as they are more readable.Lists/ArraysLists, or number arrays are used to store multiple values. Lists can store\ndifferent types of values, whereas number arrays can only store the same type of\nnumber. In practicality, you often do not need to think about the differenceFormat: They are defined using square brackets ([]), with the values\nseparated by commas. Number arrays can be prefixed with the type of number the\narray is going to store and a semicolon (for instance, a list starting with\n[B; will only store bytes)Example: [\"Silabear\", 15, true, 242], [B;1b,2B,true,false],\n[\"Kanokarob\", \"LadyEternal\", \"lionlance\", \"thederdiscohund\", \"theblackswitch\"],\n[L;1l,2l,3l,4l,5l]ValidatorBelow is a validator for SNBT. It will validate the input and show you if it is\nvalid or not.","description":"NBT is Minecraft's way of storing internal data, such as item data, entity data, and block data. In datapacks, we can use it to store data in custom data storages.","url":"/wiki/nbt-scoreboards/nbt/","tags":[]},{"title":"Predicates","content":"PredicatesPredicates are a type of file which can be called to check if a certain\ncondition is true. For instance, you can create a predicate to check if a player\nis walking, if an entity is above a specific Y level, or if a player is holding\nan item. They are extremely versatile and, in many cases, more optimised than\nexecute if commands.\nadvancements and loot table files. The structure of these predicates is the same\nas described here, although some fields may not be used in certain contexts.\nholding a beef item while being inside a desert village:{\n\"condition\": \"minecraft:entity_properties\",\n\"entity\": \"this\",\n\"predicate\": {\n\"location\": {\n\"structures\": \"minecraft:village_desert\"\n},\n\"equipment\": {\n\"mainhand\": {\n\"items\": \"minecraft:beef\"\n}\n}\n}\n}\nWe can use @a[predicate=namespace:my_predicate] to select all players who\nmatch the predicate. For example:execute as @a[predicate=namespace:my_predicate] run say I am holding beef in a desert village :D\nJSON FormatEach predicate is represented as a JSON object. Predicate files can either\ncontain one predicate object, or a list of predicate objects. Each predicate\nobject needs a condition field, which specifies the type of condition to\ncheck. The rest of the fields depend on the condition type.For more information about the JSON format in general, see the\nJSON page.Certain objects are commonly reused within different predicate (and advancement)\nconditions. Below are some of them, along with their JSON structure:Number providersA number provider is used in a predicate to provide a number. This could be a\nconstant, score value, random value, etc.This can simply be a number (e.g 4 or 5.87). This can also be an object with\na min and max field to represent a random number (e.g\n{\"min\":1, \"max\":10}). For more advanced providers, they are represented as\nobjects - the contents of the object will vary based on which type field you\nuse. The available type fields, along with the fields required for them, are\nas follows:\"binomial\": Provides a random number based on binomial distribution.\nRequires the following fields:n: The number of trials used for the binomial distribution. This should be\nan int or number providerp: The chance of success for each trial. This should be an int or number\nprovider\"constant\": Provides the specified number. Requires the following field:value: The value to provide. This should be an int or a float\"score\": Provides the score of the entity as a number. Requires the\nfollowing fields:target: An object to specify the score holder. Contains a type field -\nif set to fixed, then a name field should be used to specify which\nplayer's (by username) or entity's (by UUID) score to use. If set to\ncontext, then a target field should be used with one of the following:\nthis, killer, direct_killer, killer_playerscore: The objective name to get the entity's score from.scale: If present, then the score is multiplied by scale.\"storage\": Provides the value from a specific path in an NBT storage.\nRequires the following fields:storage: The storage ID to get the score from.path: The NBT path to the specified field in the storage.\"uniform\": Provides a random number between two values. Requires the\nfollowing fields:min: The minimum number to return. This should be a number or number\nprovider.max: The maximum number to return. This should be a number or number\nprovider.Item matcherAn item matcher is used to match an item with advanced filters for components\nand count.An item matcher is an object which can consist of the following fields:items: The item type(s) to match. This can either be string (with an item ID\nor item tag ID), or an array of item IDs.count: The count of the item stack. This can either be an integer or an\nobject with a min and max key to match a range of counts.components: An object containing the item components to match. The key is\nthe component name, and the value is the expected value in the component. This\nwill only match if the component is exactly the same as the value - if any\nother data is in the component, it will be false.predicate: Like components, but will match if the component at least\ncontains the specified data, rather than only matching if it is exactly the\nsame.ConditionsThese are all the possible conditions that can be used in a predicate.block_state_propertyblock_state_property checks if the block state(s) of the block is/are equal to\na specified value(s). This predicate type is not usable with\nexecute if predicate, instead, this predicate is used in a loot table to check\na block.Fields:block: The block ID to match (e.g minecraft:andesite_wall)properties: A map of block state properties to match. The key is the\nproperty name, and the value is the property value. For instance,\n{\"waterlogged\":\"true\", \"south\":\"tall\"}.damage_source_propertiesdamage_source_properties checks the source of damage. This is often used in\nadvancements and loot tables.Fields:predicate: An object containing the following keys:tags: A list of damage_type tags to match. Checks if the type of damage is\ninflicted in any of these tags (can be toggled with the expected field).\nFor instance, [{\"id\":\"minecraft:bypasses_shield\",\"expected\":true}].source_entity: An entity_properties predicate to match the source entity\n(inflicter, e.g skeleton) of the damage.direct_entity: An entity_properties predicate to match the direct entity\n(entity responsible, e.g arrow entity) for the damage.enchantment_active_checkenchantment_active_check checks if the enchantment is active. This can only be\nused in enchantments.Fields:active: If set to true, will check that the enchantment is active. If false,\nwill check that the enchantment is inactive.entity_propertiesentity_properties checks if the entity matches the specified properties. This\nis very often used in datapacks - it can be used to check players and entities\nwith the predicate= selector argument, and execute if predicate.Fields:entity: Who to check. Can be this (equivalent of @s), attacker (the\nentity that attacked), direct_entity (the entity that caused the damage), or\nattacking_player.predicate: An object containing all the entity properties to check. There\nare lots of these, and going into full detail would take a lot of space (use a\ngenerator like misode.github.io to create these\nmore efficiently):type: The entity type to match. For instance, minecraft:player.type_specific: An object that contains properties which may only be\nspecific to one type of entity.team: The team that the entity is on.nbt: An NBT object to match. This should be in a string. For instance,\n\"{Health:20}\".location: A location_check predicate to match the entity's location.distance: An object which is used to match the distance between the entity\nand wherever the predicate is being checked.flags: An object which is used to match certain true/false flags of the\nentity, such as if they are on fire, or if they are sneaking.equipment: An object which is used to match the equipment (head, chest,\nmainhand, etc.) of the entity. The key is the slot (e.g head), and the\nvalue is an item matcher.vehicle: Another entity_properties predicate to match the entity which\nthis entity is riding.passenger: Another entity_properties predicate to match the entity which\nis riding this entity.stepping_on: Following the same structure as location, this matches the\nblock the entity is standing on.targeted_entity: Another entity_properties predicate to match the entity\nwhich this entity (non-player) is targeting.effects: An object which matches the current status effects of this entityslots: An object which matches the contents of the entity's inventory\nslots.movement: An object which matches the movement of the entity.periodic_tick: Returns true once every x ticks of the entity's lifetime.movement_affected_by: Following the same structure as location, this\nmatches what affects the movement of the entity.components - Matches entity components exactly (the component must be\nexactly equal to what is being checked).predicates - Matches entity components ignoring any other data in the\ncomponent (the component must contain what is being checked).entity_scoresentity_scores checks if the entity's score on an object matches a specified\nvalue or range.Fields:entity: Who to check. Can be this (equivalent of @s), attacker (the\nentity that attacked), direct_entity (the entity that caused the damage), or\nattacking_player.scores: An object containing the scores to check. The key is the objective\nname, and the value is either an int (e.g 33) or an object containing a\nmin and max number provider to match a range. For instance,\n{\"scoreboard1\":5, \"scoreboard2\":{\"min\":1, \"max\": 10}}.killed_by_playerkilled_by_player checks if the entity was killed by a player. This is used in\nloot tables.Fields:inverse: If true, checks if the entity was not killed by a player.\n(optional)location_checklocation_check checks if the current location matches the specified\nproperties. When used in an entity_properties -> location field, it checks the\nentity's location, but if used in a loot table, it checks the location of the\nloot source (block or entity).Fields:position: The coordinates in the world to check. This is an object\ncontaining the following keys:x: The x coordinate to match. This should be a number or a number\nprovider.y: The y coordinate to match. This should be a number or a number\nprovider.z: The z coordinate to match. This should be a number or a number\nprovider.biomes: A biome or list of biomes to match. Will be true if the location is\nwithin a biome. For instance, [\"minecraft:plains\", \"minecraft:forest\"].structures: A structure or list of structures to match. Will be true if the\nlocation is within a structure. For instance,\n[\"minecraft:village\", \"minecraft:woodland_mansion\"].dimension: The dimension to match. Will be true if the location is in a\npredicate For instance, minecraft:overworld.light: The light level to match. This should be a single int, or an object\ncontaining a min and max number provider to match a range.block: The block to match. This should be an object containing the\nfollowing:blocks: A block ID or list of block IDs to match. For instance,\n[\"minecraft:mycelium\", \"minecraft:grass_block\"].state: An object containing the block state properties to match. For\ninstance, {\"waterlogged\":\"true\", \"south\":\"tall\"}.nbt: An NBT string to match. Will be true if the block at the location\ncontains all of the specified NBT (ignoring other tags). For instance,\n\"{Items:[{id:\\\"minecraft:stick\\\",Count:1b}]}\".fluid: The fluid to match. This should be an object containing the\nfollowing:fluids: A fluid ID or list of fluid IDs to match. For instance,\n[\"minecraft:water\", \"minecraft:flowing_water\"].state: An object containing the fluid state properties to match. For\ninstance, {\"level\":\"2\"}.smokey: Checks if the location is within 5 blocks veritically of a campfire.\nThis should be a boolean.can_see_sky: Checks if the the sky light level is the highest it could be.\nThis should be a boolean.match_toolmatch_tool matches the item used to perform an action. Contrary to what may\nseem intuitive, this can not be used to check the player's mainhand item in a\npredicate referenced in predicate= or execute if predicate - this is only\nfor loot tables and advancements.Fields:predicate: An item matcher.random_chancerandom_chance will be true if a random decimal is less than the value in\nchance. For instance, 0.5 would be true 50% of the time, 0.25 would be\ntrue 25% of the time, etc.Fields:chance: The chance of the predicate being true. This should be a float\nbetween 0 and 1.random_chance_with_enchanted_bonusrandom_chance_with_enchanted_bonus is similar to random_chance, but you can\nspecify a different random chance if the tool used has a certain enchantment.\nThis is used in loot tables and advancements.Fields:unenchanted_chance: The chance of the predicate being true if the tool is\nnot enchanted. This should be a float between 0 and 1.enchanted_chance: The chance of the predicate being true if the tool is\nenchanted. This should be a float between 0 and 1.enchantment: The enchantment ID to check for. For instance,\nminecraft:fortune.survives_explosionsurvives_explosion will be true if the entity survived an explosion. This is\nused in loot tables. This predicate type has no other fields.table_bonusEssentially, table_bonus is a more advanced version of\nrandom_chance_with_enchanted_bonus, as you can specify a different chance for\neach enchantment levelFields:enchantment: The enchantment ID to check for. For instance,\nminecraft:fortune.chances: An array of chances for each enchantment level. The first item in\nthe array would be the chance for enchantment level 1, and so on.time_checktime_check checks the current time.Fields:value: The time to check, represented in game ticks. This should be a single\nint, or an object containing a min and max number provider to match a\nrange.period: If present, value will check for GAMETIME modulo . For\ninstance, setting period to 24000 (the amount of ticks in a day) would check\nfor the current daytimevalue_checkvalue_check simply matches a value from a number provider against a range or\nconstant.Fields:value: A number or a number provider to check against.range: The range used to check value (will return true if value is\nwithin this range). This should be a single int, or an object containing a\nmin and max number provider to match a range.weather_checkweather_check matches the current weather in the world. To check for sun, you\nwould need to set both fields to false.Fields:raining: Checks if it is currently raining. This should be a boolean.thundering: Checks if it is currently thundering. This should be a booleanSpecial ConditionsThese conditions are special as they are used in conjunction with one or more\nother conditions to alter the result of the predicate, often acting like logic\ngates.all_of or any_ofall_of and any_of are self explanatory. all_of checks if all specified\npredicates are true, and any_of checks if any specified predicates are true.Fields:terms: A list of predicates to check. This cannot be the ID of the current\npredicate.invertedinverted will invert the output of the predicate. If the predicate would\nreturn true, using this would make it return false, and vice versa.Fields:term: A predicate to check. This cannot be the ID of the current predicate.referencereference simply references another predicate file, as if you included the\npredicate in the current one. This is useful for reusing predicates across\nmultiple files.Fields:name: A predicate ID to check. This cannot be the ID of the current\npredicate.","description":"Predicates are a type of file which can be called to check if a certain condition is true.","url":"/wiki/files/predicates/","tags":[]},{"title":"Functions","content":"FunctionsFunctions are files essentially containing a list of Minecraft commands.\nFunction files end in .mcfunction, and are located in the\ndata/ /function folder. Functions can be called (ran) using the\nfunction command. (See /function for more\ninformation)The function folder can contain sub-folders for organisation. This changes\ntheir reference accordingly - for example, a function located at\ndata/ /function/sub_folder/my_func.mcfunction would be called using\nfunction :sub_folder/my_func.When a function is run, the commands within it are executed in order. If the\nreturn command is run, the function stops executing immediately and any\ncommands after the return are ignored.Any line in a function which starts with a # is a comment, and the game\nignores it. Any other line is interpreted as a commandExampleThis function will give every player an apple, then tell them to enjoy the\napple.# Give a player the apple\ngive @a minecraft:apple\n\n# Tell them to enjoy the apple\nsay Enjoy the apple!\nMacro functionsMacros can dynamically change part of a function by inserting NBT into it. Any\nfunction can define a macro within it. A macro is a command beginning with $.\nMacros can use a special syntax: $(). This will substitute for any\nvalue provided aswhen run.The /function command can specify a NBT compound to use as the macro values.\nIn traditional programming, this is best represented as someFunction(foo, bar)ExampleIn this example, we write a function that gives the player a number of diamonds\nusing a macro.# When called, $(count) will be replaced with some number, producing a valid command\n$give @s diamond $(count)\nfunction example:macro {count: 7}\n\n# This also works\ndata modify storage example:storage count set value 12\nfunction example:macro with storage example:storage\n","description":"Functions are files essentially containing a list of Minecraft commands. Function files end in `.mcfunction`, and are located in the `data//function` folder. Functions can be called (ran) using the `function` command. (See [/function](/wiki/command/function) for more information)","url":"/wiki/files/functions/","tags":[]},{"title":"Recipes","content":"RecipesRecipes are files which define crafting recipes in-game. They can be used to add\nnew recipes, or overwrite existing ones.\nRecipes are JSON files located in the data/ /recipe folder.JSON formatFor information about the JSON format in general, see the\nJSON page.Since recipe files represent a variety of different recipe types, the format can\nvary. However, there are some fields which appear in every recipe file.typeDetermines which type of recipe this is. Possible values:TypeDescriptionblastingA recipe for a blast furnacecampfire_cookingA recipe for cooking items on a campfirecrafting_shapedA shaped crafting recipe in a crafting table. Ingredients must be placed in the correct pattern to craftcrafting_shapelessA shapeless recipe in a crafting table. Ingredients can be placed in any pattern to craftcrafting_special_*A crafting recipe handled using built-in logic, and not displayed in the recipe book. Only useful for disabling/enabling certain recipescrafting_decorated_potThe recipe for crafting decorated pots. Also handled with built-in logic, but does show up in the recipe bookcrafting_transmuteA recipe to turn one item into another in a crafting table, while preserving its item componentssmeltingA recipe for a furnacesmithing_transformA recipe to upgrade an item in a smithing tablesmithing_trimA recipe to add an armor trim to an item in a smithing tablesmokingA recipe for a smokerstonecuttingA recipe for a stonecuttercategoryWhich category the recipe appears in the recipe book. If not provided, defaults\nto misc.\nPossible values: blocks, building, equipment, food, misc, redstonegroupAn identifier to group multiple recipes in the recipe book. For example, recipes\nto craft planks use this.\nAllowed in most recipe types, except: crafting_decorated_pot,\ncrafting_special_*, smithing_transform, smithing_trimCooking fieldsThese fields are present in blasting, campfire_cooking, smelting and\nsmoking recipes.FieldFormatDefault valueDescriptioningredientAn ingredientrequiredThe ingredient which gets cookedresultA single resultrequiredThe result of cooking the ingredientexperienceA number0The amount of experience gained from this recipecookingtimeAn integer100, or 200 for smelting recipesThe number of ticks it takes to cook the ingredient\nseconds) for smelting, 100 ticks for blasting and smoking, and 600 ticks for\ncampfire cooking\nrows, the recipe can be moved around the crafting grid. Recipes with two or\nfewer rows and columns can be crafting in the 2x2 crafting grid in the\ninventory.\nread the example to understand it better.\npossible values of the type field which count as special crafting recipes.\nPossible special recipes:Recipe TypeDescriptioncrafting_special_armordyeThe recipe for dyeing leather armorcrafting_special_bannerduplicateThe recipe for copying bannerscrafting_special_bookcloningThe recipe for copying written bookscrafting_special_firework_rocketThe recipe for crafting firework rocketscrafting_special_firework_starThe recipe for crafting firework starscrafting_special_firework_star_fadeThe recipe for adding fade colors to firework starscrafting_special_mapcloningThe recipe for copying mapscrafting_special_mapextendingThe recipe for extending mapscrafting_special_repairitemThe recipe for repairing items with durabilitycrafting_special_shielddecorationThe recipe for adding banners to shieldscrafting_special_tippedarrowThe recipe for adding potion effects to arrowscrafting_transmute fieldsThese fields are present in crafting transmute recipes.FieldFormatDescriptioninputAn ingredientThe item to be transmuted. This item's components will be preservedmaterialAn ingredientThe item used to transmute the inputresultA counted resultThe id of the resulting item. This will copy the components of the input item if they weren't overwritten.\nrows, the recipe can be moved around the crafting grid. Recipes with two or\nfewer rows and columns can be crafting in the 2x2 crafting grid in the\ninventory.\nread the example to understand it better.\nresource location, the hash-prefixed\nresource location of an item tag (e.g. #minecraft:logs), or an array of valid\nitem resource locations.\noptional count field, an integer specifying the count of the resulting item.\nIf not included, the count defaults to 1.ExampleThis file adds a shaped crafting recipe to craft bedrock out of beds and rock\n(stone).This file should be placed in the data/ /recipe folder.\ncontaining all colors of beds.\n\"type\": \"minecraft:crafting_shaped\",\n\"pattern\": [\n\"___\",\n\" X \",\n\"___\"\n],\n\"key\": {\n\"_\": \"#minecraft:beds\",\n\"X\": \"minecraft:stone\"\n},\n\"result\": {\n\"id\": \"minecraft:bedrock\"\n}\n}\n","description":"Recipes are files which define crafting recipes in-game.","url":"/wiki/files/recipes/","tags":[]},{"title":"Advancements","content":"AdvancementsAdvancement files are used to create in-game advancements. These can have\ndisplay properties to make them visible to the player, like how vanilla\nadvancements work. In many function datapacks, we can use hidden custom\nadvancements to detect events (e.g player attacks entity) and then run a\nfunction.Advancements can be stored in trees. This means that an advancement can have\nparent and children advancements. This tree format is good for showing\nprogression in different areas of the game, as well as allowing you to have\ncustom advancment tabs.Advancement files are JSON files stored in the /data/ /advancement\nfolder.JSON FormatFor information about the JSON format in general, see the\nJSON page.Each advancement is represented by a JSON object stored in the advancement JSON\nfile. The advancment JSON object can have the following fields:criteria: An object containing the criteria/criterion that can trigger this\nadvancement. (See the Criteria section below)requirements: This can optionally be used to specify more advanced rules as\nto which criteria trigger the advancement (for example, this can be used to\nspecfiy \"Advancement is given if (Criteria A OR Criteria B) AND (Criteria C OR\nCriteria D) is true\"). This should be a list of lists of criteria keys - the\nadvancement is given when at least one criteria from each list has been\nachieved.display: If left out, this advancement is completely hidden from the player.\nOtherwise, this will control the style of the advancement, and where it is\ndisplayed to the player. It has the following keys:icon: An object defining the item used as the icon as the advancement.\nThis has a id field (the item ID) and components (an object with the\nitem components)title: A text component representing the title or name of the advancement\nthat is shown to the playerdescription: A text component representing the description of the\nadvancementbackground: (Root advancement only) The path to the background texture of\nthe advancement tabframe: Used to specify the frame (or type) of advancement. This should be\neither \"task\" (default), \"challenge\", or \"goal\".show_toast: If true, a pop-up will be shown when a player completes the\nadvancement. Defaults to true (if display exists).announce_to_chat: If true, the advancement will be announced to chat when\nit is completed by a player. Defaults to true (if display exists)hidden: If true, the advancement will not show up in the advancements menu\nuntil it has been achieved by the player. Defaults to false.parent: The ID of this advancement's parent advancement. This should be set\nif your advancement is not just for internal event purposes. If this is left\nblank, it is considered to be a root advancement.rewards: An object which stores data about what should happen to the player\nwhen the advancement has been achieved. This can contain the following fields:function: The ID of the function to run as the player when they achieve\nthe advancement.loot: A list of loot table IDs to be given to the player when they achieve\nthe advancement.recipes: A list of the recipe IDs to be unlocked by the player when they\nachieve the advancementexperience: The XP points to give to the player when they achieve the\nadvancement. This should be an integersends_telemetry_event: (minecraft namespace only) Whether to send\ntelemetry info about this advancement to Mojang. Defaults to false.criteriaThe criteria object is an object containing the criteria needed to unlock this\nadvancement. This object should contain other objects - the key of which can be\nanything, as it serves as the criteria ID. If the requirements field is not\nused, the advancement will be achieved when all of the criteria have been\nachieved.Each criteria object contains a trigger and conditions fields. There are\nmany different triggers that can be used, the contents of conditions depends\non which trigger is used.\nminecraft:impossible). This condition can either be an object (an\nentity_properties predicate) or a list of other predicates (any predicate\ntype) to further match the player.\nmisode.github.io.Using advancements to detect eventsBy specifying a function in the rewards section, and not including any\ndisplay information, you can make an advancement essentially just become an\nevent listener (something that will run a function when the player does\nsomething). In order for this to work multiple times, the function must revoke\nthe advancement from the player (using advancement revoke @s only ...), so\nthat it can be regained later.Note that the advanement will run the function as the player, but not at\nthe player.","description":"In a datapack, we can create advancements, which can additionally be used to detect events.","url":"/wiki/files/advancements/","tags":[]},{"title":"Dialogs","content":"DialogsA dialog is a \"pop-up\" menu/form which we can send to the user by using the\n/dialog command. They can show text to the user, and can also have text\ninputs, check boxes, select menus, number inputs, and action buttons.For example, you could create a settings menu for your datapack with a dialog.\nThey can open the dialog with a function (which runs the /dialog show\ncommand), and when they are done, their inputs in the form will be converted\ninto a command which will change the settings of the datapack.Dialogs are stored as JSON files in the /data/ /dialog/ folder.Types of dialogThere are many different types of dialog that we can create.All dialogs can have a title (displayed at the top of the screen), a\nbody (which can contain text), and any number of inputs (e.g text,\nnumber, multiselect, checkbox). The exact format of the dialog (including\nwhether there are buttons in the footer) depends on the type:Confirmation (minecraft:confirmation): This type of dialog has two\nbuttons in the footer (e.g \"Yes\" and \"No\", or \"Submit\" and \"Cancel\").Notice (minecraft:notice): This type of dialog has one button in the\nfooter - it is the simplest type of dialog.Multi Action (minecraft:multi_action): This type of dialog has a list of\nbuttons (arranged in columns), and optionally a \"close\" button at the bottom.Dialog List (minecraft:dialog_list): This type of dialog consists of any\nnumber of buttons that open another dialog when clicked (arranged in columns)Server Links (minecraft:server_links): This type of dialog will display\nthe server's preset custom links.\ndisplay graphically, and will look as if it is in the inventory when it is\nhovered over by the cursor.\nand multi action input form):Text (minecraft:text): Allows the user to enter text.Number range (minecraft:number_range): Allows the user to select a\nnumber with a slider (like in the settings menu)Boolean (minecraft:boolean): This is a checkbox. When the checkbox is\nticked, then the value is true, and vice versa.Single Option (minecraft:single_option): Allows the user to select one\nfrom a list of options. It looks like a button, but you click on it to cycle\nthrough the values.Each input also has a key. This is the name of the macro value that is used\nwhen a dynamic/run_command button is clicked. For instance, if one input has\nthe key message, and a button runs the command /tellraw @a \"$(message), then\nthe value from that input is used in the command.These inputs are pretty customisable. For instance, Text, Number range, and\nSingle Option types can have a custom width, text inputs can be made multiline,\netc.ActionsActions are basically buttons (e.g the submit button) which will do something\nwhen clicked. On forms, actions will run a command which uses the inputs from\nthe form, like a submit button. On other dialog types, they can do things such\nas running a set command, opening a URL, opening another dialog, etc.The action button has a click event when the player is clicked (which is\nessentially the same as text components). This click event can be: Open URL, Run\nCommand, Suggest Command, Copy Text to Clipboard, or Show Dialog.If the dialog has inputs, you can also use dynamic actions such as\ndynamic/run_command. This works similar to the run command action, except the\narguments of the commmand can change based on the values of the inputs.For example, if a simple input form has one text input with the ID name and\nthe user has entered the value Silabear, and the action is a\ndynamic/run_action action which runs the command kill @a[name=$(name)], then\nwhen the action is clicked, the player will run the command\nkill @a[name=Silabear].\nthe player does not have operator status, then most useful commands cannot be\nrun.\nJSON format of a dialog file. However, we recommend that you use\nMisode's Dialog Editor to create dialog\nfiles, which also allows you to preview the dialog in the browser.Using dialogsDialogs can be shown to a player in three different ways:/dialog command: The /dialog command can be used to show a dialog to a\nplayer at any time. For example, /dialog show @a namespace:my_dialog will\nshow the dialog in /data/namespace/dialog/my_dialog.json to all players.Pause Screen: Any dialogs listed in the dialog tag\nminecraft:pause_screen_additions\n(/data/minecraft/tags/dialog/pause_screen_additions.json) will be available\nfrom the pause screen. If this tag only has one dialog, then there will be a\nbutton on the pause screen which opens that dialog. If there are more dialogs\nin the tag, then the button on the pause screen will open a menu which lets\nyou open any of the dialogs in the tag. Note that this replaces the \"Send\nFeedback\"/\"Report Bugs\" button on the home screen if used.Quick Actions: Any dialogs listed in the dialog tag\nminecraft:quick_actions (/data/minecraft/tags/dialog/quick_actions.json)\nwill be available when a player clicks the Quick Actions keybind (which is G\nby default). If the tag only has one dialog, then clicking G will open that\ndialog, otherwise it will open a menu where you can select any of the dialogs,\nlike the pause screen additionsClick Events: In text components and actions in other dialogs, one click\nevent type is Open Dialog. This lets the player open a dialog when they\nclick on text (in chat, in a book, on a sign, etc) or a button (in a dialog).","description":"Dialogs are pop-up menus that you can send to the user","url":"/wiki/files/dialogs/","tags":[]},{"title":"Tags","content":"TagsRegistry tags, not to be confused with\nentity tags, are essentially lists of\ngroups such as blocks, items, entity types, etc. They use JSON format and are\nlocated in the data/ /tags/folder.Special tagsMinecraft uses some tags internally for certain behaviours. These tags are\nlocated in the minecraft namespace. For example:any functions in the #minecraft:load function tag will be automatically run\nwhen a datapack is loadedthe #minecraft:minable/pickaxe block tag lists blocks which are mined faster\nusing a pickaxe.In many cases, modifying these special tags allows you to configure certain\naspects of how Minecraft behaves.RegistriesTags group various types in a specific registry (category), such as items,\nblocks, functions, game events, chat types, etc.This list shows some of the possible registry types, as well as the path their\ntags should be put in.Registry TypesPathExample ValueItems/tags/item\"minecraft:apple\"Blocks/tags/block\"minecraft:grass_block\"Entity types/tags/entity_type\"minecraft:pig\"Functions/tags/function\"namespace:some_function\"Fluids/tags/fluid\"minecraft:water\"Game Events/tags/game_event\"minecraft:container_open\"Chat Types/tags/chat_type\"minecraft:say_command\"Damage Types/tags/damage_type\"minecraft:fly_into_wall\"Banner patterns/tags/banner_pattern\"minecraft:square_top_right\"Cat variants/tags/cat_variant\"minecraft:jellie\"Enchantments/tags/enchantment\"minecraft:sharpness\"Goat horns/tags/instrument\"minecraft:seek_goat_horn\"Paintings/tags/painting_variant\"minecraft:skull_and_roses\"Entity POI/tags/point_of_interest_type\"minecraft:cleric\"Biome/tags/worldgen/biome\"minecraft:plains\"Flat world preset/tags/worldgen/flat_level_generator_preset\"minecraft:classic_flat\"Structures/tags/worldgen/structure\"minecraft:village\"World preset/tags/worldgen/world_preset\"minecraft:large_biomes\"JSON formatFor information about the JSON format in general, see the\nJSON page.Tag files follow a very simple format, with two fields.replace: Can be true or false (defaults to false). If true, the tag\nwill overwrite other tags with the same path. If false, it will merge with\nthem.values: An array containing everything to group under this tag. Each element\ncan either bean id (e.g. \"minecraft:apple\")an object with an id field and a required field (e.g.\n{\"required\": false, \"id\":\"minecraft:stick\"}). If required is false,\nthe tag will still skip nonexistent ids.\n#minecraft:logs, it will also contain the entire contents of the\nminecraft:logs tag. A tag is represented by an ID beginning with a #. For\nmore information, refer to the\nresource locations\npage.\n\"replace\": true,\n\"values\": [\n\"#minecraft:logs\",\n\"#minecraft:planks\",\n\"minecraft:chest\",\n\"minecraft:stick\"\n]\n}\n","description":"Registry tags, not to be confused with [entity tags](/wiki/command/tag), are essentially lists of groups such as blocks, items, entity types, etc. They use JSON format and are located in the `data//tags/` folder.","url":"/wiki/files/tags/","tags":[]},{"title":"Resource Locations","content":"Resource LocationsA resource location is a way of referencing a resource in a datapack (or\nresourcepack), such as a function.ExampleThis is an example of a resource location for a function:/function my_namespace:some_folder/my_function\nThis resource location would try and access the function\n/data/my_namespace/function/some_folder/my_function.mcfunction. Notice how we\ndon't need to specify the function folder in the resource location, as it is\nimplied by the /function command.Resource locations for tagsTo reference a tag (ie the function tag #minecraft:load), you can use the #\nsymbol before the tag name. For example:/function #minecraft:load\nThis resource location would try and access the tag\n/data/minecraft/tags/function/load.json. In this case, all functions in the\ntag would be ran.Default namespaceIf the namespace (my_namespace, before the colon) is left out, it will default\nto the minecraft namespace./function some_folder/my_function\nThis resource location would try and access\n/data/minecraft/function/some_folder/my_function.mcfunction.Allowed charactersA file name (and resource location) can only contain lowercase letters (a-z),\nnumbers (0-9), underscores (_), dashes (-) and periods (.). In a\nresource location, / can be used to separate folders.","description":"A resource location is a kind of identified used in Minecraft to point to a certain piece of data, such as a function, item, or storage.","url":"/wiki/concepts/resource-locations/","tags":[]},{"title":"Target Selectors","content":"Target SelectorsTarget Selectors are used as an argument in commands to select entities and\nplayers in the world. We use target selectors to find players or mobs and do\nthings to them. Many commands need to be given a target selector as an argument,\nor otherwise require being executed as an entity.All target selectors start with an @ symbol, followed by a base selector (see\nthe table below), and optionally any other criteria which will narrow down the\nselection further.Example: tellraw @a[distance=..10] \"You're within 10 blocks of me\". The\ntarget selector is @a[distance=..10], and tells the game to only send the\nmessage to players within 10 blocks.Base target selectorsIn Java Edition, there are 6 base target selectors:Target SelectorDescription@eAll Entities - By itself, this selector will select every single entity which is currently loaded in the world@sThis Entity - This selector will select the entity which is currently running the command. For example, if I run a command as @s, then it will run the commands as me.@aAll Players - This selects all currently online players. (All players are always loaded in the world).@rRandom Player - This selects one random player.@pNearest Player - This selects the nearest player to the position this command is ran from.@nNearest Entity - This selects the nearest entity (player or non-player) to the position this command is ran from.\ncurrently being loaded, it will not select that entity.\nfilter the selection even more to only find the entities that you want. Target\nselector arguments are contained within square brackets after the base selector\n(@e[...]) and are written as\n[ :, =,...]Example: In our previous example (@a[distance=..10]), we use the argument\ndistance=..10 to specify that we only want to target entities which are less\nthan 10 blocks away.\nentities who do not match the argument. (E.g. @e[type=!minecraft:creeper] will\nselect every entity that is NOT a creeper)\nentities of a certain type, or those in an entity_type tag.must be a valid entity ID or entity_type tag ID. This argument\ncan only be used with @e, @s or @n.Examples:@e[type=minecraft:pig]: Selects all pigs@e[type=#minecraft:aquatic]: Selects all aquatic animalsname argumentThe name=argument will filter the selection to only include\nentities who have a specific name.is a simple string. This can not be a text component but\nname=Freddie would still match a styled name like\n{\"text\":\"Freddie\",\"color\":\"blue\"} or similar.Examples:@e[name=Aaron]: Selects all entities named Aaron@e[name=\"Aaron Aaronson\"]: Selects entities named Aaron Aaronson\ninclude entities who are within a distance range.can either be a value (such as 7) or a range (such as ..8\nor 21..)Examples:@e[distance=6]: Selects all entities which are exactly 6 blocks away from\nthe execution position.@e[distance=..20]: Selects all entities within 20 blocks of the execution\nposition.@e[distance=3..]: Selects all entities that are more than 3 blocks away from\nthe execution position.@e[distance=12..15]: Selects all entities between 12 and 15 (inclusive)\nblocks from the execution position.nbt argumentThe nbt= argument will filter the selection to only include entities\nwhich have or do not have specific NBT data.`` is an NBT compound. The entity must\nmatch everything within the compound.Examples:@a[nbt={SelectedItem:{id:\"minecraft:stone\"}}]: Selects all players who are\nholding stone@e[type=minecraft:arrow,nbt={inGround:1b}]: Selects all arrow entities who\nare in a block.sort and limit argumentsThe sort=,limit=will limit the amount of possible entities\nit will select and will select entities based on the priority defined in\n .can be one of the following:arbitrary: sort in entity load order, which is arbitrarynearest: sort in increasing order of distancefurthest: sort in decreasing order of distancerandom: sort randomly (default type for @r)can be any integer.Examples:@e[limit=1,sort=nearest]: Selects the nearest entity to the position of\nexecution@e[limit=5,sort=furthest]: Selects the furthest 5 entities from the position\nof execution.@e[limit=7,sort=random,type=minecraft:cow]: Selects 7 random cows..x/y/z argumentsThe x/y/z=arguments do not directly change the selection, but are\nused alongside other arguments to specify a starting position to work from.This argument(s) will affect the arguments distance, dx/dy/dz and\nsort/limit.Examples:@e[x=10,y=9,z=-5,distance=..5]: Selects all entities less than 5 blocks away\nfrom the position X=10/Y=9/Z=-5dx/dy/dz argumentsThe dx/dy/dz arguments will create a cuboid that is at least 1x1x1 blocks big\nand the given value will increase the size of the cuboid in that direction by\nthe given value in blocks.Any entity fully or partially inside the cuboid will be selected.You can mix and match dx, dy, and dz however you want. To create the\ncuboid at least 1 of the three has to be there.\ncommand origin to positive x/y/z\ntheir hit box is within the cuboid w=11,h=21,l=6 starting from the position\nx=10,y=13,z=87@e[x=7,y=3,z=9,dx=0,dy=0,dz=0]: Selects any entities if their hit box\noverlaps with the block at x=7,y=3,z=9tag argumentThe tag=argument will select entities which have the specified tag.\nis any tag string (no spaces).Entities do not naturally have tags - these are separate from entity_type tags\nsuch as that used in the type argument. Instead, these select entities based\non the tags added with the /tag command or Tags[] NBT.Examples:@a[tag=CustomTag]: Selects all players with the tag CustomTag@e[tag=!ignore]: Selects all entities which do not have the ignore tag.team argumentThe team=argument will select entities which are in a specific\nteam. Since entities can only be in one team at a time, you cannot use team=\nmore than once, however you can duplicate negated team arguments (team=!).is any tag string (no spaces).Examples:@a[team=red]: Selects all players in the red team@e[team=Bears]: Selects all entities in the Bears team@e[team=!blue]: Selects all entities which are not in the blue teamscores argumentThe scores={ =,...} argument will select entities based on\ntheir value on a scoreboard.is a scoreboard objective which must exist already.can\nbe either an integer or a range.Examples:@e[scores={foo=10}]: Selects all entities with a score of exactly 10 on\nthe foo scoreboard.@e[scores={foo=5,bar=7}]: Selects all entities with a score of exactly 5\non the foo scoreboard and exactly 7 on the bar scoreboard.@e[scores={foo=8..}]: Selects all entities with a score of 8 or more on\nthe foo scoreboard.predicate argumentThe predicate=argument will select entities based on whether they\npass a predicate check.is a predicate ID.Examples:@e[predicate=namespace:my_predicate]: Selects all entities who pass the\npredicate in data/namespace/predicates/my_predicate.@e[predicate=!namespace:another_predicate]: Selects all entities who fail\nthe predicate in data/namespace/predicates/another_predicate.jsongamemode argumentThe gamemode=(survival|creative|adventure|spectator) argument will select\nplayers who are in a specific game mode.Examples:@a[gamemode=creative]: Selects all players in creative modeadvancements argumentThe advancements={ =(true/false)} argument will select\nplayers based on whether they've unlocked an advancement.\nis an advancement ID.Examples:@a[advancements={minecraft:story/follow_ender_eye=true}]: Selects all\nplayers who have unlocked the follow_ender_eye advancement.@a[advancements={minecraft:story/follow_ender_eye=false}]: Selects all\nplayers who have not unlocked the follow_ender_eye advancement.advancements argumentThe advancements={ =(true/false)} argument will select\nplayers based on whether they've unlocked an advancement.\nis an advancement ID.Examples:@a[advancements={minecraft:story/follow_ender_eye=true}]: Selects all\nplayers who have unlocked the follow_ender_eye advancement.@a[advancements={minecraft:story/follow_ender_eye=false}]: Selects all\nplayers who have not unlocked the follow_ender_eye advancement.level argumentThe level=argument selects players based on their current XP level\n(not amount of points).can be an integer or range.Examples:@a[level=10]: Selects all players who have an XP level of exactly 10.@a[level=4..]: Selects all players who have an XP level of 4 or more.x_rotation argumentThe x_rotation=argument selects players based on their vertical\nrotation (pitch).can be a floating point value or float range from -90 to 90Examples:@a[x_rotation=0..90]: Selects all players who are looking below the horizon\nor directly at the horizon.@a[x_rotation=90]: Selects all players who are looking straight down.y_rotation argumentThe y_rotation=argument selects players based on their horizontal\nrotation (yaw).can be a floating point value or float range from -180 to 180Examples:@a[y_rotation=-180]: Selects all players who are facing exactly due north.@a[y_rotation=-180..-90]: Selects all players who are looking between north\nand east or exactly north or east.","description":"Target Selectors are used as an argument in commands to select entities and players in the world. We use target selectors to find players or mobs and do things to them.","url":"/wiki/concepts/target-selectors/","tags":[]},{"title":"Item Components","content":"Item ComponentsItem components are data structures which can be applied to items in Minecraft\nto give them special attributes, such as a name, lore, being able to be eaten,\netc. Each item has specific item components by default - for example, all food\nitems will have the minecraft:consumable component, which makes the item\nedible.A command such as /give or /item can be used to create an item which has\nadditional item components, or remove item components from any item.You can check out all the components and their data structure on the Minecraft\nWiki: https://minecraft.wiki/w/Data_component_format#List_of_components","description":"Item components are data structures which can be applied to items in Minecraft to give them special attributes, such as a name, lore, being able to be eaten, etc.","url":"/wiki/concepts/item-components/","tags":[]},{"title":"Coordinates","content":"CoordinatesCoordinates in Minecraft are represented by an x, y, and z value. They are\nused to represent positions of entities, blocks, particles, sounds and more. In\ncommands, they are represented as simply x y z, where x, y, and z are\ndecimal numbers representing the coordinates on each axis.Block coordinates are locked to the grid and are unique - there can only be one\nblock per set of coordinates. Block coordinates are whole numbers, for example\nyou can have a block at 123 86 94 but not 123.7 86.2 94.6. Entities are not\nlocked to the grid - they can be at decimal positions (and usually are).x.0 y.0 z.0 represents the bottom left corner of a block, not the centre. The\ncentre of a block would be represented by the coordinates x.5 y.5 z.5.\nis usually the world spawn. You can change this using the commands \"execute at\"\nor \"execute positioned\".\ntell the game to put a pink concrete block at the coordinates 123 86 94./tp @s 66.2 98 45.7: This command would teleport the current entity to the\nexact coordinates 66.2 98 45.7Relative CoordinatesUsing the symbols ~ and ^, we can reference coordinates relative to the\ncurrent coordinates (for example, you can get the position\n7 blocks above the current position).~ represents the current position on any axis. For example, 12 ~ 76 would\nteleport me to x=12 z=76 but keep y as the current position. The\ncoordinates ~ ~ ~ would represent the position of the command - this is useful\nto do something at the current position such as placing a block or summoning an\nentity.The ~ symbol can be followed by a number to include an offset to the current\nposition. For example, ~ ~12 ~ would represent the current position offset by\n10 blocks on the y-axis (or in simpler terms: the position 10 blocks above the\ncurrent position). This can also be a negative number.Similarly ^ represents a relative position, taking into account the current\nrotation too. The most common use for this is to get a position in front of the\ndirection of rotation. For example, you can use ^ ^ ^5 to get the position 5\nblocks in front of the current position in whatever direction the command or\nentity is rotated.^3 ^ ^ represents a vector 3 blocks perpendicular of the head (sway)^ ^3 ^ represents a vector 3 blocks \"above\" of the head (heave)^ ^ ^3 represents a vector 3 blocks in front of the head (surge)","description":"Coordinates in Minecraft are represented by an `x`, `y`, and `z` value. They are used to represent positions of entities, blocks, particles, sounds and more. In commands, they are represented as simply `x y z`, where `x`, `y`, and `z` are decimal numbers representing the coordinates on each axis.","url":"/wiki/concepts/coordinates/","tags":[]},{"title":"Ranges","content":"RangesA range specifies a set of values between two numbers. Ranges are used in some\ncommands (such as execute) and selectors to specify a set of values to compare\nagainst.For example, the distance= selector accepts a range to select entities within\na certain distance from the player. The range distance=..10 selects entities\nwithin 10 blocks of the player.Greater than (x >= 10)To specify a range of numbers such as \"x or greater\", we can use the min..\nsyntax. The following range represents \"10 or greater\". Note that this range\nincludes 10.10..\nLess than (`x","description":"A range specifies a set of values between two numbers.","url":"/wiki/concepts/ranges/","tags":[]},{"title":"Styled Text","content":"Styled TextStyled text (bold, underline, colours, etc) is represented as NBT based\nstructures, called \"text components\". A text component is a way to format styled\ntext in Minecraft commands, and is used in many places such as /tellraw,\n/title, and more.Instead of just using standard text (for example \"Hello World\"), we can use\ntext components to format the text in a variety of ways, including colours, text\neffects, click events, hover events, language-based text, accessing NBT data,\nand more.For more information about the NBT format in general, see the\nNBT page.FormatA text component is formatted as either an object\n({text:\"Hello World\",color:\"red\"}), or an array of objects\n([{text:\"Hello\"},{text:\"World\"}]). An object could just be a normal string\n([\"Hello\", \"World\"] and \"Hello World\" are both valid text components).If the text component is an array, then all the objects inherit the style from\nthe first object. For instance, if the first object in an array is styled to be\nred, then all the other objects in the array will also be red unless specified\notherwise.Content sourcesThe actual text of a text component can be either static text or from a source\nsuch as NBT or scoreboard. Every object requires one of the following:text:\"\": A simple string of text.score:{name:\"\",objective:\"\"}: The score of a player in an\nobjective. In some cases, name can be set to \"*\", which will access the\nscore of the player viewing the text.NBT: This will display the value of an NBT tag. If nbt is used in a text\ncomponent, then one of storage, entity, or block is also required. The\nfollowing properties should be used:nbt:\"\": The path to the NBT value. This is required - it should be a\nstring value following the NBT path format.storage:\"\": The storage to get the NBT value from.entity:\"\": The entity to get the NBT value from.block:\" \": The block to get the NBT value from.interpret:(true/false): If true, then the NBT value's text will be parsed\nand interpreted as a text component. Defaults to false.selector:\"\": The name of a player or entity.translate:\"\": A translation key from language files defined in a\nresource pack. This will display the value of the key in the player's selected\nlanguage.with: This can also optionally be used to insert arguments into the\ntranslation key. This should be an array of text components.fallback: This can also optionally be used to specify what to display if\nthe translation is not found. If this is not specified, the key itself will\nbe displayed if the translation is not found. This should be a string value.keybind:\"\": The key which a player has bound to a keybind. (For\nexample, key.jump would show the text Space, assuming the player has not\nchanged the keybind).Example: This text component will display the value of the path\nShopData.Name in the NBT storage minecraft:xyz:{ \"nbt\": \"ShopData.Name\", \"storage\": \"minecraft:xyz\" }\nStyle propertiesThe following properties can be used in a text component to change the style\nof the text:color: The colour of the text. This can be one of the 16 standard colours\n(e.g \"red\", \"light_purple\", etc.), or a hex colour code (e.g \"#ff0000\").bold: Whether the text is bold. This can be true or false.italic: Whether the text is italic. This can be true or false.underlined: Whether the text is underlined. This can be true or false.strikethrough: Whether the text is strikethrough. This can be true or\nfalse.obfuscated: Whether the text is obfuscated. Obfuscated text applies a\nspecial glitch effect to the text. This can be true or false.Example: This text will be \"Hello World\", in red, bold, and strikethrough:{ \"text\": \"Hello World\", \"color\": \"red\", \"bold\": true, \"strikethrough\": true }\nInteractivity propertiesThe following properties can be used in a text component to add\ninteractivity to the text:insertion: Can be used to specify text to be inserted into the chat when the\ntext is shift-clicked. This should be a string value.click_event: Can be used to specify an action to be performed when the text\nis clicked. This should be an object with the following properties:action: The action to be performed. This can be one of the following:\"open_url\": Opens the url in the field url in the player's web\nbrowser.\"run_command\": Runs the command in the field command (the player needs\npermission to run the commands, and this excludes commands like /say or\n/tell which make the player send something to chat).\"suggest_command\": Opens and inserts the contents of command into the\nplayer's chat box.\"copy_to_clipboard\": Copies the contents of the field value to the\nclipboard.\"change_page\": (books only) Changes the page of the book to the page\nspecified in the field page.url or command or value or page: These fields should be added to\nclick_event alongside action depending on which action you use.hover_event: Can be used to specify what happens when a player hovers over\nthe text. This should be an object with the following propertiesaction: The action to be performed. This can be one of the following:\"show_text\": Shows the text in the field value in a tooltip by the\nplayer's mouse.\"show_entity\": Shows the entity based on the fields uuid and id in a\ntooltip by the player's mouse.\"show_item\": Shows the item based on the fields id and components in\na tooltip by the player's mouse.value or uuid + id or id + components: These fields should be\nadded to hover_event alongside action depending on which action you use.Example: This text will be \"Click me\", in blue, and when clicked, it will\nrun the command /say Hello:{\n\"text\": \"Click me\",\n\"click_event\": { \"action\": \"run_command\", \"command\": \"/say Hello\" }\n}\nOtherextra: This property can be used to add another component after, which\ninherits all the styles and interactivity from the parent object.separator: If the text source returns multiple values (e.g. multiple\nentities with the selector source, or multiple NBT values with the nbt\nsource), this can be used to specify the separator between the values. This\nshould be a string value.Text component generatorsWriting text components manually is tedious - there are numerous generators which can be used to quickly create text components. We recommend our Minecraft Text Generator which has an easy UI, cool features like gradient creators, and is updated for modern versions.Writing text components manually is tedious - there are numerous generators\nwhich can be used to quickly create text components. We reccomend\nour Minecraft Text Generator which has an easy\nUI, cool features like gradient creators, and is updated for modern versions.If you are a more advanced datapacker and want full control over the output,\nthese let you create text components one component at a time, with support for\nmore advanced featuresMisodeMinecraftJSON.com","description":"Styled text in Minecraft commands is done through an NBT text format.","url":"/wiki/concepts/text/","tags":[]},{"title":"Commands","content":"CommandsCommands are the basic building blocks of most datapacks. Each command is a\nsimple instruction which can tell the game to do something. Most datapacks are\nmade primarily of functions - functions are just lists\nof commands ran in order.There are too many commands for this wiki to go over each one individually.\nHowever, important commands can be found in the Command Reference section of\nthe sidebar.Command ContextProgramming Minecraft command is unique. Commands are always run with context -\nthis means commands always have a position (in a dimension), rotation, and\nexecutor entity. Functions inherit context from their caller, so if you run a\nfunction in chat, all the commands in the function will have the same context as\nif you ran them in chat.Functions ran by the game, for instance tick, load, and scheduled functions,\nwill have the following context:the executor is the game server. If you use @s in a command, it will not\nrefer to any entity.the position of the command is the world spawnthe rotation of the command is 0, 0If you run a command in chat, then:you are the executor entity. If you use @s in a command, it refers to you.the position and rotation of the command are where you are standing and\nlooking. If you use ~ ~ ~ in a command, it refers to where your position.The /execute command will change the context of a command. For instance, this\ncommand would change the executor to the player Silabear, and the position of\nthe command to 123 456 789:execute as Silabear positioned 123 456 789 run say Hello!\n","description":"Commands tell the game to do things. [Functions](/wiki/files/functions) are files which are made up of many commands. They form the basic building blocks for any function datapack.","url":"/wiki/concepts/commands/","tags":[]}] \ No newline at end of file +[{"title":"Home","content":"Welcome to the Datapack Wiki!Welcome to the Datapack Wiki, a resource for everything related to Minecraft\nDatapacks. This community-built wiki has got guides, tutorials, and\ndocumentation to help you create and modify Minecraft Datapacks.New to Minecraft Datapacks?Don't worry! You're in the right place. We've got a guide on\nhow to make a datapack for those of you with no or\nlittle experience. If you get stuck, don't hesitate to ask in our Discord\nServer. Pages on this wiki have been written with beginners in mind - you should\nhave no trouble working through these resources.What are Minecraft Datapacks?Minecraft Datapacks are like addons - they are a Minecraft feature that lets you\ncustomize Minecraft worlds without mods. They allow you to modify and enhance\nthe game by adding new features and mechanics by using Minecraft commands,\nadvancements, worldgen, and more!With datapacks, you can:Add and modify custom recipesModify existing or create new loot tablesAdd new advancements and enchantmentsCreate unique structuresAnd much more!ContributeThis project wouldn't be possible without the support of community members. We\nencourage you to contribute to this wiki if you want to write any pages, correct\nany mistakes, or share any of your knowledge!You can hit the Edit button on any page to open the GitHub page for the\ncurrent wiki page. All our contributions are done via GitHub and are written in\nMarkdown. For more information, find the Contribution section of this page, or\nread our contribution guide on our\nGitHub repo.","description":"Welcome to the Datapack Wiki, a resource for everything related to Minecraft Datapacks. We've got guides, tutorials, and documentation to help you build your knowledge about data packs.","url":"/","tags":[]},{"title":"Write Optimized Code","content":"How To Write Optimized CodePoorly written code might cause major lag and ruin user experience. To ensure\nseamless user experience, you should write optimized code.Identify the BottlenecksFirst step to writing optimized code is to identify the bottlenecks. A\nbottleneck is a specific part of your code that hinders performance. Then, you\nneed to replace performance heavy implementations with faster variations.\nBelow - we will identify and address every major performance bottleneck.Forking\nThe concept of forking is explained on\nthe execute page itself.\n\nexecute as fork the command execution into multiple branches, executing every\nbranch one by one.Minimize the Amount of ForkingIf you want to run multiple commands using the same selector and condition, you\nshould avoid writing code in the following way:execute as @a[tag=!already_acquired_apple] if items entity @s weapon apple run say I acquired my first apple\nexecute as @a[tag=!already_acquired_apple] if items entity @s weapon apple run give @s diamond[item_name=\"Reward\"]\nexecute as @a[tag=!already_acquired_apple] if items entity @s weapon apple run tag @s add already_acquired_apple\nThis code above forks multiple times for the same selector and condition.\nThis is very inefficient. Instead, you should fork once, and call a function.\nLike this:execute as @a[tag=!already_acquired_apple] if items entity @s weapon apple run function acquired_apple\nsay I acquired my first apple\ngive @s diamond[item_name=\"Rewards\"]\ntag @s add already_acquired_apple\nMinimize the Amount of BranchesTo optimize forking, you need to minimize the amount of branches. Forking\ncreates one branch per entity, so you need to write very specific selectors that\nselect few entities.Use many selector arguments to narrow down the amount of branches. You should\nespecially make use of tag= argument by adding tags to specific entities\nfirst, and then using them. As well as distance=, limit=, type= and other\narguments.Nested ForkingSometimes, every branch that was already forked, gets forked again. That is\ncalled nested forking. If forking is nested, the total amount of branches is\ngoing to be equal to *.execute as @e[type=pig] at @e[type=cow] run say hello\nLet's explore an example where in a world with 100 pigs and 200 cows you run the\ncommand above. Since the execution forks twice, first after as @e and then\nafter at @e that leads to nested forking. Resulting in a total of\n100 * 200 = 20,000 branches. That is equivalent of 20.000 say commands ran\nat the same time.Notice how rapidly that amplifies the amount of commands. This is precisely why\nyou should always keep track of execute subcommands that fork the execution,\nbecause even the smallest mistake can cause exponential growth.That also means, you shouldn't\nID search\nfor all entities. ID search itself already forks once. Therefore, running an ID\nsearch for all entities, would result in nested forking.Slow OperationsMacro functions and entity / block\nNBT operations are two of the slowest operations in\nthe game.Macro functions are very slow, because they have to be re-evaluated every time\nyou run them. It is best that you avoid any macro functions, unless absolutely\nnecessary.All NBT operations on a block or an entity\nwhether a modifying, copying or using in a condition are slow. You should always\navoid running block / entity NBT operations every tick.It is okay to perform those operations on rarely occuring events. That way, the\nbrief lag spike does not ruin user experience.If a slow operation is unavoidable, you can put it behind a condition. That way,\nthe slow operation does not get executed all the time, but only when that\ncondition is met. For example, if you wanted to modify every pig's NoAI data,\nyou can do the following.execute as @e[type=pig] unless entity @s[tag=disabled_ai] run function example:disable_ai\ndata modify entity @s NoAI set value true\ntag @s add disabled_ai\nIn this example, to avoid mindlessly modifying NBT of every pig, we tag all pigs\nwith modified NBT. Then we add a condition to only modify NBT of pigs without\nthe tag, so that we dont run the NBT operations twice on the same pig.Scoreboard Event DetectionUsing scoreboards to detect events (such as breaking a block), requires running\na condition check every tick. Detecting many events like this may cause lag.Instead,\nuse advancements to detect events\nwhenever possible. Advancements do not have to check for condition every tick to\ndetect an event, unlike scoreboards.Recursion\nloop,\nraycast, or an\narray iteration should be used\ncarefully.Avoid the following:Combining recursive functions with forking.Recursive functions within recursive functions (Nested recursion).Running recursive functions every tick or upon often occuring eventsToo many recursion calls. For example a long distance raycast, large loop, or\niteration over a long array.\n","description":"Learn how to optimize a minecraft datapack.","url":"/guide/performance/write-optimized-code/","tags":[]},{"title":"How to Measure Performance","content":"How to Measure PerformanceDatapacks are server side - they run on the server. The \"server\" is the brain of\nthe world. It handles all the logic of the world.Generating new chunks as players explore the world.Validating player interactions such as mining blocks.Mob behaviour. All mob AI, pathfinding, targeting, etc.And so on...Server performance is measured in TPS - ticks per second.\nServer updates the game state every tick. Calculates mobs' positions and state,\nvalidating player actions like breaking and placing blocks, and processes all\nother game logic.Server normally runs at 20 TPS. However, if the server is overloaded with\ncomputations - it makes the individual tick longer, to keep up with all the\ncomputations. That leads to lower TPS, which causes lag and delay for all\nplayers. Blocks disappearing, or breaking too slowly, mobs behaviour slowing\ndown, this is all due to low TPS.Measure Overall PerformanceYou can toggle the TPS graph using F3 + 2.TPS graph showcaseGraph shows the last 240 ticks, each tick represented as a thin colored line.\nThere are a total of 4 possible colors, stacked onto each other like layers.\nEach color serves it's own purpose.Layer 1 Dark red is time spent for the main logic of the tick. Bottom layer.Layer 2 Light brown is time spent running scheduled tasks.Layer 3 Purple is time spent executing all other code.Layer 4 Green / Yellow / Red (depending on lag) is time spent waiting for the next tick. Top layer.Then, on top of the graph you can see 3 numbers: min, avg, max. They show the\nhow much time in milliseconds it took to compute for the shortest, average and\nlongest tick, currently visible on the graph.If the longest tick (max) on the graph took less than 50ms (length of a single\ntick) the TPS is good. The server is able to process all logic in time. Otherwise,\nif max is above 50 and the lines high enough to cross over the border, the TPS is\nsuffering.BenchmarkingBenchmarking is also a way of measuring performance. However, unlike the TPS\ngraph, benchmarking measures the performance of a specific chunk of code in a\ndatapack, rather than general performance of the server.Benchmarking results are inconsistent across PCs due to different hardware\nspecifications. However, the difference in results between two different\nbenchmarks is usually somewhat consistent, even across different PCs. This is\nwhy benchmarking is generally used for comparing the performance of different\nimplementations.How Benchmarking Works\nA recursive function is a function that runs itself repeatedly. A single\nrecursive function call is called an iteration.\n\npossible, for 40ms every tick.High level overview of the implementation:Move world border by a 1000 blocks in 1 second.Start recursively running the function, until the world border has moved by 40\nblocksRepeat this cycle for a 100 more ticks (5 seconds)Then, measure the average amount of iterations across the 100 ticks. This works,\nbecause world border movement does not depend on ticks, and moves in real time.Benchmark ToolsWhile you could write your own benchmark,\nwe recommend using Kragast's Benchmark datapack,\nsince it makes benchmarking easier.The following section will explain how to\nuse Kragast's Benchmark datapack using an example. This datapack measures the\nperformance of a function by running it repeatedly as many times as possible\nbefore the game starts to lag. The more times your function ran - the more\nperformant it is.To start, download the datapack, unzip, and open it. In the function folder\nunder the benchmark namespace you will notice a few functions for you to use.📄 config.mcfunction📄 order.mcfunctionFunctions above are used to customize the behavior of the benchmark datapack.\nThere are many settings, every option is documented within the config function\nusing comments. For this example, the default settings are good enough so we\nwill not change anything.📄 test.mcfunction📄 test2.mcfunctionFunctions above will both be running repeatedly to test their performance.\nFor this example, let's compare a scoreboard check with an entity NBT check.\nBut you can write your own tests, and compare anything you want. First, create a\nbunch of armor_stand entities in an empty world. Then put the following code in\ntest and test2 functions.execute as @e[type=armor_stand] if score @s test matches 1.. \nexecute as @e[type=armor_stand] if data entity @s {ShowArms:false}\nNow, all that is left is to run function #benchmark:get_profile and wait for\nthe result.Reading ResultsBenchmark ResultsWith the previously mentioned setup, and a total of 300 armor stands in the\nworld, these are the results i ended up with. Yellow number is the amount of\ntime a function was ran. Bigger number - faster execution, better performance.Function 0: This is the control function. It is always empty, and is only\nhere to provide a baseline to compare to.Function 1: This is the test function, the one with scoreboard check.Function 2: This is the test2 function, the one with entity NBT check.Since the test function executed more frequently, it has better\nperformance compared to test2.","description":"Learn about the performance impact of a datapack.","url":"/guide/performance/how-to-measure/","tags":[]},{"title":"Installing a Datapack","content":"IntroductionSo you've found a nice datapack for Minecraft, and the next step is to get it\ninto your game. This guide will explain how to install a datapack onto a world\nwhich exists, a new world.Installing a datapack to an existing worldIn your world menu, find the world which you want to install the datapack on.\nClick Edit.\nThe singleplayer menuOpen the world folder.\nThe edit menuIn the world folder, open the datapacks folder.\nWorld folder with datapacks highlightedPut the datapack zip file into the folder.\nzip folder in datapacks folderIf the zip folder contains a folder which contains data and\npack.mcmeta, then put that folder in the datapacks folder instead of the\nfull zip. Putting the zip in the datapacks folder only works when\ndata and pack.mcmeta are directly in the root folder of the zip.Rejoin the world and run /reload.\nReload command in chatInstalling a datapack to an new worldGo to the Create New World screen. Make sure that you enable cheats.\nCreate new world screenNavigate to the Data Packs screen. This is under the \"More\" tab in the latest\nversions.\nThe Data Packs screen optionDrag and drop the datapack zip into this screen.\nThe Data Packs screen after I dragged and dropped something inIf it doesn't show up, then it's likely that the zip file contains a folder\nwhich contains the datapack, and not the zip file just containing the\ndatapack. You need to take the folder out of the datapack, and put it in\nthe datapacks folder (click the \"Open Packs Folder\" button to open it.)Click on the datapack icon to apply it to the world.\nThe Data Packs screen after I clicked the iconCreate the world, and then run /reload in chat.\nReload command in chatInstalling a datapack to a realmTo install a datapack to a realm, you need to basically do this:Download the world from the realm into your singleplayer worlds.Follow the steps in \"Installing a datapack to an existing world\" to\ninstall a datapack on that world.Upload that world to your realm.","description":"So you've found a nice datapack for Minecraft, and the next step is to get it into your game. This guide will explain how to install a datapack onto a world which exists, a new world.","url":"/guide/installing-a-datapack/","tags":[]},{"title":"Adding Paintings","content":"How to add custom paintingsBy the end of this guide, you will be able to implement your own custom\npaintings, which will show up in the creative inventory.This will only work in 1.21+, as custom painting variants were added in the\nsnapshot 24w18a.\nyou don't understand this guide, you can read the\nGetting Started guide.\nthe Getting Started guide.Firstly, we are going to create the main painting variant file in the directory\ndata/ /painting_variant/. You can name the file whatever you want,\nbut it has to be in the .json file format. For the purposes of this tutorial,\nwe're going to call it example_painting.json. Inside, we will put and\nconfigure these settings:{\n\"asset_id\": \":example_painting-texture\",\n\"title\": \"Example Painting\",\n\"author\": \"Datapack Hub\",\n\"height\": 1,\n\"width\": 1\n}\nThis is a run-down of the fields in that file:title: A text component to use as this paintings title.author: A text component to use as this paintings author.height: A value between 1 and 16, represents the height of the painting when\nplaced.width: A value between 1 and 16, represents the width of the painting when\nplaced.asset_id: The resource location of the paintings texture to use. In this\nexample, example:texture_name would direct to\nassets/example/textures/painting/texture_name.png.If you are not sure what to put in asset_id, don't worry, the resource pack\npart is going to focus on that!To finish with the datapack, we are going to have to add the newly created\npainting into Minecraft's #minecraft:placeable painting variant tag. This will\nallow the painting to be placed via the Painting item, and to be added to the\ncreative inventory. To do this, create a new file called placeable.json under\ndata/minecraft/tags/painting_variant/placeable.json. Please note that the\nexact spelling and the use of the Minecraft namespace is required here!{\n\"values\": [\n\":example_painting\"\n]\n}\nFinish off with the Resource PackLastly, we are going to add the actual painting texture file. This has to be\nplaced in assets/example/textures/painting/.png This\ntexture, of course, has to have the same dimensions as the width and height you\npreviously entered into the painting variant definition file.Optionally, you can change the author and title in the datapack definition to\nuse a resourcepack translation file. Which can be added into\nassets/example/lang/.json under\n\"painting..example_painting.\".See it in actionOnce you save the above files, you need to reload the resource pack with the\nkeybind F3 + T in-game. You will also need to leave and rejoin the world to\nupdate the datapack.\n/reload command won't do the trick here!\ninto a 1x1 spot, or by searching for \"Example Painting\" in the creative\ninventory.","description":"Learn how to add custom paitings to Minecraft just with a datapack and a resourcepack!","url":"/guide/adding-new-features/painting-variants/","tags":[]},{"title":"Adding Smithing Trims","content":"How to add custom Smithing TrimsThis guide is split into three parts, adding a custom smithing trim pattern,\nadding a custom smithing trim color palette and adding a custom trimmable item.\nThese parts can be seperately without following each other.\nyou don't understand this guide, you can read the\nGetting Started guide.\nthe Getting Started guide.Adding a smithing trim patternSetting up the datapack - Smithing Trim PatternTo start, we are going to create the main trim pattern file in the directory\ndata/ /trim_pattern/. You can name the file whatever you want, but\nit has to be in the .json file format. For the purposes of this tutorial,\nwe're going to call it example_pattern.json. Inside, we will put and configure\nthese settings:{\n\"asset_id\": \":example_template\",\n\"description\": \"Example Trim\",\n\"decal\": false\n}\nThis is a run-down of the fields in that file:description: A text component to use as this trim's description name.asset_id: The resource location which is used in the resourcepack.decal: Whether or not the pattern texture should be masked based on the\nunderlying armor. Optional, defaults to false.If you are not sure what to put in asset_id, don't worry, the resource pack\npart is going to focus on that!Now, we are going to add the recipe file into data/ /recipe/. You\ncan see more about the recipe's format\nhere.{\n\"type\": \"minecraft:smithing_trim\",\n\"addition\": \"#minecraft:trim_materials\",\n\"base\": \"#minecraft:trimmable_armor\",\n\"template\": \"minecraft:diamond_block\",\n\"pattern\": \":example_template\"\n}\nHere we have to specify the template item which is going to be used for the\npattern, and the trim pattern ID itself.Finishing up with the resourcepack - Smithing Trim PatternTo finish off, we'll need to add the actual definition for all the different\ncolors and armor types. This can be done by changing the armor trim's atlas\nfile. This file can be found in assets/minecraft/atlases/armor_trims.json.\nPlease note that the exact spelling and the use of the Minecraft namespace is\nrequired here!{\n\"sources\": [\n{\n\"type\": \"minecraft:paletted_permutations\",\n\"textures\": [\n\":trims/entity/humanoid/example_template\",\n\":trims/entity/humanoid_leggings/example_template\"\n],\n\"palette_key\": \"trims/color_palettes/trim_palette\",\n\"permutations\": {\n\"quartz\": \"trims/color_palettes/quartz\",\n\"iron\": \"trims/color_palettes/iron\",\n\"gold\": \"trims/color_palettes/gold\",\n\"diamond\": \"trims/color_palettes/diamond\",\n\"netherite\": \"trims/color_palettes/netherite\",\n\"redstone\": \"trims/color_palettes/redstone\",\n\"copper\": \"trims/color_palettes/copper\",\n\"emerald\": \"trims/color_palettes/emerald\",\n\"lapis\": \"trims/color_palettes/lapis\",\n\"amethyst\": \"trims/color_palettes/amethyst\",\n\"iron_darker\": \"trims/color_palettes/iron_darker\",\n\"gold_darker\": \"trims/color_palettes/gold_darker\",\n\"diamond_darker\": \"trims/color_palettes/diamond_darker\",\n\"netherite_darker\": \"trims/color_palettes/netherite_darker\",\n\"resin\": \"trims/color_palettes/resin\"\n}\n}\n]\n}\nAnd now to finish, we'll need the actual trim textures. These should be\ngrayscale images using the same colors as\ntextures/trims/color_palettes/trim_palette (can be seen below).These black-and-white colors will be automatically replaced by the game when a\ntrim color palette is applied. An example file of\n /textures/trims/entity/humanoid/example_template and\n /textures/trims/entity/humanoid_leggings/example_template can also\nbe found below.Once you save the above files, you need to reload the resource pack with the\nkeybind F3 + T in-game. You will also need to leave and rejoin the world to\nupdate the datapack.\n/reload command won't do the trick here!\ngoing to create the main trim color palette file in the directory\ndata/ /trim_material/. Once again, you can name the file whatever\nyou want, but it has to be in the .json file format. For the purposes of this\ntutorial, we're going to call it matexample.json. Inside, we will put and\nconfigure these settings:{\n\"asset_name\": \"matexample\",\n\"description\": {\n\"text\": \"Example Material\",\n\"color\": \"#00e09d\"\n}\n}\nThis is a run-down of the fields in that file:description: A text component to use as this trim's material description\nname.asset_name: The resource location which is used in the resourcepack.override_armor_materials: A list of optional armors which should have a\ndifferent color palette. (E.g. Gold trim on gold armor has a darker color\npalette.)Next, we are going to add the ingredient item to the\n#minecraft:trim_materials item tag. This ensures the item can be used as an\ningredient in the smithing table. This file is located in\ndata/minecraft/tags/item/. Please note that the exact spelling and the use of\nthe Minecraft namespace is required here!{\n\"values\": [\n\"minecraft:barrier\"\n]\n}\nAs of 1.21.5, every item you want to work as a trim material, needs to have the\nprovides_trim_material\nitem component. So to give ourselfs a barrier which provides our custom trim\nmaterial, we can use this /give command:/give @s barrier[provides_trim_material=\":matexample\"] 1\nFinishing up with the resourcepack - Smithing Trim MaterialTo finish off, we'll need to add the material definition in the resourcepack.\nThis can be done by changing the armor trim's atlas file. This file can be found\nin assets/minecraft/atlases/armor_trims.json. Please note that the exact\nspelling and the use of the Minecraft namespace is required here!{\n\"sources\": [\n{\n\"type\": \"paletted_permutations\",\n\"textures\": [\n\"trims/entity/humanoid/bolt\",\n\"trims/entity/humanoid_leggings/bolt\",\n\"trims/entity/humanoid/flow\",\n\"trims/entity/humanoid_leggings/flow\",\n\"trims/entity/humanoid/coast\",\n\"trims/entity/humanoid_leggings/coast\",\n\"trims/entity/humanoid/sentry\",\n\"trims/entity/humanoid_leggings/sentry\",\n\"trims/entity/humanoid/dune\",\n\"trims/entity/humanoid_leggings/dune\",\n\"trims/entity/humanoid/wild\",\n\"trims/entity/humanoid_leggings/wild\",\n\"trims/entity/humanoid/ward\",\n\"trims/entity/humanoid_leggings/ward\",\n\"trims/entity/humanoid/eye\",\n\"trims/entity/humanoid_leggings/eye\",\n\"trims/entity/humanoid/vex\",\n\"trims/entity/humanoid_leggings/vex\",\n\"trims/entity/humanoid/tide\",\n\"trims/entity/humanoid_leggings/tide\",\n\"trims/entity/humanoid/snout\",\n\"trims/entity/humanoid_leggings/snout\",\n\"trims/entity/humanoid/rib\",\n\"trims/entity/humanoid_leggings/rib\",\n\"trims/entity/humanoid/spire\",\n\"trims/entity/humanoid_leggings/spire\",\n\"trims/entity/humanoid/silence\",\n\"trims/entity/humanoid_leggings/silence\",\n\"trims/entity/humanoid/wayfinder\",\n\"trims/entity/humanoid_leggings/wayfinder\",\n\"trims/entity/humanoid/raiser\",\n\"trims/entity/humanoid_leggings/raiser\",\n\"trims/entity/humanoid/shaper\",\n\"trims/entity/humanoid_leggings/shaper\",\n\"trims/entity/humanoid/host\",\n\"trims/entity/humanoid_leggings/host\"\n],\n\"palette_key\": \"trims/color_palettes/trim_palette\",\n\"permutations\": {\n\"matexample\": \":trims/color_palettes/matexample\"\n}\n}\n]\n}\nAnd next, we are going to modify assets/minecraft/atlases/blocks.json:{\n\"sources\": [\n{\n\"type\": \"paletted_permutations\",\n\"textures\": [\n\"trims/items/leggings_trim\",\n\"trims/items/chestplate_trim\",\n\"trims/items/helmet_trim\",\n\"trims/items/boots_trim\"\n],\n\"palette_key\": \"trims/color_palettes/trim_palette\",\n\"permutations\": {\n\"matexample\": \":trims/color_palettes/matexample\"\n}\n}\n]\n}\nHere, the key-value pair under permutations should be the same as the\nasset_name field from the datapack file we created before.Now, we will need to create the actual material color palette texture. Since we\nare using Vanilla's default palette_key, this image needs to have a width of 8\nand a height of 1. You can see an example palette below. This image should be\nsaved in assets/ /textures/trims/color_palettes/ as\nmatexample.png.Now comes the last and also hardest part, adding the item models and their\ndefinition for all the armor pieces. I will only show this on the diamond\nchestplate but you will have to create a file for every single armor pieces!To do this, create a new file in assets/minecraft/models/item/ called\ndiamond_chestplate_matexample_trim.json, where matexample is the name of\nyour trim material. Inside that file, put this:{\n\"parent\": \"minecraft:item/generated\",\n\"textures\": {\n\"layer0\": \"minecraft:item/diamond_chestplate\",\n\"layer1\": \"minecraft:trims/items/diamond_chestplate_matexample_trim\"\n}\n}\nAnd inside assets/minecraft/items/diamond_chestplate.json put and configure\nthis:{\n\"model\": {\n\"type\": \"minecraft:select\",\n\"cases\": [\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_quartz_trim\"\n},\n\"when\": \"minecraft:quartz\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_iron_trim\"\n},\n\"when\": \"minecraft:iron\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_netherite_trim\"\n},\n\"when\": \"minecraft:netherite\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_redstone_trim\"\n},\n\"when\": \"minecraft:redstone\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_copper_trim\"\n},\n\"when\": \"minecraft:copper\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_gold_trim\"\n},\n\"when\": \"minecraft:gold\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_emerald_trim\"\n},\n\"when\": \"minecraft:emerald\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_diamond_trim\"\n},\n\"when\": \"minecraft:diamond\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_lapis_trim\"\n},\n\"when\": \"minecraft:lapis\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_amethyst_trim\"\n},\n\"when\": \"minecraft:amethyst\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_resin_trim\"\n},\n\"when\": \"minecraft:resin\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate_matexample_trim\"\n},\n\"when\": \":matexample\"\n}\n],\n\"fallback\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_chestplate\"\n},\n\"property\": \"minecraft:trim_material\"\n}\n}\nHere, the majority of the file remains the same as default, only the last trim\nmodel definition was added.Once you save the above files, you need to reload the resource pack with the\nkeybind F3 + T in-game. You will also need to leave and rejoin the world to\nupdate the datapack.\n/reload command won't do the trick here!\ndatapack side of things is very simple. We only need to add the\ndiamond_pickaxe to the #minecraft:trimmable_armor item tag, which is located\nin data/minecraft/tags/item/. Once again, the Minecraft directory is required\nhere.{\n\"values\": [\n\"minecraft:diamond_pickaxe\"\n]\n}\nFinishing up with the resourcepack - Smithable ItemIn the resourcepack, we'll need to customize the diamond pickaxe's item model\ndefinition. This is located inside of assets/minecraft/items/.{\n\"model\": {\n\"type\": \"minecraft:select\",\n\"cases\": [\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_quartz_trim\"\n},\n\"when\": \"minecraft:quartz\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_iron_trim\"\n},\n\"when\": \"minecraft:iron\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_netherite_trim\"\n},\n\"when\": \"minecraft:netherite\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_redstone_trim\"\n},\n\"when\": \"minecraft:redstone\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_copper_trim\"\n},\n\"when\": \"minecraft:copper\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_gold_trim\"\n},\n\"when\": \"minecraft:gold\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_emerald_trim\"\n},\n\"when\": \"minecraft:emerald\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_diamond_trim\"\n},\n\"when\": \"minecraft:diamond\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_lapis_trim\"\n},\n\"when\": \"minecraft:lapis\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_amethyst_trim\"\n},\n\"when\": \"minecraft:amethyst\"\n},\n{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe_resin_trim\"\n},\n\"when\": \"minecraft:resin\"\n}\n],\n\"fallback\": {\n\"type\": \"minecraft:model\",\n\"model\": \"minecraft:item/diamond_pickaxe\"\n},\n\"property\": \"minecraft:trim_material\"\n}\n}\nNext we will need to create the following file for every single material\nlisted in the file above. All of the files need to be located inside\nassets/minecraft/models/item/ directory. For the purpose of this guide, i will\nonly create one for the resin material.{\n\"parent\": \"minecraft:item/generated\",\n\"textures\": {\n\"layer0\": \"minecraft:item/diamond_pickaxe\",\n\"layer1\": \"minecraft:trims/items/pickaxe_trim_resin\"\n}\n}\nYou might have noticed that the file above mentions a pickaxe_trim_resin\ntexture. Fortunately, we do not need to create this texture file as it is\ngenerated automatically by the game. But for it to work, we need to create the\natlas file inside assets/minecraft/atlases/blocks.json.{\n\"sources\": [\n{\n\"type\": \"paletted_permutations\",\n\"textures\": [\n\"trims/items/pickaxe_trim\"\n],\n\"palette_key\": \"trims/color_palettes/trim_palette\",\n\"permutations\": {\n\"quartz\": \"trims/color_palettes/quartz\",\n\"iron\": \"trims/color_palettes/iron\",\n\"gold\": \"trims/color_palettes/gold\",\n\"diamond\": \"trims/color_palettes/diamond\",\n\"netherite\": \"trims/color_palettes/netherite\",\n\"redstone\": \"trims/color_palettes/redstone\",\n\"copper\": \"trims/color_palettes/copper\",\n\"emerald\": \"trims/color_palettes/emerald\",\n\"lapis\": \"trims/color_palettes/lapis\",\n\"amethyst\": \"trims/color_palettes/amethyst\",\n\"resin\": \"trims/color_palettes/resin\"\n}\n}\n]\n}\nNow for the last step, we will need to create the pickaxe_trim texture. This\nis a black-and-white mask which is applied on-top of the diamond pickaxe when it\nhas a trim applied. Please note that the file has to use the same colors as\nVanillas textures/trims/color_palettes/trim_palette (this file can be seen in\nthe\nSmithing Trim Pattern\nchapter.) This image has to be located in\nassets/minecraft/textures/trims/items/ with the name pickaxe_trim.png The\ntexture I used can be found below:Once you save the above files, you need to reload the resource pack with the\nkeybind F3 + T in-game. You will also need to leave and rejoin the world to\nupdate the datapack.\n/reload command won't do the trick here!","description":"Learn how to add custom smithing trims patterns to Minecraft just with a datapack and a resourcepack!","url":"/guide/adding-new-features/smithing-trims/","tags":[]},{"title":"Recipes for your Custom Items","content":"Creating Recipes for your Custom ItemsThere are two ways to add recipes to your custom items, they differentiate based\non what Minecraft version you are developing for. The first one is for the\nMinecraft version 1.20.5+ (Datapack format 34+), here items can be directly\nspecified in the output with item components.\nThe second method is for all version before 1.20.5.1.20.5 and newerThis is the easier method of the two, only requiring you to put the item id and\ncomponents into the recipe output.\ninput items, only in the result. Meaning your custom item can't (easily) be\ncrafted out of different custom items.\nfile, that being the actual crafting recipe file. This file can be named\nwhatever, but has to end in the .json file format.Here is an example of a recipe with the output of a custom item:{\n\"type\": \"minecraft:crafting_shaped\",\n\"pattern\": [\n\"ttt\",\n\" s \",\n\" s \"\n],\n\"key\": {\n\"t\": {\n\"item\": \"minecraft:turtle_scute\"\n},\n\"s\": {\n\"item\": \"minecraft:stick\"\n}\n},\n\"result\": {\n\"id\": \"minecraft:iron_pickaxe\",\n\"count\": 1,\n\"components\": {\n\"minecraft:tool\": {\n\"rules\": [\n{\n\"blocks\": \"minecraft:turtle_egg\",\n\"speed\": 6,\n\"correct_for_drops\": true\n}\n],\n\"default_mining_speed\": 3,\n\"damage_per_block\": 1\n},\n\"minecraft:item_name\": \"{\\\\\\\"text\\\\\\\":\\\\\\\"sCUTE-axe\\\\\\\"}\"\n}\n}\n}\nIn the example, you can see that the result has a \"components\" field, where\nyou can list the components that your custom item should have. I can also\nrecommend a useful site for generating recipes with specified components:\nhttps://misode.github.io/recipe/1.20.4 and belowThis part of the guide assumes that you already knowledge some basic commands\nand how crafting recipes and advancements work.To create a crafting recipe for one of your custom items, you need just a little\nbit more than for a normal recipe. This is because of the fact that you couldn't\nuse NBT in recipes before 1.20.5 dropped, so that's why we need a small\nworkaround.Lets create the recipe first:{\n\"type\": \"minecraft:crafting_shaped\",\n\"pattern\": [\n\"ttt\",\n\" s \",\n\" s \"\n],\n\"key\": {\n\"t\": {\n\"item\": \"minecraft:turtle_scute\"\n},\n\"s\": {\n\"item\": \"minecraft:stick\"\n}\n},\n\"result\": {\n\"item\": \"minecraft:knowledge_book\"\n}\n}\nAs mentioned before, we can't use the custom item as output, so we use the\nknowledge book as a placeholder.To switch the knowledge book with our custom item, we need an advancement to\nreact when we craft the recipe. For this we use the recipe_crafted trigger.\nWith some trickery, here it is also possible to make the ingredients require\ncertain nbt.{\n\"criteria\": {\n\"requirement\": {\n\"trigger\": \"minecraft:recipe_crafted\",\n\"conditions\": {\n\"recipe_id\": \":scuteaxe\"\n}\n}\n},\n\"rewards\": {\n\"function\": \":craft_scuteaxe\"\n}\n}\nLastly we have to make the actual function that handles the item switching. You\ncan either use a give command or, what I recommend more, define the item in a\nseparate loot table and then use the loot command.clear @s knowledge_book\nadvancement revoke @s only :craft_scuteaxe\n# Any code can go here, this will run when the player crafts the item.\nloot give @s loot :\n# You can also you a give command here instead\n\nthe files we've just created.","description":"Learn how to make custom crafting recipes for custom items in Minecraft Datapacks.","url":"/guide/adding-new-features/custom-items/crafting/","tags":[]},{"title":"Creating Custom Items","content":"Creating Custom ItemsIn this guide, we will go over the basics explaining how custom items work, as\nwell as how to make your own using item components. This guide will not go over\nhow to give your custom items a texture or model.Since 1.21, it has been easy to create custom items in Minecraft. 1.21\nintroduced item components, which are like\ntags you can put on items to change their appearance or functionality. This is\nthe basis for how custom items work - we take an item which already exists, then\nadd or remove item components from that item to give it the desired feel and\nfunctionality.In this guide, we will create a custom edible item which can mine sand instantly\nand makes the player who eats it glow.How do custom items work?Custom items are items with a unique set of item components to change their\nappearance and functionality. As of 1.21, we cannot create fully custom items -\ninstead, we need to take an item which exists, and add, remove, or edit their\nitem components to customise it.Item components cannot cover every desired functionality. An example of this is\ndoing something when the item is right clicked. We still have to use workarounds\nfor this, such as giving the item a food component to make it edible, then\ndetecting when a player starts eating it. You can read more about this in our\nright click detection summary.Creating our custom itemWe are going to create a custom item with the following properties:It can mine sand very quicklyIt is edible, and players who eat it will start glowingIt will be called Sandy McDesertfaceWe will use item components to give the item those properties. Item components\nare put after the item in our item's give command. For example:/give @s flint[minecraft:item_name=\"Sharp Rock\"]\nThese are all the item components which we are going to use.PropertyComponent neededOur componentMines sand very quicklyminecraft:tool is used to make items mine different blocks quickly[tool={default_mining_speed:1.5,damage_per_block:0,rules:[{blocks:\"minecraft:sand\",speed:100}]}]Is edible, makes the player glowminecraft:consumable makes items edible. We can also use it to specify an effect for the player to recieve.[consumable={on_consume_effects:[{type:\"minecraft:apply_effects\",effects:[{id:\"minecraft:glowing\",amplifier:1,duration:100}]}]}]Gives the player saturation and nutrition stats on consumptionminecraft:food gives the player saturation and nutrition after consuming it.[food={nutrition:3,saturation:1,can_always_eat:true}]Is called Sandy McDesertfaceminecraft:item_name overrides our item name.[item_name=\"Sandy McDesertface\"]Combining all of these together, we can create a give command for our custom\nitem:/give @s stick[tool={default_mining_speed:1.5,damage_per_block:0,rules:[{speed:100,blocks:\"sand\"}]},food={nutrition:3,saturation:1,can_always_eat:true},consumable={on_consume_effects:[{type:\"minecraft:apply_effects\",effects:[{id:\"minecraft:glowing\",amplifier:1,duration:100}]}]},item_name='\"Sandy McDesertface\"'] 1\n\nan existing item. We do not yet have the functionality to create our own item\nIDs. However, we can make use of the item_model component to change the model\nor texture of an item as explained in\nthis guide.","description":"Learn how to make custom items with Minecraft Java datapacks","url":"/guide/adding-new-features/custom-items/intro/","tags":["beginner","guide","custom_items","item_components"]},{"title":"Creating Custom Item Models and Textures","content":"Creating Custom Item Models and TexturesThis guide uses the item_model item component to change the model and texture\nof items with that component. It does not replace any vanilla items. It also\ngoes over\nspawning custom models in your world as an entity.\nitems. It was replaced with item models in Minecraft version 1.21.4, so it won't\nwork in later versions. Item Models use a completely different method\ncompared to Custom Model Data.\nyou already have a resource pack or know how to create one, you can skip to\nAdding custom items. If not, just continue reading.Creating an empty resource packBefore creating your custom item, you will have to create a basic resource pack.\nFor that, create an empty folder in your minecraft/resourcepacks directory.\nCreate a new file in that folder called pack.mcmeta and add the following\ntext:{\n\"pack\": {\n\"pack_format\": 69,\n\"description\": \"\"\n}\n}\nAdd a new folder named assets, and a folder inside with the name of your\nnamespace. This should be the name of your resource pack, in small letters\nand with underscores (_) as spaces.Now to the fun part.Adding custom itemsYou will now have to decide it you want a simple,\n2d item (like for example a Totem of Undying) or a\ncustom 3d model.Adding custom 2d itemsTo add a custom texture, make sure it's a png and place it in the\nassets/namespace/textures/item directory. You can give it any name, but it\nmakes sense to keep it lowercase and without spaces. Your texture will also have\nto have a 16x16 size.Now, you will add the default Minecraft model for 2-dimensional items to your\ncustom item. To do that, create a file in\nassets/namespace/models/item/your_item.json with the following contents:{\n\"parent\": \"item/generated\",\n\"textures\": {\n\"layer0\": \"namespace:item/your_texture\"\n}\n}\nYou can now continue reading at\nAdding the item_modelAdding custom 3d modelsFor creating your custom model, I recommend using\nBlockbench. It's the most popular Minecraft model\ncreation tool and even used by Minecraft itself. Export both the texture and the\nmodel as a Block/Item model.When you have your model and texture file, you will have to place your model in\nthe assets/namespace/models/item/your_model.json folder and your texture in\nassets/namespace/textures/item/your_item.json. You can use any name, but it\nmakes sense to keep it lowercase and with underscores (_) instead of\nspaces.TexturesYour model file will now probably look like this:JSON of the model fileReplace all the values inside the textures bracket with\nnamespace:item/your_texture.\ncreate this file in assets/namespace/items/your_item.json:{\n\"model\": {\n\"type\": \"minecraft:model\",\n\"model\": \"namespace:item/your_item_model\"\n}\n}\nThis binds your model to the item_model component.You can now add your texture to any item using this command:/give @s [item_model=\"namespace:your_item\"]\n\nvanilla item texture without a resource pack nor a data pack using a command\nlike this:/give @s [item_model=\"minecraft:vanilla_item\"]\n\nDisplay. An item display does what the name suggests: It displays items. And\nsince you can change the model and texture of an item, you can also change them\non an item display. You can spawn an item displays with your custom\nmodel/texture like this:/summon item_display ~ ~ ~ {item:{id:\"minecraft:paper\",count:1,components:{\"minecraft:item_model\":\"namespace:your_item\"}}}\n\nyour models. The best you can do is using multiple item displays and teleporting\nthem/changing their transformation data. ","description":"Learn how to make custom item models and textures with Minecraft Java resource packs","url":"/guide/adding-new-features/custom-items/models/","tags":[]},{"title":"Adding Mob Variants","content":"How to add custom mob variantsBy the end of this guide, you will be able to add your own naturally spawning\nmob variants, including custom spawn conditions.This will only work in 1.21.5+, as data-driven mob variants were added in the\nsnapshot 25w04a. \nunderstanding of datapacks. If you don't understand this guide, you can read the\nGetting Started guide. \nthe Getting Started guide.Firstly, we are going to create the main cat variant file in the directory\ndata/ /cat_variant/. You can name the file whatever you want, but it\nhas to be in the .json file format. For the purposes of this tutorial, we're\ngoing to call it example_cat.json. Inside, we will put and configure these\nsettings:{\n\"asset_id\": \"example:entity/cat/example_cat\",\n\"baby_asset_id\": \"example:entity/cat/custom_baby_cat\",\n\"spawn_conditions\": [\n{\n\"priority\": 0\n}\n]\n}\nThis is a run-down of the fields in that file:asset_id: The resource location of the paintings texture to use. In this\nexample, example:entity/cat/example_cat directs to\nassets/example/textures/entity/cat/example_cat.png.spawn_conditions: A list of spawn conditions, each with a priority. Right\nnow we only have one, with a priority of 0. This means it will spawn like any\nother cat texture.Settings up the resource packNext we are going to add the actual texture file for the cat variant. This needs\nto be placed in assets/ /textures/entity/cat/, and match the name\nyou specified in the asset_id field earlier. In this example that is\nexample_cat.png.TestingIf you load the datapack and the resource pack, you should now be able to spawn\nyour cat using /summon minecraft:cat ~ ~ ~ {variant:\"example:example_cat\"}\nusing the /reload command won't do the trick here! \nfield in the .json file you created earlier.{\n\"asset_id\": \"example:entity/cat/custom\",\n\"baby_asset_id\": \"example:entity/cat/custom_baby_cat\",\n\"spawn_conditions\": [\n{\n\"condition\": {\n\"type\": \"minecraft:structure\",\n\"structures\": \"minecraft:village_snowy\"\n},\n\"priority\": 1\n},\n{\n\"condition\": {\n\"type\": \"minecraft:biome\",\n\"biomes\": \"snowy_taiga\"\n},\n\"priority\": 1\n},\n{\n\"priority\": 0\n}\n]\n}\nThis cat variant will spawn with a priority level of 1 if it spawns in a snowy\nvillage or a snowy taiga. If another cat variant were to meet its spawn\nconditions, the game would randomly select a variant.For more spawn conditions, see\nthis page on\nthe minecraft wiki.Other mobs with variantsYou can also add variants for these mobs:chickencowfrogpigwolfzombie nautilusFor example, if you wanted to add a frog variant, you would:Create a variant file in data/ /frog_variantAdd something like the following to the file:{\n\"asset_id\": \"example:entity/frog/example_frog\",\n\"spawn_conditions\": [\n{\n\"priority\": 0\n}\n]\n}\nAdd the texture to assets/ /textures/entity/frog/example_frogMobs with additional fieldsIf you want to add a chicken, cow, or pig variant, you'll also need to specify\nthe model field, like this:{\n\"asset_id\": \"example:entity/cow/example_cow\",\n\"baby_asset_id\": \"example:entity/cow/example_cow_baby\",\n\"model\": \"normal\",\n\"spawn_conditions\": [\n{\n\"priority\": 0\n}\n]\n}\nThe model field can be:normal, cold or warm for cowsnormal or cold for chickens and pigsnormal or warm for zombie nautiliIf you want to add a wolf variant, you'll need to specify 3 textures, like this:{\n\"assets\": {\n\"angry\": \"example:entity/wolf/example_wolf_angry\",\n\"tame\": \"minecraft:entity/wolf/example_wolf_tame\",\n\"wild\": \"minecraft:entity/wolf/example_wolf\"\n},\n\"baby_assets\": {\n\"angry\": \"example:entity/wolf/example_baby_wolf_angry\",\n\"tame\": \"minecraft:entity/wolf/example_baby_wolf_tame\",\n\"wild\": \"minecraft:entity/wolf/example_baby_wolf\"\n},\n\"spawn_conditions\": [\n{\n\"priority\": 0\n}\n]\n}\nIt's worth noting that you can't add custom variants for some mobs like Horses\nand Rabbits. If it's not in the list mentioned earlier, then it can't be added\nusing a datapack.","description":"Learn how to add custom mob variants with Minecraft datapacks","url":"/guide/adding-new-features/mob-variants/","tags":[]},{"title":"Adding Jukebox Songs","content":"How to add custom jukebox songsIn this guide, we will not only learn how to create custom jukebox songs, but\nalso how to give yourself a custom music disc item and implement custom sounds!This will only work in 1.21+, as custom jukebox songs were added in the snapshot\n24w21a.\nyou don't understand this guide, you can read the\nGetting Started guide.\nthe Getting Started guide.Firstly, we are going to create the actual jukebox song file in the directory\ndata/ /jukebox_song/. The file can be named whatever, but\nit has to be in the .json file format. For the purposes of this tutorial,\nwe're gonna call it example_jukebox_song.json. Inside, we will put and\nconfigure this:{\n\"comparator_output\": 13,\n\"description\": {\n\"text\": \"ARTIST - SONG NAME\"\n},\n\"length_in_seconds\": 69.0,\n\"sound_event\": {\n\"sound_id\": \":\"\n}\n}\nThis is a run-down of the fields in that file:comparator_output: A value between 1 and 15, representing the redstone\noutput when a comparator is placed next to the jukebox playing this song.description: The description of the enchantment (should be a JSON text\ncomponent).length_in_seconds: The length of the song (in seconds).sound_event: The ID of the sound (from the resource pack) to play.If you don't understand what to put in sound_event, don't worry, the next part\nis going to focus specifically on this!Adding custom music - Resource PackThis part is going to be optional in the case, that you only want a vanilla\nMinecraft sound to play from the jukebox. In that case, change the sound_id in\nthe example_jukebox_song.json file from the datapack to the sounds ID. (for\nexample: \"sound_id\": \"minecraft:music_disc.cat\").If you don't want to use a default Minecraft sound, then a resource pack is\nrequired to add the custom sound (in this case, the music on the disc) to\nMinecraft, so that the datapack can read it.\ncan use to convert an MP3, WAV, or other audio file to .ogg.\nassets/ /sounds/.ogg. Make sure thatand\nare the same values you put in the datapack's JSON file (the\nexample_jukebox_song.json file in our case).Then, if you haven't already, you need to create a sounds.json file at the\nposition assets/ /sounds.json. This file tells Minecraft what audio\nfiles map to what IDs. Put this inside:{\n\"music_disc.\": {\n\"sounds\": [\n{\n\"name\": \":\",\n\"stream\": true\n}\n]\n}\n}\nSee it in actionOnce you save the above files, you need to activate the resource pack with the\nkeybind F3 + T in-game. You will also need to leave and rejoin the world to\nupdate the datapack.\n/reload command won't do the trick here!\nminecraft:jukebox_playable component. This can be any item - it doesn't have\nto necessarily be an already existing music disc (but you can if you want).give @s minecraft:YOUR_ITEM[minecraft:jukebox_playable=\":example_jukebox_song\"]\nThen, you can use this item on a jukebox, and it should start playing your song!","description":"Learn how to create custom music discs and custom jukebox songs with Minecraft datapacks","url":"/guide/adding-new-features/jukebox-songs/","tags":[]},{"title":"How to Make a Minecraft Datapack - Beginner's Guide","content":"How to make a Minecraft DatapackDatapacks are a Minecraft feature that lets you customize Minecraft worlds\nwithout mods. They allow you to modify and enhance the game by adding new\nfeatures and mechanics by using Minecraft commands, advancements, worldgen, and\nmore! This guide will walk you through the process of creating your first\nMinecraft datapack from scratch in the latest version.\nessentially add-ons to Minecraft which can change the game, whether by adding a\nsimple game mechanic, or creating completely new experiences! The best part is\nthat they're really easy to create, even if you have little coding knowledge\ntried coding before or if you've got loads of experience. The process of coding\na datapack is a bit different to other typical programs. By the end of this\ntutorial, you'll have made a simple datapack which makes arrows explode when\nthey land!PrerequisitesMinecraft Datapacks basically just consist of text files inside folders. For\nthis reason, you can technically make a datapack with just the default text\neditor and a file explorer. However, if you are able to, we highly suggest\ndownloading a code editor such as Visual Studio Code.With VS Code, you will be able to view errors in your datapack, autocomplete\ncommands, and highlight syntax with different colours so that making datapacks\nisn't as painful as using Notepad.Download Visual Studio Code: https://code.visualstudio.com/downloadGet the VS Code extensions for datapack development:\nhttps://marketplace.visualstudio.com/items?itemName=amandin.dpc-pack\nStudio Code which essentially has all the same features, except it can be slower\nor more difficult to work with. https://vscode.dev/\nin. Go ahead and do that now - make sure that your world has cheats enabled\nand it is set to creative mode. In the world, you will need to run the\n/datapack create command - it will create your datapack folder as well as the\nnecessary metadata for you, which saves you a bunch of time.For example, to make a datapack with the ID example_datapack and the\ndescription \"This is an example datapack\", you would run the following command:/datapack create example_datapack \"This is an example datapack\"\nOnce you've created your empty datapack, the next step is to find and open the\nworld folder:Save and quit your worldGo to your world in the Singleplayer menu and hit \"Edit\"Press \"Open World Folder\"The folder that opens contains your Minecraft world's data. There will be loads\nof subfolders in this folder: find the one which is called datapacks, and open\nit. This folder is where the world's datapacks are stored. If you used\n/datapack create, you should see your datapack's folder here already. (If not,\nyou'll have to create it yourself. This is explained in the \"NOTE\" box below)\nOpen Folder, and open the newly created folder. Navigating through your\ndatapack will be so much easier!\nopen folder location\npack.mcmeta tells Minecraft that the folder is a datapack, as well as\ncontaining the basic information about the pack, such as what versions it works\nin. /datapack create made this file automatically, but you can open the file\nlike normal and view it if you want:{\n\"pack\": {\n\"description\": \"This is an example datapack\",\n\"pack_format\": 94\n}\n}\nIf you're interested, here's what this file means:pack is an object containing the metadata of the file.description is the name of your datapack, usually along with a short\ndescription of what your pack does.pack_format tells Minecraft what versions this datapack works in. 94 (or\n94.0) for 1.21.11 (Most recent pack_format for the latest Minecraft Release\ncan be found at the bottom of the nav bar).\n/datapack create doesn't exist. You will have to create your datapack folder\n(inside datapacks) yourself. Just make a folder, and then inside that folder,\ncreate pack.mcmeta (as shown above) and the data folder.\ndatapacks. A function is a file containing Minecraft commands. When a function\nis ran, every command in the function is ran in order. Functions are always ran\nas an entity (or as the Server) and at a position\nfashion, let's make a function which sends \"Hello World\" to chat.Open your empty data folder.In the data folder, create a new folder. This folder is your\nnamespace - it will contain all the data specific to your datapack.\nUsually this needs to have a unique name (one which other people would\nnot have picked), but for this tutorial just call it example.In the example folder, create a folder called function. This folder will\ncontain all the .mcfunction files.You should now have a folder structure that looks something like this:/world/datapacks/example_datapack/data/example/function\n\ndue to some pesky name changes Mojang introduced in a recent update.\nhello_world.mcfunction. Open this file with any text editor (we recommend\nVisual Studio Code)Inside hello_world.mcfunction, put the following:# Show the player Hello World on their screen\ntitle @s title \"Hello World!\"\n\n# Give the player a diamond\ngive @s diamond\n\ncommands have! Having the / before a command will make the mcfunction invalid\nand fail when it tries to run\nthat doesn't work, rejoin your world), you should be able to use the following\ncommand to run the function:/function example:hello_world\nWhat's next?Now you know how to create a basic function and run it, we'll next start to\nthink about how to create our project. For more advanced projects, this can\nsometimes be the most difficult part. Luckily for us, what we want to create\nwon't be too difficult.Let's break down the idea into smaller steps. Remember, we want to create a\ndatapack which makes arrows explode.Detect when an arrow lands on the ground. We can do this by running a\ncommand on a loop which will select any arrow on the ground and then run a\nfunction.Create an explosion. This is as simple as summoning a TNT at the position\nof the arrow.Remove the arrow. If you don't do this, then it will keep on exploding\nforever.The next steps of this guide will guide you through the typical process of each\nof those steps.Running functions on a loopThe first step on our list is to detect arrows which land on the ground. To do\nthis, we need to run a command on a loop. Luckily, Minecraft makes this pretty\neasy for us.Firstly, let's make the function which you want to run on a loop. In the\nfunction folder, create a new mcfunction file - call this one\nloop.mcfunction.For now, let's just make it say \"Hi\" every time it loops. You can do this by\nputting this in the new function:say Hi\nTo make this function run on a loop, we need to create a JSON file which tells\nMinecraft \"run this command every tick\" (every tick = 20 times per second)In the data folder, create the minecraft folder.In the minecraft folder, create a tags folderIn the tags folder, create a function folderIn the new function folder, create a new text file: tick.jsonThe final path would look like this:/world/datapacks/example_datapack/data/minecraft/tags/function/tick.json\ntick.json is NOT a function. In tick.json, we are going to put a list\nof functions which we want to run every tick. If you put any commands in\ntick.json, it will break your pack.In tick.json, put the following:{\n\"values\": [\"example:loop\"]\n}\nvalues is a list of function references which will be run on a loop.example:loop is a reference to the loop.mcfunction file we created\nearlier. example refers to the namespace (the folder in data), and loop\nrefers to the mcfunction file name.If you save this file, go back to your world, and run /reload, you should see\nthat the chat is being spammed with \"Hi\" over and over again!Selecting the arrowsNow we've created a function which will run infinitely on a loop, we can move on\nto detecting when an arrow is in the ground.As far as the game is concerned, an arrow is an entity, just like a pig, cow\nor zombie. Minecraft gives us a special way to select any types of entities\nwith target selectors. Once we've selected an\nentity, we can use the /execute command to run a\ncommand as the entity.We can use these to select all arrows which are in the ground, and then run a\ncommand to make them explode (and then remove themselves).As mentioned, to select an entity, we need to use a target selectors. I'm going\nto teach you a bit about target selectors. You should pay attention here, but if\nyou only want the code, scroll past this section.What are target selectors?Target selectors are a special bit of code we can use to find an entity in the\nworld. They all start with an @ symbol. There are 6 base target selectors:Target SelectorDescription@eAll Entities - By itself, this selector will select every single entity which is currently loaded in the world.@sThis Entity - This selector will select the entity which is currently running the command. For example, if I run a command as @s, then it will run the commands as me.@aAll Players - This selects all currently online players. (All players are always loaded in the world).@rRandom Player - This selects one random player.@pNearest Player - This selects the nearest player to the position this command is ran from.@nNearest Entity - This selects the nearest entity (player or non-player) to the position this command is ran from.On it's own, a base target selector (like in the table) does not do much. We can\nnarrow down the selection even more by using criteria. Criteria are put in\nsquare brackets after the base selector.For example, we can use @e with a type criteria to select all entities of a\ncertain type - for example, @e[type=minecraft:cow] would select all cow\nentities.I'm not going to explain every single criteria you can use - you can view a list\nhere. These are the\nbasic ones which you might see quite often:CriteriaDescription[type=minecraft:arrow]Entity Type - This criteria will narrow down the selection to only include entities of a certain type. For good pack optimisation, you should use this often.[distance=..5]Distance to entity - This criteria will only include entities based on their distance to their distance to the current position. .. can be used to represent a greater/less than symbol - for example, ..5 means less than 5 blocks away.[limit=2]Limit selection - Using the limit criteria, you can make specify a max amount of entities to be selected. This is often used in conjunction with the sort criteria. For example, @e[sort=nearest,limit=1] would select the nearest entity of any type.[nbt={key:value}]Entity Data - This criteria will select entities if their NBT (entity data) matches a pattern. (note: if you do this loads of times, it might start to be a bit laggy!)How are we going to use them?We can use these selectors to only select arrows which are in the ground. We can\nselect all arrows with @e[type=arrow], but this will also include arrows in\nthe air. To select arrows in the ground, we can check if they have the data\n{inGround:1b}, so we would use @e[type=arrow,nbt={inGround:1b}]This target selector can be used in an execute command to run a command as the\nentity. Try putting this in your loop.mcfunction:execute as @e[type=arrow,nbt={inGround:1b}] run say I'm an arrow, I'm in the ground!\n/reload your datapack and fire an arrow at at a block. You should see that\nyour chat is spammed with messages, meaning that we successfully selected arrows\nin the ground, and executed a command as them!Make it go boomNow we can move onto the fun part! We have a simple command which will run\nanother command as any arrow in the ground. We only need to do two things with\nthis command:Get the arrow's positionSpawn an explosion at the position of the arrowKill the arrow so that it only explodes onceTo create an explosion in Minecraft, we can simply summon a TNT entity that has\nan instant fuse length - we can do this by summoning tnt with the data\n{fuse:0} at the position of the arrow. We can do this using the execute at\ncommand, which tells the game that the summon command should be ran at the\nposition of the entity, instead of at the world spawn (because all commands are\nrun at a position in the world). This way, when we summon an entity at ~ ~ ~,\nthe game knows that it's referring to the position of the arrow. This sounds\ncomplicated, but in reality, its a really easy and intuitive system when you\nunderstand it :Pexecute at @e[type=arrow,nbt={inGround:1b}] run summon tnt ~ ~ ~ {fuse:0}\nThen, we just need to copy this command and make it kill the arrow after the\nexplosion has happened. This is as simple as it sounds - we can use /kill to\nremove the arrow. Your finished loop.mcfunction should look like this:execute as @e[type=arrow,nbt={inGround:1b}] at @s run summon tnt ~ ~ ~ {fuse:0}\nkill @e[type=arrow,nbt={inGround:1b}]\n\nthe world. A better system would involve creating a function which referenced\n@s (the \"current\" entity) instead of @e[...], and then runnning that\nfunction as all arrows in the ground. This way, we only use @e[...] once,\nwhich is a lot more efficient. However, for the purposes of this tutorial, it\ndoesn't matter at all.\nwith a simple exploding arrows datapack which you made with the help of this\ntutorial. Take a break to play around with it - you deserve one!And when you want to move on to other datapack ideas you might have, feel free\nto join our Discord server for extra support from our team of helpers. We're\nmore than happy to help you on your journey to creating awesome Minecraft\ndatapacks!","description":"Learn how to create a Minecraft datapack with our beginner's guide. This step-by-step tutorial will help you understand the basics of datapack creation, even if you have little coding knowledge. Start enhancing your Minecraft experience today!","url":"/guide/getting-started/","tags":["guide","beginner","Minecraft","datapack","tutorial","step-by-step"]},{"title":"Raycasts","content":"RaycastingRaycasting is when we shoot a line from the player's eyes in the direction they\nare looking. We use this to get what the player is looking at and do something\nto it, such as spawning an explosion.\nfunction is a function that runs itself over and over again.\nare always run at a position and rotation. This means that we can run a function\nat a postition, move it forward in the direction, and run it again, over and\nover again. This is how we can make a raycast.MethodThis method will show you how to find what entity that a player is looking at.\nThis is useful for many reasons - if you wanted to make a gun datapack, you'd\nneed to damage the entity that a player is looking at in order to damage them.To do this, you have to run a recursive function which will start at the eyes of\nthe player and keep running itself 0.1 blocks forward until it hits an\nentity. When it does hit an entity, you can easily get the entity and do\nsomething to it.Firstly, we'll make the function which, when you run it, will start the\nraycast. In this function, we'll want to:Set the maximum distance for the raycast, so it won't go on forever if it\nnever hits an entity.Run the function at the eyes of the player.To set a maximum distance, we store the maximum amount of times we want the\nfunction to run in a scoreboard. Every time the recursive function runs, we want\nto subtract one from that scoreboard, and only continue if the score is more\nthan 0.First, you need to create a scoreboard in your load function. This scoreboard\nwill store the maximum amount of times the raycast function can run:# Create the scoreboard\nscoreboard objectives add raycast dummy\nThen, when we want to start the raycast, we just do the following:Tag the entity or player that starts the raycast, so we can refer back to\nthem.Set the maximum distance for the raycast.Call the raycast function in the facing direction.Remove the tag at the end, so it doesn't interfere with other raycasts.# Tag the raycaster\ntag @s add raycaster\n\n# Set the maximum distance\nscoreboard players set .raycastLimit raycast 1000\n\n# Begin the raycast function\nexecute at @s anchored eyes positioned ^ ^ ^.1 run function :raycast\n\n# Remove the tag from the raycaster\ntag @s remove raycaster\nIn the raycast function, we just want to check if the function has hit an\nentity, and if not, run it again until it does, hits a wall, or reaches the\nraycasts limit, moving slightly each time.The next step is a bit more complex. We execute a command as every entity that\nis not the caster and whose hitbox intersects with the current path of the\nraycast (using\nvirtual volumes).\nThe command will return run :hit if the raycast hits an entity. The\nreturn run will stop the raycast from running further, and then will run the\nhit function as the entity it has hit.The last command checks if the raycast hit a wall. If it does, the raycast will\nend. If it doesn't, it will then check if the limit is reached, again ending if\nit is. Should the limit not be reached yet, it will move 0.1 blocks forward\nand call the raycast function again (recursion).# Remove one from the raycast limit\nscoreboard players remove .raycastLimit raycast 1\n\n# Optional: display a particle\nparticle minecraft:flame\n\n# Check if the raycast has hit an entity's hitbox\nexecute positioned ~-.99 ~-.99 ~-.99 as @e[dx=0,tag=!raycaster] positioned ~.99 ~.99 ~.99 as @s[dx=0] run return run function :hit\n\n# If the raycast has not hit a wall, and the limit has not been reached, move the raycast forward and run the function again\nexecute if block ~ ~ ~ #minecraft:replaceable if score .raycastLimit raycast matches 1.. positioned ^ ^ ^0.1 run function :raycast\n","description":"Raycasting is when we shoot a line from the player's eyes in the direction they are looking. We use this to get what the player is looking at, and do something to it, such as spawning an explosion.","url":"/guide/misc/raycasts/","tags":[]},{"title":"Slowcast","content":"SlowcastingA Slowcast is similar to a raycast, but unlike a standard Raycast, it is not\ninstant.In some cases it is enough to use a simple tp command that teleports a marker a\nbit forward every tick. If you wanted it to move faster, however, you have to\nincrease the distance it teleports and this could result in skipping over\nentities or blocks you might want to detect.A slowcast solves this problem by teleporting multiple times within a single\ntick to travel faster but still checking if it hits something on its way.\nfunction is a function that runs itself over and over again.\non its way.Slowcasts can be useful if you want to create fast but not instantaneous moving\nprojectiles for magic spells for example.To make a slowcast, you need:To set up a projectile with all the data it needs.A duration function to manage the travel distance.A step function that teleports the projectile and checks if it hit something.A temporary loop that calls the step function for all active projectiles.Let's start by creating all the necessary scoreboards in the load function.scoreboard objectives add temp dummy\nscoreboard objectives add slowcast.steps dummy\nscoreboard objectives add slowcast.duration dummy\nThe next step is to initialize the projectile. This is done by running the\nfollowing function as and at the player. It summons a new marker entity (any\nother entity works too) and runs the setup function as that entity.execute anchored eyes positioned ^ ^ ^.3 summon minecraft:marker run function :setup\nSadly it is not possible to add nbt data in the summon sub-command so we have to\nadd it in the setup function too. We will give it a tag that marks it as a\nslowcast projectile. After that, we set all the scores it needs to function\nproperly. In this example, you will see that instead of setting the scores\ndirectly it copies from temporary scoreboards. This is so that the values are\nnot hardcoded and can be different for different projectiles without having to\ncreate a new setup function for each projectile. At the end, we then call the\ntemporary loop function.tag @s add slowcast\n\nscoreboard players operation @s slowcast.steps = maxSteps temp\nscoreboard players operation @s slowcast.duration = duration temp\n\nfunction :temp_tick\nThe projectile is all set up and the loop function is called. The loop function\nis the part of this whole system that keeps everything running as long as there\nare active slowcast projectiles.execute as @e[type=marker,tag=slowcast,scores={slowcast.duration=1..}] at @s run function :duration\n\nexecute if entity @n[type=marker,tag=slowcast] run schedule function :temp_tick 1t\nNow the actual slowcast logic which handles the movement, travel distance, and\nhit detection.In the looping function the duration function is called, let's make this one\nfirst. This function is responsible for the slowcasts travel distance and\ncalling the step function for the actual movement.Decrease the duration score.Store the projectile step count in a temporary scoreboard.Call the step function 0.2 blocks further in the facing direction.Kill the projectile should it have a distance score of below 1 at the end of\nthe function.scoreboard players remove @s slowcast.duration 1\n\nscoreboard players operation steps temp = @s slowcast.steps\nexecute positioned ^ ^ ^.1 run function :step\n\nexecute unless score @s slowcast.duration matches 1.. run kill\nIn the called step function we handle the teleportation between the current and\ntarget position and check if the projectile has hit something on its way there.Decrement the step score in the temporary scoreboard (we still need the step\nscore stored in the projectile for the next time we call the step function).Make some particles for the visuals (you could replace the particle command\nwith another function call that does more complex stuff).Execute a command as every entity (excluding entities with the slowcast tag\nand players) whose hit box intersects with both\nvirtual volumes\nrun the hit function and kill the projectile.Tp the projectile to the current position (until now it only executed the\ncommand at this position but is still 0.1 block further back).Execute this function again one 0.1 block step forward should the temporary\nstep counter still be over 1 (recursion).scoreboard players remove steps temp 1\n\nparticle flame ~ ~ ~ .1 .1 .1 0 1\n\nexecute as @e[type=!player,type=!marker,dx=0] positioned ~-.99 ~-.99 ~-.99 if entity @s[dx=0] positioned ~.99 ~.99 ~.99 unless function :hit run kill @n[tag=slowcast]\n\ntp ~ ~ ~\n\nexecute if score steps temp matches 1.. positioned ^ ^ ^.1 run function :step\nThe hit function called in the hit detection does whatever you want it to do\nwhen hitting an entity. It could spawn an explosion, apply an effect, or simply\ndeal some damage.\nthe projectile in the step function. You could use this to make a piercing\nprojectile for example.","description":"Like a raycast but in slow. Useful if simply using tp every tick skips over too much when making it fast.","url":"/guide/misc/slowcasts/","tags":[]},{"title":"Debugging your Datapacks","content":"Debugging your datapacksThere will come times when your datapack won't work, and you will have to figure\nout what exactly doesn't work in it. Don't worry if this happens to you, if\nyou're like any of the rest of us, this will happen often. Code will almost\nnever work the first time you try it. An error in your code is referred to as a\nbug. Removing these bugs is called debugging. This guide will teach you the best\nmethods for debugging datapacks.What are bugs?Bugs are a fancy programmer term for an error in your code. There are two main\ntypes of bugs:Syntax error: This is a bug in the actual written code. This is caused by\nthe code you write being incorrectly written so that the computer literally\ncan't read it. For example, writing executr as @a would be a syntax error\nbecause executr isn't a command.Logic error: This is a bug where the written code is correctly written,\nbut the code doesn't do what you want it to. This is caused by a mistake in\nthe code logic. In the simplest example, if you want to give a player 32\ndiamonds, but you accidentally wrote 322.Finding and debugging syntax errorsSyntax errors are pretty easy to spot and fix, due to Minecraft's output logs,\nwhich literally tell you if your code is incorrect. When you're coding\ndatapacks, its a good idea to always have the logs open if you need to double\ncheck it. You can open the logs by opening the default Minecraft launcher and\nclicking \"Settings\", and then enabling \"Open output log when Minecraft: Java\nEdition starts\", then just starting the game.A guide on how to open the Minecraft launchers output logsSyntax errors will show up in red text when you /reload your datapack. But\nsometimes other errors can also show in yellow text instead.Lets take this image as an example:\nOutput log with an error. Here, the\nerror tells you exactly where the error is - in this case it's in the function\n\"be:give\" at line 1 after \".... give @s\". And indeed I did spell \"loot\" as\n\"lot\", which caused the error.\nCode with a syntax errorFinding logic errorsLogic errors are more difficult to find because there's nothing actually\nincorrect with the code you wrote, it just does something other than what you\nwant it to do.An easy way to find where a logic error is in the code is to make use of the\nsay or tellraw command. These commands will send any message to the\nchat, making it easy for you to know when and if your code actually runs as\nyou expect it to. You can easily put a\nsay Function ran correctly command in your function - If the\nfunction runs, then it will send a message to the chat. It will also send the\nname of the entity that ran the function to the chat, so you can see if your\nfunction is executed by the correct entity.Similarly, you can use the tellraw command for more advanced debugging. The\ntellraw command also has the capability to show you the value of scoreboards and\nNBT values, so you can check what data your code is using. For instance, if you\nwant to check the value of a scoreboard, you could use the following command:tellraw @a {\"score\":{\"name\":\"@s\",\"objective\":\"some_scoreboard_objective\"}}\nBased on the output of these commands in chat, you can use this to tell where\nyour code goes wrong. (Just make sure to remove them after you've found the\nerror, otherwise it can get annoying).You may want to keep the debug messages in the datapack, but you don't want it\nto be sent to every player. Fortunately for us, with the tellraw command, you\ncan specify to who the message will be sent. This means you could only send the\ndebug messages to those who have the tag debug:tellraw @a[tag=debug] {\"text\":\"Debug message sent only to people with the debug tag!\"}\nDebugging logic errorsUnfortunately, debugging logic errors in your code isn't as easy as fixing one\nspelling mistake. But yet there are still techniques that we can use.One way to solve logic errors is to recreate the error in a separate project.\nWhen you remove all the other context of the pack, you can focus just on the bit\nwhich doesn't work. You can just copy out the code you want to fix into a\nseparate datapack, then fix it there. Once you've identified and fixed the\nproblem, you'll know how to fix it in the real project.SummaryThe first main method for debugging datapacks is using Minecraft's output logs,\nwe've already learnt how to use those in the first part of this guide. The\nsecond method is using the in-game commands, like /say and /tellraw to print\ninformation in real-time about how your datapack works. But those are not the\nonly ones, you can use the /scoreboard objectives setdisplay \ncommand to show the values of a scoreboard on your screen in real-time, or you\ncan use /data get ..., which will print the value of any NBT data in chat.A scoreboard on screenYou might also find that some other methods that suit you the best, for example\nyou might find the Data Reload mod\nuseful for displaying errors in chat, or a completely different method, that is\nup to you.","description":"Sometimes your datapack won't work, and you will have to figure out what exactly doesn't work in them. And this guide will help you with exactly that!","url":"/guide/misc/debugging/","tags":[]},{"title":"Choosing a Server","content":"Choosing a ServerWhen you join a Minecraft server, you are playing on a computer running a\nspecial software. This software allows you to interact with other players on the\nserver and play the game. There are so many different choices when it comes to\nchoosing Minecraft server JARs that it can easily become overwhelming.In this guide, we focus on multiple aspects of the various servers, from\nperformance, to datapack support to even features that are exclusive to certain\nserver softwares.Background InformationBefore we dive into the different server JARs, we need to talk about the\ndifferent types of Minecraft servers. Throughout this guide, we will be using\nthe term \"server JAR\" to refer to the actual Minecraft server file. These JARs\nare Java executable files that run the Minecraft server.There are a few common types of Minecraft servers:Vanilla: The vanilla server is the most basic server software, it's just\nthe vanilla game.Bukkit-based: Bukkit is a plugin-based server software that is used by\nmost Minecraft servers. It is the most popular of the server softwares as it\nprovides a wide range of plugins and features.Modded: Modded servers are based on the Fabric or Forge, which are\nmod-based server softwares. They are more customizable than Bukkit-based\nservers, but are not as popular. The use of modded servers is still very\nlimited, making it hard to find a mod for some purposes.Sponge-based: Sponge is a plugin-based server software that is used by\nmany Minecraft servers. It is similar to Bukkit-based servers, but is more\ncustomizable and has support for mods with SpongeForge.VanillaThe vanilla server is the most basic server software, and is the one that you\nget when you download the jar file from the\nofficial website. It does not\ncome with mod or plugin support. Beyond datapacks, it is not customizable at\nall.ProsConsEasy to set upNo mod supportFastest to update (comes out with every update)Lackluster performanceDesigned with exclusively datapacks in mindLimited customizationsNo additional bug fixesNo additional bug fixes\nFor some, a lack of bug fixes can be both positive and negative. Mileage may\nvary!\n\nEven though the list mentions bad performace, the vanilla server still performs well. \nFor small servers on decent hardware, it doesn't really matter what you choose.\n\nwith some basic performance optimizations, Bukkit plugin support, and some customization.\nIt can cause some issues with datapacks but mitigating datapack-related bugs is\nsignificantly easier when compared to Paper. If you want plugins and\ndatapacks, this is likely the one you want.ProsConsPopular and well-supportedBad datapack support by default (but fixable)Comes with some performance optimizationsMay be lacking Bukkit APIs other servers haveDatapack bugs are less commonNot as customizable as other server softwaresPaperPaper is a fork of Spigot, and it's the most popular\nBukkit server JAR according to bStats. It is\none of the most customizable server software on this list and comes with\nexcellent plugin support and amazing performance optimizations. Unfortunately,\nit is notorious for breaking datapacks and even some plugins for the sake of\nperformance, modernity and bug fixes.ProsConsPopular and well-supportedBreaks many datapacks due to destructive performance optimizationsNumerous performance optimizationsOnly designed for pluginsModern and forward-looking, provides many new Bukkit APIsSome useful bugs are fixed by default (TNT duping, sand duping, etc.)Comes with extensive documentation and configuration options\nUntil recently, Paper was based Spigot, but recently, the devs converted the project\ninto a hard fork (no longer based on Spigot), allowing for quicker update times, \nhowever, stable releases can still be slow to release.\n\nprimarily by older Minecraft servers. Forge is the gold standard for mods for\nversions >1.13 while still offering support for latest versions. Many mods and modpacks\nsuch as RLCraft, Pixelmon, ATM (All The Mods) will only run on Forge. Forge\nis still updated to latest versions, however, newer loaders are recommended.ProsConsGreat for older Minecraft versionsBy choosing older versions, you miss out on datapack featuresLarge mod catalog spanning many yearsDifferent mod loaders are recommended and used nowadaysMany mods do not affect DP features\nIt's recommended to use NeoForge on the latest version when\npossible. This will offer the bestest of Datapack features and the most modern\nmods\n\nMinecraft servers. It is a fork of Forge designed to be cleaner and more modern,\nwith significant reworks to many bloated parts of Forge. It is designed to be\nused with new versions of Minecraft and many mods that did target the latest\nversion of Forge will now target both or exclusively NeoForge!ProsConsGreat for newer Minecraft versionsMany mods (especially QoL mods) are exclusively built for FabricGreat modding communityForge and NeoForge are sometimes considered bloatedMost mods do not affect DP featuresFabricFabric is another mod-based server software. Fabric is\nused by most modern modded servers due to its fast boot time, advanced injection\nand great mods. Fabric is likely the best modded server for use with datapacks\ndue to how it injects its code.ProsConsPopular and well-supportedFinding server-side mods are hardMods rarely affect datapacksHard to troubleshoot mod errors sometimesGreat for newer Minecraft versionsSupport for older Minecraft versions is limited\nYou may see people talk about Cardboard. It's a mod that can add the Paper API\nto your Fabric server, however the actual functionality is limited and its slow\nto update.We do not recommend you use it! Instead, try find native Fabric alternatives!\n\nvanilla version of Sponge. It is an alternative to Bukkit-based server jars with\nincredible extensibility. It is very rarely used due to the lack of mods/plugins\nsupporting it.ProsConsHigh quality plugins are commonSupport for newer Minecraft versions is experimentalGenerally fastServer support is hard to findGreat for older Minecraft versionsFinding Sponge mods are hardSpongeForgeSpongeForge is a version of\nSponge with support for Forge mods. Similarly to SpongeVanilla, it is very\nrarely used due to the lack of mods supporting it.ProsConsSupport for plugins and modsSupport for newer Minecraft versions is experimentalPlugins are well integratedGenerally not as popular as Bukkit-based serversGreat for older Minecraft versionsFinding Sponge mods are hard, support for Forge mods is pinned at lower versionsHonorable MentionsMinestomMinestom is a very high performance, lightweight server jar designed for extreme\ncustomizability at the expense of doing everything yourself.\nThis server jar is basically an empty shell and is only recommended for highly\ntechnical purposes. You need to program everything you want into this server\nyourself, including features you may expect to come with the jar (lighting). You\nhave been warned!\n\nbut rather proxies.Most Minecraft servers can't handle more than a hundred-or-so people at once, so\nhow do giant servers like Hypixel have tens of thousands of people on at one\ntime? Imagine a large server with many mini games. Every time you teleport to a\ngame, a proxy is sending you to a completely different server, usually dedicated\nto running just that game. Larger servers can have thousands of people\nonline at a time because not everyone is in one server, they are split between\ntens or hundreds of servers. Simply put, the proxy is like glue, sticking\nservers together and allowing people to \"teleport\" between them.","description":"Learn the differences, pros and cons of different Minecraft server softwares, and which one you should use for datapacks, mods and/or plugins.","url":"/guide/choosing-a-server/","tags":[]},{"title":"Cooldown checks","content":"Cooldown checksA cooldown restricts how frequently a player triggers a custom action. In most\ndatapacks, these actions involve running functions or commands.For example, consider a custom wand that shoots fireballs when a player\nright clicks. Without a cooldown, players could spam the wand, resulting\nin lag or unbalanced gameplay. Adding a cooldown ensures the player waits a few\nseconds before shooting another fireball.Core conceptsCooldown: A timer that prevents an action from running again until a specified\namount of time has elapsed since the last execution.Action: The command or function the cooldown restricts.Implementation methodsThere are two main ways to implement a cooldown mechanic in your project:Scoreboard-based cooldown - Uses a scoreboard objective to store how \nmuch time remaining until the cooldown expires. This is the simplest and the easiest to understand version, \nbut if you're creating a larger datapack, or intend on using it with multiple players, you may prefer to use an alternative version to minimise system lag.Worldclock-based cooldown - Uses the time on a worldclock to measure the elapsed time since an action was last used. This is a non-ticking approach that works well for large datapacks, or any project that uses many cooldown timers.","description":"Learn how to create and check cooldown timers using several common methods.","url":"/guide/cooldown/","tags":[]},{"title":"Worldclock-based cooldown","content":"Worldclock-based cooldownA worldclock cooldown works by storing a timestamp of when an action was last used in a scoreboard objective.\nYour datapack compares this stored time with the current time to determine if the cooldown has ended.Although this is more complicated, this function doesn't rely on any ticking commands. This is especially\ngood for much larger datapacks because it is the most performance-efficient method.What you will createA cooldown.json clock in the world clock folder.A last_used scoreboard objective (this stores when the action was last used).A:check_cooldown function (this is used to check the cooldown)1. Setup the world clockIn your datapack namespace, create a folder named world_clock. Then, create a file named cooldown.json inside the folder. This \nbasically just registers a new world clock (think of this as a special type of stopwatch). This file needs no data, other than {}.{}\nRestart your world/server (/reload isn't enough here), then run /time of :cooldown query time to verify that the clock exists.2. Create the scoreboard objectiveYou will need a scoreboard objective stores the last time the action was used in the cooldown world clock. You can call this scoreboard\nanything - for simplicity, here we will call it last_used. You should create this scoreboard objective in your load function.scoreboard objectives add last_used dummy\n3. Create the check_cooldown functionYou will run this function whenever you want to do something which is on a cooldown. For example, \nif you have a special item which you only want the player to be able to use once every 5 seconds,\nyou would run this function to check if the player is on cooldown or not.In this function, we check the executor's last_used score against the current time on the cooldown clock. If the\ndifference between the times is less than 100 ticks (5 seconds), then the function will return a failure. If not,\nthen the function will return a success and the last_used will be set to the current time.# Temporarily store the current time on the cooldown clock\nexecute store result score #current_time last_used run time of :cooldown query time\n\n# Calculate the difference in times (i.e. the time since the action was last used)\n# basically: \"#current_time\" = \"#current_time\" - time of last use\nscoreboard players operation #current_time last_used -= @s last_used\n\n# If the difference is less than 100 ticks, then not enough time has passed, so we tell the player and then return a failure\nexecute if score #current_time last_used matches ..100 run tellraw @s {color:\"red\",text:\"This is on cooldown! Wait before you try again.\"}\nexecute if score #current_time last_used matches ..100 run return fail\n\n# If the function hasn't yet been stopped, then the player is not on a cooldown\n# so we can update the last_used time and then return a success. \n\nexecute store result score @s last_used run time of :cooldown query time\nreturn 1\n\nDon't modify the cooldown world clock; it will break the cooldown calculations.\n\nplayer still is on a cooldown, then the function will fail and the command will not run. If the player isn't on a cooldown, then\nthe function will set the cooldown and then return a success, so the command WILL run.In this example, a creeper will only be summoned when the player has no active cooldown (in which case, the cooldown will be set).\nIf the player has an active cooldown, then the creeper will not be summoned, and instead the error message in check_cooldown.mcfunction \nwill be sent.execute as if function :check_cooldown run summon creeper\nUsing multiple cooldownsIf you want to have multiple different cooldowns for different items, then you will need a different last_used scoreboard and check_cooldown\nfunction for each cooldown. However, you can re-use the cooldown world clock for as many cooldowns as you wish.","description":"Learn how to create and check cooldown timers using the world clock.","url":"/guide/cooldown/worldclock/","tags":[]},{"title":"Scoreboard-based cooldown","content":"Scoreboard-based cooldownA scoreboard-based cooldown stores a number on each player (or entity) and\nchanges that number over time.This guide uses a ticking approach, which means the datapack updates the\ncooldown every game tick (20 ticks per second). This works well \nfor small projects with only a few cooldowns and short durations. If you track many cooldowns or \nmany entities, this negatively affects performance, because the game has to run loads of commands.In summary, this approach sets a player's score on a scoreboard, and then decreases that score every \ntick. This means that, when we need to do something which requires a cooldown, we can just check the \nscore to see if the player has an active cooldown or not.What you will createA my_cd scoreboard objective (this tracks the actual cooldown for each plalyer)A tick function (this reduces each player's cooldown score)A check_cooldown function (this will be used to check and reset the player's cooldown)\nRight-click menu guide.\nobjective is just a scoreboard which can only be changed by commands.scoreboard objectives add my_cd dummy\n2. Reduce the score in the tick functionIn your tick function (which runs every tick), reduce the my_cd\nscore by 1 for any player with my_cd ≥ 1.scoreboard players remove @a[scores={my_cd=1..}] my_cd 1\n\nit only runs the command when the player has an active cooldown. To do this, you would need a tick advancement which runs a function - \nin that function, you would decrease the player's score and then revoke the advancement only if their score is 1 or more. This would replace \nthe commands in the tick function, and slightly help to minimise lag.\nif you have a special item which you only want the player to be able to use once every 5 seconds, \nyou would run this function to check if the player is on cooldown or not.In this function, we check the executor's my_cd score to tell whether they have an active cooldown.If the score is 1 or higher (i.e. they haven't reached the end of the cooldown), then the function will return a failure..If the score is 0 or doesn't exist yet (i.e. they do not have an active cooldown), then the function will return a success.# If the player is still on cooldown, tell the player and stop here.\nexecute if score @s my_cd matches 1.. run tellraw @s {color:\"red\",text:\"This is on cooldown! Wait before you try again.\"}\nexecute if score @s my_cd matches 1.. run return fail\n\n# If the function hasn't yet been stopped, then the player is not on a cooldown\n# so we can set the cooldown and then return a success. \n\nscoreboard players set @s my_cd 100\nreturn 1\n4. Using the check_cooldown functionWhenever the player does something that needs a cooldown, you can use execute if function with the check_cooldown function. If the \nplayer still is on a cooldown, then the function will fail and the command will not run. If the player isn't on a cooldown, then \nthe function will set the cooldown and then return a success, so the command WILL run.In this example, a creeper will only be summoned when the player has no active cooldown (in which case, the cooldown will be set).\nIf the player has an active cooldown, then the creeper will not be summoned, and instead the error message in check_cooldown.mcfunction \nwill be sent.execute as if function :check_cooldown run summon creeper\nUsing multiple cooldownsIf you want to have multiple different cooldowns for different items, then you will need a different cooldown scoreboard and check_cooldown\nfunction for each cooldown. You will also need to decrease the score for each cooldown in the tick function.","description":"Learn how to create and check cooldown timers using a scoreboard objective.","url":"/guide/cooldown/scoreboard/","tags":[]},{"title":"Generating Random Numbers","content":"Generating Random Numbers using Datapacks!Generating a random number is very useful in programming for many reasons.\nMinecraft 1.20.2 added the /random command, which lets us do this very easily.\nHowever, if you are using an older version, you can still generate random\nnumbers using loot tables.1.20.2 and newerBecause of the /random added in 1.20.2, it is much simpler to generate random\nnumbers. It now only requires a single command:execute store result ... run random value 1..10\nIn the command you can change the values 1 and 10 to change the range. You can\nfill in ... to specify where you want to store the random number. For example,\nto store the random number in the player's scoreboard:execute store result score @s run random value 1..10\n1.20.1 and belowIn earlier versions, a loot table can be used to generate a random number. This\nworks by summoning a loot table which will drop a random amount of air items,\nand storing the result of that summon.This template loot table can be used to generate a random number between 1 and\n10:{\n\"pools\": [\n{\n\"rolls\": {\n\"min\": 1,\n\"max\": 10\n},\n\"entries\": [\n{\n\"type\": \"minecraft:item\",\n\"name\": \"minecraft:stone\",\n\"functions\": [\n{\n\"function\": \"minecraft:set_count\",\n\"count\": 0\n}\n]\n}\n]\n}\n]\n}\nYou can change the values 1 and 10 to change the range. If you leave it as\nit is, it generates a random number between 1-10.To use this, you will just have to store the result of summoning this loot\ntable:execute store result ... run loot spawn ~ ~ ~ loot :rng\n","description":"Generate a random number in a datapack using the /random command, or alternatively, a loot table.","url":"/guide/nbt-and-scores/random-numbers/","tags":[]},{"title":"Player ID System","content":"Player ID SystemThis guide will explain how to create a player ID system within a datapack. A\nplayer ID system gives each player a unique score on a scoreboard, which can\nthen be used to link players to entities, or for the player to be able to select\nanother player easily.Assigning player IDsFirstly, we need to create a scoreboard objective to store the players' IDs.\nThis scoreboard will also hold a counter of the IDs given in a fake player so\nthat no two players end up with the same ID.# Create the playerid scoreboard\nscoreboard objectives add playerid dummy\nNext, we need to assign an ID to the player when they first join the world.\nCreate a function which assigns the value of the max player ID counter to the\nplayer, and then increments it by one.# Assign the max player ID to the player\n# (When this is first ran, .max playerid is not set and read as 0, so the first player gets the ID 0)\nscoreboard players operation @s playerid = .max playerid\n\n# Increment the max player ID by one\nscoreboard players add .max playerid 1\nFinally, we need to make this function run when a player first joins the world.\nWe can do this using a tick advancement - it will only trigger when the player\nfirst joins the world.{\n\"criteria\": {\n\"requirement\": {\n\"trigger\": \"minecraft:tick\"\n}\n},\n\"rewards\": {\n\"function\": \":assign_id\"\n}\n}\nFind the player/entity with a specific IDWe can use a predicate to check if the player has the same ID as the specified\nID (stored in a fake player on a scoreboard). In this case, this predicate will\nonly trigger if the player's playerid score is equal to the playerid score\nof the fake player (#this).{\n\"condition\": \"minecraft:entity_scores\",\n\"entity\": \"this\",\n\"scores\": {\n\"playerid\": {\n\"min\": { \"type\": \"minecraft:score\", \"target\": { \"type\": \"minecraft:fixed\", \"name\": \"#this\" }, \"score\": \"playerid\" },\n\"max\": { \"type\": \"minecraft:score\", \"target\": { \"type\": \"minecraft:fixed\", \"name\": \"#this\" }, \"score\": \"playerid\" }\n}\n}\n}\nWe can call this predicate any time we want to find the player or entity with a\nspecific ID - just set the #this fake player to the score you want to match,\nand then call the predicate as all entities or players. This function will\nreturn all the entities with the same ID as the executor:# Set #this to the current entity's ID\nscoreboard players operation #this playerid = @s playerid\n\n# Find all entities which have the same ID\nexecute as @e[predicate= :match_id] run say I have the same ID.\n","description":"Create a player ID system in a Minecraft datapack for linking players to entities.","url":"/guide/nbt-and-scores/player-id-system/","tags":[]},{"title":"Floating Point Division","content":"Division with floating pointsTypically, we can use scoreboard players operation to divide two numbers in\nMinecraft. However, this command will only output an integer. If the result of\nthe division is a decimal number, it is always rounded down. To divide numbers\nwith decimal points, we need to use a workaround:Multiply the dividend by a large factor of 10 (e.g 1000000).Divide the numbers using scoreboard players operation.Store the result to a data storage, scaling it down by the same factor of 10.Here is an example of how to divide two arbitrary integer numbers:# Define the numbers we want to divide (in this case, 10 / 3)\nscoreboard players set #dividend math 10\nscoreboard players set #divisor math 3\n\n# Multiply the dividend by 1000000\nexecute store result storage minecraft:math temp int 1000000 run scoreboard players get #dividend math\nexecute store result score #dividend math run data get storage minecraft:math temp\n\n# Divide the numbers\nscoreboard players operation #dividend math /= #divisor math\n\n# Store the result to a data storage\nexecute store result storage minecraft:math result float 0.000001 run scoreboard players get #dividend math\n\n# Display the result\ntellraw @a {\"nbt\":\"result\",\"storage\":\"minecraft:math\"}\nAlternatively, you can scale by 1/n to divide by n. For instance, if you\nwant to divide by 2, you can scale by 1/2 which is 0.5:# Define the numbers we want to divide (in this case, 10 / 2)\nscoreboard players set #dividend math 10\n\n# Scale down by 0.5 (divide by 2)\nexecute store result storage minecraft:math result float 0.5 run scoreboard players get #dividend math\n\n# Display the result\ntellraw @a {\"nbt\":\"result\",\"storage\":\"minecraft:math\"}\n","description":"Learn how to divide numbers in Minecraft which have decimal points.","url":"/guide/nbt-and-scores/division/","tags":[]},{"title":"Array Iteration","content":"Array IterationArray Iteration allows us to loop through an array and do something with each\nitem individually (for example, add every item in an array, output each array\nitem individually, modify all elements in an array, combine strings in an array,\netc.)MethodFor this guide, imagine our array is defined with the following:data modify storage minecraft:example ExampleArray set value [\"Array Item 1\", \"Array Item 2\", \"Array Item 3\"]\nThe steps to iterate through the array are:Store the length of the array in a score.Do something with the first element in the array (array[0]) - you can\neither just read the element, or modify it.Copy the first element to the end of the array, then remove the first\nelement.Decrease the length score by 1.If the length score is 1 or more, repeat from step 2 until it isn't.First, we need a function which will begin the process. This is where we do step\n1 and then run the loop function:# Get the length of the array, and store it in a fake player in a scoreboard\n# (we assume you already have created a scoreboard - do this in your load function)\nexecute store result $length run data get storage minecraft:example ExampleArray\n\n# If the length is at least 1, run the loop function\nexecute if score $length matches 1.. run function :array_loop\nIn the array_loop function, you can do whatever you want to the array item,\nincluding modifying it. In this example, we will send the array item to chat,\nand then replace it with \"Iterated\".# We can access the current array item with \"storage minecraft:example ExampleArray[0]\"\n\n# Send the current array element to chat\ntellraw @a {\"nbt\":\"ExampleArray[0]\",\"storage\":\"minecraft:example\"}\n\n# Replace the current array element with \"Iterated\"\ndata modify storage minecraft:example ExampleArray[0] set value \"Iterated\"\n\n# Copy the current element to the end of the array then remove the current element (so the loop will work)\ndata modify storage minecraft:example ExampleArray append from storage minecraft:example ExampleArray[0]\ndata remove storage minecraft:example ExampleArray[0]\n\n# Decrease the length score\nscoreboard players remove $length 1\n\n# If there are still items left (length is not 0), run the loop again\nexecute if score $length matches 1.. run function :array_loop\nThe chat output should be as follows:Array Item 1\nArray Item 2\nArray Item 3\n\n# /data get storage minecraft:example ExampleArray\nOutput: [\"Iterated\", \"Iterated\", \"Iterated\"]\n","description":"This guide explains how to loop through an array's items in a Minecraft datapack","url":"/guide/nbt-and-scores/array-iteration/","tags":[]},{"title":"Get default item components","content":"Get Default Item ComponentsThis method will explain how to get the default data components (commonly referred to as item components) from an item. These default components are usually hidden from a datapack but aquiring them can be really useful. We could, for example, use this to read the max_stack_size from any item.The method relies on the minecraft:copy_components loot table function which copies item components from a source item, but also includes the (hidden) default components. We can use this functionality in a datapack to easily access the default components of any item.MethodTo start, we make a loot table that drops a dummy item and applies the copy_components loot function. This function requires a source to copy the components from. This, unfortunatly, can only be one of block_entity, any entity from context (for example this or attacker) or a tool. The only source that can be an item is tool so we'll use that.Now we need to \"tell\" the loot table what the tool is. This can be done through loot context. In this case we'll use fishing loot context.{\n\"type\": \"minecraft:fishing\",\n\"pools\": [{\n\"rolls\": 1,\n\"entries\": [{\n\"type\": \"minecraft:item\",\n\"name\": \"minecraft:poisonous_potato\",\n\"functions\": [{\n\"function\": \"minecraft:copy_components\",\n\"source\": \"tool\"\n}]\n}]\n}]\n}\nThe fishing loot context allows us to use the mainhand slot as a tool. This leads us to the following command:loot replace entity @s weapon.offhand fish namespace:copy_default_components ~ ~ ~ mainhand\nThis command will place a dummy item (from the loot table) into the player's offhand slot. (Since we don't want to replace the offhand slot or any other inventory slot, we'll have to summon a temporary entity to store the dummy item. More on that later.) Then, the loot table will also copy all components from the item in the mainhand to the dummy item in the offhand slot, even the default (hidden) components.To check this worked, you can access the item components data manually using the command /data get entity @s equipment.offhand.components - you should see all the default components that are usually hidden.\ntag @s add target_player \nexecute summon minecraft:armor_stand run function namespace:get_default_components/process \ntag @s remove target_player\nNext we copy the desired item to its mainhand. After that, we can use this mainhand slot to provide the \"tool\" context and copy the dummy item to it's offhand. Then the only thing we need to do is store the data from the armor stand and kill it.# Move the item from the desired player slot onto the armor stand\nitem replace entity @s weapon.mainhand from entity @a[tag=target_player,limit=1] armor.head\n\n# Run the loot table\nloot replace entity @s weapon.offhand fish namespace:get_default_components ~ ~ ~ mainhand\n\n# Copy the components to a result storage\ndata remove storage namespace:temp default_components\ndata modify storage namespace:temp default_components set from entity @s equipment.offhand.components\n\n# Kill the armor stand\nkill @s\nNow we can run the function namespace:get_default_components/init as a player to get the components from the chosen slot (in this case the head slot). The source slot can be changed by modifying armor.head on line 2. The item data components will be stored to the namespace:default_components storage, and from here you can access them in your datapack.\n\"function\": \"minecraft:copy_components\",\n\"source\": \"tool\",\n\"include\": [\n\"minecraft:max_stack_size\"\n]\n}\n","description":"This section explains how you would collect the default data components from an item using a Minecraft datapack.","url":"/guide/nbt-and-scores/get-default-item-components/","tags":[]},{"title":"Mods vs Datapacks","content":"Mods vs DatapacksMods and datapacks are two commonly confused topics in Minecraft, and knowing\nthe difference between them could help you decide which better fits your use\ncase. While both mods and datapacks extend Minecraft's capabilities, mods\ngenerally offer more control and customization, while datapacks are more\nintegrated with the base game and rely on the server.What is a mod?Simply put, mods are modifications to the base game, which includes\nJava code mods, datapacks, resource packs and\nBukkit plugins. In this guide, we will only address two of these topics, Java\ncode mods and datapacks. For the remainder of this guide, when you read \"mod\", we\nwill be referring to Java code mods.DatapacksDatapacks are extensions to vanilla features and are officially supported by\nMojang Studios. Datapacks are becoming increasingly powerful with the advent of\nnew data-driven features, commands and technical additions. For these reasons, \ndatapacks make an excellent addition for a vanilla server or even some modded servers, \nwho don't want to worry about incompatibilities or dealing with broken plugins/mods.Datapacks can be used to define custom world generation,\nadvancements, enchantments, loot tables,\nrecipes and many contain\ncommand functions; small scripts which run Minecraft\ncommands (with some small caveats). Datapacks use these functions to create\nunique mod-like features or add interactivity in maps. Many impressive datapacks\ncan be so well made they are confused for mods, which is where some of the\nconfusion between them and mods stem from.Due to how they work, datapacks can be more limited compared to mods. New\nfeatures have to be added by Mojang themselves before they can be used in\ndatapacks and many custom features such as custom entities and custom blocks\nhave yet to be implemented. In addition to this, anything that requires the\nMinecraft client such as rendering changes or key input is not possible, as\ndatapacks are installed on the server/world.ModMods are unofficial changes to the game's code using Java and in most cases a\nmod loader such as Fabric, Forge, NeoForge, etc. Mods are not supported by\nMojang Studios, while Mojang usually doesn't interact with the modding scene \n(and sometimes, even helps it as with the example of deobfuscation in 26.1), \nthey do not natively support mods and likely never will. Mods allow you to do \nanything you want with the game on both the client and the server. They give you \nfull control of everything in the game from game rendering, to blocks, to key input, \nto even networking. They allow for much more complex interactions with some minor caveats.\nDo not install mods from suspicious sources, as they can have near full access to\nanything on your computer including sensitive files.Always download from a reputable distributor such as\nModrinth or\nCurseForge!\n\nMods can include data and asset files alongside code. This includes shipping\nmodel/texture files in the resource pack format, recipe files in the datapack\nformat, and more.In some cases, mods can simply be datapacks in a specially formatted JAR file!\n\neveryone on the server uses the required mods, which can be hard to manage\nespecially with larger packs. Mods can also be harder to debug and troubleshoot,\nespecially if they utilize parts of Minecraft's obfuscated code (pre-26.1). A strength of\ndatapacks is that anyone can join a server that uses them since they are fully\nvanilla.Summary of DifferencesAs you may have read, datapacks and mods are very different and can be used for\nvery different use cases. Below we've summarized some of the important points\ninto a handy-dandy list!ModsDatapacksAllow for full control over all of Minecraft's codeModify the base systems of the gameCan contain datapacks in the form of data foldersMay contain command functions along with system modifications such as recipes or world generationFull control over everything in game/server and out of game (could be a security risk)Limited to server-side changes of game mechanics, malicious datapacks are much safer than malicious modsGenerally faster and can improve game and server performance due to high level of controlGenerally slower but more lightweight and less resource hungryIdeal for modifying the game in ways datapacks cannot (e.g custom blocks, new mobs) or adding new mechanics/systemsIdeal for small mods that modify existing systems, \"vanilla\" looking mods and map makingServer owners must verify mod compatibility between clientsAny client can use datapacks, making them easy to manageMay require some knowledge of Java to use and debug effectivelyIn most cases, easier to debugIf you would like to learn how to install datapacks, see our guide!","description":"Learn the differences between mods and datapacks","url":"/guide/datapacks-for-mods/mods-vs-datapacks/","tags":[]},{"title":"MCFunction vs Coding","content":"MCFunction vs Traditional CodingMany people will join the datapack community with experience with traditional\nprogramming languages. While this can be helpful for understanding topics, there\nare a lot of differences between the two, many of which can seem confusing when\nyou are used to a more traditional programming language. In this guide we touch\non some common questions and problems people run into when trying to apply\ntraditional coding logic to MCFunction.Q: How do you do variables in MCFunction?MCFunction isn't like most programming languages, MCFunction uses scoreboards,\nstorages and macros (1.20.2+) as their variables.Scoreboards are like a table. They store a\nname and a value which you can then retrieve and modify later. You can use both\nentity names/UUIDs and \"fake player\" names (names not associated with any\nplayer), allowing for easy combination of variables and entity scores.\nScoreboards can only hold 32-bit integers and other data types (such as floats,\ndoubles or strings) can not be stored this way.Storages are a way of storing\nNBT data without attaching it to an entity or\nblock. Storages are stored globally per world and unlike scoreboards, don't need\nto be initialized beforehand. Unlike entity and block NBT, storages have no\nfixed structure, and can contain whichever arbitrary keys are added to it.Macros are like fancy string\ntemplating, when a function is supplied with macros, it will go through the\nfunction file and replace the macro with its value (block, entity, storage).\nInterestingly, this also works function-wide, meaning you could use them as mock\narguments.\nMacros can be significantly slower than other methods, it is best to only use\nthem when necessary or in non-performance-critical code.\n\n# creates a new table called storage\n# (dummy means it does not track any statistic)\nscoreboard objectives add storage dummy\n\n# adds a fake player named \"$steps\" to storage (using prefix \"$\" to avoid collisions with real players, good practice)\nscoreboard players set $steps storage 41\n\n# sets the value of a player to 42\nscoreboard players set Cbble_ storage 42\n\n# Macros\n# Run cool function with a macro\nfunction dph:cool_function with block ~ ~ ~ Items\nfunction dph:cool_function with entity @e[type=minecraft:squid,limit=1,sort=nearest] CustomName\nfunction dph:cool_function {Potato:true}\n\n# Usage with entity NBT:\nexecute as @p run dph:cool_function with entity @s SelectedItem\n\n# this is in the dph:cool_function function\n$say The player running this function is holding $(count) items with ID $(id)!\n\n# Storages\ndata merge storage example:main {number: 1, message: \"Hello!\"}\ndata modify storage example:main other_number set from storage example:main number\ndata modify storage example:main compound.array append value 42\n(Get more info on storages on\nthe wiki page)Q: How do you loop in MCFunction?Looping in most cases is done with 1 of 2 methods, depending on the use case:Recursive Function Calls: This is when a function calls itself which will\nloop until some end condition is met, or forever, if one is never met.Tick Functions (#minecraft:tick): This is a special tag you can declare\nthat will run every function declared in it every tick, it is best practice\nto only have one of these function in a datapack at a time.Q: How do you make functions/methods?Every MCFunction file is its own function which you can run with the function\ncommand. MCFunction does not support inheritance and inherited functions, but\nyou can call any function from anywhere in your datapack.function [...]\nQ: How do I do conditionals?You can also do some basic conditionals with\nselectors, but most if not all conditionals\nare done with the\nexecute if\nsubcommand, which accepts a variety of different inputs and check if they\nmatch/are equal. You can learn more about execute if on the\nexecute page.Q: How do you do math/expressions?MCFunction does math in an interesting way; it uses scoreboard operations in\norder to do math. Using the scoreboard players operation subcommand, you can\ndo a\nvariety of math operations.\nMCFunction does not come with complex math operations like trig functions, absolutes, a\npre-defined Pi, or even square root! These all must be implemented either by\nhand or with a third-party library.\n","description":"Learn the differences between using MCFunctions and traditional coding.","url":"/guide/mcf-vs-code/","tags":[]},{"title":"Right Click Detection Summary","content":"Right Click DetectionThere a few ways we can detect right clicks in a Minecraft datapack, depending\non your situation. Here are the methods we can use:Using a Carrot on a stickThis method is the \"traditional\" right click detection method. We can use a\nscoreboard to detect when a player right clicks a carrot on a stick item.This is the most straightforward method for simple right click detection, but it\nhas certain drawbacks - including making pigs follow the player.Using an item with the consumable componentWith the item changes added in 1.20.5, we can now detect right clicks on any\nitem using the consumable component. This method is much more versatile.\nHowever, this method triggers once per tick, not just once per right click.Using the on_consume advancement criteriaWith the item changes added in 1.20.5, we can now detect right clicks on any\nitem using the on_consume advancement criteria, which detects when an item is consumed.\nThis method is quite similar to the consumable component method, with a few advantages and disadvantages.Using an Eye of EnderThis method is a bit more niche, as it only works in worlds without strongholds.\nThis method also triggers once per tick, not just once per right click.Clicking an Interaction EntityThis method detects when the player right clicks on an interaction entity.\nUnlike the other methods, which all detect right clicks while holding specific\nitems, this method lets you detect when a player right clicks on a specific area\nof the world.","description":"This section goes over the various ways of detecting right clicks with a Minecraft datapack.","url":"/guide/right-click/","tags":[]},{"title":"Using COAS/WFOAS for RC detection","content":"Carrot on a Stick Right Click DetectionUsing a carrot on a stick (or a warped fungus on a stick) is perhaps one of the\nsimplest methods of right-click detection, requiring only a single tick command\nand a scoreboard. This method works due to the used:carrot_on_a_stick\nstatistic detecting right clicks on any carrot_on_a_stick item.\nCOAS. This method also works with warped fungus on a stick (WFOAS) items.\nitem counts as \"using\" an item, and will therefore increase the\nused:carrot_on_a_stick statistic. We can track changes to this statistic using\na scoreboard. When it goes up, we know that the player has right clicked a COAS,\nand we can run a command when that happens.MethodTo get started, we need to create a scoreboard with the criteria\nminecraft.used:minecraft.carrot_on_a_stick, so that we can later detect when a\nplayer uses the COAS (by right clicking on it).If you don't already have it, you'll need to create a load function with a\ncommand that creates a new scoreboard objective. You can name the objective\nwhatever you want. We recommend naming it something like .rc_coas.\nIn your load function, put a scoreboard command such as this:scoreboard objectives add.rc_coas minecraft.used:minecraft.carrot_on_a_stick\nThis scoreboard will go up by 1 every time a player right clicks a COAS -\nwhen this happens we can execute our function. Note that this command must run\nevery tick, otherwise it won't be able to detect right clicking. Put this in\nyour tick/loop function:# This will run the \"rc_run\" function as the player who uses the COAS.\nexecute as @a[scores={.rc_coas=1..}] run function :rc_run\nscoreboard players reset @a[scores={.rc_coas=1..}].rc_coas\nIn the rc_run.mcfunction file, you can do whatever you like as a result of\nright clicking the COAS. As an example, putting this in rc_run.mcfunction will\nmake the player say Used COAS when they right click a COAS item.say Used COAS\nDetecting specific itemsThe above method will detect when any carrot on a stick item is right clicked,\nwhich by itself isn't useful. Instead, we want to detect when a specific carrot\non a stick item is clicked.We can give our carrot on a stick item a special custom_data component which\nis unique to our custom item. The custom_data component can support any NBT\ndata, but the simplest value would be {item:\"my_custom_item\"}:# Give the player the custom item\ngive @s carrot_on_a_stick[custom_data={item:\"my_custom_item\"}]\nThen, we can just add an extra check to our execute command in\ntick.mcfunction to only run the function when the player is holding our custom\nitem:# Replace the previous execute command in tick.mcfunction with this:\nexecute as @a[scores={.rc_coas=1..}] if items entity @s weapon.mainhand carrot_on_a_stick[custom_data~{item:\"my_custom_item\"}] run function :rc_run\n# If you want more than one custom item, simply copy the above command, and just change \"my_custom_item\"\n","description":"Using a carrot on a stick for right click detection is an easy way to detect right clicks with a datapack.","url":"/guide/right-click/coas/","tags":[]},{"title":"Using the on_consume advancement criteria for right click detection.","content":"On Consume Right Click DetectionA second method for right click detection using the consumable components is the on_consume method, which requires the player to actually consume the item before using it.\nhas a default right click functionality (such as placing a block), it will keep\nthat functionality. This method is best used for items that don't have a default\nright click functionality.\nAny item can be used here, but it is recommended to not already have a right click function. The custom data is the value we will be using to separate our item. If you wish to give your item a windup time, change the consume seconds (it can be 0 for no windup). The cooldown group is the global group used for the item cooldown, any item in this group will go on cooldown for the value of seconds set after it is used.Now that we have the item, we must write the right click detection.\nThis method uses the on_consume advancement criteria, which detects when an item is consumed, we then check if the item has the custom data value we assigned.{\n\"criteria\": {\n\"right_click\": {\n\"trigger\": \"minecraft:consume_item\",\n\"conditions\": {\n\"item\": {\n\"components\": {\n\"minecraft:custom_data\": {\n\"tutorial\": \"item\"\n}\n}\n}\n}\n}\n},\n\"requirements\": [\n[\n\"right_click\"\n]\n],\n\"rewards\": {\n\"function\": \"tutorial:right_click\"\n}\n}\nFinally, let's write the function that will run on right click.# Custom logic\nsay Right click detected.\n\n# Give back the item as it was consumed\ngive @s echo_shard[consumable={consume_seconds:1,animation:\"eat\"},custom_data={tutorial:\"item\"},use_cooldown={seconds:5,cooldown_group:\"tutorial_item\"}] 1\n\n# Revoke the advancement\nadvancement revoke @s only tutorial:consume\n","description":"Using the on_consume advancement criteria to detect when a player right clicks in a datapack.","url":"/guide/right-click/on_consume/","tags":[]},{"title":"Using the Consumable component for RC detection","content":"Consumable Component Right Click DetectionThe minecraft:consumable component can be a helpful indicator of when an item\nis right clicked by the player in a Minecraft datapack. We can detect usage of\nan item with the consumable and food components with an advancement which\ncan trigger a function. This method can be used on almost any type of item.\nhas a default rightclick functionality (such as placing a block), it will keep\nthat functionality. This method is best used for items that don't have a default\nrightclick functionality.\nmust create a using_item advancement, and specify the item data you want to\ntrigger the advancement. Then, you can specify a reward function which will be\nrun when the advancement is triggered.{\n\"criteria\": {\n\"requirement\": {\n\"trigger\": \"minecraft:using_item\",\n\"conditions\": {\n\"item\": {\n\"items\": [\n\"minecraft:\"\n],\n\"predicates\": {\n\"minecraft:custom_data\": {\"custom_id\": \"your_custom_item_id\"}\n}\n}\n}\n}\n},\n\"rewards\": {\n\"function\": \":rightclick_run\"\n}\n}\nIn the function (in this case,\n/data/ /function/rightclick_run.mcfunction), you can put commands\nthat you want to run when the item is clicked. Make sure that this function also\nrevokes the advancement so that it can be triggered again next tick.# Revoke the advancement from the player so it can be used again\nadvancement revoke @s only :click\n\n# Custom logic\nsay I right clicked the item!\nAfter /reloading the datapack, we will now need to give the player the item\nwith the custom food and data components.give @p [consumable={consume_seconds:999999999,animation:\"none\"},food={nutrition:0,saturation:0,can_always_eat:true},custom_data={custom_id:\"your_custom_item_id\"}] 1\nNow, when you right click this item, it should send a message to the chat saying\nI right clicked the item!.","description":"Using the minecraft:consumable component to detect when the user right clicks an item in a datapack.","url":"/guide/right-click/consumable_component/","tags":[]},{"title":"Using an Interaction Entity for RC detection","content":"Interaction Right (and left) Click DetectionAn interaction entity can detect clicks in a specific area, instead of on an\nitem. Interaction entities can detect both right and left clicks (although this\nguide will go over right clicks specifically). There are two methods to detect\nright clicks using interaction entities, depending on what you want to do\nafterwards.Method 1: Detect when a player right clicks an interaction entityThis method works best when you want to do something to the player when they\nright click the interaction entity.To detect when the interaction entity has been interacted with, you must create\na player_interacted_with_entity advancement, and specify the entity data you\nwant to trigger the advancement. Then, you can specify a reward function which\nwill be run when the advancement is triggered.{\n\"criteria\": {\n\"requirement\": {\n\"trigger\": \"minecraft:player_interacted_with_entity\",\n\"conditions\": {\n\"entity\": {\n\"type\": \"minecraft:interaction\",\n\"nbt\": \"{Tags:[\\\\\"my_interaction\\\\\"]}\"\n}\n}\n}\n},\n\"rewards\": {\n\"function\": \":rightclick_run\"\n}\n}\nIn the function (in this case, you will need to create it:\n/data/ /functions/rightclick_run.mcfunction), you can put commands\nthat you want to run when the interaction entity is right clicked. Make sure\nthat this function also revokes the advancement so that it can be triggered\nagain next tick.# Revoke the advancement so we can detect the click again\nadvancement revoke @s only namespace:interacted_with_interaction\n\n# Custom logic\nsay I clicked the interaction entity!\nNow you can summon the interaction entity by doing\n/summon interaction ~ ~ ~ {Tags:[\"my_interaction\"]} - you may want to enable\nhitboxes with F3 + B in order to see the hitbox of the interaction entity (it\nis invisible without it).Method 2: Detect when an interaction entity is right clickedThis method works best when you want to do something to the interaction when it\nis right clicked, ignoring which player did it.The interaction entity will have an interaction NBT tag when it has been right\nclicked by a player. You can use a tick function to detect this easily using\nexecute if entity, and run a function as the interaction entity when it has\nbeen triggered:execute as @e[type=interaction,tag=my_interaction] if data entity @s interaction run function :rightclick_run\nIn the rightclick_run function, you will need to remove the interaction NBT\nfrom the entity so that it resets, and then you can add custom logic:# Remove the interaction tag so it can be used again\ndata remove entity @s interaction\n\n# Custom logic\nsay I was right clicked!\n\nthe interaction NBT, use the attack NBT.","description":"Interaction entities can be used to detect when a player rightclicks or leftclicks in a specific area of the world.","url":"/guide/right-click/interaction/","tags":[]},{"title":"Using an Eye of Ender for RC detection","content":"Eye of Ender Right Click Detection\neither use a similiar method that works everywhere (using the Food Component\nmethod) or do some changes to these functions, as specified at the end of this\nguide.\nthe Carrot on a Stick method, we can detect when an eye of ender item is being\nused by the player as a result of right clicking it.Unlike the Carrot on a Stick method, this method will be trigger every tick that\nright click is being held, instead of just once when right click is pressed.MethodTo detect when an eye of ender is being used, you must create a using_item\nadvancement, and specify the item data you want to trigger the advancement.\nThen, you can specify a reward function which will be run when the advancement\nis triggered.{\n\"criteria\": {\n\"requirement\": {\n\"trigger\": \"minecraft:using_item\",\n\"conditions\": {\n\"item\": {\n\"items\": [\n\"minecraft:ender_eye\"\n],\n\"predicates\": {\n\"minecraft:custom_data\": {\"custom_id\": \"your_custom_item_id\"}\n}\n}\n}\n}\n},\n\"rewards\": {\n\"function\": \":rightclick_run\"\n}\n}\nIn the function (in this case,\n/data/ /functions/rightclick_run.mcfunction), you can put commands\nthat you want to run when the item is clicked. Make sure that this function also\nrevokes the advancement so that it can be triggered again next tick.# Revoke the advancement from the player so it can be used again\nadvancement revoke @s only :used_eye_of_ender\n\n# Custom logic\nsay I successfully used EoE detection!\nIf you want this method to work in worlds with strongholds, you can either block\nthe target of ender eyes in the pack.mcmeta or killing the eye and giving it\nback after it being used.","description":"An intresting right click detection method for sure, due to the fact that it can only be used in worlds without strongholds!","url":"/guide/right-click/eoe/","tags":[]},{"title":"Credits","content":"CreditsThe Datapack Wiki is managed by Datapack Hub, based\non an original design and idea by Aandeel. All of the\ncontent on this wiki is made possible thanks to the dedication of our awesome\ncontributors! You can contribute to this wiki on our GitHub - click the Edit\nbutton on any page.AdministratorsThese people run and develop the site, making any and all important decisions.SilabearCobblestoneAandeelEditorsThese people are in charge of what contributions are added to the site, as well\nas planning and writing new pages.GearsContributorsThese people have written or edited pages for the wiki or guides.DiamondHeDeAnSuperAnt_SwitchedCubeKraggle09AmandinSubzerodittotheblackswitch\ncontribute by clicking the Edit button on any page.","description":"The Datapack Wiki is brought to you by [Datapack Hub](https://datapackhub.net) in collaboration with Aandeel.","url":"/credits/","tags":[]},{"title":"Resources","content":"ResourcesListed here are links to credible and reliable places and libraries to aid in\ncommand/datapack support and creation.\nexternal sites or Discord Servers, so proceed with caution. However, they're all\nsafe to use and have amazingly useful content and tools for creating Minecraft\nDatapacks.\nDatapack Hub - Get help with\nMinecraft Datapacks, resource packs, commands and more.Website\nSmithed - A general (but non-help) datapack\ncommunity for sharing projects.Discord\nMinecraft Commands - Get help with\nJava datapacks/commands or Bedrock addons.Discord\nShaderLABS - Get help with vanilla\nshaders.Discord\nBlockbench - Support for the\nBlockbench (3D model editor) app.Discord\nFabricMC - Get help with Fabric\nand Fabric mods.Discord\nMinecraft - Discuss Minecraft\ngenerally with people from around the world.Discord\nAnimated Java - Support for\nthe Animated Java Blockbench plugin.Discord\nDataworld (French) - A French discord\nserver for help with datapacks.Discord\nAnthill\n(Russian) - A russian-speaking discord server for help with datapacks,\nresource packs and commands.GeneratorsWebsite\nMCStacker - Generate commands such as\n/summon, /give, and more.Website\nMisode - Generate files such as\nadvancements, predicates, recipes, worldgen, and more.Website\nTheDestruc7i0n Recipe\nGenerator - Generate simple recipes.Website\nMinecraft JSON - Generate JSON Text.Website\nBlock Display Engine - Create models with\ndisplay entities and export as commands.Website\nhaselkern's\nArmorStand - Generate summon commands for armor stands in any pose.Website\nDatapack Hub's Text Editor -\nCreate /tellraw commands and text components (JSON text) for Minecraft Java\nEdition with our easy-to-use, modern online tool!ToolsTool\nWeld - The fastest data and resource\npack merger in the west.Templates/ReferenceWebsite\nMinecraft Wiki - A detailed technical\nwiki covering all Minecraft mechanics.Website\nMisode's MCMeta - A GitHub\nrepository with every vanilla file (compiled by Misode).Website\ninventivetalent's Minecraft assets -\nWebsite with every vanilla file.Website\nCCCode's version-diff -\nShows all the differences in vanilla files between two versions.Website\nMisode's\nTick Order - A detailed sequence of events that occur during a Minecraft\nserver tick.Tutorials/Content CreationYouTube\nCloud Wolf - Datapack\ntutorials, especially advanced concepts.YouTube\nSlicedlime - Covers all the\ntechnical changes in recent snapshots.YouTube\nConure - Small, but\ninformative datapack tutorials.YouTube\nLegitimoose - Easy to\nunderstand datapack and command tutorials.PMC Guide\nStructure\nGeneration GuidePMC Guide\nWorld\nGeneration GuideWebsite\nMCC's FAQs -\nA list of common questions along with tutorials for answers.LibrariesLibrary\nTagLib - A curated\nlist of useful tag files.Library\nSmithed (Libraries) - A\ncollection of useful technical and compatibility libraries.Library\nPlayer Motion -\nAllows manipulating player's motion.Library\nBlockstate - Extracts\nthe BlockState data of any block at given position.Library\nBookshelf - A\nuser-friendly modular library datapack with lots of useful modules.Library\nIris - A raycasting library\nwith micrometric precision and taking into account individual block\ngeometries.Library\nAjjGUI - A Data-Driven GUI\nlibrary.Library\nMcfunction\nLogger - A library for logging things to the server console.Library\nMoxvallix's Library - The\nultimate Minecraft Datapack Library, constantly updated with new helpful\nfunctions.ModsMod\nDatamancer - A tool for\ndatapack devs with several features, such as function profiling &\nbenchmarking, marker goggles, datapack autoreloading and more.Mod\nDatapack debugger -\nSet breakpoints in the functions to \"freeze\" the game when the breakpoint is\nreached.Mod\nBetter Suggestions -\nProvides more/better suggestions for Minecraft commands.Mod\nNBT Autocomplete -\nAdds suggestions for NBT tags in commands.","description":"Listed here are links to credible and reliable places to aid in command support and creation.","url":"/resources/","tags":[]},{"title":"Ranges","content":"RangesA range specifies a set of values between two numbers. Ranges are used in some\ncommands (such as execute) and selectors to specify a set of values to compare\nagainst.For example, the distance= selector accepts a range to select entities within\na certain distance from the player. The range distance=..10 selects entities\nwithin 10 blocks of the player.Greater than (x >= 10)To specify a range of numbers such as \"x or greater\", we can use the min..\nsyntax. The following range represents \"10 or greater\". Note that this range\nincludes 10.10..\nLess than (`x","description":"A range specifies a set of values between two numbers.","url":"/wiki/concepts/ranges/","tags":[]},{"title":"Commands","content":"CommandsCommands are the basic building blocks of most datapacks. Each command is a\nsimple instruction which can tell the game to do something. Most datapacks are\nmade primarily of functions - functions are just lists\nof commands ran in order.There are too many commands for this wiki to go over each one individually.\nHowever, important commands can be found in the Command Reference section of\nthe sidebar.Command ContextProgramming Minecraft command is unique. Commands are always run with context -\nthis means commands always have a position (in a dimension), rotation, and\nexecutor entity. Functions inherit context from their caller, so if you run a\nfunction in chat, all the commands in the function will have the same context as\nif you ran them in chat.Functions ran by the game, for instance tick, load, and scheduled functions,\nwill have the following context:the executor is the game server. If you use @s in a command, it will not\nrefer to any entity.the position of the command is the world spawnthe rotation of the command is 0, 0If you run a command in chat, then:you are the executor entity. If you use @s in a command, it refers to you.the position and rotation of the command are where you are standing and\nlooking. If you use ~ ~ ~ in a command, it refers to where your position.The /execute command will change the context of a command. For instance, this\ncommand would change the executor to the player Silabear, and the position of\nthe command to 123 456 789:execute as Silabear positioned 123 456 789 run say Hello!\n","description":"Commands tell the game to do things. [Functions](/wiki/files/functions) are files which are made up of many commands. They form the basic building blocks for any function datapack.","url":"/wiki/concepts/commands/","tags":[]},{"title":"Item Components","content":"Item ComponentsItem components are data structures which can be applied to items in Minecraft\nto give them special attributes, such as a name, lore, being able to be eaten,\netc. Each item has specific item components by default - for example, all food\nitems will have the minecraft:consumable component, which makes the item\nedible.A command such as /give or /item can be used to create an item which has\nadditional item components, or remove item components from any item.You can check out all the components and their data structure on the Minecraft\nWiki: https://minecraft.wiki/w/Data_component_format#List_of_components","description":"Item components are data structures which can be applied to items in Minecraft to give them special attributes, such as a name, lore, being able to be eaten, etc.","url":"/wiki/concepts/item-components/","tags":[]},{"title":"Coordinates","content":"CoordinatesCoordinates in Minecraft are represented by an x, y, and z value. They are\nused to represent positions of entities, blocks, particles, sounds and more. In\ncommands, they are represented as simply x y z, where x, y, and z are\ndecimal numbers representing the coordinates on each axis.Block coordinates are locked to the grid and are unique - there can only be one\nblock per set of coordinates. Block coordinates are whole numbers, for example\nyou can have a block at 123 86 94 but not 123.7 86.2 94.6. Entities are not\nlocked to the grid - they can be at decimal positions (and usually are).x.0 y.0 z.0 represents the bottom left corner of a block, not the centre. The\ncentre of a block would be represented by the coordinates x.5 y.5 z.5.\nis usually the world spawn. You can change this using the commands \"execute at\"\nor \"execute positioned\".\ntell the game to put a pink concrete block at the coordinates 123 86 94./tp @s 66.2 98 45.7: This command would teleport the current entity to the\nexact coordinates 66.2 98 45.7Relative CoordinatesUsing the symbols ~ and ^, we can reference coordinates relative to the\ncurrent coordinates (for example, you can get the position\n7 blocks above the current position).~ represents the current position on any axis. For example, 12 ~ 76 would\nteleport me to x=12 z=76 but keep y as the current position. The\ncoordinates ~ ~ ~ would represent the position of the command - this is useful\nto do something at the current position such as placing a block or summoning an\nentity.The ~ symbol can be followed by a number to include an offset to the current\nposition. For example, ~ ~12 ~ would represent the current position offset by\n10 blocks on the y-axis (or in simpler terms: the position 10 blocks above the\ncurrent position). This can also be a negative number.Similarly ^ represents a relative position, taking into account the current\nrotation too. The most common use for this is to get a position in front of the\ndirection of rotation. For example, you can use ^ ^ ^5 to get the position 5\nblocks in front of the current position in whatever direction the command or\nentity is rotated.^3 ^ ^ represents a vector 3 blocks perpendicular of the head (sway)^ ^3 ^ represents a vector 3 blocks \"above\" of the head (heave)^ ^ ^3 represents a vector 3 blocks in front of the head (surge)","description":"Coordinates in Minecraft are represented by an `x`, `y`, and `z` value. They are used to represent positions of entities, blocks, particles, sounds and more. In commands, they are represented as simply `x y z`, where `x`, `y`, and `z` are decimal numbers representing the coordinates on each axis.","url":"/wiki/concepts/coordinates/","tags":[]},{"title":"Target Selectors","content":"Target SelectorsTarget Selectors are used as an argument in commands to select entities and\nplayers in the world. We use target selectors to find players or mobs and do\nthings to them. Many commands need to be given a target selector as an argument,\nor otherwise require being executed as an entity.All target selectors start with an @ symbol, followed by a base selector (see\nthe table below), and optionally any other criteria which will narrow down the\nselection further.Example: tellraw @a[distance=..10] \"You're within 10 blocks of me\". The\ntarget selector is @a[distance=..10], and tells the game to only send the\nmessage to players within 10 blocks.Base target selectorsIn Java Edition, there are 6 base target selectors:Target SelectorDescription@eAll Entities - By itself, this selector will select every single entity which is currently loaded in the world@sThis Entity - This selector will select the entity which is currently running the command. For example, if I run a command as @s, then it will run the commands as me.@aAll Players - This selects all currently online players. (All players are always loaded in the world).@rRandom Player - This selects one random player.@pNearest Player - This selects the nearest player to the position this command is ran from.@nNearest Entity - This selects the nearest entity (player or non-player) to the position this command is ran from.\ncurrently being loaded, it will not select that entity.\nfilter the selection even more to only find the entities that you want. Target\nselector arguments are contained within square brackets after the base selector\n(@e[...]) and are written as\n[ :, =,...]Example: In our previous example (@a[distance=..10]), we use the argument\ndistance=..10 to specify that we only want to target entities which are less\nthan 10 blocks away.\nentities who do not match the argument. (E.g. @e[type=!minecraft:creeper] will\nselect every entity that is NOT a creeper)\nentities of a certain type, or those in an entity_type tag.must be a valid entity ID or entity_type tag ID. This argument\ncan only be used with @e, @s or @n.Examples:@e[type=minecraft:pig]: Selects all pigs@e[type=#minecraft:aquatic]: Selects all aquatic animalsname argumentThe name=argument will filter the selection to only include\nentities who have a specific name.is a simple string. This can not be a text component but\nname=Freddie would still match a styled name like\n{\"text\":\"Freddie\",\"color\":\"blue\"} or similar.Examples:@e[name=Aaron]: Selects all entities named Aaron@e[name=\"Aaron Aaronson\"]: Selects entities named Aaron Aaronson\ninclude entities who are within a distance range.can either be a value (such as 7) or a range (such as ..8\nor 21..)Examples:@e[distance=6]: Selects all entities which are exactly 6 blocks away from\nthe execution position.@e[distance=..20]: Selects all entities within 20 blocks of the execution\nposition.@e[distance=3..]: Selects all entities that are more than 3 blocks away from\nthe execution position.@e[distance=12..15]: Selects all entities between 12 and 15 (inclusive)\nblocks from the execution position.nbt argumentThe nbt= argument will filter the selection to only include entities\nwhich have or do not have specific NBT data.`` is an NBT compound. The entity must\nmatch everything within the compound.Examples:@a[nbt={SelectedItem:{id:\"minecraft:stone\"}}]: Selects all players who are\nholding stone@e[type=minecraft:arrow,nbt={inGround:1b}]: Selects all arrow entities who\nare in a block.sort and limit argumentsThe sort=,limit=will limit the amount of possible entities\nit will select and will select entities based on the priority defined in\n .can be one of the following:arbitrary: sort in entity load order, which is arbitrarynearest: sort in increasing order of distancefurthest: sort in decreasing order of distancerandom: sort randomly (default type for @r)can be any integer.Examples:@e[limit=1,sort=nearest]: Selects the nearest entity to the position of\nexecution@e[limit=5,sort=furthest]: Selects the furthest 5 entities from the position\nof execution.@e[limit=7,sort=random,type=minecraft:cow]: Selects 7 random cows..x/y/z argumentsThe x/y/z=arguments do not directly change the selection, but are\nused alongside other arguments to specify a starting position to work from.This argument(s) will affect the arguments distance, dx/dy/dz and\nsort/limit.Examples:@e[x=10,y=9,z=-5,distance=..5]: Selects all entities less than 5 blocks away\nfrom the position X=10/Y=9/Z=-5dx/dy/dz argumentsThe dx/dy/dz arguments will create a cuboid that is at least 1x1x1 blocks big\nand the given value will increase the size of the cuboid in that direction by\nthe given value in blocks.Any entity fully or partially inside the cuboid will be selected.You can mix and match dx, dy, and dz however you want. To create the\ncuboid at least 1 of the three has to be there.\ncommand origin to positive x/y/z\ntheir hit box is within the cuboid w=11,h=21,l=6 starting from the position\nx=10,y=13,z=87@e[x=7,y=3,z=9,dx=0,dy=0,dz=0]: Selects any entities if their hit box\noverlaps with the block at x=7,y=3,z=9tag argumentThe tag=argument will select entities which have the specified tag.\nis any tag string (no spaces).Entities do not naturally have tags - these are separate from entity_type tags\nsuch as that used in the type argument. Instead, these select entities based\non the tags added with the /tag command or Tags[] NBT.Examples:@a[tag=CustomTag]: Selects all players with the tag CustomTag@e[tag=!ignore]: Selects all entities which do not have the ignore tag.team argumentThe team=argument will select entities which are in a specific\nteam. Since entities can only be in one team at a time, you cannot use team=\nmore than once, however you can duplicate negated team arguments (team=!).is any tag string (no spaces).Examples:@a[team=red]: Selects all players in the red team@e[team=Bears]: Selects all entities in the Bears team@e[team=!blue]: Selects all entities which are not in the blue teamscores argumentThe scores={ =,...} argument will select entities based on\ntheir value on a scoreboard.is a scoreboard objective which must exist already.can\nbe either an integer or a range.Examples:@e[scores={foo=10}]: Selects all entities with a score of exactly 10 on\nthe foo scoreboard.@e[scores={foo=5,bar=7}]: Selects all entities with a score of exactly 5\non the foo scoreboard and exactly 7 on the bar scoreboard.@e[scores={foo=8..}]: Selects all entities with a score of 8 or more on\nthe foo scoreboard.predicate argumentThe predicate=argument will select entities based on whether they\npass a predicate check.is a predicate ID.Examples:@e[predicate=namespace:my_predicate]: Selects all entities who pass the\npredicate in data/namespace/predicates/my_predicate.@e[predicate=!namespace:another_predicate]: Selects all entities who fail\nthe predicate in data/namespace/predicates/another_predicate.jsongamemode argumentThe gamemode=(survival|creative|adventure|spectator) argument will select\nplayers who are in a specific game mode.Examples:@a[gamemode=creative]: Selects all players in creative modeadvancements argumentThe advancements={ =(true/false)} argument will select\nplayers based on whether they've unlocked an advancement.\nis an advancement ID.Examples:@a[advancements={minecraft:story/follow_ender_eye=true}]: Selects all\nplayers who have unlocked the follow_ender_eye advancement.@a[advancements={minecraft:story/follow_ender_eye=false}]: Selects all\nplayers who have not unlocked the follow_ender_eye advancement.advancements argumentThe advancements={ =(true/false)} argument will select\nplayers based on whether they've unlocked an advancement.\nis an advancement ID.Examples:@a[advancements={minecraft:story/follow_ender_eye=true}]: Selects all\nplayers who have unlocked the follow_ender_eye advancement.@a[advancements={minecraft:story/follow_ender_eye=false}]: Selects all\nplayers who have not unlocked the follow_ender_eye advancement.level argumentThe level=argument selects players based on their current XP level\n(not amount of points).can be an integer or range.Examples:@a[level=10]: Selects all players who have an XP level of exactly 10.@a[level=4..]: Selects all players who have an XP level of 4 or more.x_rotation argumentThe x_rotation=argument selects players based on their vertical\nrotation (pitch).can be a floating point value or float range from -90 to 90Examples:@a[x_rotation=0..90]: Selects all players who are looking below the horizon\nor directly at the horizon.@a[x_rotation=90]: Selects all players who are looking straight down.y_rotation argumentThe y_rotation=argument selects players based on their horizontal\nrotation (yaw).can be a floating point value or float range from -180 to 180Examples:@a[y_rotation=-180]: Selects all players who are facing exactly due north.@a[y_rotation=-180..-90]: Selects all players who are looking between north\nand east or exactly north or east.","description":"Target Selectors are used as an argument in commands to select entities and players in the world. We use target selectors to find players or mobs and do things to them.","url":"/wiki/concepts/target-selectors/","tags":[]},{"title":"Resource Locations","content":"Resource LocationsA resource location is a way of referencing a resource in a datapack (or\nresourcepack), such as a function.ExampleThis is an example of a resource location for a function:/function my_namespace:some_folder/my_function\nThis resource location would try and access the function\n/data/my_namespace/function/some_folder/my_function.mcfunction. Notice how we\ndon't need to specify the function folder in the resource location, as it is\nimplied by the /function command.Resource locations for tagsTo reference a tag (ie the function tag #minecraft:load), you can use the #\nsymbol before the tag name. For example:/function #minecraft:load\nThis resource location would try and access the tag\n/data/minecraft/tags/function/load.json. In this case, all functions in the\ntag would be ran.Default namespaceIf the namespace (my_namespace, before the colon) is left out, it will default\nto the minecraft namespace./function some_folder/my_function\nThis resource location would try and access\n/data/minecraft/function/some_folder/my_function.mcfunction.Allowed charactersA file name (and resource location) can only contain lowercase letters (a-z),\nnumbers (0-9), underscores (_), dashes (-) and periods (.). In a\nresource location, / can be used to separate folders.","description":"A resource location is a kind of identified used in Minecraft to point to a certain piece of data, such as a function, item, or storage.","url":"/wiki/concepts/resource-locations/","tags":[]},{"title":"Styled Text","content":"Styled TextStyled text (bold, underline, colours, etc) is represented as NBT based\nstructures, called \"text components\". A text component is a way to format styled\ntext in Minecraft commands, and is used in many places such as /tellraw,\n/title, and more.Instead of just using standard text (for example \"Hello World\"), we can use\ntext components to format the text in a variety of ways, including colours, text\neffects, click events, hover events, language-based text, accessing NBT data,\nand more.For more information about the NBT format in general, see the\nNBT page.FormatA text component is formatted as either an object\n({text:\"Hello World\",color:\"red\"}), or an array of objects\n([{text:\"Hello\"},{text:\"World\"}]). An object could just be a normal string\n([\"Hello\", \"World\"] and \"Hello World\" are both valid text components).If the text component is an array, then all the objects inherit the style from\nthe first object. For instance, if the first object in an array is styled to be\nred, then all the other objects in the array will also be red unless specified\notherwise.Content sourcesThe actual text of a text component can be either static text or from a source\nsuch as NBT or scoreboard. Every object requires one of the following:text:\"\": A simple string of text.score:{name:\"\",objective:\"\"}: The score of a player in an\nobjective. In some cases, name can be set to \"*\", which will access the\nscore of the player viewing the text.NBT: This will display the value of an NBT tag. If nbt is used in a text\ncomponent, then one of storage, entity, or block is also required. The\nfollowing properties should be used:nbt:\"\": The path to the NBT value. This is required - it should be a\nstring value following the NBT path format.storage:\"\": The storage to get the NBT value from.entity:\"\": The entity to get the NBT value from.block:\" \": The block to get the NBT value from.interpret:(true/false): If true, then the NBT value's text will be parsed\nand interpreted as a text component. Defaults to false.selector:\"\": The name of a player or entity.translate:\"\": A translation key from language files defined in a\nresource pack. This will display the value of the key in the player's selected\nlanguage.with: This can also optionally be used to insert arguments into the\ntranslation key. This should be an array of text components.fallback: This can also optionally be used to specify what to display if\nthe translation is not found. If this is not specified, the key itself will\nbe displayed if the translation is not found. This should be a string value.keybind:\"\": The key which a player has bound to a keybind. (For\nexample, key.jump would show the text Space, assuming the player has not\nchanged the keybind).Example: This text component will display the value of the path\nShopData.Name in the NBT storage minecraft:xyz:{ \"nbt\": \"ShopData.Name\", \"storage\": \"minecraft:xyz\" }\nStyle propertiesThe following properties can be used in a text component to change the style\nof the text:color: The colour of the text. This can be one of the 16 standard colours\n(e.g \"red\", \"light_purple\", etc.), or a hex colour code (e.g \"#ff0000\").bold: Whether the text is bold. This can be true or false.italic: Whether the text is italic. This can be true or false.underlined: Whether the text is underlined. This can be true or false.strikethrough: Whether the text is strikethrough. This can be true or\nfalse.obfuscated: Whether the text is obfuscated. Obfuscated text applies a\nspecial glitch effect to the text. This can be true or false.Example: This text will be \"Hello World\", in red, bold, and strikethrough:{ \"text\": \"Hello World\", \"color\": \"red\", \"bold\": true, \"strikethrough\": true }\nInteractivity propertiesThe following properties can be used in a text component to add\ninteractivity to the text:insertion: Can be used to specify text to be inserted into the chat when the\ntext is shift-clicked. This should be a string value.click_event: Can be used to specify an action to be performed when the text\nis clicked. This should be an object with the following properties:action: The action to be performed. This can be one of the following:\"open_url\": Opens the url in the field url in the player's web\nbrowser.\"run_command\": Runs the command in the field command (the player needs\npermission to run the commands, and this excludes commands like /say or\n/tell which make the player send something to chat).\"suggest_command\": Opens and inserts the contents of command into the\nplayer's chat box.\"copy_to_clipboard\": Copies the contents of the field value to the\nclipboard.\"change_page\": (books only) Changes the page of the book to the page\nspecified in the field page.url or command or value or page: These fields should be added to\nclick_event alongside action depending on which action you use.hover_event: Can be used to specify what happens when a player hovers over\nthe text. This should be an object with the following propertiesaction: The action to be performed. This can be one of the following:\"show_text\": Shows the text in the field value in a tooltip by the\nplayer's mouse.\"show_entity\": Shows the entity based on the fields uuid and id in a\ntooltip by the player's mouse.\"show_item\": Shows the item based on the fields id and components in\na tooltip by the player's mouse.value or uuid + id or id + components: These fields should be\nadded to hover_event alongside action depending on which action you use.Example: This text will be \"Click me\", in blue, and when clicked, it will\nrun the command /say Hello:{\n\"text\": \"Click me\",\n\"click_event\": { \"action\": \"run_command\", \"command\": \"/say Hello\" }\n}\nOtherextra: This property can be used to add another component after, which\ninherits all the styles and interactivity from the parent object.separator: If the text source returns multiple values (e.g. multiple\nentities with the selector source, or multiple NBT values with the nbt\nsource), this can be used to specify the separator between the values. This\nshould be a string value.Text component generatorsWriting text components manually is tedious - there are numerous generators which can be used to quickly create text components. We recommend our Minecraft Text Generator which has an easy UI, cool features like gradient creators, and is updated for modern versions.Writing text components manually is tedious - there are numerous generators\nwhich can be used to quickly create text components. We reccomend\nour Minecraft Text Generator which has an easy\nUI, cool features like gradient creators, and is updated for modern versions.If you are a more advanced datapacker and want full control over the output,\nthese let you create text components one component at a time, with support for\nmore advanced featuresMisodeMinecraftJSON.com","description":"Styled text in Minecraft commands is done through an NBT text format.","url":"/wiki/concepts/text/","tags":[]},{"title":"Predicates","content":"PredicatesPredicates are a type of file which can be called to check if a certain\ncondition is true. For instance, you can create a predicate to check if a player\nis walking, if an entity is above a specific Y level, or if a player is holding\nan item. They are extremely versatile and, in many cases, more optimised than\nexecute if commands.\nadvancements and loot table files. The structure of these predicates is the same\nas described here, although some fields may not be used in certain contexts.\nholding a beef item while being inside a desert village:{\n\"condition\": \"minecraft:entity_properties\",\n\"entity\": \"this\",\n\"predicate\": {\n\"location\": {\n\"structures\": \"minecraft:village_desert\"\n},\n\"equipment\": {\n\"mainhand\": {\n\"items\": \"minecraft:beef\"\n}\n}\n}\n}\nWe can use @a[predicate=namespace:my_predicate] to select all players who\nmatch the predicate. For example:execute as @a[predicate=namespace:my_predicate] run say I am holding beef in a desert village :D\nJSON FormatEach predicate is represented as a JSON object. Predicate files can either\ncontain one predicate object, or a list of predicate objects. Each predicate\nobject needs a condition field, which specifies the type of condition to\ncheck. The rest of the fields depend on the condition type.For more information about the JSON format in general, see the\nJSON page.Certain objects are commonly reused within different predicate (and advancement)\nconditions. Below are some of them, along with their JSON structure:Number providersA number provider is used in a predicate to provide a number. This could be a\nconstant, score value, random value, etc.This can simply be a number (e.g 4 or 5.87). This can also be an object with\na min and max field to represent a random number (e.g\n{\"min\":1, \"max\":10}). For more advanced providers, they are represented as\nobjects - the contents of the object will vary based on which type field you\nuse. The available type fields, along with the fields required for them, are\nas follows:\"binomial\": Provides a random number based on binomial distribution.\nRequires the following fields:n: The number of trials used for the binomial distribution. This should be\nan int or number providerp: The chance of success for each trial. This should be an int or number\nprovider\"constant\": Provides the specified number. Requires the following field:value: The value to provide. This should be an int or a float\"score\": Provides the score of the entity as a number. Requires the\nfollowing fields:target: An object to specify the score holder. Contains a type field -\nif set to fixed, then a name field should be used to specify which\nplayer's (by username) or entity's (by UUID) score to use. If set to\ncontext, then a target field should be used with one of the following:\nthis, killer, direct_killer, killer_playerscore: The objective name to get the entity's score from.scale: If present, then the score is multiplied by scale.\"storage\": Provides the value from a specific path in an NBT storage.\nRequires the following fields:storage: The storage ID to get the score from.path: The NBT path to the specified field in the storage.\"uniform\": Provides a random number between two values. Requires the\nfollowing fields:min: The minimum number to return. This should be a number or number\nprovider.max: The maximum number to return. This should be a number or number\nprovider.Item matcherAn item matcher is used to match an item with advanced filters for components\nand count.An item matcher is an object which can consist of the following fields:items: The item type(s) to match. This can either be string (with an item ID\nor item tag ID), or an array of item IDs.count: The count of the item stack. This can either be an integer or an\nobject with a min and max key to match a range of counts.components: An object containing the item components to match. The key is\nthe component name, and the value is the expected value in the component. This\nwill only match if the component is exactly the same as the value - if any\nother data is in the component, it will be false.predicate: Like components, but will match if the component at least\ncontains the specified data, rather than only matching if it is exactly the\nsame.ConditionsThese are all the possible conditions that can be used in a predicate.block_state_propertyblock_state_property checks if the block state(s) of the block is/are equal to\na specified value(s). This predicate type is not usable with\nexecute if predicate, instead, this predicate is used in a loot table to check\na block.Fields:block: The block ID to match (e.g minecraft:andesite_wall)properties: A map of block state properties to match. The key is the\nproperty name, and the value is the property value. For instance,\n{\"waterlogged\":\"true\", \"south\":\"tall\"}.damage_source_propertiesdamage_source_properties checks the source of damage. This is often used in\nadvancements and loot tables.Fields:predicate: An object containing the following keys:tags: A list of damage_type tags to match. Checks if the type of damage is\ninflicted in any of these tags (can be toggled with the expected field).\nFor instance, [{\"id\":\"minecraft:bypasses_shield\",\"expected\":true}].source_entity: An entity_properties predicate to match the source entity\n(inflicter, e.g skeleton) of the damage.direct_entity: An entity_properties predicate to match the direct entity\n(entity responsible, e.g arrow entity) for the damage.enchantment_active_checkenchantment_active_check checks if the enchantment is active. This can only be\nused in enchantments.Fields:active: If set to true, will check that the enchantment is active. If false,\nwill check that the enchantment is inactive.entity_propertiesentity_properties checks if the entity matches the specified properties. This\nis very often used in datapacks - it can be used to check players and entities\nwith the predicate= selector argument, and execute if predicate.Fields:entity: Who to check. Can be this (equivalent of @s), attacker (the\nentity that attacked), direct_entity (the entity that caused the damage), or\nattacking_player.predicate: An object containing all the entity properties to check. There\nare lots of these, and going into full detail would take a lot of space (use a\ngenerator like misode.github.io to create these\nmore efficiently):type: The entity type to match. For instance, minecraft:player.type_specific: An object that contains properties which may only be\nspecific to one type of entity.team: The team that the entity is on.nbt: An NBT object to match. This should be in a string. For instance,\n\"{Health:20}\".location: A location_check predicate to match the entity's location.distance: An object which is used to match the distance between the entity\nand wherever the predicate is being checked.flags: An object which is used to match certain true/false flags of the\nentity, such as if they are on fire, or if they are sneaking.equipment: An object which is used to match the equipment (head, chest,\nmainhand, etc.) of the entity. The key is the slot (e.g head), and the\nvalue is an item matcher.vehicle: Another entity_properties predicate to match the entity which\nthis entity is riding.passenger: Another entity_properties predicate to match the entity which\nis riding this entity.stepping_on: Following the same structure as location, this matches the\nblock the entity is standing on.targeted_entity: Another entity_properties predicate to match the entity\nwhich this entity (non-player) is targeting.effects: An object which matches the current status effects of this entityslots: An object which matches the contents of the entity's inventory\nslots.movement: An object which matches the movement of the entity.periodic_tick: Returns true once every x ticks of the entity's lifetime.movement_affected_by: Following the same structure as location, this\nmatches what affects the movement of the entity.components - Matches entity components exactly (the component must be\nexactly equal to what is being checked).predicates - Matches entity components ignoring any other data in the\ncomponent (the component must contain what is being checked).entity_scoresentity_scores checks if the entity's score on an object matches a specified\nvalue or range.Fields:entity: Who to check. Can be this (equivalent of @s), attacker (the\nentity that attacked), direct_entity (the entity that caused the damage), or\nattacking_player.scores: An object containing the scores to check. The key is the objective\nname, and the value is either an int (e.g 33) or an object containing a\nmin and max number provider to match a range. For instance,\n{\"scoreboard1\":5, \"scoreboard2\":{\"min\":1, \"max\": 10}}.killed_by_playerkilled_by_player checks if the entity was killed by a player. This is used in\nloot tables.Fields:inverse: If true, checks if the entity was not killed by a player.\n(optional)location_checklocation_check checks if the current location matches the specified\nproperties. When used in an entity_properties -> location field, it checks the\nentity's location, but if used in a loot table, it checks the location of the\nloot source (block or entity).Fields:position: The coordinates in the world to check. This is an object\ncontaining the following keys:x: The x coordinate to match. This should be a number or a number\nprovider.y: The y coordinate to match. This should be a number or a number\nprovider.z: The z coordinate to match. This should be a number or a number\nprovider.biomes: A biome or list of biomes to match. Will be true if the location is\nwithin a biome. For instance, [\"minecraft:plains\", \"minecraft:forest\"].structures: A structure or list of structures to match. Will be true if the\nlocation is within a structure. For instance,\n[\"minecraft:village\", \"minecraft:woodland_mansion\"].dimension: The dimension to match. Will be true if the location is in a\npredicate For instance, minecraft:overworld.light: The light level to match. This should be a single int, or an object\ncontaining a min and max number provider to match a range.block: The block to match. This should be an object containing the\nfollowing:blocks: A block ID or list of block IDs to match. For instance,\n[\"minecraft:mycelium\", \"minecraft:grass_block\"].state: An object containing the block state properties to match. For\ninstance, {\"waterlogged\":\"true\", \"south\":\"tall\"}.nbt: An NBT string to match. Will be true if the block at the location\ncontains all of the specified NBT (ignoring other tags). For instance,\n\"{Items:[{id:\\\"minecraft:stick\\\",Count:1b}]}\".fluid: The fluid to match. This should be an object containing the\nfollowing:fluids: A fluid ID or list of fluid IDs to match. For instance,\n[\"minecraft:water\", \"minecraft:flowing_water\"].state: An object containing the fluid state properties to match. For\ninstance, {\"level\":\"2\"}.smokey: Checks if the location is within 5 blocks veritically of a campfire.\nThis should be a boolean.can_see_sky: Checks if the the sky light level is the highest it could be.\nThis should be a boolean.match_toolmatch_tool matches the item used to perform an action. Contrary to what may\nseem intuitive, this can not be used to check the player's mainhand item in a\npredicate referenced in predicate= or execute if predicate - this is only\nfor loot tables and advancements.Fields:predicate: An item matcher.random_chancerandom_chance will be true if a random decimal is less than the value in\nchance. For instance, 0.5 would be true 50% of the time, 0.25 would be\ntrue 25% of the time, etc.Fields:chance: The chance of the predicate being true. This should be a float\nbetween 0 and 1.random_chance_with_enchanted_bonusrandom_chance_with_enchanted_bonus is similar to random_chance, but you can\nspecify a different random chance if the tool used has a certain enchantment.\nThis is used in loot tables and advancements.Fields:unenchanted_chance: The chance of the predicate being true if the tool is\nnot enchanted. This should be a float between 0 and 1.enchanted_chance: The chance of the predicate being true if the tool is\nenchanted. This should be a float between 0 and 1.enchantment: The enchantment ID to check for. For instance,\nminecraft:fortune.survives_explosionsurvives_explosion will be true if the entity survived an explosion. This is\nused in loot tables. This predicate type has no other fields.table_bonusEssentially, table_bonus is a more advanced version of\nrandom_chance_with_enchanted_bonus, as you can specify a different chance for\neach enchantment levelFields:enchantment: The enchantment ID to check for. For instance,\nminecraft:fortune.chances: An array of chances for each enchantment level. The first item in\nthe array would be the chance for enchantment level 1, and so on.time_checktime_check checks the current time.Fields:value: The time to check, represented in game ticks. This should be a single\nint, or an object containing a min and max number provider to match a\nrange.period: If present, value will check for GAMETIME modulo . For\ninstance, setting period to 24000 (the amount of ticks in a day) would check\nfor the current daytimevalue_checkvalue_check simply matches a value from a number provider against a range or\nconstant.Fields:value: A number or a number provider to check against.range: The range used to check value (will return true if value is\nwithin this range). This should be a single int, or an object containing a\nmin and max number provider to match a range.weather_checkweather_check matches the current weather in the world. To check for sun, you\nwould need to set both fields to false.Fields:raining: Checks if it is currently raining. This should be a boolean.thundering: Checks if it is currently thundering. This should be a booleanSpecial ConditionsThese conditions are special as they are used in conjunction with one or more\nother conditions to alter the result of the predicate, often acting like logic\ngates.all_of or any_ofall_of and any_of are self explanatory. all_of checks if all specified\npredicates are true, and any_of checks if any specified predicates are true.Fields:terms: A list of predicates to check. This cannot be the ID of the current\npredicate.invertedinverted will invert the output of the predicate. If the predicate would\nreturn true, using this would make it return false, and vice versa.Fields:term: A predicate to check. This cannot be the ID of the current predicate.referencereference simply references another predicate file, as if you included the\npredicate in the current one. This is useful for reusing predicates across\nmultiple files.Fields:name: A predicate ID to check. This cannot be the ID of the current\npredicate.","description":"Predicates are a type of file which can be called to check if a certain condition is true.","url":"/wiki/files/predicates/","tags":[]},{"title":"Tags","content":"TagsRegistry tags, not to be confused with\nentity tags, are essentially lists of\ngroups such as blocks, items, entity types, etc. They use JSON format and are\nlocated in the data/ /tags/folder.Special tagsMinecraft uses some tags internally for certain behaviours. These tags are\nlocated in the minecraft namespace. For example:any functions in the #minecraft:load function tag will be automatically run\nwhen a datapack is loadedthe #minecraft:minable/pickaxe block tag lists blocks which are mined faster\nusing a pickaxe.In many cases, modifying these special tags allows you to configure certain\naspects of how Minecraft behaves.RegistriesTags group various types in a specific registry (category), such as items,\nblocks, functions, game events, chat types, etc.This list shows some of the possible registry types, as well as the path their\ntags should be put in.Registry TypesPathExample ValueItems/tags/item\"minecraft:apple\"Blocks/tags/block\"minecraft:grass_block\"Entity types/tags/entity_type\"minecraft:pig\"Functions/tags/function\"namespace:some_function\"Fluids/tags/fluid\"minecraft:water\"Game Events/tags/game_event\"minecraft:container_open\"Chat Types/tags/chat_type\"minecraft:say_command\"Damage Types/tags/damage_type\"minecraft:fly_into_wall\"Banner patterns/tags/banner_pattern\"minecraft:square_top_right\"Cat variants/tags/cat_variant\"minecraft:jellie\"Enchantments/tags/enchantment\"minecraft:sharpness\"Goat horns/tags/instrument\"minecraft:seek_goat_horn\"Paintings/tags/painting_variant\"minecraft:skull_and_roses\"Entity POI/tags/point_of_interest_type\"minecraft:cleric\"Biome/tags/worldgen/biome\"minecraft:plains\"Flat world preset/tags/worldgen/flat_level_generator_preset\"minecraft:classic_flat\"Structures/tags/worldgen/structure\"minecraft:village\"World preset/tags/worldgen/world_preset\"minecraft:large_biomes\"JSON formatFor information about the JSON format in general, see the\nJSON page.Tag files follow a very simple format, with two fields.replace: Can be true or false (defaults to false). If true, the tag\nwill overwrite other tags with the same path. If false, it will merge with\nthem.values: An array containing everything to group under this tag. Each element\ncan either bean id (e.g. \"minecraft:apple\")an object with an id field and a required field (e.g.\n{\"required\": false, \"id\":\"minecraft:stick\"}). If required is false,\nthe tag will still skip nonexistent ids.\n#minecraft:logs, it will also contain the entire contents of the\nminecraft:logs tag. A tag is represented by an ID beginning with a #. For\nmore information, refer to the\nresource locations\npage.\n\"replace\": true,\n\"values\": [\n\"#minecraft:logs\",\n\"#minecraft:planks\",\n\"minecraft:chest\",\n\"minecraft:stick\"\n]\n}\n","description":"Registry tags, not to be confused with [entity tags](/wiki/command/tag), are essentially lists of groups such as blocks, items, entity types, etc. They use JSON format and are located in the `data//tags/` folder.","url":"/wiki/files/tags/","tags":[]},{"title":"Dialogs","content":"DialogsA dialog is a \"pop-up\" menu/form which we can send to the user by using the\n/dialog command. They can show text to the user, and can also have text\ninputs, check boxes, select menus, number inputs, and action buttons.For example, you could create a settings menu for your datapack with a dialog.\nThey can open the dialog with a function (which runs the /dialog show\ncommand), and when they are done, their inputs in the form will be converted\ninto a command which will change the settings of the datapack.Dialogs are stored as JSON files in the /data/ /dialog/ folder.Types of dialogThere are many different types of dialog that we can create.All dialogs can have a title (displayed at the top of the screen), a\nbody (which can contain text), and any number of inputs (e.g text,\nnumber, multiselect, checkbox). The exact format of the dialog (including\nwhether there are buttons in the footer) depends on the type:Confirmation (minecraft:confirmation): This type of dialog has two\nbuttons in the footer (e.g \"Yes\" and \"No\", or \"Submit\" and \"Cancel\").Notice (minecraft:notice): This type of dialog has one button in the\nfooter - it is the simplest type of dialog.Multi Action (minecraft:multi_action): This type of dialog has a list of\nbuttons (arranged in columns), and optionally a \"close\" button at the bottom.Dialog List (minecraft:dialog_list): This type of dialog consists of any\nnumber of buttons that open another dialog when clicked (arranged in columns)Server Links (minecraft:server_links): This type of dialog will display\nthe server's preset custom links.\ndisplay graphically, and will look as if it is in the inventory when it is\nhovered over by the cursor.\nand multi action input form):Text (minecraft:text): Allows the user to enter text.Number range (minecraft:number_range): Allows the user to select a\nnumber with a slider (like in the settings menu)Boolean (minecraft:boolean): This is a checkbox. When the checkbox is\nticked, then the value is true, and vice versa.Single Option (minecraft:single_option): Allows the user to select one\nfrom a list of options. It looks like a button, but you click on it to cycle\nthrough the values.Each input also has a key. This is the name of the macro value that is used\nwhen a dynamic/run_command button is clicked. For instance, if one input has\nthe key message, and a button runs the command /tellraw @a \"$(message), then\nthe value from that input is used in the command.These inputs are pretty customisable. For instance, Text, Number range, and\nSingle Option types can have a custom width, text inputs can be made multiline,\netc.ActionsActions are basically buttons (e.g the submit button) which will do something\nwhen clicked. On forms, actions will run a command which uses the inputs from\nthe form, like a submit button. On other dialog types, they can do things such\nas running a set command, opening a URL, opening another dialog, etc.The action button has a click event when the player is clicked (which is\nessentially the same as text components). This click event can be: Open URL, Run\nCommand, Suggest Command, Copy Text to Clipboard, or Show Dialog.If the dialog has inputs, you can also use dynamic actions such as\ndynamic/run_command. This works similar to the run command action, except the\narguments of the commmand can change based on the values of the inputs.For example, if a simple input form has one text input with the ID name and\nthe user has entered the value Silabear, and the action is a\ndynamic/run_action action which runs the command kill @a[name=$(name)], then\nwhen the action is clicked, the player will run the command\nkill @a[name=Silabear].\nthe player does not have operator status, then most useful commands cannot be\nrun.\nJSON format of a dialog file. However, we recommend that you use\nMisode's Dialog Editor to create dialog\nfiles, which also allows you to preview the dialog in the browser.Using dialogsDialogs can be shown to a player in three different ways:/dialog command: The /dialog command can be used to show a dialog to a\nplayer at any time. For example, /dialog show @a namespace:my_dialog will\nshow the dialog in /data/namespace/dialog/my_dialog.json to all players.Pause Screen: Any dialogs listed in the dialog tag\nminecraft:pause_screen_additions\n(/data/minecraft/tags/dialog/pause_screen_additions.json) will be available\nfrom the pause screen. If this tag only has one dialog, then there will be a\nbutton on the pause screen which opens that dialog. If there are more dialogs\nin the tag, then the button on the pause screen will open a menu which lets\nyou open any of the dialogs in the tag. Note that this replaces the \"Send\nFeedback\"/\"Report Bugs\" button on the home screen if used.Quick Actions: Any dialogs listed in the dialog tag\nminecraft:quick_actions (/data/minecraft/tags/dialog/quick_actions.json)\nwill be available when a player clicks the Quick Actions keybind (which is G\nby default). If the tag only has one dialog, then clicking G will open that\ndialog, otherwise it will open a menu where you can select any of the dialogs,\nlike the pause screen additionsClick Events: In text components and actions in other dialogs, one click\nevent type is Open Dialog. This lets the player open a dialog when they\nclick on text (in chat, in a book, on a sign, etc) or a button (in a dialog).","description":"Dialogs are pop-up menus that you can send to the user","url":"/wiki/files/dialogs/","tags":[]},{"title":"Functions","content":"FunctionsFunctions are files essentially containing a list of Minecraft commands.\nFunction files end in .mcfunction, and are located in the\ndata/ /function folder. Functions can be called (ran) using the\nfunction command. (See /function for more\ninformation)The function folder can contain sub-folders for organisation. This changes\ntheir reference accordingly - for example, a function located at\ndata/ /function/sub_folder/my_func.mcfunction would be called using\nfunction :sub_folder/my_func.When a function is run, the commands within it are executed in order. If the\nreturn command is run, the function stops executing immediately and any\ncommands after the return are ignored.Any line in a function which starts with a # is a comment, and the game\nignores it. Any other line is interpreted as a commandExampleThis function will give every player an apple, then tell them to enjoy the\napple.# Give a player the apple\ngive @a minecraft:apple\n\n# Tell them to enjoy the apple\nsay Enjoy the apple!\nMacro functionsMacros can dynamically change part of a function by inserting NBT into it. Any\nfunction can define a macro within it. A macro is a command beginning with $.\nMacros can use a special syntax: $(). This will substitute for any\nvalue provided aswhen run.The /function command can specify a NBT compound to use as the macro values.\nIn traditional programming, this is best represented as someFunction(foo, bar)ExampleIn this example, we write a function that gives the player a number of diamonds\nusing a macro.# When called, $(count) will be replaced with some number, producing a valid command\n$give @s diamond $(count)\nfunction example:macro {count: 7}\n\n# This also works\ndata modify storage example:storage count set value 12\nfunction example:macro with storage example:storage\n","description":"Functions are files essentially containing a list of Minecraft commands. Function files end in `.mcfunction`, and are located in the `data//function` folder. Functions can be called (ran) using the `function` command. (See [/function](/wiki/command/function) for more information)","url":"/wiki/files/functions/","tags":[]},{"title":"Recipes","content":"RecipesRecipes are files which define crafting recipes in-game. They can be used to add\nnew recipes, or overwrite existing ones.\nRecipes are JSON files located in the data/ /recipe folder.JSON formatFor information about the JSON format in general, see the\nJSON page.Since recipe files represent a variety of different recipe types, the format can\nvary. However, there are some fields which appear in every recipe file.typeDetermines which type of recipe this is. Possible values:TypeDescriptionblastingA recipe for a blast furnacecampfire_cookingA recipe for cooking items on a campfirecrafting_shapedA shaped crafting recipe in a crafting table. Ingredients must be placed in the correct pattern to craftcrafting_shapelessA shapeless recipe in a crafting table. Ingredients can be placed in any pattern to craftcrafting_special_*A crafting recipe handled using built-in logic, and not displayed in the recipe book. Only useful for disabling/enabling certain recipescrafting_decorated_potThe recipe for crafting decorated pots. Also handled with built-in logic, but does show up in the recipe bookcrafting_transmuteA recipe to turn one item into another in a crafting table, while preserving its item componentssmeltingA recipe for a furnacesmithing_transformA recipe to upgrade an item in a smithing tablesmithing_trimA recipe to add an armor trim to an item in a smithing tablesmokingA recipe for a smokerstonecuttingA recipe for a stonecuttercategoryWhich category the recipe appears in the recipe book. If not provided, defaults\nto misc.\nPossible values: blocks, building, equipment, food, misc, redstonegroupAn identifier to group multiple recipes in the recipe book. For example, recipes\nto craft planks use this.\nAllowed in most recipe types, except: crafting_decorated_pot,\ncrafting_special_*, smithing_transform, smithing_trimCooking fieldsThese fields are present in blasting, campfire_cooking, smelting and\nsmoking recipes.FieldFormatDefault valueDescriptioningredientAn ingredientrequiredThe ingredient which gets cookedresultA single resultrequiredThe result of cooking the ingredientexperienceA number0The amount of experience gained from this recipecookingtimeAn integer100, or 200 for smelting recipesThe number of ticks it takes to cook the ingredient\nseconds) for smelting, 100 ticks for blasting and smoking, and 600 ticks for\ncampfire cooking\nrows, the recipe can be moved around the crafting grid. Recipes with two or\nfewer rows and columns can be crafting in the 2x2 crafting grid in the\ninventory.\nread the example to understand it better.\npossible values of the type field which count as special crafting recipes.\nPossible special recipes:Recipe TypeDescriptioncrafting_special_armordyeThe recipe for dyeing leather armorcrafting_special_bannerduplicateThe recipe for copying bannerscrafting_special_bookcloningThe recipe for copying written bookscrafting_special_firework_rocketThe recipe for crafting firework rocketscrafting_special_firework_starThe recipe for crafting firework starscrafting_special_firework_star_fadeThe recipe for adding fade colors to firework starscrafting_special_mapcloningThe recipe for copying mapscrafting_special_mapextendingThe recipe for extending mapscrafting_special_repairitemThe recipe for repairing items with durabilitycrafting_special_shielddecorationThe recipe for adding banners to shieldscrafting_special_tippedarrowThe recipe for adding potion effects to arrowscrafting_transmute fieldsThese fields are present in crafting transmute recipes.FieldFormatDescriptioninputAn ingredientThe item to be transmuted. This item's components will be preservedmaterialAn ingredientThe item used to transmute the inputresultA counted resultThe id of the resulting item. This will copy the components of the input item if they weren't overwritten.\nrows, the recipe can be moved around the crafting grid. Recipes with two or\nfewer rows and columns can be crafting in the 2x2 crafting grid in the\ninventory.\nread the example to understand it better.\nresource location, the hash-prefixed\nresource location of an item tag (e.g. #minecraft:logs), or an array of valid\nitem resource locations.\noptional count field, an integer specifying the count of the resulting item.\nIf not included, the count defaults to 1.ExampleThis file adds a shaped crafting recipe to craft bedrock out of beds and rock\n(stone).This file should be placed in the data/ /recipe folder.\ncontaining all colors of beds.\n\"type\": \"minecraft:crafting_shaped\",\n\"pattern\": [\n\"___\",\n\" X \",\n\"___\"\n],\n\"key\": {\n\"_\": \"#minecraft:beds\",\n\"X\": \"minecraft:stone\"\n},\n\"result\": {\n\"id\": \"minecraft:bedrock\"\n}\n}\n","description":"Recipes are files which define crafting recipes in-game.","url":"/wiki/files/recipes/","tags":[]},{"title":"Advancements","content":"AdvancementsAdvancement files are used to create in-game advancements. These can have\ndisplay properties to make them visible to the player, like how vanilla\nadvancements work. In many function datapacks, we can use hidden custom\nadvancements to detect events (e.g player attacks entity) and then run a\nfunction.Advancements can be stored in trees. This means that an advancement can have\nparent and children advancements. This tree format is good for showing\nprogression in different areas of the game, as well as allowing you to have\ncustom advancment tabs.Advancement files are JSON files stored in the /data/ /advancement\nfolder.JSON FormatFor information about the JSON format in general, see the\nJSON page.Each advancement is represented by a JSON object stored in the advancement JSON\nfile. The advancment JSON object can have the following fields:criteria: An object containing the criteria/criterion that can trigger this\nadvancement. (See the Criteria section below)requirements: This can optionally be used to specify more advanced rules as\nto which criteria trigger the advancement (for example, this can be used to\nspecfiy \"Advancement is given if (Criteria A OR Criteria B) AND (Criteria C OR\nCriteria D) is true\"). This should be a list of lists of criteria keys - the\nadvancement is given when at least one criteria from each list has been\nachieved.display: If left out, this advancement is completely hidden from the player.\nOtherwise, this will control the style of the advancement, and where it is\ndisplayed to the player. It has the following keys:icon: An object defining the item used as the icon as the advancement.\nThis has a id field (the item ID) and components (an object with the\nitem components)title: A text component representing the title or name of the advancement\nthat is shown to the playerdescription: A text component representing the description of the\nadvancementbackground: (Root advancement only) The path to the background texture of\nthe advancement tabframe: Used to specify the frame (or type) of advancement. This should be\neither \"task\" (default), \"challenge\", or \"goal\".show_toast: If true, a pop-up will be shown when a player completes the\nadvancement. Defaults to true (if display exists).announce_to_chat: If true, the advancement will be announced to chat when\nit is completed by a player. Defaults to true (if display exists)hidden: If true, the advancement will not show up in the advancements menu\nuntil it has been achieved by the player. Defaults to false.parent: The ID of this advancement's parent advancement. This should be set\nif your advancement is not just for internal event purposes. If this is left\nblank, it is considered to be a root advancement.rewards: An object which stores data about what should happen to the player\nwhen the advancement has been achieved. This can contain the following fields:function: The ID of the function to run as the player when they achieve\nthe advancement.loot: A list of loot table IDs to be given to the player when they achieve\nthe advancement.recipes: A list of the recipe IDs to be unlocked by the player when they\nachieve the advancementexperience: The XP points to give to the player when they achieve the\nadvancement. This should be an integersends_telemetry_event: (minecraft namespace only) Whether to send\ntelemetry info about this advancement to Mojang. Defaults to false.criteriaThe criteria object is an object containing the criteria needed to unlock this\nadvancement. This object should contain other objects - the key of which can be\nanything, as it serves as the criteria ID. If the requirements field is not\nused, the advancement will be achieved when all of the criteria have been\nachieved.Each criteria object contains a trigger and conditions fields. There are\nmany different triggers that can be used, the contents of conditions depends\non which trigger is used.\nminecraft:impossible). This condition can either be an object (an\nentity_properties predicate) or a list of other predicates (any predicate\ntype) to further match the player.\nmisode.github.io.Using advancements to detect eventsBy specifying a function in the rewards section, and not including any\ndisplay information, you can make an advancement essentially just become an\nevent listener (something that will run a function when the player does\nsomething). In order for this to work multiple times, the function must revoke\nthe advancement from the player (using advancement revoke @s only ...), so\nthat it can be regained later.Note that the advanement will run the function as the player, but not at\nthe player.","description":"In a datapack, we can create advancements, which can additionally be used to detect events.","url":"/wiki/files/advancements/","tags":[]},{"title":"Scoreboards","content":"ScoreboardsScoreboards are a key/value system for storing numbers bound to a player in\nMinecraft. On a scoreboard objective, each player can have a score, which is an\ninteger value. This player does not need to exist - fake players can be used\nto store a number without attaching it to a player but rather an arbitrary name.You can modify objectives with the /scoreboard or /execute store commands.\nSome objectives can automatically change based on player statistics.Scoreboard objectives can also be optionally displayed on the sidebar, under a\nplayer's name, and/or in the tab list - although only one objective can be shown\nin each slot at a time.Types of scoreboard objectivesThere are three main types of scoreboard objectives in Minecraft.Dummy objectivesThese are objectives which can only be modified with commands, like a \"blank\"\nscoreboard which you can modify however you want. They are useful for storing\narbitrary numbers, or tracking custom values within your datapack.You can create this scoreboard with the command:\n/scoreboard objectives add objective_name dummy. For a better example, take a\nlook at the following function:scoreboard objectives add intelligence dummy\nscoreboard players set @a intelligence 100\nexecute store result score Silabear intelligence run data get entity Silabear Health\nThis would create the following scoreboard:PlayerintelligencePlayer1100Player2100Silabear20You can also put fake players on a dummy objective. These work just like\nnormal players on an objective, except they don't exist. You can specify a fake\nplayer by using a special character such as a #, $, ., etc. before the\nname. For example:scoreboard players set #max intelligence 150\nCriteria-based objectivesThese are read-only objectives which are automatically updated based on player\nstatistics. They are usually used to track player events or progress. For\nexample, the criteria minecraft.custom:minecraft.sneak_time will store the\namount of ticks a player has been sneaking on the objective.scoreboard objectives add sneaking_duration minecraft.custom:minecraft.sneak_time\nAfter sneaking for one second, the objective will look like this:Playersneaking_durationPlayer120Trigger objectives:These are objectives which allow the player to manually set their score using\nthe /trigger command. This is especially useful for creating chat UIs, as it\nis the closest thing we have to creating \"custom commands\" with datapacks. Any\nplayer can run /trigger, regardless of their operator status.A player may only run /trigger if that trigger objective has been enabled for\nthat user. Once a user has used /trigger on an objective, they cannot use it\nagain until it is re-enabled.scoreboard objectives add option trigger\nscoreboard players enable @a option\nPlayers will now be able to use the /trigger command to modify their score on\nthe option objective./trigger option will set the player's score to 1./trigger option set 5 will set the player's score to 5./trigger option add 3 will add 3 to the player's score.\ncannot trigger it until it is re-enabled:scoreboard players reset @a option\n","description":"Scoreboards are a way of storing numerical data attributed to a player or entity in a Minecraft Datapack.","url":"/wiki/nbt-scoreboards/scoreboards/","tags":[]},{"title":"NBT","content":"NBTNBT (Named Binary Tags) is a structured (key/value) data format used by\nMinecraft to store data about entities, items, blocks, structures, player data,\nworldgen, and more. You can use it to store custom data in items and NBT\nstorages.SNBT FormatSNBT (Stringified Named Binary Tags) format is a JSON-like tree structure used\nin datapack development to manipulate the NBT data of an entity. SNBT is a\nhuman-readable version of NBT (Named Binary Tags), which is a format used by\nMinecraft to store data. NBT is used to store data about entities, items,\nblocks, structures, game saves, and more.SNBT consists of key/value pairs, which are represented as key:value.\nThese are contained with compounds, marked with curly brackets ({}).\nCompounds can contain multiple key/value pairs, which are separated with commas,\nlike so: key:value,key:value,key:valueAn example SNBT structure looks like:\n{name:\"Silabear\",age:102,friends:[\"Flynecraft\",\"Aandeel\",\"Cobblestone\"],socials:{discord:\"silabear\"}}NBT pathsNBT paths are used to reference a specific location within an NBT structure.\nThey are used in commands like /data get and /data modify to access or\nmodify NBT data.NBT paths are made up of a series of keys, separated by dots (.). Square\nbrackets ([]) can be used to access items in an array, either by index\narray[0] or by object value (array[{age:102}])Imagine the following NBT structure:{\nroot: {\nversion: 1,\ntitle: \"Targets\",\npeople: [\n{name: \"Silabear\", age: 102},\n{name: \"Aandeel\", age: 100}\n]\n}\n}\nThe following are examples of NBT paths:root.version: would give the value 1.root.title: would give the value \"Targets\".root.people[0]: would give the value {name: \"Silabear\", age: 102}.root.people[0].name: would give the value \"Silabear\".root.people[{name:\"Aandeel\"}]: would give the value\n{name: \"Aandeel\", age: 100}.root.people[{name:\"Aandeel\"}].age: would give the value 100.NBT storagesStorages allow you to store NBT data in a world without binding it to a physical\nobject (item, entity, block), but rather storing it under a namespaced ID (e.g\nexample:main). Storages are stored globally per world, and can only be\naccessed with /data. Storages don't need to be initialized beforehand, unlike\nscoreboards.Unlike entity and block NBT, storages have no fixed structure, and can contain\nwhichever arbitrary keys are added to it.Storage exampleStorages are defined when a /data command modifies them. Unlike scoreboards,\nstorages do not need to be \"created\" - the only code needed to initialize a\nstorage is a /data modify or /data merge command to that storage, for\nexample:data merge storage example:main {number: 1, message: \"Hello!\"}\ndata modify storage example:main other_number set from storage example:main number\ndata modify storage example:main compound.array append value 42\nThe example:main storage would now contain the following data:{\nnumber: 1,\nmessage: \"Hello!\",\nother_number: 1,\ncompound: {\narray: [42]\n}\n}\nData TypesThere are a few data types you can use to represent different types of data,\nincluding whole numbers, decimal numbers, string, text, booleans, and more.StringsStrings can store any text value, or more technically, any sequence of unicode\ncharacters.Format: Strings are stored within either double or single quotes. For\nstrings containing standard characters (A-Z, a-z, 0-9, -,_,+,.), the quotes\nare optional (as long as the text starts with a letter), but recommended.\n\"\" or ' ' orExample: name:\"Silabear\", name:'Cobblestone', name:AandeelWhole NumbersShort, Int, and Long data types all represent integers (whole\nnumbers).Byte is an 8 bit integer, it can be any value from 0 to 255Short is a 16 bit integer, it can be any value from -32,768 to 32,767Int is a 32 bit integer, it can be any value from -2,147,483,648 to\n2,147,483,647Long is a 64 bit integer, it can be any value from\n-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807Format: By default, numbers are stored as integers. To store a number in the other formats, you need to use the appropriate suffix. For shorts, ints, and longs, the suffixes are s, i, and l respectively.The suffix can be extended with u or s to say whether it is unsigned (only a\npositive number) or signed (can be positive or negative) - for example, 402ub.It is also possible to write using E notation (e.g 1.2E3 would be 1200),\nhexadecimals (e.g 0xBC would be 188), and binary (e.g 0b110 would be 6)Example: count:1234s, bigNumber:1200000,\nreallyBigNumber:12123023687234L, byte:112bDecimal NumbersFloat and Double data types both represent decimal numbers.Float is a signed 32 bit floating point number, it can be any value from\n-3.4028235E38 to 3.4028235E38. It is precise to 7 decimal places.Double is a signed 64 bit floating point number, it can be any value from\n-1.7976931348623157E308 to 1.7976931348623157E308. It is precise to 15\ndecimal places.Format: By default, decimal numbers are stored as doubles. To store a number\nin the other formats, you need to use the appropriate suffix. For floats, the\nsuffix is f. For doubles, the suffix is d.Example: pi:3.1415926535d, e:2.718281828459045d, phi:1.6180fBytes or BooleansIn older versions of Minecraft, booleans were stored as bytes with 0b\nrepresenting false and 1b representing true. In newer versions, booleans\nwere introduced. Essentially, booleans represent the old 0b and 1b with a\nmore descriptive name. It's recommended to use booleans instead of bytes\nwhenever possible, as they are more readable.Lists/ArraysLists, or number arrays are used to store multiple values. Lists can store\ndifferent types of values, whereas number arrays can only store the same type of\nnumber. In practicality, you often do not need to think about the differenceFormat: They are defined using square brackets ([]), with the values\nseparated by commas. Number arrays can be prefixed with the type of number the\narray is going to store and a semicolon (for instance, a list starting with\n[B; will only store bytes)Example: [\"Silabear\", 15, true, 242], [B;1b,2B,true,false],\n[\"Kanokarob\", \"LadyEternal\", \"lionlance\", \"thederdiscohund\", \"theblackswitch\"],\n[L;1l,2l,3l,4l,5l]ValidatorBelow is a validator for SNBT. It will validate the input and show you if it is\nvalid or not.","description":"NBT is Minecraft's way of storing internal data, such as item data, entity data, and block data. In datapacks, we can use it to store data in custom data storages.","url":"/wiki/nbt-scoreboards/nbt/","tags":[]},{"title":"Custom World Generation","content":"Custom World GenerationCustom World Generation is an experimental feature, allowing a data pack to\ngenerate custom features, biomes, or dimensions, primarily by way of a series of\nJSON files rather than by using commands.This guide goes over how to create every step of a custom dimension, which\nitself comprises all of the following. If you only want to achieve one or some\nof these things, you can generally skip to those respective sections.Modifying and defining dimension settingsGenerating terrainCreating biomesArranging biomesCreating features (ores, trees, etc.)Many sub-tasks related to the aboveAt the same time, this documentation will express some of the major limitations\nthat come with Custom World Generation. There are many aspects of worldgen that\nwe will go over here in brief, but that could fill entire guides of their own to\nexplore in detail. Many of the tasks involved in creating Custom World\nGeneration can be extremely time-intensive and require a lot of trial and error.What is Custom World Generation?Custom Worldgen can take the form of anything from a completely separate\ndimension, an override of vanilla dimensions or biomes, like the Overworld at\nlarge or Swamps in particular, or individual features that are placed via\ncommands. The following are all things that Custom World Generation can include,\nirrespective of difficulty.Custom TerrainCustom Dimension Settings, such as:UltrawarmPiglin zombificationRespawn Anchors vs BedsLight levelDaylight cycle (on/off)etc.Custom Biomes (Surface and Cave)Natural features (Trees, ores, flowers, etc.)Custom colors and ambient particlesCustom Biome layout (including of vanilla biomes)Custom Structures, and changes related to structures, are also a sub-feature of\nCustom World Generation. We already have documentation for creating Custom\nStructures, which you can find\nhere.Folder StructureTo begin creating a Custom Dimension, there are a few folders you should create\nin a data pack. If you’re unfamiliar with the general structure of a data pack,\nyou should check out our Data Pack Starter Guide.In your namespace folder, you will create the following folders, organized as\nsuch:/\n├── dimension/\n├── dimension_type/\n└── worldgen/\n├── biome/\n├── configured_carver/\n├── configured_feature/\n├── density_function/\n├── noise/\n├── noise_settings/\n└── placed_feature/\nYou may not need all of these folders depending on the degree of configurability\nyou want or the scope of your project, so which folders are needed or optional\nfor any particular task will be listed at the top of each section.Because Custom World Generation requires so many different JSON files, many with\na variety of required vs. optional fields, it is strongly recommended that you\ngenerate most or all of these files using\nMisode’s generators. Furthermore, frequent\nreference to the wiki pages for\ncustom dimensions and their respective subcategories will likely be necessary,\nif only to determine what type of data some fields are expecting, when Misode or\nthis guide do not specify.\nreference don’t exist or are in the wrong folder, when in fact they are,\ndepending on the version you are working in. This is most common for\nconfigured_features, but be on the lookout for this behavior elsewhere.\nstart with the Dimension Type. The Dimension Type is what defines the very broad\ndetails about the dimension, such as whether water evaporates instantly like the\nNether (Ultrawarm), whether Beds and/or Respawn Anchors work or explode, and\nwhat light level Hostile Mobs need to spawn. Most of these fields are self\nexplanatory, and most of them are required.dimension_type/overworld.json{\n\"ambient_light\": 0.0,\n\"bed_works\": true,\n\"coordinate_scale\": 1.0,\n\"effects\": \"minecraft:overworld\",\n\"has_ceiling\": false,\n\"has_raids\": true,\n\"has_skylight\": true,\n\"height\": 384,\n\"infiniburn\": \"#minecraft:infiniburn_overworld\",\n\"logical_height\": 384,\n\"min_y\": -64,\n\"monster_spawn_block_light_limit\": 0,\n\"monster_spawn_light_level\": {\n\"type\": \"minecraft:uniform\",\n\"max_inclusive\": 7,\n\"min_inclusive\": 0\n},\n\"natural\": true,\n\"piglin_safe\": false,\n\"respawn_anchor_works\": false,\n\"ultrawarm\": false\n}\nTo create this, simply add a .json file to the dimension_type folder, and set\nthe name to that of the dimension you are creating/modifying. Like all file\nnames, it must have no capital letters, and no special characters except\nunderscores. Then generate the list of fields with\nMisode.Note that some fields, like “has ceiling”, don’t do what you would expect – this\nfield doesn’t actually give the dimension a physical ceiling, that’s handled in\nthe terrain. Similarly, “Effects” pretty much just changes the skybox and\ndetermines whether the time affects the light level.Noise SettingsFolders: noise_settings\nOptional Folders: density_function, noiseThe Noise Settings are one of the largest files you will create. This single\nfile per dimension controls all of the following:What base block the dimension’s terrain is made of (Stone, Netherrack, etc.)What base fluid is used for the sea level (Water, Lava, etc. Does not need to\nbe a fluid)Some global settings, such as:Whether “Creatures” (passive mobs) spawn during chunk generationBiome noise parameters that the worldspawn is allowed to be set in during\nworld creationWhether large ore veins generate, and their general size and shape via\nDensity Functions. Only applies to Copper and Iron veinsWhether aquifers generate. Not configurable beyond true/false. If false,\nmost caves below sea level will be filled with the base fluid.Noise Router (The shape of the terrain, which is determined by a few further\nfields)Surface Rules (What blocks the surface is made up of, typically broken down by\nbiome)Note that the sea level also determines the level that caves become filled with\nLava, so a higher sea level will also raise the cave Lava level, and a deeper\nworld with a default sea level will result in all caves being filled with lava\nbelow the same point (about Y=-50).Noise Router (Terrain)The Noise Router is responsible for most factors relating to the terrain, which\nis to say, whether a given block is air/fluid or the default_block, before\nsurface_rules or biome features are added. In addition, the Noise Router\nincludes several fields that don’t directly influence the terrain, but may\napproximate it for use in making biome distribution conform to the terrain.The Noise Router contains several fields. All of these fields are density\nfunctions, which can be defined in-line or referenced from the density_function\nfolder. These are essentially formulas of variable length and complexity, that\nuse a variety of functions to determine a value between 0 and 1 for every\ncoordinate. For density functions that affect terrain, this determines whether\nthe block is air/fluid (respecting sea level), or the default_block,\nrespectively.Let’s look at what each of these density functions are responsible for.barrier, fluid_level_floodedness, fluid_level_spreadThese all relate to some facet of Aquifer generation, if they are enabled.lavaUsed to determine whether an aquifer is lava or not. Does not affect the lava\nthat floods the bottom of the world.vein_toggle, vein_ridged, vein_gapUsed to control the shape, density, and rarity of both Iron and Copper Large Ore\nVeins. Cannot change what these blocks are made of, but whether the vein is\nCopper or Iron is based on the vein_toggle noise range.temperature, vegetationCorrespond to the “temperature,” and “humidity,” parameters in the dimension’s\nbiome source, respectively. Ostensibly create the noise maps that biomes are\nplaced relative to. These density functions don’t affect terrain at all.continents, erosion, depth, ridgesCorrespond to the “continentalness,” “erosion,” “depth”, and \"weirdness\"\nparameters in the dimension’s biome source, respectively. Like the temperature\nand vegetation density functions, whatever is put in these fields will not\ndirectly affect terrain, and ostensibly just create noise maps for the biome\nsource to use. However, in the vanilla overworld, these fields are used to\nreference separate density function files that also get referenced elsewhere, to\ninform the terrain. This means that unlike the temperate and vegetation density\nfunctions, these correspond to certain parts of the terrain.For example, high erosion parameter values match up with where the terrain is\nmore flat, because of how it gets referenced by other density functions that\nimpact terrain.\ncontinents, erosion, and depth, but it’s generally not necessary to have so many\nparameters that conform to terrain, and can in fact make biome distribution\nharder and more time consuming.\nthe surface of the world is so that neither can generate above that surface.\nTypically, will be similar to the final_density, but with the surface slightly\nlowered, and with noise caves unaccounted for. Similar to the above few\nfunctions, it does not affect terrain at all.final_densityThis is the density function that actually creates the bulk of the terrain. As\nsuch, it’s often the largest and most complex part of the noise_settings file,\nbarring surface_rules. It controls not only the surface, including hills,\nmountains, valleys, and oceans, but also the large noise caves and noodle caves\nintroduced in the Caves and Cliffs update. And, as alluded to above, you still\nneed at least the continents and erosion density functions to align with the\ngeneral shape of this density function if you plan to have ocean biomes generate\nonly where the terrain dips below sea level, or mountain biomes generate only\nwhere the terrain spikes up to look like mountains.In the\nvanilla Overworld,\nthe final_density is split into two distinct parts: The part that handles the\nshape of the surface, including mountains, hills, rivers, and oceans; and the\npart that handles the large noise caves underground. These are separated by an\nin-line range_choice density function.Density functions are very complex, and being very math-heavy, difficult to dive\ninto and learn about; an in-depth understanding of them and how to apply them is\noutside the scope of this guide. Generally, a lot of trial and error is\nrequired, and there are minimal resources for getting particularly good at\napplying them. These are primarily\nthe wiki page which lists them all\nand what they do to the inputs/arguments,\nthis brief tutorial\nwritten by Misode and now hosted on the wiki, which explains how the Final\nDensity affects the terrain, and provides some basic steps to manipulate it, and\nof course\nMisode’s generator to help\nvisualize individual density functions or chains of them. However, as a brief\nintroduction, this guide will attempt to describe, roughly, how the vanilla\noverworld's final_density applies important density functions to shape the\nworld's surface.sloped_cheeseUsed as the input in the aforementioned range_choice density function to\ndistinguish between the surface and underground (for noise caves), as well as\nthe main density function that gets applied to the surface. It multiplies the\ndepth and the jaggedness density functions with the factor density function,\ncombining the various shapes they create into one coherent surface shape.factorContains a complex spline that functionally combines the continents, erosion,\nand ridges_folded density functions. These three on their own are ostensibly\nnoise maps like temperature and vegetation, but this spline translates them into\nterrain. Continents is used to create a transition between high and low terrain,\nwith erosion added to flatten the terrain, and ridges_folded (which just\nreferences ridges with some multipliers) to carve rivers or raise peaks on\nmountains.depthCreates a gradient from the surface of the world down, where the surface and\neverything above it is assigned a value of 0, and ascends towards 1 as the world\nheight decreases. It gets the coordinates of the surface by referencing the\noffset density function.offsetSimilar to factor, and uses the continents, erosion, and ridges_folded density\nfunctions in a similar way to create a shape similar to the terrain's surface,\nbut slightly offset so that the depth density function doesn't start the\ngradient until a little below the surface (generally).jaggednessSimilar to factor, and uses the continents, erosion, and ridges_folded density\nfunctions in a similar way to create a more jagged version of the surface shape.\nThis gets diluted some due to being combined with both offset and factor higher\nup the chain, but results in some hills populating flatter areas, which also\nhelps to break up otherwise smooth or flat mountains so they look more natural\nand rolling.Surface RulesSurface Rules are what add the surface layers to terrain. This is\nhighly-configurable, but at its most basic level, it’s what decides that the\nground in Forests is made up of Grass Blocks and Dirt, and that Deserts have\nSand and Sandstone. Surface Rules can also allow for different blocks to make up\nthe ground depending on height, steepness, or even based on random noise.Notably, the Surface Rule also places the Bedrock on the bottom (or top) of the\nworld, and handles the transition from Stone to Deepslate at Y=0. This means\nboth of these features can be edited or removed, and in fact it’s fairly easy to\ndo so compared to handling the actual surface.Creating surface rules is relatively easy. You’ll start with something like this\nin your Noise Settings:{\n\"surface_rule\": {\n\"type\": \"minecraft:sequence\",\n\"sequence\": []\n}\n}\nInside the sequence brackets, you can add yet more objects. There are four\ndifferent types:Sequence: Allows you to add a new nested list. Generally, it’s good\npractice to nest sequences inside of a condition that will apply to multiple\nchild conditions or blocks.Block: Defines the block that gets placed. Usually used at the end of a\nseries of conditions.Bandlands: Not a typo. Just places the hardcoded Badlands terracotta\npattern, and doesn’t have any additional fields.Condition: This is the most prominent part of Surface Rules. There are\nmultiple kinds of conditions, including biome, Y level, steep, and more.\nRegardless of the condition you select, it will always have the additional\nfield “then run”, which just accepts another object type from the above list.You may find yourself using combinations of conditions, with or without\nsequences, to get a satisfying surface. This guide won't go over every surface\nrule condition, but here are some common ones and how they are often used.above_preliminary_surfaceUses the initial_density_without_jaggedness density function to determine where\nthe surface of the world is. Not using this would just mean that the surface\nrule would apply in noise caves as well. If you’re not using an\ninitial_density_without_jaggedness density function, there’s no other real harm\nin choosing not to use this condition.stone_depthThis condition finds the blocks that are actually on the surface via heightmap,\nignoring water, and works even if there was no preliminary surface condition\nused. This is one of the most common conditions, in that every dimension will\nuse it, but it is also a fairly resource-intensive condition, and the one most\nlikely to cause chunk generation lag. It’s best to use it minimally, as high up\nin the Surface Rule as you can. Oftentimes, you will need at least two of these:\nOne for the top surface, and one for the secondary surface.waterCan be used to have its child conditions apply based on the fluid level at that\nlocation, including not being in fluid. The vanilla Overworld surface rule uses\nthis a lot, and it’s a great way to alleviate the impact of an earlier\nstone_depth condition.biomeSpecifies which biome(s) to apply the rest of the rule to.y_aboveCauses the rest of the rule to only apply to blocks above the specified Y value.\nYou can add an optional multiplier for this value, or choose to add the\nstone_depth from previous conditions to this calculation.It’s best to look at how the Overworld’s surface rule uses combinations of\nconditions to produce a surface of, for example, Grass Blocks with 2-4 layers of\nDirt underneath. The vanilla Overworld Surface Rule is not as extreme as the\nvanilla Overworld Dimension file (up next), but it is a little more lengthy and\nsophisticated than can reasonably be pasted here.\nMisode’s generator has a\nfeature to view the vanilla Overworld Noise Settings as a preset, which includes\nthe Surface Rule; this may be useful to get a more user-friendly view of how the\nconditions fit together.DimensionFolders: dimensionThe Dimension file is where you reference both the Dimension Type and Noise\nSettings you would like this dimension to use by their namespaced ID. The name\nof this file is also what will become the namespaced ID of this dimension for\ncommands such as /execute in, regardless of the names of the noise_settings or\ndimension_type files referenced. Lastly, this is where you will list all of the\nbiomes you want to appear in the world, using parameters to define which biomes\ncan appear where on several noise maps.Biome SourceBesides Terrain, the Biome Source is where you may find yourself spending the\nmost time. It is highly configurable, and has the potential to integrate with\nthe Continents and Erosion density functions defined in the Noise Router to help\nplace biomes in a way that appears to conform to the terrain (Mountain biomes on\nelevated terrain, Plains biomes on flatter terrain, etc.). Biome Layout is much\nmore approachable than terrain in terms of configurability, but making them work\nhand-in-hand in this way can be time consuming.To put things in perspective, you may have noticed above that the vanilla\nOverworld’s Dimension file is over 200,000 lines long. Every biome has dozens of\nrepeat entries, each with slightly different parameters to get the biome\ndistribution and terrain conformity just right. This is because the six primary\nparameters (temperature, humidity, continentalness, erosion, and depth)\nbasically work to create a 6-dimension noise map. Making a biome source that\nplaces biomes according to terrain by hand is borderline impossible, and indeed,\nthis file gets generated by the game using a system similar to\nSnowcapped, a tool by jacobsjo that uses\ngrids to simplify the visualization of a 6D grid.The Nether is far easier to work with and add new biomes to, as those biomes do\nnot conform to the terrain, and each vanilla biome has only one entry.The End’s biome source is hardcoded; this is because Mojang needs to ensure that\nthe central End Island is always the default “minecraft:the_end” biome, which\ncannot be guaranteed with current tools. However, if you don’t mind making the\ncentral End Island a different biome, you can approach a custom biome layout\nsimilarly to how you would the Nether.For a custom dimension, the complexity is up to you. If you aim to have your\nbiomes conform to terrain, then you may end up with a biome layout of comparable\ncomplexity and time commitment to the vanilla Overworld’s. If not, then it’s\njust a matter of determining which biomes you do or do not want to appear next\nto each other, and then setting the parameters appropriately.Each entry in the “biomes” list should look something like this:{\n\"biome\": \"minecraft:plains\",\n\"parameters\": {\n\"temperature\": [-0.45, -0.15],\n\"humidity\": [-1, -0.35],\n\"continentalness\": [-0.11, 0.3],\n\"erosion\": [-0.7799, -0.375],\n\"weirdness\": [-1, -0.9333],\n\"depth\": 0,\n\"offset\": 0\n}\n}\nMore biomes can be added by including more entries in the “biomes” list. It can\nand often may include repeats. Each entry must also contain all of the\nparameters listed above. Unless otherwise specified, all of these parameters can\neither be a single constant, or a list of two constants, which serves as a min\nand max range of values. These must be in order from min to max; failure to do\nso will cause the data pack to not validate.temperature, humidityThese are named completely arbitrarily, and have no bearing on the actual\ntemperature or humidity of the biome that impacts gameplay in any way. You can\nmake both a “desert” and “snowy” biome have a temperature of 0, and all it will\nmean is that they will be placed near each other (unless other parameters forbid\nthis). These parameters just refer to different noise maps that are available.\nThese should each be a value between -1.0 and 1.0. The closer a value is to 0,\nthe more frequently that biome will appear, or the larger.depthUsed exclusively for cave biomes, and is otherwise 0. Positive values cause that\nbiome to be placed deeper in the world, and the area above it to be filled with\nother biomes of lower depth values that meet the other parameters of that space.\nIn the vanilla depth density function, a depth of 1.0 corresponds to\napproximately 128 blocks below the surface, but this can vary if you've changed\nthe Final Density or the depth density function in your Noise Router.offsetHelps to limit the relative size of the biome. Accepts a value between 0 and\n1.0, and must be a single constant, not a list. Larger values reduce the size of\nthe biome, and allow biomes of neighboring parameter values to fill the space.\nThis can also result in the biome becoming rarer, if it was already small enough\nthat a positive offset causes some of its placements to disappear.weirdnessThis parameter corresponds to the ridges density function, which is responsible\nfor rivers and mountain peaks. Values closer to 0 tend to correspond to rivers,\nand values further from 0 tend to correspond to peaks, before dipping back to\nmore level terrain. The vanilla overworld also uses this parameter to place\n\"variant\" biomes like Bamboo Jungles or Pale Gardens, which otherwise might\nshare similar parameters to their base biomes (Jungles and Dark Forests)continentalness, erosionThese are the two parameters that influence a biome’s placement on the density\nfunctions of the same names used for Terrain. In the vanilla Overworld, only\nthese values will affect biome position relative to the shape of the terrain.\nFor the vanilla Overworld:High continentalness corresponds to inlands terrain.Low continentalness corresponds to ocean terrain.High erosion corresponds to flat terrain.Low erosion corresponds to jagged terrain.The above rules may not necessarily hold true if you have a Final Density that\ndiffers from the vanilla Overworld.The best way to view and manipulate the biome source and how it may look in the\nworld is with Misode’s generator.\nHowever, it may not show completely accurate biome placement if you are taking\nadvantage of continentalness and/or erosion.BiomesFolders: biome\nOptional Folders: configured_carver, placed_feature,\nconfigured_featureThis is where the most configurability and excitement, and least limitations,\ncomes into play. Biomes are really just designated areas that can have the\nfollowing things defined:Precipitation (True/False)TemperatureUsed to determine rain or snow if Precipitation is trueAlso influences natural grass and foliage coloration, along with DownfallOverride colors for grass, foliage, sky, fog, water, and water fogFor grass and foliage, this color is added to the color determined by\nTemperature and Downfall, which references the respective colormaps in the\nResource Pack.Particles, if any (such as in many Nether biomes)Music and ambient soundsCave and canyon (ravine) typesNaturally spawning mobsFeaturesNot all of these need to be defined, but they all need to be present, even if\nempty. As always, it’s best to use\nMisode’s generator to ensure all\nrequired fields are accounted for. It also has useful tools for selecting\ncolors, where appropriate.\nyour biome will necessarily be incompatible with any other data packs that\nmodify that biome, too. This means you can’t, for example, add more Diamonds to\nthe vanilla Swamp biome, and then also include Terralith -- you would need to\ninstead use Terralith’s Swamp biome as a base and add more diamonds to that, if\nyou want to use both in the same world.\nspawn in this biome, at what rarities and in what quantities.\ncan’t change that. Passive Mobs will always need Grass Blocks and light to\nspawn, and Hostile Mobs will still need a low enough light level as defined in\nthe Dimension Type. Some mobs, like Sniffers and Camels, don’t have as strict\nspawning conditions because they don’t spawn naturally in vanilla. This means\nthey can spawn anywhere in the biome, even if it doesn’t make sense.\n\"spawners\": {\n\"ambient\": [\n{\n\"type\": \"minecraft:bat\",\n\"maxCount\": 8,\n\"minCount\": 8,\n\"weight\": 10\n}\n],\n\"axolotls\": [],\n\"creature\": [\n{\n\"type\": \"minecraft:sheep\",\n\"maxCount\": 4,\n\"minCount\": 4,\n\"weight\": 12\n},\n{\n\"type\": \"minecraft:pig\",\n\"maxCount\": 4,\n\"minCount\": 4,\n\"weight\": 10\n},\n{\n\"type\": \"minecraft:chicken\",\n\"maxCount\": 4,\n\"minCount\": 4,\n\"weight\": 10\n},\n{\n\"type\": \"minecraft:cow\",\n\"maxCount\": 4,\n\"minCount\": 4,\n\"weight\": 8\n},\n{\n\"type\": \"minecraft:horse\",\n\"maxCount\": 6,\n\"minCount\": 2,\n\"weight\": 5\n},\n{\n\"type\": \"minecraft:donkey\",\n\"maxCount\": 3,\n\"minCount\": 1,\n\"weight\": 1\n}\n],\n\"misc\": [],\n\"monster\": [\n{\n\"type\": \"minecraft:spider\",\n\"maxCount\": 4,\n\"minCount\": 4,\n\"weight\": 100\n},\n{\n\"type\": \"minecraft:zombie\",\n\"maxCount\": 4,\n\"minCount\": 4,\n\"weight\": 95\n}\n]\n}\n}\nSpawners are defined by first opening up a list of one of several categories,\nsuch as Monster, Creature, Water Ambient, or Axolotl. You can make mobs spawn in\nwhatever category you want, but if you put it in the wrong category than it\nbelongs (generally, Creature for passive mobs, Monster for hostile mobs, etc.),\nthey may either fail to spawn entirely, or overspawn and exceed the mobcap. For\nthis reason, it is advised that you only spawn mobs in their correct category;\nif you don’t know which it belongs to, refer to a vanilla biome that spawns that\nmob and see where it’s placed.An individual mob spawner entry includes the mob type, its weight (which works\njust like loot tables) and a min and max count. These latter values determine\nhow many mobs will spawn within a group as one successful spawn attempt of that\nmob type. The min must be greater than 0.Spawn CostsSpawn Costs are an optional field within the biome file, and are used to limit\nthe frequency of spawns around mobs of a certain type, within that biome only.\nIn vanilla, this is used to limit the number of Endermen that appear in Warped\nForests, and Skeletons that appear in Soul Sand Valleys.{\n\"spawn_costs\": {\n\"minecraft:enderman\": {\n\"charge\": 1.0,\n\"energy_budget\": 0.12\n}\n}\n}\nA Spawn Cost for an individual mob consists of an energy_budget, and a charge,\nwhich are both float values. These are a little hard to explain, but\nessentially, the “charge” is used to calculate an individual mob’s contribution\nto the overall “energy budget” shared by all mobs of that type in the biome. If\nthe value calculated from that charge would exceed that energy budget, it fails\nto spawn. This is very simplified, and indeed somewhat unintuitive, as the\ncharge will generally be higher than the energy budget.If you’d like to learn more about how this works, see the wiki entry relating to\nit here.CarversThis is where the legacy caves and ravines are defined for the biome. They are\nsplit into two steps: air and liquid, which behave as you would expect; either\nproducing regular air caves, or flooded caves.You can define custom caves or canyons with a configured_carver, including\ndefining what types of blocks the cave will be allowed to replace (which is why\nit’s called a carver), their frequency, size, and other values. To explore this\nfully, it’s recommended to mess with the various fields using\nMisode’s generator.FeaturesFeatures are the real meat of a biome. These are everything that actually fills\nup the biome and gives it character beyond the terrain and surface. Trees,\nflowers, ores, geodes, granite deposits, and sometimes small structures like\nDesert Wells are all features. There is a lot you can do here, but the options\naren’t limitless.For one, there’s the issue of performance. Larger and more common features make\nloading new chunks slower, as do features that have hyper-specific location\nrequirements to spawn.For two, some specific shapes are harder to achieve, and some common features\naren’t as configurable as others. Trees are some of the most configurable\nfeatures in the game, able to use any block or combination of blocks for their\ntrunks, leaves, roots, and more, and can be used to make elaborate shapes and\nfeatures that don’t even look like trees. Conversely, the coral reefs in Warm\nOceans are easy to replicate and adjust the frequency and location of, but their\nshapes and the blocks they’re made of cannot be changed at all.As such, it’s often better to have some broad strokes for the “feel” or\natmosphere you want for a biome in mind, rather than planning everything down to\nthe shape, as flexibility may be necessary.{\n\"features\": [\n[],\n[\"minecraft:lake_lava_underground\", \"minecraft:lake_lava_surface\"],\n[\"minecraft:amethyst_geode\"],\n[\"minecraft:monster_room\", \"minecraft:monster_room_deep\"],\n[],\n[],\n[\n\"minecraft:ore_dirt\",\n\"minecraft:ore_gravel\",\n\"minecraft:ore_granite_upper\",\n\"minecraft:ore_granite_lower\",\n\"minecraft:ore_diorite_upper\",\n\"minecraft:ore_diorite_lower\",\n\"minecraft:ore_andesite_upper\",\n\"minecraft:ore_andesite_lower\",\n\"minecraft:ore_tuff\",\n\"minecraft:ore_coal_upper\",\n\"minecraft:ore_coal_lower\",\n\"minecraft:ore_iron_upper\",\n\"minecraft:ore_iron_middle\",\n\"minecraft:ore_iron_small\",\n\"minecraft:ore_gold\",\n\"minecraft:ore_gold_lower\",\n\"minecraft:ore_redstone\",\n\"minecraft:ore_redstone_lower\",\n\"minecraft:ore_diamond\",\n\"minecraft:ore_diamond_medium\",\n\"minecraft:ore_diamond_large\",\n\"minecraft:ore_diamond_buried\",\n\"minecraft:ore_lapis\",\n\"minecraft:ore_lapis_buried\",\n\"minecraft:ore_copper\",\n\"minecraft:underwater_magma\",\n\"minecraft:disk_sand\",\n\"minecraft:disk_clay\",\n\"minecraft:disk_gravel\"\n],\n[],\n[\"minecraft:spring_water\", \"minecraft:spring_lava\"],\n[\n\"minecraft:glow_lichen\",\n\"minecraft:patch_tall_grass_2\",\n\"minecraft:patch_bush\",\n\"minecraft:trees_plains\",\n\"minecraft:flower_plains\",\n\"minecraft:patch_grass_plain\",\n\"minecraft:brown_mushroom_normal\",\n\"minecraft:red_mushroom_normal\",\n\"minecraft:patch_pumpkin\",\n\"minecraft:patch_sugar_cane\",\n\"minecraft:patch_firefly_bush_near_water\"\n],\n[\"minecraft:freeze_top_layer\"]\n]\n}\nBest practice is to have the “features” section of your biome consist of 11\nlists (defined with square brackets: [ ]), called “steps”, but you can have any\nnumber of steps, fewer or greater. Generally, features will be placed in order\nbased on which step they appear in, from top to bottom. So, if you want to place\nTree features with leaves made of Stone, and then place Ore features that get\nplaced in the stone, you would put those features in separate steps, with the\nOre feature in a later step from the Tree.Other parts of the game refer to these steps by name, representative of the\norder they generate in, specifically for things like Custom Structure Generation\nto reference which step of generation those should appear in. However, the names\nthemselves are arbitrary and just reflect which steps vanilla chooses to put its\nfeatures in; any feature type can go in any step. For interest’s sake, these\ndesignations are, in order from first step to last:RAW_GENERATION: Where End biomes place the small circular endstone\nislandsLAKES: Where Overworld biomes place lava lakes, and used to place water\nlakesLOCAL_MODIFICATIONS: Where Overworld Biomes place Amethyst Geodes, and\nthe Frozen Ocean biome places IcebergsUNDERGROUND_STRUCTURES: Where Overworld Biomes place Dungeons and FossilsSURFACE_STRUCTURES: Where the Desert biome places Desert WellsSTRONGHOLDS: No vanilla biomes place features here, but you can and it’ll\nwork fineUNDERGROUND_ORES: Where all Overworld biomes place ores (which includes\nactual ore blocks, as well as the blobs of Dirt, Gravel, and Stone variants),\nas well as discs that generate on the floor underwaterUNDERGROUND_DECORATION: Where all Nether biomes place ores (which\nincludes actual ore blocks, as well as the blobs of Gravel and Blackstone),\nand where Overworld mountain biomes place blobs of Infested StoneFLUID_SPRINGS: Where all Overworld and Nether biomes place water and/or\nlava springs (individual fluid blocks that may or may not spill out of walls\nor ceilings)VEGETAL_DECORATION: Where all biomes place features such as trees,\nflowers, cacti, Huge Fungi, Chorus Plants and similar featuresTOP_LAYER_MODIFICATION: Where all Overworld biomes place a feature that\ncauses snow or ice to cover the top blocks if the temperature is\nsufficiently low at that altitudeNote that there are some exceptions to generation order. For example, Deltas\nwill generally spawn after everything else regardless of which step they’re\nplaced in. Conversely, Lakes often spawn before other features, even if they are\nin a later step.\nwhich step it is) in multiple biomes, they must always be in the same order, or\nthe game will throw an error and fail to load (this is called a feature order\ncycle error). For the same reason, you can't repeat a feature in the same step,\neven one after the other, if that feature is used in a different biome.\nconfigured_features. A configured_feature defines what type of feature it is,\nphysically, such as an ore or a tree. The placed_feature determines under what\nconditions it spawns, such as in or on what blocks, at what Y level, or other\nfactors. The placed_feature is what the biome file references.Technically, the configured_feature can be defined in-line in the\nplaced_feature, however it’s good practice to separate these files. This allows\neasier delineation when creating and editing -- as some configured_feature types\ninclude in-line placements like a placed_feature -- and also makes it easier to\nreuse a configured_feature in multiple placed_features.Configured FeaturesThere are many configured_feature types, each with different required fields.\nListing each in detail would be unhelpful, outside the scope of this guide, and\na duplication of efforts --\nthe wiki serves as a great\nreference to become familiar with the available feature types. As always,\nutilizing Misode to keep track of\nrequired fields is highly recommended. Furthermore, if you do have an idea of a\nvanilla feature that looks similar to what you want to create, referencing it or\nstarting from it as a base, and then modifying it, is a completely valid\nstrategy.Instead, what this section of the guide will go over is point out which features\nare best for what purpose, and which features are surprisingly difficult to work\nwith, primarily as this knowledge may help keep you from becoming frustrated\nthat you can’t figure out how to do something that is, in fact, not possible.{\n\"type\": \"minecraft:tree\",\n\"config\": {\n\"decorators\": [],\n\"dirt_provider\": {\n\"type\": \"minecraft:simple_state_provider\",\n\"state\": {\n\"Name\": \"minecraft:dirt\"\n}\n},\n\"foliage_placer\": {\n\"type\": \"minecraft:blob_foliage_placer\",\n\"height\": 3,\n\"offset\": 0,\n\"radius\": 2\n},\n\"foliage_provider\": {\n\"type\": \"minecraft:simple_state_provider\",\n\"state\": {\n\"Name\": \"minecraft:oak_leaves\",\n\"Properties\": {\n\"distance\": \"7\",\n\"persistent\": \"false\",\n\"waterlogged\": \"false\"\n}\n}\n},\n\"force_dirt\": false,\n\"ignore_vines\": true,\n\"minimum_size\": {\n\"type\": \"minecraft:two_layers_feature_size\",\n\"limit\": 1,\n\"lower_size\": 0,\n\"upper_size\": 1\n},\n\"trunk_placer\": {\n\"type\": \"minecraft:straight_trunk_placer\",\n\"base_height\": 4,\n\"height_rand_a\": 2,\n\"height_rand_b\": 0\n},\n\"trunk_provider\": {\n\"type\": \"minecraft:simple_state_provider\",\n\"state\": {\n\"Name\": \"minecraft:oak_log\",\n\"Properties\": {\n\"axis\": \"y\"\n}\n}\n}\n}\n}\nAs mentioned above, some configured_features, like trees, offer a lot of control\nand flexibility. Trees have several different shapes to choose from for their\ntrunks and leaves, as well as optional roots (such as what Mangroves have),\noptions for decorations on any face of leaves, and can accept one or multiple\ndifferent blocks to make up each of these facets.The Ore feature type does not have quite as many fields, but still presents a\ngood deal of configurability. Making a new ore configured_feature entails\ndetermining what the block being placed is (the state) and what blocks it tries\nto get placed in (the target), which can be a block tag. As you can see in the\nbelow example for Coal, you can also list multiple state and target pairs in one\nfeature, which vanilla uses to place the appropriate Deepslate variant if the\nblock it gets placed in is a Deepslate or Tuff Block rather than Stone or a\nstone variant.{\n\"type\": \"minecraft:ore\",\n\"config\": {\n\"discard_chance_on_air_exposure\": 0.0,\n\"size\": 17,\n\"targets\": [\n{\n\"state\": {\n\"Name\": \"minecraft:coal_ore\"\n},\n\"target\": {\n\"predicate_type\": \"minecraft:tag_match\",\n\"tag\": \"minecraft:stone_ore_replaceables\"\n}\n},\n{\n\"state\": {\n\"Name\": \"minecraft:deepslate_coal_ore\"\n},\n\"target\": {\n\"predicate_type\": \"minecraft:tag_match\",\n\"tag\": \"minecraft:deepslate_ore_replaceables\"\n}\n}\n]\n}\n}\nThe size is self-explanatory but is not indicative of the actual quantity of the\nstate blocks that will be placed. More info on that relationship can be found on\nthe wiki.\nDiscard_chance_on_air_exposure is a chance between 0.0 and 1.0 to intentionally\nfail to spawn the feature if it touches air, such as in a cave. This is used in\nvanilla for so-called “buried” ore features like Iron and Diamonds, to encourage\nother forms of mining than just caving.The Ore feature type is also what is used for the blobs of dirt, gravel,\ngranite, tuff, and other blocks in the Overworld.Moving into feature types that are not configurable and what you can do about\nit. End Islands, Basalt Pillars, Ice Spikes, Glowstone Blobs, and Coral Claws\nare all examples of features that have no configuration at all, meaning their\nshape and block palette is hardcoded. You can still change how they get placed\nwith a placed_feature later, but you can’t change what these features physically\nare.For cases like these where you may want to make use of those specific shapes,\nbut can’t recreate them with other features (End Islands are a good example),\nyou can create features to replace those blocks with other blocks in a later\nstep. A good feature to use for this is geodes, because they can define a list\nof blocks that they are not able to replace, which can include all blocks except\nthe desired replaceables.This just allows you to replace a target block with a state block in a\n3D-diamond with a defined radius. It unfortunately doesn’t support block tags.\nIt also has a maximum radius of 12, so you may need a higher quantity of them\nusing your placed_feauture later to get consistent coverage.Placed FeaturesA placed_feature typically references a configured_feature, and determines how\nit gets placed in the world. For some features, like Trees, they will obey\nwherever your placements happen to define as valid. For other features, like Ice\nSpikes, they need to adhere to hardcoded conditions of the feature type, which\nare not always obvious. Ice Spikes for example can only spawn on Snow Blocks,\nregardless of what the placed_feature says.As with the previous section, this guide will not go over every type of\nplacement that can be included, nor every field they contain. These are all\ncovered in detail on the wiki, and\ngenerating them can be aided using\nMisode.However, there are a handful of placement types that are used extremely\ncommonly, and so we will go over what those are, how to use them, and when they\nmay not be needed.{\n\"type\": \"minecraft:ore\",\n\"config\": {\n\"discard_chance_on_air_exposure\": 0.0,\n\"size\": 10,\n\"targets\": [\n{\n\"state\": {\n\"Name\": \"minecraft:copper_ore\"\n},\n\"target\": {\n\"predicate_type\": \"minecraft:tag_match\",\n\"tag\": \"minecraft:stone_ore_replaceables\"\n}\n},\n{\n\"state\": {\n\"Name\": \"minecraft:deepslate_copper_ore\"\n},\n\"target\": {\n\"predicate_type\": \"minecraft:tag_match\",\n\"tag\": \"minecraft:deepslate_ore_replaceables\"\n}\n}\n]\n}\n}\nGenerally, placements are calculated in order from first to last. For some\nplacement types, this is irrelevant, while for others, being listed before or\nafter another placement can dramatically alter the spawning behavior. The\nfollowing placement types are the most commonly used; a majority of\nplaced_features will use some combination of these placements:countThe number of spawn attempts this feature will make per chunk. Accepts a\nconstant, or other number providers like uniform or trapezoid. If excluded, the\nplaced_feature will make only 1 spawn attempt per chunk.count_on_every_layerAn alternative to count. A little hard to explain, but essentially includes some\nrandom X and Z distribution, and Y distribution based on layers of air or fluid.rarity_filterAccepts a positive integer. Essentially divides any previous count-type\nplacements by this value. For example, a rarity of 1 will cause no change, a\nrarity of 2 will make the feature half as common, a rarity of 5 will make it 5\ntimes less common, etc. If no count-type placement was specified before this\nplacement, the count is assumed to be 1.in_squareThis is used to include some random distribution within the chunk. Without this\nplacement, all of the spawn attempts would be made at the chunk’s 0x, 0z\ncoordinate. If you are using count_on_every_layer, you do not need to use\nin_square.height_rangeDetermines the height this feature will try to spawn in. Accepts a constant, or\nother number providers like uniform or trapezoid. Whether using a constant or a\nnumber provider, each value must also be defined as “absolute” (this exact Y\nlevel), “above_bottom” (this many blocks above the lowest Y level of this\ndimension) or “below_top” (this many blocks below the highest Y level of this\ndimension, always a positive number). This allows some flexibility for\nsituations such as if the height of the dimension may change or is unknown.heightmapAccepts one of a few different heightmaps, including MOTION_BLOCKING,\nOCEAN_FLOOR, and WORLD_SURFACE_WG. This causes the feature to attempt to spawn\nat the highest block in the chosen X and Z coordinate, according to the selected\nheightmap. Unsurprisingly, this can cause undesired behavior if the dimension\nhas a roof, like the Nether.biomeDoesn’t have any other fields. Ensures that this feature won’t be allowed to\nspawn if the spawn attempt would be inside a biome that does not contain this\nplaced_feature in its listed features. Without it, if a chunk contains two\nbiomes, the feature would be allowed to “bleed” into the neighboring biome, even\nif it doesn’t belong there, as long as all other conditions are met (for\nexample, a Desert’s Cactus feature spawning in an adjacent Beach biome).block_predicate_filterCan be used to apply one or more conditions based on nearby blocks, including\nthe block that has been selected for the spawn attempt. This can include details\nlike if the block below is solid or in a block tag, whether it has a sturdy\nface, or is a valid location for a sapling or mushroom to be placed.One of the most important things to keep in mind when creating placed_features\nin particular is performance. More than anything else in worldgen, the\nplaced_features are going to have the greatest impact on the speed of your chunk\ngeneration. Features that have a high count, or hyper-specific\nblock_predicate_filters, can cause chunks to load more slowly. Similarly,\nincluding a height range for a feature that includes a lot of space that the\nfeature can’t spawn in can impact this chunk generation, as all of those failed\nspawn attempts still have to be calculated.","description":"This guide goes over how to create every step of a custom dimension, which includes custom biomes, terrain, and features.","url":"/wiki/worldgen/custom-worldgen/","tags":[]},{"title":"/function","content":"/function commandThis command runs any .mcfunction file when called. You can also pass in a NBT\ncompound or NBT source path if the function is a macro function. All functions\nare run independently and one after another - for example, if you run\nfunction1 and then function2, then function2 will only run once\nfunction1 has finished.Syntaxfunction : : Runs the .mcfunction file at\ndata/ /function/ function : {key:value}: Runs the .mcfunction file\nat data/ /function/ , and uses the {key:value} if the\nfunction is a macro function.function : with (block |entity |storage ) :\nRuns the .mcfunction file at data/ /function/ , and\nuses the NBT source if the function is a macro function.","description":"This command runs any `.mcfunction` file when called. You can also pass in a NBT compound or NBT source path if the function is a macro function. All functions are run independently and one after another - for example, if you run `function1` and then `function2`, then `function2` will only run once `function1` has finished.","url":"/wiki/command/function/","tags":[]},{"title":"/summon","content":"/summon commandThe /summon command is used to summon an entity at a position, along with any\nentity NBT.SyntaxThe syntax of the /summon command is as follows:summon [position] [nbt data]\n : an ID of a minecraft entity. For example: minecraft:cow,\nmarker, zombie. If the namespace (minecraft:) is omitted, it will\ndefault to the minecraft namespace.[position] (optional): the coordinates at\nwhich the entity should be spawned. (Defaults to the current position).[nbt data] (optional): a compound containing the NBT (in\nSNBT format) which the entity should\nbe spawned with. For example: {NoAI:1b}.Examplessummon minecraft:cow - Summons a cow at the current position.summon minecraft:ender_dragon ~ ~50 ~ - Summons an ender dragon 50 blocks\nabove the current positionsummon minecraft:wither 29 372 121 - Summons a wither at the coordinates\nx=29, y=372, z=121summon minecraft:zombie ~ ~ ~ {NoAI:1b} - Summons a zombie at the current\nposition with the NoAI NBT, meaning it will not move around or attack\nplayers.AlternativesThe execute summoncommand can also be used to summon an entity.\nUsing this\nexecute subcommand will\nsummon an entity at the current position, and then run the specified command as\nthe newly summoned entity.However, execute summon cannot provide any NBT to give the entity upon being\nspawned. You will have to edit the nbt in the command/function which is\nexecuted, which can be a bit tedious. An alternative to\nexecute summon minecraft:cow run function custom_function would be the\nfollowing:summon minecraft:cow ~ ~ ~ {Tags:[\"newly_summoned_cow\"]}\nexecute as @n[type=cow,tag=newly_summoned_cow] at @s run function custom_function\ntag @n[type=cow,tag=newly_summoned_cow] remove newly_summoned_cow\n","description":"The /summon command is used to summon an entity at a position, along with any entity NBT.","url":"/wiki/command/summon/","tags":[]},{"title":"/data","content":"/data commandThe /data command is used to modify and fetch NBT data of\nblocks,\nentities and\nstorages.\nto modify player data.\nresulting value by scale, if specified.\nsource is a data source, path is an\nnbt path and scale is a number.\nIf scale is set, and the data at that path it not a number, the command fails.After fetching the NBT at the path, if it exists, it prints the data in\nSNBT format in the chat. Therefore, its\nmain use is manually inspecting NBT data. However, it also returns the integer\nrepresentation of the\nfetched data, so it can be used in combination with execute store or\nreturn run to convert NBT into an integer.Examplesdata get entity @s SelectedItem.id data get block ~ ~ ~ Itemsmerge Merges data with the given data source.\ntarget is a data source and nbt is an\nSNBT compound.\nThis command fails if the given entity or block does exist, or if the block is\nnot a block entity and cannot hold NBT data. However, if the data source is a\nstorage, and that storage does no exist yet, the storage is automatically\ncreated.Examplesdata merge entity @n[type=creeper] {Fuse: 10s, ignited: true, ExplosionRadius: 8}\ndata merge storage example:data {a: 1, b: \"b\", c: [41b, 0b]}modify Modifies the NBT data at the specified path of the given data source. This gives\nmore fine-grained control that data merge.\ntarget is the data source to modify and path is an\nNBT path, the specific sub-path of that\ndata source.\naction determines what kind of modification occurs. There are 5 possible\nactions, as below.\nsource determines the source of the data being used to modify the target.\nSee source below.appendAppends an NBT value to a\nlist or a typed array, making the value\nthe last element.\nIf the specified path does not exist in the data source, it is created and\ninitialized as a list containing the value just appended.\nThis is equivalent to data modify ... insert 0 ....insert Inserts an NBT value into a\nlist or array at a specific index,\nshifting all proceeding elements to the right. Negative indices may be used to\nindicate inserting values from the end.\nIf the index specified would cause the inserted item to be further than one\nafter the first or last element of the list, the command fails.\nInserting creates list if it doesn't exist in the same way as append.mergeMerges source into target at path. This is similar to\ndata merge, but allows modifying a sub-path of a data source, and allows\nmerging from more than just hardcoded NBT values.prependPrepends an NBT value to a\nlist or a typed array, making the value\nthe first element.\nLists are created in the same wat as append.\nThis is equivalent to data modify ... insert -1 ....setSets the value of target at path, discarding any previously present value.\nThis will create keys in a compound if not present, but cannot be used to add\nelements to an array or list, only modify existing ones.\nset can create a chain of nested compounds if they don't already exist.\nFor example, if the storage example:main does not yet exist, after the\nfollowing command:data modify storage example:main a.b.c.d set value 10\nThe example:main storage looks like this: {a: {b: {c: {d: 10}}}}.sourcesource determines the value modifying target. It can be one of:value- Gets the value from an\nSNBT literal.from [path] - Gets the data from the specified\ndata source and path.string [path] [start] [end] - Gets the data from the specified\ndata source and ensures that it's a string. If start or\nend is specified, truncates the string using those values. start is\ninclusive, while end is exclusive. Both numbers are allowed to be negative,\ncounting from the end of the string. For example, the indices 1 -1 remove\none character from each end of the string, while 0 1 takes the first\ncharacter.remove Removes the NBT data from source at path. source is a\ndata source and path is an\nNBT path.\nThis deletes compound keys, and removes array and list elements, shifting\nproceeding elements left. It cannot, however, be used to delete an entire\nstorage using the special {} path; only single keys of the root storage.\nNBT data in a sub-path of it, for example:data modify storage example:main temp.a set value 1\ndata modify storage example:main temp.b set value 2\n# Removes both keys\ndata remove storage example:main temp\n\nNBT of an entity.block- The NBT of a block entity.storage- The NBT from a\ndata storage.Data mergingData merging is a process of merging two data values into one another.\nThere are two values: The left side and the right side. The left side is the\nbase of the operation, with the right being merged into the left.If both sides of the operation are compounds, each key of the right compound is\nmerged into the matching key of the left compound. If the key does not exist in\nthe left compound, it is created and set to the value of the right.If both sides are not a compound, the left is simply set to the right.","description":"The data command is used to modify and fetch NBT data of blocks, entities and storages.","url":"/wiki/command/data/","tags":[]},{"title":"/execute","content":"/execute commandThe execute command is used to execute other commands conditionally, or in a\ndifferent context. The execute command is made up of multiple subcommands, which\ncan be chained repeatedly and in any order to modify context in various ways.Each subcommand has its own syntax, and most allow/require another subcommand to\nfollow.ContextEvery command is executed in a context. Various execute subcommands can modify\nthe context in which other commands are run. The context includes:Position: The position at which the command is executed (the origin of\nrelative coordinates)Anchor: Either eyes or feet. Specifies the origin of local coordinates to\neither the eyes or feet of an entity.Executor: The entity executing the command (which entity the @s selector\nrefers to)Rotation: The rotation of the commandDimension: The dimension in which the command is executedForkingSome subcommands can split the command execution into multiple branches. This is\ncalled forking. This means any subcommands that follow will be executed multiple\ntimes, once for each branch. Minecraft will finish executing all subcommands in\nthe first branch before moving on to the next.For example, if there are two markers A and B, and the following command is run:\nexecute as @e[type=marker] run function example\nAnd the example function contained the following commands:say first command\nsay second command\nThe chat output would look like this:[A] first command\n[A] second command\n[B] first command\n[B] second command\nSubcommands\ndenotes that another subcommand is optional.\n(rounding down coordinates to integers).can be any subset of xyz, in\nany order.Examples:execute align xz ...\nexecute align yxz ...execute anchored (eyes|feet) ...Changes the execution anchor to the eyes or feet of the entity.Examples:execute anchored eyes ...\nYou can lock this though by using positioned ^ ^ ^ after it.\nany other context such as location).\nIfrefers to multiple entities, the following subcommand gets\nexecuted once for each referenced entity, with that entity as the executor.\nIfrefers to no entities, the execute chain terminates and no further\nsubcommands are run.Examples:execute as @a[distance=10..] ...\nexecute as @e[type=pig] ...execute at...Changes the position and rotation of the following subcommand to that of\n(Executor remains the same).\nForking rules apply the same as execute as.Examples:execute at @s ...\nexecute at @p ...execute facing...Changes the rotation of the following subcommand to face.\ncan either be a set of coordinates, or\nentity (eyes|feet), which targets the eyes or feet of the given\nentity.Examples:execute facing 0 0 0 ...\nexecute facing entity @e[type=marker,limit=1] feetexecute in...Changes the dimension of the following subcommand to.\nApplies dimension scaling, meaning coordinates are divided by 8 when\ntransferring from the overworld to the nether.Examplesexecute in minecraft:nether ...execute on...Changes executor to other entities based on their relation with the current\nexecutor. Same forking rules apply as execute as.\nPossible values forare:attacker - The most recent entity to damage the current entity in the last 5\nseconds.controller - The entity which is riding and in control of the current\nentity.leasher - The entity holding the the current entity on a lead.origin - The entity the current entity originated from, such as the player\nthat shot an arrow.passengers - All entities riding the current entity (not including entities\nriding the passengers).target - The entity the current entity is trying to attack (angry at).vehicle - The entity that the current entity is riding.Examplesexecute on passengers ...\nexecute on target ...execute positioned...Changes the position (but not rotation) of the following subcommand to\n . Also resets anchor.\ncan be a set of coordinates, as , or\nover .\npositioned as... is equivalent to at..., except that it\ndoesn't change rotation or dimension.\npositioned oversets the y coordinate of the position to be one\nabove the specified heightmap.Examples:execute position ~ 0 ~-10 ...\nexecute positioned as @s ...\nexecute over world_surface ...execute rotated...Changes the rotation of the following subcommand to.\ncan either be rotation coordinates, or as , which changes\nthe rotation to that of the specified entity. For rotated as , forking\nrules apply the same as as entity.Examples:execute rotated ~10 0 ...\nexecute rotated as @e[tag=rotate] ...execute summon...Summons the specified entity at the current position, and executes the following\nsubcommand as that entity.\nNote: You cannot specify NBT data for the summoned entity.Examples:execute summon iron_golem ...\nexecute summon marker ...execute run Runs the specified command with the current context. Takes no further\nsubcommands.\nexecute at @e[type=sheep] run setblock ~ ~ ~ stoneexecute store (result|success)...Stores an integer value somewhere. If storing result, this numeric value is\ntaken from the output of the final subcommand (Either a run subcommand or a\ncondition). If storing success, the value is either 1 if the final\nsubcommand succeeds (condition passes or command successfully performs its\nfunction), or 0 otherwise.target can be one of the following:block : Stores the value in the\nspecified path of the given block in the format specified by type (Any\nnumeric NBT type), and multiplied by scale. Note: Even if type is a\ndecimal type (float or double), the value is still rounded down.entity : Stores the value in the specified\npath of the target entity, the same way as block. entity must only refer\nto a single entity.storage : Stores the value in the given\npath of the target storage in the same way as block and entity.score : Stores the value for the target entity in\nthe provided scoreboard. target can refer to more than one entity.bossbar (value|max): Stores the value in a bossbar, changing either\nthe current value or the maximum value.Examples:execute store result entity @s Pos[1] double 1.5 ...\nexecute store success score $foo my_objective ...\nexecute store result bossbar foo_bar value ...execute (if|unless) [...]Executes the following subcommand under a given condition. unless inverts the\ncondition, meaning the chain only continues if the condition not met.Possible values for condition:biome : Checks whether a specific biome is at the given\nposition.block : Checks whether the given position is a certain\nblock.blocks (all|masked): Compares two volumes of\nblocks: from start to end, and from destination such that the second\nvolume is the same dimensions as the first. If all is specified, it checks\nall blocks. If mask is specified, air blocks are ignored.data (block|entity|storage) : Checks if the specified\npath matches the NBT data of target.dimension : Checks if the execution is in the specified\ndimension.entity : Checks whether target resolves to one or more\nentities.function : Runs the specified function and tests the return\nvalue. If the function did not run the return command, or if it returns\nzero, the condition is not met. Must be followed by another subcommand.items (block|entity) : Checks if the given item\nmatches the specified slot of the target block or entity. item is in the\nformat[ ].loaded : Checks if the specified position is loaded.predicate : Checks whether a predicate succeeds.score (matches | ):\nChecks whether a score is within a range (matches), or has a specified\ncomparison to another score. operator can be on of:=,\n>.stopwatch : Checks if the specified stopwatch matches the\nspecified range.Examples:execute if biome ~ ~ ~ minecraft:snowy_taiga ...\nexecute if block 16 -42 83 #minecraft:logs ...\nexecute if blocks ~ ~ ~ ~10 ~10 ~10 0 64 0 all ...\nexecute if data storage example:store path{thing:1} ...\nexecute if dimension minecraft:the_end ...\nexecute if entity @e[tag=existent] ...\nexecute if function example:my_fn ...\nexecute if items entity @s weapon.mainhand #minecraft:swords[minecraft:custom_data={foo:\"bar\"}] ...\nexecute if loaded 0 0 0 ...\nexecute if predicate example:check ...\nexecute if score @s score = @r score ...\nexecute if stopwatch example:timer 10 ...","description":"The execute command is used to execute other commands conditionally, or in a different context. The execute command is made up of multiple subcommands, which can be chained repeatedly and in any order to modify context in various ways.","url":"/wiki/command/execute/","tags":[]},{"title":"All Commands List","content":"List of all commandsThis is a list of all commands along with what they do basically, organised by\npermission level.SyntaxWe use the following syntax to make it easier to understand which arguments are\nneeded.VariableMeaning An argument.[ ]An optional entry. Pick one of these. This is required.[entryA│entryB│entryC]Pick one of these. This is optional....Some syntax is left out, you can find more about the command on its dedicated pageCommon ParametersParameters that show up commonlyVariableMeaningtarget(s)A Target Selector.rangeA Range.timeIndicates time (1s = 1 second, 1t = 1 game tick)List of commands by Permission LevelPermission level 0These commands can be run by any player, no matter their permission level./help [command] - Shows the help menu for commands/list [uuids] - Lists players on the server/random- Creates a random value (requires\nPermission Level 2+)/seed - Displays the world's seed, permission level 0 only in singleplayer/teammsg- Sends a message to all players in the same team of the\ncommand runner. (Alias /tm)/me- Displays: *in chat/msg- Sends a private message to a player. (Alias\n/tell and /w)/trigger [add|set] [ ] - Triggers a scoreboard objective\n(see Scoreboards)Permission level 1There are currently no commands with the permission level 1 in Java Edition.Permission level 2These commands require a permission level same or bigger than 2 to run them./advancement-\nGives, removes or checks players advancements/attribute get|base|modifier|reset ... - Can change or\nread attributes. See more on the\nMinecraft Wiki/bossbar list|add|remove|set|get [ ] ... - Changes or creates bossbars/clear [ ] [ ] [ ] - Clears items from the players\ninventory/clone <... | from ...> -\nCopies blocks in an area from one place to another, or from one dimension to\nanother/damage [ ] [at ]|[by ] [from ] -\nDamages selected entities/players./data... - Changes block entity or entity NBT\ndata. See more on its dedicated page./datapack disable |enable |list [available|enabled]|create-\nEnables, disables or creates a datapack/defaultgamemode- Sets the default\ngamemode of a world/dialog |clear- Shows and hides\ndialog screens from players/difficulty [peaceful|easy|normal|hard] - Sets or gets the difficulty of a\nworld/effect ] [ ]|give [ |infinite] [ ] [ ]> -\nChanges the entity's active effects/enchant [ ] - Adds enchantments onto held\nitem. (Note that you can't enchant items with a level higher than what is\npossible in survival)/execute ... - Executes a different command (See more here:\n/execute)/experience ... - Adds, removes or gets the\nplayers experience points. (ALIAS: /xp)/fetchprofile |id |entity- Fetches the profile of the target. It works asynchronously as the operation might take some time.\nAfter successful completion, a message will be printed that lets users copy the contents of a fully resolved minecraft:profile component or /give @s minecraft:player_head with said component.\nFor the entity subcommand, the player must be online, and will fail if they are not./fill [destroy|hollow|keep|outline|replace [filter]] -\nFills the defined region with selected blocks/fillbiome [replace [filter]] - Fills the\ndefined region with a specific biome/forceload add [ ]- Forces chunks to be\nloaded constantly/function |with |entity |storage [ ] -\nTriggers a function/gamemode [ ] - Changes or checks the player's gamemode/gamerule [ ] - Changes or checks a gamerule/give [ ] - Gives an item to the player/item |entity ... - Modifies\nor copies items from inventories of entities/blocks/kill [ ] - Kills selected entities/locate- Displays the coordinates or returns the\ndistance of the nearest biome, structure or point of interest./loot |insert |spawn |replace |kill |mine ...> ... -\nSpawns or inserts the selected loot table into an inventory or the world/particle [ ] [force|normal] [ ] -\nSpawns a selected particle with specified parameters/place... - Places a structure, a\nfeature, a structure template or a template pool on a selected location/playsound [ ] [ ] [ ] [ ] [ ] [ ] -\nPlays a specified sound to a player/random... - Rolls a random number/recipe- Gives or takes recipes from a\nplayer/reload - Reloads all datapacks in a world. (If there is an error in any of\nthe files, it won't reload it)/return |fail|run- Returns a number from a function, while\nalso stopping it/ride |dismount> - Make an entity ride or dismount\na different entity/rotate [ ]>> -\nUsed to rotate an entity, works similarly to /teleport but doesn't dismount\nthe entity it's riding./say- Sends a message into chat to all players/schedule [append|replace]|clear-\nSchedules a function or clears it. Note that this will not transfer over\nselectors/scoreboard... - Manages\nscoreboard objectives and players/seed - Displays the world's seed, permission level 2 only in multiplayer./setblock [destroy|keep|replace] - Changes or replaces a\nspecified block with a different one/setworldspawn [ ] [ ] - Sets the world's spawn/spawnpoint [ ] [ ] [ ] - Changes the spawn point for a\nplayer/spectate [ ] - Makes a player spectate an entity, note that\nthe spectator has to be in spectator mode/spreadplayers [under ]-\nTeleport entities randomly across a specified area/stopsound [ ] [ ] - Stops any playing sound/stopwatch |query |restart |remove- Keeps track of real time (not game time), and is not affected by game tick rates or speeds. \nTime is calculated to millisecond precision/summon [ ] [ ] - Summons an entity/swing- Swings (animation only) the hand of an entity, mostly used for mannequins/tag add |remove | list - Adds, removes or lists\nentities tags/team... - Modifies and creates teams/teleport [ ] |facing [ ]>]> ... - Teleport entities to a specified location. (ALIAS: /tp)/tellraw- Sends a JSON message to players/time |query |set- Controls or checks the time/title (times clear|reset|title |subtitle |actionbar ) -\nDisplays text on the player's screen/weather weather [ ] - Changes the weather/worldborder add|center|damage|get|set|warning ... - Controls the\nworldborderPermission level 3These commands require a permission level same or bigger than 3 to run them./ban [ ] - Adds the player's profile into the server's\nbanlist/ban-ip [ ] - Adds the player's IP address into the server's\nbanlist/banlist [ips|players] - Displays the server's banlist/debug- Starts or stops a debug/deop- Removes a player operator status/kick [ ] - Kicks a player off a server. (Note, a player in\nsingle player / the host of the world can't be kicked!)/op- Makes a player operator/pardon- Removes player's profile from the server's banlist/pardon-ip- Removes player's IP address from the server's banlist/tick |freeze|unfreeze|step [|stop]|sprint [|stop]> -\nControls or checks the tick rate of a world/transfer [ ] [ ] - Transfers a player to a\ndifferent server/whitelist... - Modifies the server's\nwhitelistPermission level 4These commands require a permission level same or bigger than 4 to run them./jfr start|stop - Starts or stops JFR(Java FlightRecorder & other custom\nevents) profiling/perf- Captures info and metrics about the game for 10 seconds/publish [ ] [ ] [ ] - Opens a singleplayer\nworld to your local network/save-all [ ] - Saves the server to a disk/save-on - Enables automatic server saves/save-off - Disables automatic server saves/setidletimeout- Used to set the time before idle players are\nkicked (If 0 - disabled)/stop - Stops the server/version - Sends the server's version info (the name, protocol version and\nthe resourcepack and datapack formats).List of commands by Server TypeMultiplayer Only CommandsThese commands can only be run only on a server./ban [ ] - Adds the player's profile into the server's\nbanlist/ban-ip [ ] - Adds the player's IP address into the server's\nbanlist/banlist [ips|players] - Displays the server's banlist/deop- Removes a player operator status/op- Makes a player operator/pardon- Removes player's profile from the server's banlist/pardon-ip- Removes player's IP address from the server's banlist/perf- Captures info and metrics about the game for 10 seconds/save-all [ ] - Saves the server to a disk/save-on - Enables automatic server saves/save-off - Disables automatic server saves/setidletimeout- Used to set the time before idle players are\nkicked (If 0 - disabled)/stop - Stops the server/transfer [ ] [ ] - Transfers a player to a\ndifferent server/whitelist... - Modifies the server's\nwhitelistSingleplayer Only CommandsThis command can only be run in singleplayer, not on a server./publish [ ] [ ] [ ] - Opens a singleplayer\nworld to your local network","description":null,"url":"/wiki/command/all/","tags":[]},{"title":"JSON","content":"JSON FormatJSON is a data storage type used by Minecraft Datapacks for files such as predicates and tags, as well as in Styled Text. JSON is a way of storing data, usually used in .json files but is also seen in .mcmeta files too.How JSON worksJSON stands for JavaScript Object Notation. It was originally created as a\nway of writing objects in Javascript. These days, JSON is used in almost every\nprogramming environment, datapacks included.JSON is a way of storing information so that both a computer and a human can\nunderstand it. It stores data as key-value pairs - this means that a key\n(such as name) can store any value (such as Aron Aronson). The code can ask\nfor name, and it will get the result Aron Aronson.A .json file usually is itself just a JSON object (aka a JSON dictionary). A\nJSON dictionary is like a real dictionary because it holds sets of key/value\npairs - just like how a dictionary consists of word/definition pairs. In a JSON\ndictionary, the key and value are separated by a colon (\"key\":value), and each\nkey/value pair is separated by a comma.Example JSON{\n\"name\": \"Aron Aronson\",\n\"age\": 83,\n\"alive\": true,\n\"family_members\": [\"James Aronson\", \"Catherine Aronson\"],\n\"login_details\": {\n\"email\": \"aron.aronson@gmail.com\",\n\"password\": \"MyNameIsAron12345\"\n}\n}\nAn explanation of this file:Everything is contained within curly brackets {...}, which means that the\nwhole file is a JSON dictionary.The first key/value pair is \"name\":\"Aron Aronson\". The key here is name,\nand it has a string (text) value: \"Aron Aronson\"The second key/value pair is \"age\":83. The key here is age, and it has a\ninteger (whole number) value of 83. The number isn't \" signs, because\nif a value is in \" signs, it is considered to be text.The third key/value pair is \"alive\":true. The key here is alive, and it\nhas a boolean (true/false) value of true.The fourth key/value pair is \"family_members:[...]\". The key here is\nfamily_members, and it has a list value (indicated by the square\nbrackets []). This list has two string (text) values. The list does\nnot contain key/value pairs, just values.The final key/value pair is \"login_details\":{...}. The key here is\nlogin_details, and it has a dictionary value. The dictionary itself\ncontains two key/value pairs.Note that the key in a key/value pair is contained within \" signs - don't\nconfuse this with the string data type seen in the first key/value pair. The key\nis always on the left of the colon, and is always in \" signs. The\nvalue is always on the right of the colon, and should only use \" signs if\nit is a text value.Types of valuesYou can use the following data types for JSON values:String (e.g \"Hi! I am text\"): A string is plain text. Everything inside\nthe string should be contained within \" or ' signs. If you want to use one\nof those signs within the string without making the computer think the string\nhas ended, put a \\ before the character (e.g \"Dave said \\\"Hello\\\".\")Integer (e.g 42): An integer (often called an int) is a whole number.\nThis is also often used to store date and time values (seconds since\nJan 1 1970)Float (e.g 12.5): A float (short for \"floating point number\") is any\ndecimal number. The decimal point needs to be a . symbol.Boolean (e.g true or false): A boolean is either true or false. In\nsome circumstances, these are just easier ways to write 1 or 0.List (e.g [123, \"hello\", 456, \"goodbye\"]): A list is an ordered\ncollection of values (not key/value pairs). List items should be contained\nwithin square brackets ([]) and separated with a comma. Confusingly, the\nfirst item in a list is \"item 0\", the second one is \"item 1\", etc.Dictionary (e.g {\"name\":\"Aron\", \"age\":94}): A dictionary contains\nkey/value pairs, separated by commas. The key needs to be inside \" signs,\nand followed by a colon.JSON PathsA JSON path is basically the address of a specific value within a JSON\nstructure. Nested dictionaries (if the value of a key is a dictionary) are\nseparated by . signs, otherwise it's pretty straightforward how they work.If we assume that root contains the entirety of the example file (remember\nthat the contents of the file itself is just a JSON dictionary), then the\nfollowing paths can be used:root.name would return \"Aron Aronson\"root.alive would return trueroot.family_members[0] would return \"James Aronson\" (the first item in the\narray)root.login_detiails.password would return \"MyNameIsAron12345\"In datapacks, you will not use JSON paths often, but you will use\nNBT paths, which are very similar.\nlanguages, such as Python, use a different format, such as:root[\"login_details\"][\"password\"]\n","description":"A rough guide to the JSON format used in Minecraft Datapacks (among other places)","url":"/wiki/info/json/","tags":[]},{"title":"Breaking Changes","content":"List of breaking changesThis is a list of all breaking changes to datapacks (excluding resource packs). Special thanks to Conure's How To Upgrade Your Datapacks Series, Misode's Technical Changelog and the Minecraft Wiki for the source of many of these.26.1OtherThe default value of the rotation property on banners and signs has been changed from 0 to 8.To fix this, just add a [rotation=0].The villager.* slots have been removed. You can now access them using mob.inventory.*.The field ignore_fall_damage_from_current_explosion field on players has been removed.The minecraft:post_piercing_attack no longer requires the player to have 7+ hunger to work. If you want it to retain its previous functionality, you must now add a predicate testing for the player's hunger.A new required field has_ender_dragon_fight has been added to Dimension Type files.TimeThere have been multiple changes to the /time.The time command now affects time per dimension, as there is now no universal time for all dimensions. Previously, it affected the time of the overworld, no matter where it was ran from.To fix this, add of minecraft:overworld to all time commands. (e.g. /time of minecraft:overworld set 1500). This only applies if the command is not being run from the overworld./time (of minecraft:overworld) setnow advanced the time to the next day/night/moon/midnight, instead of setting it to a constant value (e.g. 18000 was previous midnight)/time query daytime is now /time query minecraft:day/time query day is now /time query minecraft:day repetitionA new field default_clock has been added to Dimension Type files, and while it isn't required, omitting it will result in there being no time in that dimension.You can just set default_clock to minecraft:overworld to restore its previous behaviour.The time_check predicate condition, Timelines and time_of_day Game Test environments now have a required field clock.You can just set clock to minecraft:overworld to restore its previous behaviour.Mob VariationsFor cats, chickens, cows and pigs, a new field baby_asset_id is now required.For wolfs, a new field baby_asset is now required. It has the same format as the asset field.Wolf sound variants in wolf_sound_variant have been moved into a new field adult_sounds, as a new field baby_sounds was added.WorldgenSeveral worldgen features have been renamed and are now configurableThe forest_rock configured feature has been renamed to block_blob.Has a new required block predicate field can_place_on.The ice_spike configured feature has been renamed to spike.Has new required block state provider field state.Has new required block predicate fields can_place_on and can_replace.The huge_red_mushroom and huge_brown_mushroom configured features have a new required block predicate field can_place_on.In the tree feature the force_dirt and dirt_provider parameters were replaced with a below_trunk_provider rule-based block state provider.The state_provider under the disk feature is now a block state provider. This means you must add a \"type\": \"minecraft:rule_based_state_provider\" to it.Features spawned from Bone Meal are no longer restricted to the flower feature type, and instead controlled by the #can_spawn_from_bone_meal configured feature tag.The flower, flower_no_bonemeal, and random_patch feature types have been removed, instead patches can now be expressed as a sequence of count and random_offset placement modifiers.The alter_ground tree decorator configuration has changed so that provider is now a rule-based block state provider.Block Tags#dry_vegetation_may_place_on has been renamed to #supports_dry_vegetation#bamboo_plantable_on has been renamed to #supports_bamboo#small_dripleaf_placeable has been renamed to #supports_small_dripleaf#big_dripleaf_placeable has been renamed to #supports_big_dripleaf#mushroom_grow_block has been renamed to #overrides_mushroom_light_requirement (Mushrooms cannot survive without a light level below 13 if not in the above tag.)#snow_layer_can_survive_on has been renamed to #support_override_snow_layer (Snow layers can be placed on blocks in this tag even if they do not have a top full face.)#snow_layer_cannot_survive_on has been renamed to #cannot_support_snow_layer#dirt has been split into multiple other tags, and now only contains dirt blocks. To keep its previous functionality, use the new #substrate_overworld block tag.Item TagsThe #dyeable item tag has been removed, as it's now controlled by the crafting_dye recipe type.Enchantment TagsRemoved the #trades/desert_special, #trades/jungle_special, #trades/plains_special, #trades/savanna_special, #trades/snow_special, #trades/swamp_special, #trades/taiga_special.These only exist if you are using the \"Villager Trade Rebalance\" experimental datapack.RecipesRenamed the following stonecutter recipes, alongside their relevant advancementsminecraft:chiseled_stone_bricks_stone_from_stonecutting → minecraft:chiseled_stone_bricks_from_stone_stonecuttingminecraft:end_stone_brick_slab_from_end_stone_brick_stonecutting → minecraft:end_stone_brick_slab_from_end_stone_bricks_stonecuttingminecraft:end_stone_brick_stairs_from_end_stone_brick_stonecutting → minecraft:end_stone_brick_stairs_from_end_stone_bricks_stonecuttingminecraft:end_stone_brick_wall_from_end_stone_brick_stonecutting → minecraft:end_stone_brick_wall_from_end_stone_bricks_stonecuttingminecraft:mossy_stone_brick_slab_from_mossy_stone_brick_stonecutting → minecraft:mossy_stone_brick_slab_from_mossy_stone_bricks_stonecuttingminecraft:mossy_stone_brick_stairs_from_mossy_stone_brick_stonecutting → minecraft:mossy_stone_brick_stairs_from_mossy_stone_bricks_stonecuttingminecraft:mossy_stone_brick_wall_from_mossy_stone_brick_stonecutting → minecraft:mossy_stone_brick_wall_from_mossy_stone_bricks_stonecuttingminecraft:prismarine_brick_slab_from_prismarine_stonecutting → minecraft:prismarine_brick_slab_from_prismarine_bricks_stonecuttingminecraft:prismarine_brick_stairs_from_prismarine_stonecutting → minecraft:prismarine_brick_stairs_from_prismarine_bricks_stonecuttingminecraft:quartz_slab_from_stonecutting → minecraft:quartz_slab_from_quartz_block_stonecuttingminecraft:stone_brick_walls_from_stone_stonecutting → minecraft:stone_brick_wall_from_stone_stonecutting1.21.11You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21.11CommandsAll gamerules have been moved to a registry, this mainly means that they now use the minecraft: prefix and are now in snake_case, though some have been renamed.There are some exceptions to the generic renames. Click to see them all.disableElytraMovementCheck → minecraft:elytra_movement_check (the value was inverted)\ndisablePlayerMovementCheck → minecraft:player_movement_check (the value was inverted)\ndisableRaids → minecraft:raids (the value was inverted)\ncommand_modification_block_limit → minecraft:max_block_modifications\ndoDaylightCycle → minecraft:advance_time\ndoMobLoot → minecraft:mob_drops\nannounceAdvancements → minecraft:show_advancement_messages\ncommandBlocksEnabled → minecraft:command_blocks_work\ndoEntityDrops → minecraft:entity_drops\ndoImmediateRespawn → minecraft:immediate_respawn\ndoInsomnia → minecraft:spawn_phantoms\ndoLimitedCrafting → minecraft:limited_crafting\ndoMobSpawning → minecraft:spawn_mobs\ndoPatrolSpawning → minecraft:spawn_patrols\ndoTileDrops → minecraft:block_drops\ndoTraderSpawning → minecraft:spawn_wandering_traders\ndoVinesSpread → minecraft:spread_vines\ndoWardenSpawning → minecraft:spawn_wardens\ndoWeatherCycle → minecraft:advance_weather\nmaxCommandChainLength → minecraft:max_command_sequence_length\nmaxCommandForkCount → minecraft:max_command_forks\nnaturalRegeneration → minecraft:natural_health_regeneration\nsnowAccumulationHeight → minecraft:max_snow_accumulation_height\nspawnRadius → minecraft:respawn_radius\nspawnerBlocksEnabled → minecraft:spawner_blocks_workSome gamerules now have a limited value range. Click to see them all.max_block_modifications - Minimum 1\nmax_command_forks - Minimum 1\nmax_command_sequence_length - Minimum 0\nmax_entity_cramming - Minimum 0\nmax_snow_accumulation_height - Minimum 0 | Maximum 8\nplayers_nether_portal_creative_delay - Minimum 0\nplayers_nether_portal_default_delay - Minimum 0\nplayers_sleeping_percentage - Minimum 0\nrandom_tick_speed - Minimum 0\nrespawn_radius - Minimum 0The gamerule doFireTick and allowFireTicksAwayFromPlayer have been removed and replaced with minecraft:fire_spread_radius_around_player, which controls the maximum distance in blocks that fire can spread around the player.Setting it to 0 disables fire spreading.Setting it to -1 will allow fire to spread even without players around.In Game Tests, in the game_rules test environment the bool_rule and int_rule have been replaced with a single rules field.The rules field is a list of key-value pairs with the key being the gamerule's name and the value being the value (bool or int). (\"minecraft:random_tick_speed\": 62)Many fields from Biome and Dimension Type files have been removed and replaced by Environment Attributes.Because this change is so huge, and covers so many fields, I won't list out all the changes here. I recommend just reading the wiki page about them.If you were using the world border to track real time, it won't work now, as it uses game time now.You can now get the real time using the (/stopwatch)[https://minecraft.wiki/w/Commands/stopwatch] command.The /worldborder command is now specified in ticks by default, rather than the previous seconds.To restore its previous functionality, add an s suffix to the end. (/worldborder set 620 20s)ItemsThe spear animation in the consumable item component has been renamed to trident, the spear animation still exists, but now uses a different animation. (the same as vanilla spears)If you are using the filtered item modifier, rename the field modifier with on_pass. (as a new on_fail field was also added)TagsRenamed item tag #enchantable/sword to #enchantable/sweeping.This only controls enchantability for the sweeping edge enchant. May be preferable to use the #minecraft:enchantable/meele_weapon, which includes spears and swords.Removed some biome tags, depending on your use for them, follow the steps below:If you were only referencing them in your code, and not editing them:Create these tags yourself with their previous values.If you were using them to edit biome properties, this funcionality has been replaced with new Environment Attributes.Removed #snow_golem_melts biome tag - replaced by gameplay/snow_golem_melts environment attribute.Removed #increased_fire_burnout biome tag - replaced by gameplay/increased_fire_burnout environment attribute.Removed #plays_underwater_music biome tag - replaced by only_underwater field in the audio/background_music environment Attribute.Removed #has_closer_water_fog biome tag - replaced by visual/water_fog_radius environment Attribute.Removed #without_patrol_spawns biome tag - replaced by gameplay/can_pillager_patrol_spawn environment Attribute.Entity DataThe AngryAt field has been renamed to angry_at.The AngerTime field has been removed, as it has been replaced by an anger_end_time field, stored as a long, which is the number of the tick the anger ends at.If you NEED to only make the mob angry for a certain amount of time, you will have to get the game's tick number with /time query gametime, store that, add to it the amount of ticks you want and then set the anger_end_time to that.OtherThe minecraft texture atlas minecraft:blocks no longer stores blocks & items, as items are now stored in the minecraft:items atlas.1.21.9 - 10You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21.9OtherThe pack.mcmeta format has been completely changed. Pack versions now have major and minor changes. Based on which versions you plan to support, folow the steps below to update it. (also applied to resource packs)If you only plan to support 1.21.9 and newer:The supported_formats field has been removed and replaced by min_format and max_format, which are specified as a list of two integers ([major, minor]) or one integer (makes it support any minor version).The same applies for the formats field in the overlay section, it has also been replaced by min_format and max_formatIf you plan to support older versions too (1.21.8 and below):You must keep the supported_formats field in addition to the new min_format and max_format, which are specified as a list of two integers ([major, minor]) or one integer (makes it support any minor version).The same applies for the formats field in the overlay section, which you must also keep in addition to the new min_format and max_format.The flash particle now requires a color parameter.To fix this, and restore its original white, just add {color:[1.000,1.000,1.000,1.00]} to the end, like any other particle parameter.The item and block minecarft:chain has been renamed to minecraft:iron_chainThe field respawn.angle on the player has been renamed to respawn.yaw (now you can also get respawn.pitch)CommandsThe gamerule spawnChunkRadius has been removed, as \"loaded\" spawn chunks no longer exist.The spawnpoint and setworldspawn commands require an additional pitch parameter, IF you also specified the yaw parameter.If you didn't specify any, you can just ignore this, if you did have yaw, just add a 0 to the end of the command.WorldgenThe initial_density_without_jaggedness field in noise_settings definitions has been replaced with a preliminary_surface_level field.The minecraft:find_top_surface density function can be used to replicate the previous scanning.1.21.6 - 8You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21.6-8OtherIf you are using an item which renders bigger than its inventory size is (most\nlikely for a barrel/custom GUI), it will break with this version. You can\nchange the item model to behave like previously by changing the newly added\noversized_in_gui item model field in the resource pack.The sound event id block.sand.wind has been renamed to\nblock.dry_grass.ambientAll JSON files (in worlds, packs, configuration, etc.) are now parsed in\nstrict modeUsers will now be prompted for confirmation before executing a command from\nthe run_command click action in books and chat if the command requires\npermissions higher than 0. This is not a breaking change, just a warning which\nshows to the player.Item ComponenentsThe painting/variant component no longer accepts inline variantsEntity DataThe Particle field in the area_effect_cloud entity has been renamed to\ncustom_particle, and now always functions as an exact override for the\ndefault colored entity_effect particleTagsRenamed #plays_ambient_desert_block_sounds block tag to\n#triggers_ambient_desert_sand_block_sounds1.21.5You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21.5OtherTrim pattern and trim material items are no longer specified in the trim\nregistries, but instead in the recipes and items respectively🛠️ To fix this:Trim Pattern - delete the field template_item from your trim pattern\nfile, and add a new field containing your trim pattern id into your\nsmithing trim pattern recipe. See the\nSmithing Trims guide\nfor an example.Trim Material - delete the field ingredient from your trim material\nfile, and add the\nprovides_trim_material\nitem component to your item. (E.g.\nbarrier[provides_trim_material='minecraft:iron']) See the\nSmithing Trims guide\nfor an example.Field background in advancement definition no longer contains textures/\nprefix and .png suffixWolf VariantsIn the wold variants file, the fields angry_texture, tame_texture and\nwild_texture have been grouped in field assets and renamed to angry,\ntame and wild.Added field spawn_conditions, which describes where the variant can spawn.\nSee more in the changelog under \"Spawn conditions\".Data TypesThe data format of Text Components was changed from JSON to\nSNBT.With that, all the special formats and values were changed. You can read\nmore about it on the changelog.For example, minecraft:custom_name=\"{\"text\":\\\"Renamed item\\\"}\" is now\nminecraft:custom_name={text:'Renamed item'}. Or the previous\n/tellraw @s \"\"text\":\"Hello world\"\" is now\n/tellraw @s {text:'Hello world'}TagsRemoved #default_spawns and #full_moon_spawns in cat variant tagsRenamed #dead_bush_may_place_on block tag to #dry_vegetation_may_place_onEntities & Entity DataThe potion entity type has been split into splash_potion and\nlingering_potionA lot of fields will no longer be preserved, or have been removed (You can see\nthem all on https://www.minecraft.net/en-us/article/minecraft-snapshot-25w07a)The ArmorDropChances, HandDropChances, and body_armor_drop_chance fields\nhave been merged into a drop_chances field.The format is a list of equipment_slot:value variables. E.g.\ndrop_chances:{chest:0.1,feet:1.0}And drop chances with a default value are no longer stored. The\ndrop_chances field is removed entirely if all defaults.The ArmorItems, HandItems, and body_armor_item fields have been merged\ninto an equipment fieldThe format is a list of equipment_slot:item_stack variables. E.g.\nequipment:{chest:{id:'minecraft:diamond_chestplate'}}.This affects all mobs and Armor Stands, but not players.The format of saddles has been unified between mobs, becoming a new equipment\nslot, stored in the equipment.saddle field.This is a pure rename from the previous SaddleItem in horse-like mobs. In\nstriders and pigs this replaces the old Saddle boolean.The Saddle dropping on death is now affected by the drop_chances field.The FallDistance field has been changed from float to double and is now\ncalled fall_distanceThe armor and off-hand equipment of Players is now also stored in the\nequipment field (although items written into the Inventory using armor and\noff-hand slot numbers still work)Pos, Motion, and Rotation values without the correct number of\ncomponents (3, 3, and 2 respectively) will now be fully discarded, instead of\nonly selecting the specified componentsThe SleepingX, SleepingY, and SleepingZ fields have been merged into a\nsingle sleeping_pos field (e.g. sleeping_pos: [I;1,2,3])Block States in the entity data of Arrows, Minecarts, Block Displays,\nEndermen, Falling Blocks, Primed TNT, or Piston Moving Blocks are no longer\nallowed to be specified as an empty objectLots of entity and block entity data fields now have a new default value. Click to see them allEntity Datacreeper - Fuse defaults to 30; ExplosionRadius defaults to 3;tnt - block_state defaults to tnt; fuse defaults to 80;\nexplosion_power defaults to 4;goat - HasLeftHorn and HasRightHorn fields default to true;interaction - width and height fields default to 1;allay - CanDuplicate field removed (now controlled by\nDuplicationCooldown);cat - CollarColor defaults to 14 (red);dolphin - TreasurePosX, TreasurePosY, TreasurePosZ fields removed;\nMoistness defaults to 2400;falling_block - BlockState defaults to sand; HurtEntities defaults to\nfalse (or true if BlockState is anvil); FallHurtAmount defaults to 0;\nFallHurtMax defaults to 40; DropItem defaults to true;fox - Trusted field defaults to empty;phantom - Size renamed to size; AX, AY, and AZ fields collected\ninto a single anchor_pos field;player - SpawnX, SpawnY, SpawnZ, SpawnAngle, SpawnDimension, and\nSpawnForced fields collected into a single respawn field;\nenteredNetherPosition renamed to entered_nether_pos;turtle - HomePosX, HomePosY, and HomePosZ fields collected into a\nsingle home_pos field; HasEgg renamed to has_egg;vex - LifeTicks renamed to life_ticks; BoundX, BoundY, and BoundZ\nfields collected into a single bound_pos field;wolf - CollarColor defaults to 14 (red);area_effect_cloud - Duration defaults to -1 (infinite);ender_dragon - DragonDeathTime defaults to 0;firework_rocket - ShotAtAngle defaults to false;ghast - ExplosionPower defaults to 1;item - Health defaults to 5; PickupDelay defaults to 0; Age defaults\nto 0;item_frame and glow_item_frame - ItemDropChance defaults to 1.0;shulker - Color defaults to 16 (no color);skeleton - StrayConversionTime field removed;spectral_arrow - Duration defaults to 200;snow_golem - Pumpkin defaults to true;tnt_minecart - fuse defaults to 80; explosion_power defaults to 4;\nexplosion_speed_factor defaults to 1;trader_llama - DespawnDelay defaults to 47999;villager - FoodLevel and Xp fields default to 0;wandering_trader - DespawnDelay defaults to 0;zombie - DrownedConversionTime field removed;zombie_villager - Xp defaults to 0;arrow, spectral_arrow, trident - damage defaults to 2;dragon_fireball, wind_charge, breeze_wind_charge, wither_skull,\nsmall_fireball, and large_fireball - acceleration_power defaults to 0.1;small_fireball and large_fireball - ExplosionPower defaults to 1;block_display, item_display, and text_display -\ninterpolation_duration, teleport_duration, and start_interpolation\nfields default to 0; view_range defaults to 1; shadow_radius defaults to\n0; shadow_strength defaults to 1; width and height fields default to 0;Block Entity Datacampfire - CookingTimes and CookingTotalTimes fields removed;chiseled_bookshelf - last_interacted_slot defaults to -1;hopper - TransferCooldown defaults to -1;jigsaw - name, target, and pool fields default to minecraft:empty;\nfinal_state defaults to minecraft:air;sculk_shrieker - warning_level defaults to 0;structure_block - ignoreEntities and showboundingbox fields default to\ntrue; posY defaults to 1;CommandsThe horse.saddle item slot has been renamed to saddle, and now supports\nany entity that can equip a Saddle.The behavior of setblock and fill commands have changed in how they handle\nblock entity data:If the block entity data is not specified, and the existing block has data,\nthe block entity data will be preservedIf the block entity data is specified, the block entity data will be set to\nthe specified valueTo clear the block entity data explicitly, you must now specify the block\nentity data as {}The operation is now successful if either the block state changed or the\nblock entity data changedItem ComponenentsEntities now have a set of components fro changing variants and other\napperance like stuff.Mob buckets and paintings available in creative menu will now use new entity\nvariant components instead of\nentity_data\ncomponentCustom tooltips for Bucket of Tropical Fish and Painting items are now based\non new components instead of\nbucket_entity_data\nand\nentity_dataThe hide_additional_tooltip and hide_tooltip component were removed, and\nreplaced by the new\ntooltip_display\ncomponent. This means that all the items which used this will now need to be\nhidden using the new component.All item components which had a show_in_tooltip field, had this field\nremoved. The old behaviours can be done using the new tooltip_display\ncomponent.In the dyed\ncomponent, the color field now always uses its simplified form, with the rgb\nfield inlined to top-level (e.g. dyed_color={rgb:12345} →\ndyed_color=12345).In the\ncan_place_on\nand can_break,\nthe predicates field has been inlined to top-level, and supports either a\nsingle element or list. (e.g.\ncan_place_on={predicates:[{blocks:'stone'},{blocks:'dirt'}]} →\ncan_place_on=[{blocks:'stone'},{blocks:'dirt'}])The\nenchantments\nand\nstored_enchantments\ncomponents, will now always use their simplified form, with the levels field\ninlined to top-level (e.g. enchantments={levels:{sharpness:2}} →\nenchantments={sharpness:2})RecipesThe base ingredient field is no longer optional in the\nsmithing_transform recipe type.The base, template, and addition ingredient fields are no longer\noptional in the smithing_trim recipe\ntype.Added a new field pattern in the\nsmithing_trim recipe type.PredicatesSome entity sub-predicates have been removed and replaced by a combination of\ncomponents predicate and variant entity componentsThese include: axolotl, fox, mooshroom, rabbit, horse, llama,\nvillager, parrot, salmon, tropical fish, painting, cat, frog,\nwolf, pigField color has been removed from minecraft:sheep sub-predicateThe stepping_on entity predicate can now only evaluate to true if the entity\nis on ground1.21.4You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21.4Item ComponentsField model in\nequippable\ncomponent has been renamed to asset_id.The dyed\ncomponent now tint's based on the model, not item ID.The\ncustom_model_data\ncomponent has new fields floats, flags, strings, colors.Item blocks with\nblock_entity_data\ncomponent will now set block entity data only if id tag matches type of placed\nblock entityRenamesThe TNTFuse field of TNT Minecarts has been renamed to fuseChanged some Furnace, Smoker and Blast Furnace data. From camelCase to\nsnake_case.Renamed CookTime to cooking_time_spentRenamed CookTimeTotal to cooking_total_timeRenamed BurnTime to lit_time_remainingOtherRemoved #tall_flowers block tag. And also removed the #flowers and\n#tall_flowers item tags.The trail particle has a new required field: duration - Indicates, in\nticks, for how long the particles should travel to its destination.🎨 The item model resource pack format got completely changed, now allowing\nfor tinting, layered, conditional, and much more!1.21.2You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21.2Item ComponentsThe food item\ncomponent no longer automatically allows for consumption of food, and now only\nholds the data relating to it (meaning nutrition, saturation and\ncan_always_eat are the only fields left in the component)🛠️ To fix this, just add the\nconsumable\ncomponent: consumable={}. This component is very customizable, you can\nread about it\nhere.The lock has been\nchanged into an item predicate, with a format of lock={ITEM_PREDICATE}🛠️ The previous lock=\"MyKey\" would now look like\nlock={components:{\"minecraft:custom_name\":\"'MyKey'\"}}The fire_resistant component has been renamed to\ndamage_resistant,\nwith a new fieldtypes - A # damage type tag. Items in entity form or worn by players\nwith this component will be resistant to the damage types included in the\ntag.Loot TablesThe /loot command now returns an error when trying to drop from block\nwithout loot table (like air)The special loot table empty has been removed.Sheep now always use a single loot table entities/sheep, but wool drops are\nstill defined in sub-tables in entities/sheep/ OtherAttribute IDs now don't have the generic., player. or zombie. prefixes\nanymore (generic.scale → scale).boat and chest_boat entity types have been split into separate types, one\nper variant (Type=oak → minecraft:oak_boat,...)With that the minecraft:boat entity sub-predicate has been removed.The previous Lock field of containers has been renamed to lock and is now\nan item predicate.You now cannot ride Leash Knots, Lighting Bolts and Fishing Bobbers with\n/ride command.The killed_by_crossbow advancement was renamed to killed_by_arrow, and\nwill now trigger whenever an arrow kills an entity, not just when fired from a\ncrossbow.Renamed effect type damage_item to change_item_damage, which now also\nsupports negative amounts.Removed liquid carvers and changed biome format (the carvers field is now\njust a list of carvers)1.21You can also watch this video from Conure covering the breaking datapack\nchanges:\nWhy Your Datapack Broke in 1.21General RenamesAll folders which previously had plural names (except tags) now have\nsingular names. A list of all changed folders can be found below:structures → structureadvancements → advancementrecipes → recipeloot_tables → loot_tablepredicates → predicateitem_modifiers → item_modifierfunctions → functiontags/functions → tags/functiontags/items → tags/itemtags/blocks → tags/blocktags/entity_types → tags/entity_typetags/fluids → tags/fluidtags/game_events → tags/game_eventThe uuid and name arguments have been replaced with a singular namespaced\nid argument.🛠️ For example: attribute ... modifier add 0.5 add_value\nwould now look like\nattribute ... modifier add 0.5 add_valueEntity NBTEntity attribute format has changed:Attributes → attributesName → idBase → baseModifiers → modifiers (Now stores modifiers in the same format as\nmodifiers in the\nminecraft:attribute_modifiers\nitem component)UUID → uuidName → idAmount → amountOperation → operation (This is now a named constant instead of an\nint)add_value - now a string, previously 0add_multiplied_base - now a string, previously 1add_multiplied_total - now a string, previously 2🛠️ For example:\nsummon ... {Attributes:[{Name:\"generic.scale\",Base:2,Modifiers:[{UUID:[I;1,0,0,0],Name:\"example_modifier\",Amount:1,Operation:0}]}]}\nwould now look like\nsummon ... {attributes:[{id:\"generic.scale\",base:2,modifiers:[{id:\"tutorial:example_modifier\",amount:1,operation:\"add_value\"}]}]}Replaced the power NBT tag with an acceleration_power tag. This controls\nthe projectile's acceleration (and maximum speed).This applies to: dragon_fireball, large_fireball, small_fireball,\nfireball, breeze_wind_charge, wind_charge, wither_skull.The field ShotFromCrossbow from projectile NBT has been removed. A new\nweapon field has been added to replace this feature.🛠️ For example: @e[type=arrow,nbt={ShotFromCrossbow:1b}] would now look\nlike @e[type=arrow,nbt={weapon:{id:\"minecraft:crossbow\"}}]TagsRemoved the #minecraft:music_discs item tagPredicatesSome predicate fields have been renamed:killer → attackerdirect_killer → direct_attackerkiller_player → attacking_playerThe random_chance_with_looting has been renamed (because its now controlled\nby enchantments) to random_chance_with_enchanted_bonus. The fields were\nupdated accordingly:The looting_multiplier field has been removedThe chance field has been removed.enchantment - is a new field containing the namespaced:id of the\nEnchantment that grants the bonus chanceenchanted_chance is a new field for the chance for an enchanted item. A\nlevel-based value.unenchanted_chance - is a new field specifying the chance for an\nunenchanted item.If you are testing for an enchantment on your item, the field enchantment →\nenchantments. Can be either an Enchantment, a list of Enchantments or an\n#Enchantment Tag.Item ModifiersThe looting_enchant field has been replaced by enchanted_count_increase.\nThis has a new field enchantment (specifies which enchantment).Under enchant_randomly the field enchantments is now called options.Under enchant_with_levels the field treasure was removed.Under copy_name the field killer → attacking_entity and killer_player\n→ last_damage_player1.20.2Entity effects in NBT now use namespaced IDs instead of numbers.The structure for entity effects in NBT has been changed from PascalCase to\nsnake_case.For mob effect instances:Id → idAmbient → ambientAmplifier → amplifierDuration → durationShowParticles → show_particlesShowIcon → show_iconHiddenEffect → hidden_effectFactorCalculationData → factor_calculation_dataFor others:CustomPotionEffects → custom_potion_effects (potion, lingering_potion,\nsplash_potion, tipped_arrow, arrow)Effects → effects (suspicious_stew, area_effect_cloud)EffectId → id` (suspicious_stew)EffectDuration → duration (suspicious_stew)EffectId and EffectDuration → stew_effects (mooshroom)ActiveEffects → active_effects (player, armor_stand, mobs)Primary → primary_effect (beacon)Secondary → secondary_effect (beacon)","description":"A list of breaking changes to datapacks.","url":"/wiki/info/breaking-changes/","tags":[]},{"title":"Page Formatting","content":"Page FormattingLast Updated: 05-26-2026This section goes over how we format wiki pages. We like to be consistent, so\nplease read through this section carefully and use these features to your\nadvantage:Basic Writing GuidelinesWhen writing for the wiki, write in a way that is easy to understand and easy\nfor beginners to understand. Put yourself in the viewer's shoes. What\nconfused you when you first learned about the topic? What new terms did you\nlearn? Avoid using technical terms without explaining them or point to a\nresource that explains them.Documentation and tutorials are a great way to learn, but sometimes you don't\nneed to read every part of a page to understand it. When writing for the wiki,\nwrite in a way that makes it easy to scan and understand quickly. Some\nrecommendations are using white space to your advantage to break your page into\neasily digestible chunks.When learning a concept, it is helpful to have concrete examples that people can\nrefer to instead of just using a concept. This will help wiki-goers understand\nthe concept better and make it easier to remember.Writing StyleThe datapacking community is a diverse group of people with different\nbackgrounds; many people don't speak English as their first language or may feel\nintimidated!When writing, try to follow these guidelines:Use the active voice. For example, instead of\nThe pig is teleported by the command, write\nThe command teleported the pig.Don't use unnecessary adverbs or adjectivesTry not to use the words: obvious, simple, basic, easy, actual, just,\nclear, and however, as these can come off as intimidating; our goal is to\nteach, not degradeExplicitly reference what you are explaining (don't do: \"it says\", do: \"the\nplayer says\")Use 's for indicating possessionUse the \"Oxford comma\"Technical informationAll content on the website (except a few small exceptions) are made using a\ntechnology called mdsvex. This technology enables people like you to insert\nMarkdown with svelte components. For most wiki writers,\nthis detail is not important and can be ignoredIt is recommended to know what the proper way to format Markdown is in order to\nstay consistent and prevent confusion.The front matter title is the same as the title in the sidebar and the title\non the page (heading 1 or single #)Use bold and italics sparingly and only when emphasis is neededUse headings to break up the page into sectionsCode blocks are used to show code snippets or commandsAdmonitions are used to show important information\nunrelated to the content of the pageTables are used to show large amounts of dataEach page is made of 3 parts:front matter (metadata about the page such as title, description, tags,\nversion, etc.)content (the actual content of the page)components (custom components that allow for interactivity or other features\nnot able to be reproduced with markdown)Each is crucial to making the page look and feel how it does.FrontmatterWe try to keep the front matter as minimal as possible, but it is still\nrequired. Without it, the page will not display correctly on search engines or\nother sites. The front matter for this page looks like this:title: \"Site Development\" description: \"This page is meant to be an introduction\nto formatting a page for the wiki. In it is multiple examples which you can\nexamine raw in the [site source code](https://github.com/Datapack-Hub/wiki).\"\nversion: 26.2\nFront matter is denoted with triple hyphens (---) at the top of the page and\nthe end of the front matter.The title should be the same as the title in the sidebar in order to reduce\nconfusion.The description should be a short summary of the content of the page in\norder to show people what all is covered in the article.The version should be set to the latest version that the page has been and\nworks in. If the page works in 1.21.4 but not in 1.21.5 or later, this should\nbe set to 1.21.4.Custom ElementsOur markdown system adds unlimited customizability to the way we format our\npages. As of the time of writing, we have the following features:AdmonitionsCode TitlesMCFunction Formatting (Thanks Snave!)HighlightingAdmonitions are a way to warnings, info or tips, or other important information\nto your page.\n\nThis is an example of an info box.\n\n\nCode blocks are a way to format code in your page. These code blocks come with\nthe option to add a title to the code block for clarity. The Datapack Wiki\nsupports syntax highlighting for MCFunction which should be used for code\nsamples whenever possible.function example() {\nconsole.log(\"Hello World!\");\n}\nHighlighting is a way to highlight specific text. It isn't commonly used, but\nexists.Highlighted Text like this.Highlighted Text\nStandardized ElementsThe wiki uses a few elements that are standardized across the entire wiki. Right\nnow this only consists of command syntax. You can find the command syntax we use\nin the commands page.","description":"This page is an introduction to formatting page content, and details about how the wiki handles formatting.","url":"/contribute/formatting/","tags":[]},{"title":"Git Practices","content":"Git PracticesLast Updated: 05-26-2026This page is an introduction to how we use Git in the\nwiki repository. In order to keep the\nwiki consistent and reputable, we have a few rules that we follow.Git provides a lot of features that are great for collaboration, and we try to\nuse them as much as possible.\nand changes to main. You can click the\n\"Fork\" button in the top right\ncorner of the repository to create a fork of the repository. This will create a\ncomplete copy of the repository that you can work on.Once you have forked the repository, you can clone it to your local machine.When it comes time to merge your changes, you can create a pull request, and a\nwiki contributor will review your contribution, hopefully in a speedy manner (we\napologize if it's not in reality).BranchesBranches are useful additions to help separate features in your fork. We use\nkebab-case for branch names meaning the branch name should be all lowercase\nwith hyphens to separate words. For example, if you are working on a page called\n\"Adding New Features\", the branch name should be adding-new-features.We do not recommend you use branches on the main repository for single one-off\npages or changes, even if you have permissions to. Branches in the repository\nare mainly for upcoming Minecraft versions or huge upcoming reworks, if you\nbelieve you have a reason to add a branch to the main repository, let a wiki\nadmin know.Commit MessagesCommit messages are a great way to keep track of what changes have been made to\nthe wiki. Summarize the changes in the commit message and use the imperative\nmood.For example, if you are adding a new page called \"Adding New Features\", the\ncommit message should be Add new page for adding new features. If you are\nfixing a typo on a page, the commit message could be\nFix typo in page about adding new features.Optionally, you can add a short description of the changes in the commit\nmessage. This is not required, but it is recommended.MergingWhenever you start working on a new branch or features, pull the latest changes\nfrom the main branch. This will ensure that you have the most up-to-date\nchanges.You will likely run into an issue with the search.json file, which is used to\ngenerate the search index. This file is generated automatically and should not\nbe manually edited. A solution to this is to remove the search.json file and\noptionally run the search index generation script. This will regenerate the file\nand you can commit it.node run ./gen_search_indexes_node.js\n\nOR\n\nbun ./gen_search_indexes.js\nOther Important InformationMake a description of your changes in your PR.Reviewers: Proofread changes before approving them.Reviewers: It's not required, but it's recommended the changes follow American\nEnglish for consistency sake.","description":"This page is an introduction to our Git practices a page for the wiki.","url":"/contribute/git-practices/","tags":[]}] \ No newline at end of file