Datapack Editor

0 views
Skip to first unread message

Myra Krallman

unread,
Aug 4, 2024, 5:16:49 PM8/4/24
to casfaugeede
TheOrigin Creator autosaves whenever you make a change. For text boxes, they save when you click off them. Data is stored in your browser's cache (not your browsing history), so note that clearing it may delete all your projects. You can (and should) export your work as JsonOC Files (more reliable but don't work in Minecraft) or Datapacks (less reliable but do work in Minecraft) so you can reimport them later.

Items in the left sidebar can optionally specify a namespace and/or an extension in the format namespace:filename.ext. If the namespace is not specified (filename.ext or filename), it will default to the Id set in the meta file. If the extension is not provided, it will default to either .json or .mcfunction. If you're unsure of a file's namespaced id, just click on it at look at the top!


Additionally, when editing files, if you do not specify a namespace for a specific field, it will either default to "minecraft" (for vanilla things like items, blocks, entities, recipes, advancements, etc), or "0" (which means your own pack's ID). You can always use 0 as the namespace to refer to your own pack's ID.


To initalize your first project, click the Reset button, choose whether you are working on a vanilla datapack or an origins datapack, and put in a name and version number for the project. After clicking apply, the project tree will immediately be populated with folders you'll use for the datapack.


If you have a project you want to import and edit instead of working from scratch, you can press the Import button and select that datapack instead. You could also drag the datapack file on to the webpage directly.


From this point, you can right click any folder (The items with icons are folders) in the file tree on the left and click New File or New Folder to add that respective item.


After adding anything, click on it to open up an editor for that item; you can switch between editors of different items by clicking them in the left pane. Right clicking any item in the left pane provides you the option to delete, cut, copy, and paste it anywhere. You can also pick up any added items and drag them around in the left pane to move them.


Note that when editing files, if you do not specify a namespace for a specific field, it will either default to "minecraft" (for vanilla things like items, blocks, entities, recipes, advancements, etc), or "0" (which means your own pack's ID). You can always use 0 as the namespace to refer to your own pack's ID.


When you are finished editing, you can press the Export button to export your work to a datapack or to a mod. Note that empty folders will not be exported. If you're having issues exporting to a mod, remember that mods are just thin layers around datapacks. Every .jar file is really a .zip file, and you can change it's extension via renaming and open it up to see what's inside! You can include both assets and datapack files in a mod created this way.


The Origin Creator exposes several functions into the browser console (accessible through F12, Ctrl+Shift+I or similar), or through the global "Autorun" (more info can be found in the next accordion section) editor you can find in the projects tab. The API can be accessed through the global variable oc. As a reminder, NEVER copy code into the browser from someone you don't trust!


Functions and fields here reference files with their "path" in the tree, as opposed to their id and type. You can locate the path of a file with it's id with the locatePath(type, id) function. To do the opposite and get the type and id of a path, use the getTypedId(path) function.


The Origin Creator will automatically run any javascript found in the global "Autorun" panel in the projects panel of the tool, provided the "Enable" box is checked. You can use this to register macros or do other useful things in code that you don't want to copy into your browser every time the Origin Creator starts. This is a friendly reminder to NEVER PUT CODE YOU DON'T TRUST INTO THIS!


In 1.13 you can create datapacks. Datapacks are basically very simple mods the user doesn't need to install. They can add/edit crafting recipes, add advancements, add functions, add structures, edit loot tables and do some more things. This is great, but editing them is really tedious. Here is a screenshot of me editing the loot table of a cow so it drops more beef:


To download the other ones you need to make a folder in the versions folder for minecraft and put the client and JSON file for the versions in there. They all need to be named the same aside from file extensions. Once you do that, you will be able to choose that version when making a new profile with the minecraft launcher.


Make sure the file extension is .mcmeta and not .txt when you rename it! In other words, remove your old file extension. You may be warned that changing a file name extension could make the file unusable. However, this actually indicates that you have renamed the pack.mcmeta file correctly.


If you are using Microsoft Windows and can't see file extensions, for Windows 10, you can turn them on by going to the View menu of the file explorer and checking the check box for file name extensions. For Windows beneath Windows 10, you can uncheck "hide extensions" in folder settings.


Any text editor should work. It is recommended that the chosen text editor supports JSON, which is the format used by files of mcmeta extension and most other files in a data pack.Note that most text editors do not recognize mcmeta extension as JSON. Thus, you need to configure the editors manually.


This file is written in JSON! This tutorial does not go into specifics about the format now, but be aware about how things are laid out. Be very careful not to forget quotation marks, colons, and curly or square brackets. Make sure to not write trailing commas. Missing one of these can lead to your data pack not working correctly! To check your files you can use a JSON validator, such as the one found on JSONLint.


The value of "pack_format" tells Minecraft what release the data pack is designed for, and is different for certain versions. The following list shows what versions each value is associated with:


The text following "description" can be any string or a raw JSON text. It will show up when you hover over your data pack in the output from /datapack list and in the data pack UI when creating a world.In pack.mcmeta, it is possible to use the symbol (see Minecraft Formatting codes) in the description of pack.mcmeta and the data pack name.


Once you have created your pack.mcmeta, try testing it out in-game! Open the world or, if you are already in the world, type /reload, then type /datapack list. It should list two entries. One should be [vanilla] (built-in), the second one should be named like [file/(your data pack's name) (world)], where your data pack's folder name goes at (your data pack's name). When you hover over your data pack's entry, you should see the description of your data pack as you have written in description of your pack.mcmeta.


If you don't see your pack in the list, make sure your pack.mcmeta file is correct and saved. Look for any missing curly brackets , commas ,, colons :, quotation marks "", or square brackets []. Remember that for each open brace, quotation, or square bracket, you must have a closing bracket, quotation, or square brackets. If you still don't see your pack, make sure it's in the right folder.


Note that the correct JSON syntax may differ slightly based on your version of Minecraft (e.g., in Minecraft 1.21, the JSON "item" name was replaced with "id"). The JSON examples on this page attempt to reflect the most up-to-date version of Minecraft.


The correct data pack file structure may also differ depending on your Minecraft version. For example, in Minecraft 1.21, the recipes, functions, loot_tables, structures, predicate, and advancements folders were changed to be singular (function, loot_table, etc.).


Entries in data packs have resource locations in a fashion of namespace:path. The corresponding file would be located at data/namespace/(data_type)/path.(suffix). Note that / characters in the path will be translated into directory separators.


For example, if two data packs add two new minigame mechanisms to Minecraft and both have a function named start. Without namespaces, these two functions would clash and the minigames would be broken. But if they have different namespaces of minigame_one and minigame_two, the functions would become minigame_one:start and minigame_two:start, which no longer conflict.


Most of the time when Minecraft requires an ID, such as for /function, you should provide the namespace in addition to the path. If you don't specify the namespace, it will fallback to minecraft.


Make sure to always use your own namespace for anything new that you add, and only use other namespaces if you're explicitly overriding something else, or, in the case of tags, appending to something else.


For example, Minecraft uses the minecraft namespace, which means that this namespace should only be used when the data pack needs to overwrite existing Minecraft data or to add its entries to vanilla tags.


Loot tables will tell Minecraft what should be dropped when a mob dies or what should be generated inside containers, like chests, when opened for the first time, they can also be called by the /loot command.


Structures can be used with structure blocks and jigsaw blocks and/or can overwrite how certain vanilla structures look in Minecraft. It is saved in an NBT format. You can create an NBT file by using a structure block or by exporting a build using a third party program like MCEdit.


This is a rough example of a shaped crafting recipe, as specified by the crafting_shaped type. pattern is a list used to specify the shape of the crafting recipe. It contains a maximum of 3 strings, each string standing for one row in the crafting grid. These strings then contain a maximum of 3 single characters next to each other, each character standing for one spot in the crafting grid. You don't need all 3 strings, nor do you need to have 3 characters in each string. But each string should contain the same amount of characters. You can use spaces to indicate empty spots.

3a8082e126
Reply all
Reply to author
Forward
0 new messages