Как написать датапак для майнкрафт

Привет. Не особо интересовался я датапаками, но течение популярное и посмотреть захотелось. В особенности меня интересовали не изменения каких-то простых вещей или рецепты, а то, как датапаки могут взаимодействовать с миром и игроков. Я это узнал, и даже предлагаю ради интереса написать простенький свой. Начнём с совсем простого.

Этому и будет посвящен сей материал. Разберём как можно создать свой датапак, его структуру увидим и выведем приветствие игрока в чате. Своего рода Hello world! для датапаков.

Датапаки используют сложные комбинации команд консоли, так что понимание команд игры будет очень полезным.

Свой датапак. Начало!

В удобном месте создаём папку для датапака. Я назову свою hello_datapack.

В неё добавляем файл pack.mcmeta. Буквально можно создать обычный .txt и переименовать. Но так можно сделать только если у вас отображены Расширения имен файлов! Убедитесь, что в конце нет никаких txt!

Пишем туда такую конструкцию:

{

    «pack»: {

        «pack_format»: 6,

«description»: «Made by Astler»

    }

}

Как я писал в инструкции к ресурс паку Свои модели для мобов в Minecraft Optifine.

Цифра 6 для pack_format соответствует версиям 1.16.2 — 1.16.5. Для других версий:

  • 4 для версий 1.13 – 1.14.4
  • 5 для версий 1.15 – 1.16.1
  • 6 для версий 1.16.2 – 1.16.5
  • 7 для версии 1.17+

Теперь создадим необходимые папки. В корне датапака создаём папку «data». В этой папке нужно добавить ещё две папки: «minecraft» и папку для ваших файлов, имя которой выбираем сами. У меня это будет «geekstand».

Переходим в папку «minecraft». Сюда добавляем папку «tags», а в ней ещё одну «functions». Ух. Много папок. Но тут наконец всё. В «functions» добавляем файл load.json. Туда пишем:

{

  «values»: [

    «geekstand:load»

  ]

}

Этот файлик создаст точку входа для нашего мода, будет запущено при загрузке мира. И да, нужно учитывать, что вашу надпись можно будет увидеть в консоли при запуске мира, но чтобы этот текст увидел игрок: пишем /reload. Впрочем, я спешу, ведь ещё нет никакой фразы :D.

Теперь переходим к самому контенту датапака. Вернемся в «data». Открываем папку «geekstand» и в неё добавляем ещё одну: «functions». С папками теперь всё.

Помните содержимое файла load.json? Мы написали это: «geekstand:load». Значит теперь, в папку «functions» в папке «geekstand» мы добавим load.mcfunction.

Прописываем туда такую команду:

tellraw @a [{«text»:«nHi, «,«color»:«blue»,«bold»:«true»}, {«selector»:«@a»,«color»:«blue»,«bold»:«true»}, «!», {«text»:«How are you?»,«color»:«gold»}]

Эту команду вы можете запустить и в обычной игре, но в этом нет никакого интереса.

Сохраняем файлик и собираем это всё в zip архив. Проверьте после запаковки, что папка «data» и файл pack.mcmeta находятся в корне архива.

Установка и запуск датапака

Запускаем игру, переходим к созданию нового мира:

Нажимаем на Наборы данных:

И просто перетягиваем zip датапака в окно игры.

Активируем его и жмём готово. Создаём мир.

Пишем /reload и видим в чате:

Надо добавить пробел. Редактируем команду и перезапускаем:

tellraw @a [{«text»:«nHi, «,«color»:«blue»,«bold»:«true»}, {«selector»:«@a»,«color»:«blue»,«bold»:«true»}, «!», {«text»:» How are you?»,«color»:«gold»}]

Супер!

Добавим кликабельную ссылку

Теперь добавим ссылку? Многие датапаки предлагают посетить ресурс автора.

Под предыдущей командой добавляем такую строку:

tellraw @a [{«text»:«Visit my website: «,«color»:«blue»},{«text»:«GeekStand.topn»,«color»:«#FFD166»,«clickEvent»:{«action»:«open_url»,«value»:«https://geekstand.top»}}]

И ссылка кликабельна!

У меня уже готова вторая часть, она будет круче!

А на этом сегодня всё, можете ещё поиграть с цветами и текстами.

Полезное по теме: Создание датапака (англ.)

Information icon.svg

This tutorial shows how to create a data pack.

Getting started

Data packs can be used to add or modify functions, loot tables, world structures, advancements, recipes, tags, dimensions, predicates and world generation.

What not to do

There are some things that you should not do while creating a data pack. Here is a list of «don’ts»:

  • Release Minecraft versions or modifications that allow players to play without having bought Minecraft from Mojang.
  • Release the decompiled source code of Minecraft in any way.

To create a data pack, start off by navigating to the datapacks folder inside the world folder.

To find the world folder, locate the saves folder inside your game directory, which is .minecraft by default.

  • In singleplayer, you can select your world, click on «Edit», then «Open world folder».
  • On a server, you can navigate to its root directory (where server.properties is located), then enter the world directory.

Once you are in the datapacks folder, create a folder with a name of your choice. It will be your data pack’s name. Enter the data pack folder.

The first thing to do after you are in the folder is to create a pack.mcmeta file. This lets Minecraft identify your data pack.

Creating an MCMETA file

To create an MCMETA file, right click within your data pack folder and create a new text document. Name this file «pack.mcmeta«.

Note

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.

FileExtensions.png

Text editor

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.

pack.mcmeta content

Open pack.mcmeta in your text editor and paste or type the following:

{
  "pack": {
    "pack_format": 10,
    "description": "Tutorial Data Pack"
  }
}
Note

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.

"pack_format"

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:

  • 4 for versions 1.13 – 1.14.4
  • 5 for versions 1.15 – 1.16.1
  • 6 for versions 1.16.2 – 1.16.5
  • 7 for versions 1.17 — 1.17.1
  • 8 for versions 1.18 — 1.18.1
  • 9 for versions 1.18.2
  • 10 for versions 1.19+

Note: As more updates are released, values may be changed or added.

"description"

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.

Testing your pack

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.

When your pack shows up, you are ready to move on.

Troubleshooting

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.

Naming

Make a folder called data in your data pack folder, where you have placed the pack.mcmeta file in. In this data folder you have to create one or more folders which will act as your namespaces.

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.

A few examples:

  • an item tag of ID dummy:foo_proof/bar would be located at data/dummy/tags/item/foo_proof/bar.json
  • a function of ID foo:handler/bar_call would be located at data/foo/functions/handler/bar_call.mcfunction

Legal characters

Namespaces, paths and other folder and file names in the data pack should only contain the following symbols:

  • 0123456789 Numbers
  • abcdefghijklmnopqrstuvwxyz Lowercase letters
  • _ Underscore
  • - Hyphen/minus
  • / Forward Slash/Directory separator (Can’t be used in namespace)
  • . Period

The preferred naming convention is lower_case_with_underscores, called lower snake case.

Namespace

Most objects in the game use namespaced resource locations to prevent potential content conflicts or unintentional overrides.

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.

Functions

Functions are a set of commands that can be run in order.

To add functions, first create a folder named functions inside the namespace folder. Then, create a file named (function_name).mcfunction in this folder or in any of its subfolders. This will be your function file. Your function will be named in the game as (namespace):(name) or (namespace):(subfolder1)/(subfolder2)/.../(name) when the function file is located in a subfolder.

Loot tables

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.

To add loot tables, first create a folder named loot_tables inside the namespace folder. Then, create a file named (loot_table_name).json in this folder or in any of its subfolders. This will be your loot table file. Your loot table will be named in the game as (namespace):(name) or (namespace):(subfolder1)/(subfolder2)/.../(name) if the file is located in a subfolder. All the vanilla loot tables are in the minecraft namespace.

Here is an example of a cow’s loot table, it can be used as a reference:

{
  "type": "minecraft:entity",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 0,
                "max": 2,
                "type": "minecraft:uniform"
              }
            },
            {
              "function": "minecraft:looting_enchant",
              "count": {
                "min": 0,
                "max": 1
              }
            }
          ],
          "name": "minecraft:leather"
        }
      ]
    },
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 1,
                "max": 3,
                "type": "minecraft:uniform"
              }
            },
            {
              "function": "minecraft:furnace_smelt",
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "predicate": {
                    "flags": {
                      "is_on_fire": true
                    }
                  },
                  "entity": "this"
                }
              ]
            },
            {
              "function": "minecraft:looting_enchant",
              "count": {
                "min": 0,
                "max": 1
              }
            }
          ],
          "name": "minecraft:beef"
        }
      ]
    }
  ]
}

To learn what each tag means, see Loot tables. There is also a list of vanilla loot tables on that page.

Structures

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.

To add structures to a data pack, first create a folder named structures inside the namespace folder. Then, put your structure file in this folder or in any of its subfolders. Your structure will be named in the game as (namespace):(name) or (namespace):(subfolder1)/(subfolder2)/.../(name) if the file is located in a subfolder.

World generation

Custom world generation allows data packs to change how the world generates. This is particularly useful in conjunction with custom worlds.

To change world generation, first create a folder named worldgen inside the namespace folder. Then, put your noise_settings file in this folder or in any of its subfolders. Your changes will be named in the game as (namespace):(name) or (namespace):(subfolder1)/(subfolder2)/.../(name) if the file is located in a subfolder.

Advancements

Advancements can be completed by players and give various rewards.

To add advancements, first create a folder named advancements inside the namespace folder. Then, create a file named (advancement_name).json (You can’t put spaces in the file name. Use lowercase letters in the file name). in this folder or in any of its subfolders. This will be your advancement file. Your advancement will be named in the game as (namespace):(name) or (namespace):(subfolder1)/(subfolder2)/.../(name) if the file is located in a subfolder.

Recipes

Recipes are used to let players craft items.

To add recipes, first create a folder named recipes inside the namespace folder. Then, create a file named (recipe_name).json in this folder or in any of its subfolders. This will be your recipe file. Your recipe will be named in the game as (namespace):(name) or (namespace):(subfolder1)/(subfolder2)/.../(name) if the file is located in a subfolder.

Shaped crafting

The first common type of crafting is shaped crafting.

{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "123",
    "231",
    "312"
  ],
  "key": {
    "1": {
      "item": "Resource location of the item"
    },
    "2": {
      "item": "Resource location of the item"
    },
    "3": {
      "item": "Resource location of the item"
    }
  },
  "result": {
    "item": "Resource location of the item",
    "count": Number of items produced
  }
}

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.

key is a compound used to specify what item should be used for which character in pattern. This can either be specified using item followed by an item ID or tag followed by an item data pack tag.

The result compound speaks for itself, it specified what the resulting item should be. count is used to specify how many of the item should be given.

This is the original recipe for a piston (can be used as a reference):

{
  "type": "crafting_shaped",
  "pattern": [
    "TTT",
    "#X#",
    "#R#"
  ],
  "key": {
    "R": {
      "item": "minecraft:redstone"
    },
    "#": {
      "item": "minecraft:cobblestone"
    },
    "T": {
      "tag": "minecraft:planks"
    },
    "X": {
      "item": "minecraft:iron_ingot"
    }
  },
  "result": {
    "item": "minecraft:piston"
  }
}

Shapeless crafting

There’s another common type of recipes, a shapeless recipe. The list with multiple items allows alternatives for the given slot such as Oak Plank and Birch Plank.

{
  "type": "crafting_shapeless",
  "ingredients": [
    {
      "item": "<item ID>"
    },
    {
      "item": "<item ID>"
    },
    [
      {
        "item": "<item ID>"
      },
      {
        "item": "<item ID>"
      }
    ]
  ],
  "result": {
    "item": "<item ID>",
    "count": 5
  }
}

As specified by the crafting_shapeless type, this is a recipe without a pattern. The ingredients can be put in the crafting grid in any shape or form. In the example, there’s a list inside the ingredients compound. This means any of the items in this list can be used.

This is the original recipe for Fire Charge (can be used as a reference):

{
  "type": "crafting_shapeless",
  "ingredients": [
    {
      "item": "minecraft:gunpowder"
    },
    {
      "item": "minecraft:blaze_powder"
    },
    [
      {
        "item": "minecraft:coal"
      },
      {
        "item": "minecraft:charcoal"
      }
    ]
  ],
  "result": {
    "item": "minecraft:fire_charge",
    "count": 3
  }
}

It is also possible to create new smelting recipes.

{
  "type": "smelting",
  "ingredient": {
    "item": "<item ID>"
  },
  "result": "<item ID>",
  "experience": 0.35,
  "cookingtime": 200
}

This is a rough example of a smelting recipe. «ingredient» is used to specify the item you are going to smelt. «result» is going to specify the result. In «experience», you are able to choose the amount of xp gained for smelting, and in «cookingtime» the amount of time that it will take for the item to smelt, which in this case is 10 seconds (200 ticks = 10 seconds).

This is the default smelting recipe for a diamond ore:

{
  "type": "smelting",
  "ingredient": {
    "item": "minecraft:diamond_ore"
  },
  "result": "minecraft:diamond",
  "experience": 1,
  "cookingtime": 200
}

Tags

Main article: tag

Tags are used to group blocks, items, entities, or functions together. Additionally, the minecraft:tick function tag is used to run functions every tick and the minecraft:load function tag is used to run functions every time the world is (re)loaded.

To add tags, first create a folder named tags inside the namespace folder. Inside this folder, create folders named blocks, items and functions. Then, create a file named (tag_name).json in one of these folders or in any of their subfolders. This will be your tag file. Your tag will be named in the game as (namespace):(name) or (namespace):(subfolder1)/(subfolder2)/.../(name) if the file is located in a subfolder.

Predicates

Predicates are technical JSON files that represent the conditions for loot tables, /execute if predicate command, or predicate target selector argument.

To add predicates, first create a folder named predicates inside the namespace folder. Then, create a file named (predicate_name).json (You can’t put spaces in the file name. Use lowercase letters in the file name). in this folder or in any of its subfolders. This will be your predicate file. Your predicate will be named in the game as (namespace):(name) or (namespace):(subfolder1)/(subfolder2)/.../(name) if the file is located in a subfolder.

Dimensions

Dimensions are JSON file used to specify all the dimensions a world contains.

To add dimensions, first create a folder named dimension inside the namespace folder. Then, create a file named (dimension_name).json (You can’t put spaces in the file name. Use lowercase letters in the file name). in this folder. This will be your dimension file.

Custom dimensions can be accessed in game using /execute in (namespace):(dimension_name)

Utilities

Book and Quill JE2 BE2.png

Many utilities have been created in order to make programming in mcfunction easier. This is a reference list for utilities such as transpilers or syntax highlighting plugins. Please apply reasonable caution when downloading software onto your computer, as the creators are responsible for the content provided.

Compiler/Transpilers and Frameworks

Name Hosting Description Link
Minecraft Script GitHub A language based on JavaScript that can be compiled into a working data pack using a Node.js compiler. https://mcscript.stevertus.com/
Minity GitHub Another scripting language that compiles into data packs using a Node.js compiler. https://github.com/minity-script/minity
TMS Transpiler GitHub A python tool that can assemble indented mcfunction code into valid files. Great if you don’t want to learn a new language. https://github.com/davidkowalk/advanced_minecraft_scripting
ObjD Pub A dart framework for creating data packs to minimize the repetitive work to be done. https://objd.stevertus.com/

Another option is to use a visual interface to create the framework or the content for your project.

Visual Generators

Name Hosting Description Link
Datapack Creator Planet Minecraft An IDE for creating data packs with some useful tools https://www.planetminecraft.com/mod/datapack-creator-ide/
NBTData Pack Generator nbt-data.com An online generator for a raw data pack framework without any functions. https://www.nbt-data.com/datapack-generator
Recipe Generator thedestruc7i0n.ca An Online Generator to generate the JSON files required for crafting. https://crafting.thedestruc7i0n.ca/
Minecraft Tools Recipe Generator minecraft.tools An Online Generator to generate the JSON files required for crafting. https://minecraft.tools/en/custom-crafting.php
Misode’s Data Pack Generator GitHub JSON Generator for Minecraft Data Packs https://misode.github.io/
MCStacker for MC 1.19 mcstacker.net/ A collection of command generators. https://mcstacker.net/
Origin Creator GitHub A fully featured webtool for creating data packs. https://xmgzx.github.io/apps/origin-creator/
MCreator mcreator.net A easy-to-use, fully featured graphical tool for creating data packs. https://mcreator.net/

If you use an IDE you might want syntax highlighting for the mcfunction syntax. Depending on your IDE or your text editor extra steps may have to be taken to install it in your environment.

Syntax Highlighting

IDE/Editor Description Link
Atom Syntax highlighting and snippets https://atom.io/packages/mcfunction
Atom Syntax highlighting and autocomplete. https://atom.io/packages/mcfunction-novum
Visual Studio Code

Sublime Text

Language grammars and syntax highlighting for mcfunction files. https://github.com/Arcensoth/language-mcfunction
Notepad++ Syntax highlighting. https://pastebin.com/hbMiJ3YV
Visual Studio Code Heavy language features for JSON and mcfunction files. https://marketplace.visualstudio.com/items?itemName=SPGoding.datapack-language-server

See also

  • Data packs
  • Resource packs
  • Tutorials/Installing a data pack
Data packs
Components
  • Advancements
  • Functions
  • Item modifiers
  • Loot tables
  • Predicates
  • Recipes
  • Structure templates
  • Tags
World generation
  • Dimensions
    • Dimension types
  • World presets
  • Density functions
  • Biomes
  • Carvers
  • Features
  • Structures
Data packs
  • Caves & Cliffs Prototype Data Pack
Tutorials
  • Installing a data pack
  • Creating a data pack
Tutorials
Introductory
  • Menu screen
  • Downgrading
  • Game terms
Newcomer survival
  • The first day/beginner’s guide
  • The second day
  • The third day
  • Hunger management
  • Things not to do
  • Simple tips and tricks
  • Your first ten minutes
Shelters
  • Best biomes for homes
  • Best building materials
  • Building and construction
  • Navigation
  • Shelters
  • Shelter types
General
  • Achievement guide
  • Advancement guide
  • Best enchantments guide
  • Breaking bedrock
  • Combat
  • Complete main adventure
  • Creating a village
  • Dual wielding
  • End survival
  • Exploring caverns
  • Gathering resources on peaceful difficulty
  • Getting food quickly
  • Headless pistons
  • Hitboxes
  • Horses
  • Indestructible end crystals
  • Light suppression
  • Mapping
  • Measuring distance
  • Minecraft in education
  • Mining
    • Diamonds
    • Fossils
    • Ancient Debris
  • Nether hub
  • Nether portals
  • Nether survival
  • Organization
  • Pillar jumping
  • PvP
    • PvP bases
  • Spawn-proofing
  • Summoning jockeys
  • The Void
  • Time-saving tips
  • Thunderstorm survival
  • Units of measure
  • Update suppression
  • Village mechanics
    • Trading
  • X-ray glitches
Challenges
  • Acquiring a conduit
  • Curing a zombie villager
  • Defeating temples
  • Defeating a village raid
  • Defeating a Nether fortress
  • Defeating a bastion remnant
  • Defeating a dungeon
  • Defeating a pillager outpost
  • Defeating a woodland mansion
  • Defeating a monument
  • Defeating an End city
  • Defeating the Ender dragon
  • Defeating the Wither
  • Exploring an ancient city
  • Obtaining every music disc
Non-standard
survival
  • Adventure survival
  • Half hearted hardcore
  • Hardcore mode
  • Surviving in a single area indefinitely
  • Infinite desert survival
  • Island survival
  • Manhunt
  • Nomadic experience
  • Skywars survival
  • Superflat survival
  • Flat survival
  • Ultra hardcore survival
Challenge maps
  • Beating a challenge map
  • Creating a challenge map
Constructions
  • Adding beauty to constructions
  • Airlock
  • Architectural terms
  • Building a cruise ship
  • Building a metropolis
  • Building a rollercoaster
  • Building safe homes
  • Building water features
  • Color palette
  • Creating shapes
  • Defense
  • Desert shelter
  • Elevators
  • Endless circling pool
  • Furniture
  • Glazed terracotta patterns
  • Making nice floors
  • Pixel art
  • Ranches
  • Roof types
    • Curved roofs
    • Roof construction guidelines
    • Roof decorations
  • Secret door
  • Settlement guide
  • Underwater home
  • Walls and buttresses
  • Water gate
  • Water-powered boat transportation
Farming
Blocks and items
  • Amethyst
  • Armor
  • Azalea
  • Bamboo
  • Basalt
  • Bedrock
  • Blaze rod
  • Bone meal
  • Cactus
  • Chorus fruit
  • Clay and mud
  • Cobblestone
  • Cocoa bean
  • Copper
  • Crops (Beetroot, Carrot, Potato, Wheat)
  • Dirt
  • Dragon’s breath
  • Dripstone
  • Egg
  • Fern
  • Fish
  • Flower
  • Froglight
  • Glow berries
  • Glow ink sac
  • Glow lichen
  • Goat horn
  • Gold
  • Hanging roots
  • Honey
  • Ice
  • Iron
  • Kelp
  • Lava
  • Meat
  • Moss block
  • Mushroom
  • Music disc
  • Nautilus shell
  • Nether growth
  • Nether vine
  • Nether wart
  • Obsidian
  • Powder snow
  • Pumpkin, Melon
  • Rooted dirt
  • Sculk growths
  • Scute
  • Seagrass
  • Sea pickle
  • Snow
  • Soul soil
  • Sugar cane
  • Sweet berries
  • Tree
  • Trident
  • Vine
  • Villager trading hall
  • Wither rose
  • Wool
  • Duplication
Mobs
  • Mob farming
  • Mob grinding
  • Monster spawner traps
  • Allay
  • Animals
  • Axolotl
  • Blaze
  • Cat
  • Cave spider
  • Creeper
  • Drowned
  • Ender dragon
  • Enderman
  • Frog
  • Goat
  • Guardian
  • Hoglin
  • Iron golem
  • Magma cube
  • Phantom
  • Piglin bartering farm
  • Raid
  • Shulker
  • Slime
  • Squid
  • Turtle
  • Villager
  • Wandering trader
  • Warden
  • Witch
  • Wither
  • Wither skeleton
  • Zombie
  • Zombie villager
  • Zombified piglin
OP farms
  • End of light mob farms
Enchanting
and smelting
  • Enchantment mechanics
  • Anvil mechanics
  • Automatic smelting
  • Manual smelting
Blockbreaking
  • Blast chamber
  • Wither cage
Mechanisms
Basic redstone
  • Automatic respawn anchor recharger
  • Basic logic gates
  • Combination locks
  • Command block
  • Flying machines
  • Hopper
  • Item sorting
  • Item transportation
  • Mechanisms
  • Observer stabilizer
  • Randomizers
  • Redstone music
  • Redstone tips
  • Rube Goldberg machine
  • Shulker box storage
  • Villager trading hall
Detectors
  • Block update detector
  • Comparator update detector
  • Daylight sensor
  • Day night detector
Minecarts
  • Train station
  • Minecarts
    • Storage
    • Storage system
Traps
  • Snow golems
  • TNT cannons
  • Trapdoor uses
  • Trap design
  • Traps
Pistons
  • Piston uses
  • Piston circuits
  • Quasi-connectivity
  • Zero-ticking
  • Instant repeaters
Advanced
redstone
  • Advanced redstone circuits
  • Arithmetic logic
  • Calculator
  • Command stats
  • Hourly clock
  • Morse code
  • Printer
  • Redstone computers
  • Redstone telegraph
Servers
  • Playing on servers
  • Multiplayer Survival
  • Spawn jail
  • Griefing prevention
  • Joining a LAN world with alternate accounts
Server setup
  • Setting up a server
  • Server startup script
  • FreeBSD startup script
  • OpenBSD startup script
  • Ubuntu startup script
  • Setting up a Hamachi server
  • Setting up a Minecraft Forge server
  • Setting up a Spigot server
  • Ramdisk enabled server
Technical
  • Improving frame rate
  • Minecraft help FAQ (IRC channel)
  • Update Java
Maps
  • Custom maps
  • Map downloads
  • Command NBT tags
  • Falling blocks
  • Updating old terrain using MCEdit
Resource packs
  • Creating a resource pack
  • Loading a resource pack
  • Sound directory
Data packs
  • Creating a data pack
  • Installing a data pack
Creating
Minecraft media
  • Creating videos
  • Livestreaming
Game installation
  • Installing snapshots
  • Joining and leaving the Bedrock Edition beta program
  • How to get a crash report
  • Installing Forge mods
  • Custom Minecraft directory
  • Playing and saving Minecraft on a thumb drive
  • Playing and saving Minecraft on a thumb drive with the old launcher
  • Recover corrupted saved world data
  • Run Minecraft through Google Drive
  • Save game data to Dropbox (world data only)
  • Saved data Dropbox guide
Outdated
  • Building micro shelters
  • Custom texture packs
  • Door-based iron golem farming
  • Far Lands
  • How to get a crash report
  • Installing mods
  • Man-made lake
  • Managing slimes in superflat mode
  • Minecart booster
  • Potion farming
  • Repeater reboot system
  • Survival with no enabled data packs
  • Update LWJGL
  • Update Minecraft
  • Village chaining
  • Water ladder
  • Water tram

Описание

Из данного гайда вы узнаете как создать свой собственный ДатаПак для Майнкрафт 1.15 и выше.
В видео находится вся нужная информация для того, чтобы начать создавать свои датапаки с нуля.
Также автор расскажет, за что отвечают все папки и как их наполнить в датапаке.

Видео

Как установить любой датапак

  1. Откройте игру
  2. Выберите мир, в который хотите установить дата-пак, и нажмите «Настроить»
  3. Нажмите «Открыть папку мира»
  4. Откройте папку «datapacks» и распакуйте в нее архив
  5. Готово

Скачать пример датапака (вместе с миром)

# Ссылка Размер Дата
  https://drive.google.com/file/d/11XXfsJhx0axg9EhbIYleUU1_I6ew_gEz

4 октября 2021, 21:59

15.4т

10


Download Article


Download Article

Data packs provide an easier way for players to customize their game in Minecraft. They allow the customization and addition of new advancements, loot tables, recipes, structures, and more. This article provides a basic introduction to data packs and a few of their uses so that players may learn to customize and enhance their own Minecraft experience.

  1. Image titled Make a Minecraft Data Pack Step 1

    1

    Open up a Minecraft world folder. You can do this by typing in %appdata% in your Windows search bar and hitting enter. Then, click the .minecraft folder and then the saves folder.

  2. Image titled Make a Minecraft Data Pack Step 2

    2

    Open up your world’s data packs folder. Open the world’s folder and then click on the data packs folder inside. This will be where the data pack will be created.

    Advertisement

  3. Image titled Make a Minecraft Data Pack Step 3

    3

    Create a folder for your data pack. Create a new folder and name it what you would like your data pack to be called.

  4. Image titled Make a Minecraft Data Pack Step 4

    4

    Create an MCMETA file. Create a new text document and rename it to pack.mcmeta. Make sure that you are changing not only the document name but the extension name as well. You should get a message warning that changing the file name extension might make it unusable.

  5. Image titled Make a Minecraft Data Pack Step 5

    5

    Make sure that your MCMETA file is the correct extension. You can make sure of this in Windows Explorer by clicking «View» and making sure the box next to «File name extensions» is checked. This will allow you to see the extension of every file on your computer.

  6. Image titled Make a Minecraft Data Pack Step 6

    6

    Open the MCMETA file with any text editor and enter the text shown above.

    • This will work in Notepad but it may be more convenient to use a text editor like Notepad++.
    • The number next to «pack» depends on which version of Minecraft you will be running this data pack on. If your version is 1.16.2, keep the number as 6. If your version is 1.17, change the number to 7. If your version is 1.15-1.16, change the number to 5. If your version is 1.13-1.14, change the number to 4. If your version is 1.16.2 or newer, keep the number as 6. If your version is 1.15-1.16, change the number to 5. If your version is 1.13-1.14, change the number to 4.
    • The text next to «description» is what will show up in the game when you highlight your mouse over the data pack. The description can be changed to anything but keep in mind that files like these may only contain letters, numbers, underscores, hyphens, forward slashes, and periods.
  7. Image titled Make a Minecraft Data Pack Step 7

    7

    Create a data folder. Inside your data pack folder, create a folder called data. The two items inside of your data pack should be the data folder and the MCMETA file.

  8. Image titled Make a Minecraft Data Pack Step 8

    8

    Create a Minecraft folder. Inside your data folder, create a new folder called Minecraft. This is where you will be putting the rest of your files for your data pack.

  9. Advertisement

  1. Image titled Make a Minecraft Data Pack Step 9

    1

    Create a folder inside the Minecraft folder called loot_tables. This is where you will be putting any folders that modify the current loot tables in the game.

  2. Image titled Make a Minecraft Data Pack Step 10

    2

    Create a folder inside the loot_tables folder called entities. This is where you will be putting any files that modify the current loot tables for entities in Minecraft.

  3. Image titled Make a Minecraft Data Pack Step 11

    3

    Find the .jar file for the version of Minecraft that you are working with. You can access this by typing %appdata% in your Windows search bar and going to .minecraftversions and selecting the version you are working with.

  4. Image titled Make a Minecraft Data Pack Step 12

    4

    Open the Minecraft versions .jar file with a program like WinRAR or 7-Zip. This will allow you to view all of the files inside of this specific version.

  5. Image titled Make a Minecraft Data Pack Step 13

    5

    Open the entities loot tables folder. You can do this by going to dataminecraftloot_tablesentities. This will allow you to see the files for the loot tables of all entities in the game.

  6. Image titled Make a Minecraft Data Pack Step 14

    6

    Choose the entity file for the loot table that you want to modify. Select the file and copy and paste it into your entities folder inside your own data pack.

  7. Image titled Make a Minecraft Data Pack Step 15

    7

    Open the entity’s file in a text editor. Here you can see many things that affect the loot table of that given mob. The essential information that can be gathered from this is as follows:

    • «rolls»: This is how many times that particular table will be rolled. This may affect how many of those items the player may receive.
    • «min» and «max»: These are the minimum and maximum amounts of a particular item that an entity may drop.
    • «name»: This is the item that the entity will drop when the loot table is activated.
    • «condition»: This is the action that will cause the entity’s loot table to be rolled. The current default for entities is «minecraft:killed_by_player»
  8. Image titled Make a Minecraft Data Pack Step 16

    8

    Look up namespace IDs for possible items to include in the modified loot table. You can see a list of all items by starting to type out the command /give player minecraft. In order for a list of item IDs to pop up, you must be in a world that has cheats enabled.

  9. Image titled Make a Minecraft Data Pack Step 17

    9

    Make desired changes to the entity’s loot table. When making basic modifications to loot tables it is highly recommended to stick to changing values and names instead of trying to add new lines of text. In this example, the rabbit loot table is changed to drop 1 blaze rod when killed. This can be shown by changing the «name» value to «mineraft:blaze_rod».

  10. Image titled Make a Minecraft Data Pack Step 18

    10

    Save the file and test in the game. Save the text file and open the world in order to test and see if the loot table was successfully changed. Type the /reload command to reload the world’s data packs and spawn a mob and kill it in order to make sure that the data pack was successful.

  11. Advertisement

  1. Image titled Make a Minecraft Data Pack Step 19

    1

    Create a folder inside the Minecraft folder of your data pack called recipes. This is where any modified recipes will be included in the data pack.

  2. Image titled Make a Minecraft Data Pack Step 20

    2

    Find the .jar file for the version of Minecraft that you are working with. You can access this by typing %appdata% in your Windows search bar and going to: .minecraftversions and selecting the version you are working with.

  3. Image titled Make a Minecraft Data Pack Step 21

    3

    Open the Minecraft versions .jar file with a program like WinRAR or 7-Zip. This will allow you to view all of the files inside of this specific version.

  4. Image titled Make a Minecraft Data Pack Step 22

    4

    Open the recipes folder. You can do this by going to dataminecraftrecipes. This will allow you to see the files for all of the recipes for any given block in the game.

  5. Image titled Make a Minecraft Data Pack Step 23

    5

    Copy and paste the desired recipe into the recipes folder of the data pack. Make sure that the selected recipe is the desired one. Some items have multiple recipes in game and may have multiple files in the version’s recipes folder. An example would be andesite slabs having two recipes: one from the crafting table and another from the stonecutter.

  6. Image titled Make a Minecraft Data Pack Step 24

    6

    Open the recipe’s file in a text editor. There are a few things to note about a given crafting table recipe.

    • «pattern»: This is the pattern of the crafting recipe shown by a 3×3 grid identical to the grid seen in the game. If a recipe doesn’t fill in the entire 3×3 grid, it will be able to be crafted in any row or column of the crafting grid. The pattern can be made using the item key below. Keep in mind that the quotations include a grid. This means that it is very important to leave spaces where necessary in order to keep the desired recipe.
    • «key»: This is where the items are defined. The character shown above the item is what will be used in the crafting recipe.
    • «result»: This is the item that will be crafted once the recipe is completed.
  7. Image titled Make a Minecraft Data Pack Step 25

    7

    Make desired changes to the recipe. Once again, it is highly recommended to stick to modifying current lines of text instead of adding new ones. If adding another item to the recipe is necessary, make sure that there is a comma after every item except for the last one. If you forget a comma, the recipe will not work. If there is only one item in the recipe, a comma is not needed. The example above shows a modified recipe for a cake. The modified recipe includes a horizontal line of milk buckets.

  8. Image titled Make a Minecraft Data Pack Step 26

    8

    Notice the difference between shaped and shapeless crafting recipes. If a shapeless recipe was selected, it will look slightly different. The «item» in the ingredients bracket shows which item will be the input and the «item» in the result bracket shows the item that will be the output. The count at the bottom shows how many of the result item will be crafted.

  9. Image titled Make a Minecraft Data Pack Step 27

    9

    Save the file and test in game. Save the text file and open the world in order to test and see if the loot table was successfully changed. Type the /reload command to reload the world’s data packs and test out the recipe in a crafting table to make sure the change was successful.

  10. Advertisement

  1. Image titled Make a Minecraft Data Pack Step 28

    1

    Create a folder inside the loot_tables folder called blocks. This is where any modified loot tables of blocks will be placed. A block’s loot table is the block that will be dropped when a player mines it.

  2. Image titled Make a Minecraft Data Pack Step 29

    2

    Find the .jar file for the version of Minecraft that you are working with. You can access this by typing %appdata% in your Windows search bar and going to: .minecraftversions and selecting the version you are working with.

  3. Image titled Make a Minecraft Data Pack Step 30

    3

    Open the Minecraft versions .jar file with a program like WinRAR or 7-Zip. This will allow you to view all of the files inside of this specific version.

  4. Image titled Make a Minecraft Data Pack Step 31

    4

    Open the blocks loot tables folder. You can do this by going to dataminecraftloot_tablesblocks. This will allow you to see the files for the loot tables of all blocks in the game.

  5. Image titled Make a Minecraft Data Pack Step 32

    5

    Choose the block file for the loot table that you want to modify. Select the file and copy and paste it into your blocks folder inside your own data pack.

  6. Image titled Make a Minecraft Data Pack Step 33

    6

    Open the block’s file in a text editor. Here you can see many things that affect the loot table of that given block. The essential information that can be gathered from this is as follows:

    • «rolls»: This is how many times that particular table will be rolled. This may affect how many of that item the player may receive.
    • «type»: This decides which item can be dropped. For example if a grass block is mined with a silk touch enchanted pickaxe it will drop a grass block, but if it is mined with anything else, it will drop a dirt block.
    • «name»: This is the item that will drop based on the given type.
  7. Image titled Make a Minecraft Data Pack Step 34

    7

    Look up namespace IDs for possible items to include in the modified loot table. You can see a list of all items by starting to type out the command /give player minecraft. In order for a list of item IDs to pop up, you must be in a world that has cheats enabled.

  8. Image titled Make a Minecraft Data Pack Step 35

    8

    Make desired changes to the block’s loot table. When making basic modifications to loot tables it is highly recommended to stick to changing values and names instead of trying to add new lines of text. In this example, the birch planks block loot table is modified. The change involves a diamond shovel dropping when a birch plank is mined.

  9. Image titled Make a Minecraft Data Pack Step 36

    9

    Save the file and test in game. Save the text file and open the world in order to test and see if the loot table was successfully changed. Type the /reload command to reload the world’s data packs and break the specific block in order to test and see if the data pack was successful.

  10. Advertisement

  1. Image titled Make a Minecraft Data Pack Step 37

    1

    Open the world folder that holds you data pack. You can either do this by going to the same folder that you were working with. Or you can go to the Minecraft main menu and click on edit and then open world folder for that particular world.

  2. Image titled Make a Minecraft Data Pack Step 38

    2

    Open the data packs folder inside the world and the data pack will be there. The data pack can be copy and pasted into any world and will work as long as the versions are the same.

  3. Advertisement

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Video

  • Mob and entity loot tables, as well as recipes, are not the only things that can be modified with a data pack. Advancements, chest loot tables, smelting recipes, and structures are just a few more things that can be changed. Keep in mind that this was a basic guide on data packs and that this is just touching the surface of things that can be done with data packs!

  • If you made changes to your data pack and it is not working in the game, make sure that you saved your file in the correct location and used the reload command in the game. Also, be sure that you didn’t leave out a quotation mark or a comma. If you accidentally delete one, that means the data pack will not work until you add it back.

Show More Tips

  • Mob and entity loot tables, as well as recipes, are not the only things that can be modified with a data pack. Advancements, chest loot tables, smelting recipes, and structures are just a few more things that can be changed. Keep in mind that this was a basic guide on data packs and that this is just touching the surface of things that can be done with data packs!

Show More Tips

Thanks for submitting a tip for review!

Advertisement

About This Article

Thanks to all authors for creating a page that has been read 42,292 times.

Did this article help you?

Get all the best how-tos!

Sign up for wikiHow’s weekly email newsletter

Subscribe

You’re all set!


Download Article


Download Article

Data packs provide an easier way for players to customize their game in Minecraft. They allow the customization and addition of new advancements, loot tables, recipes, structures, and more. This article provides a basic introduction to data packs and a few of their uses so that players may learn to customize and enhance their own Minecraft experience.

  1. Image titled Make a Minecraft Data Pack Step 1

    1

    Open up a Minecraft world folder. You can do this by typing in %appdata% in your Windows search bar and hitting enter. Then, click the .minecraft folder and then the saves folder.

  2. Image titled Make a Minecraft Data Pack Step 2

    2

    Open up your world’s data packs folder. Open the world’s folder and then click on the data packs folder inside. This will be where the data pack will be created.

    Advertisement

  3. Image titled Make a Minecraft Data Pack Step 3

    3

    Create a folder for your data pack. Create a new folder and name it what you would like your data pack to be called.

  4. Image titled Make a Minecraft Data Pack Step 4

    4

    Create an MCMETA file. Create a new text document and rename it to pack.mcmeta. Make sure that you are changing not only the document name but the extension name as well. You should get a message warning that changing the file name extension might make it unusable.

  5. Image titled Make a Minecraft Data Pack Step 5

    5

    Make sure that your MCMETA file is the correct extension. You can make sure of this in Windows Explorer by clicking «View» and making sure the box next to «File name extensions» is checked. This will allow you to see the extension of every file on your computer.

  6. Image titled Make a Minecraft Data Pack Step 6

    6

    Open the MCMETA file with any text editor and enter the text shown above.

    • This will work in Notepad but it may be more convenient to use a text editor like Notepad++.
    • The number next to «pack» depends on which version of Minecraft you will be running this data pack on. If your version is 1.16.2, keep the number as 6. If your version is 1.17, change the number to 7. If your version is 1.15-1.16, change the number to 5. If your version is 1.13-1.14, change the number to 4. If your version is 1.16.2 or newer, keep the number as 6. If your version is 1.15-1.16, change the number to 5. If your version is 1.13-1.14, change the number to 4.
    • The text next to «description» is what will show up in the game when you highlight your mouse over the data pack. The description can be changed to anything but keep in mind that files like these may only contain letters, numbers, underscores, hyphens, forward slashes, and periods.
  7. Image titled Make a Minecraft Data Pack Step 7

    7

    Create a data folder. Inside your data pack folder, create a folder called data. The two items inside of your data pack should be the data folder and the MCMETA file.

  8. Image titled Make a Minecraft Data Pack Step 8

    8

    Create a Minecraft folder. Inside your data folder, create a new folder called Minecraft. This is where you will be putting the rest of your files for your data pack.

  9. Advertisement

  1. Image titled Make a Minecraft Data Pack Step 9

    1

    Create a folder inside the Minecraft folder called loot_tables. This is where you will be putting any folders that modify the current loot tables in the game.

  2. Image titled Make a Minecraft Data Pack Step 10

    2

    Create a folder inside the loot_tables folder called entities. This is where you will be putting any files that modify the current loot tables for entities in Minecraft.

  3. Image titled Make a Minecraft Data Pack Step 11

    3

    Find the .jar file for the version of Minecraft that you are working with. You can access this by typing %appdata% in your Windows search bar and going to .minecraftversions and selecting the version you are working with.

  4. Image titled Make a Minecraft Data Pack Step 12

    4

    Open the Minecraft versions .jar file with a program like WinRAR or 7-Zip. This will allow you to view all of the files inside of this specific version.

  5. Image titled Make a Minecraft Data Pack Step 13

    5

    Open the entities loot tables folder. You can do this by going to dataminecraftloot_tablesentities. This will allow you to see the files for the loot tables of all entities in the game.

  6. Image titled Make a Minecraft Data Pack Step 14

    6

    Choose the entity file for the loot table that you want to modify. Select the file and copy and paste it into your entities folder inside your own data pack.

  7. Image titled Make a Minecraft Data Pack Step 15

    7

    Open the entity’s file in a text editor. Here you can see many things that affect the loot table of that given mob. The essential information that can be gathered from this is as follows:

    • «rolls»: This is how many times that particular table will be rolled. This may affect how many of those items the player may receive.
    • «min» and «max»: These are the minimum and maximum amounts of a particular item that an entity may drop.
    • «name»: This is the item that the entity will drop when the loot table is activated.
    • «condition»: This is the action that will cause the entity’s loot table to be rolled. The current default for entities is «minecraft:killed_by_player»
  8. Image titled Make a Minecraft Data Pack Step 16

    8

    Look up namespace IDs for possible items to include in the modified loot table. You can see a list of all items by starting to type out the command /give player minecraft. In order for a list of item IDs to pop up, you must be in a world that has cheats enabled.

  9. Image titled Make a Minecraft Data Pack Step 17

    9

    Make desired changes to the entity’s loot table. When making basic modifications to loot tables it is highly recommended to stick to changing values and names instead of trying to add new lines of text. In this example, the rabbit loot table is changed to drop 1 blaze rod when killed. This can be shown by changing the «name» value to «mineraft:blaze_rod».

  10. Image titled Make a Minecraft Data Pack Step 18

    10

    Save the file and test in the game. Save the text file and open the world in order to test and see if the loot table was successfully changed. Type the /reload command to reload the world’s data packs and spawn a mob and kill it in order to make sure that the data pack was successful.

  11. Advertisement

  1. Image titled Make a Minecraft Data Pack Step 19

    1

    Create a folder inside the Minecraft folder of your data pack called recipes. This is where any modified recipes will be included in the data pack.

  2. Image titled Make a Minecraft Data Pack Step 20

    2

    Find the .jar file for the version of Minecraft that you are working with. You can access this by typing %appdata% in your Windows search bar and going to: .minecraftversions and selecting the version you are working with.

  3. Image titled Make a Minecraft Data Pack Step 21

    3

    Open the Minecraft versions .jar file with a program like WinRAR or 7-Zip. This will allow you to view all of the files inside of this specific version.

  4. Image titled Make a Minecraft Data Pack Step 22

    4

    Open the recipes folder. You can do this by going to dataminecraftrecipes. This will allow you to see the files for all of the recipes for any given block in the game.

  5. Image titled Make a Minecraft Data Pack Step 23

    5

    Copy and paste the desired recipe into the recipes folder of the data pack. Make sure that the selected recipe is the desired one. Some items have multiple recipes in game and may have multiple files in the version’s recipes folder. An example would be andesite slabs having two recipes: one from the crafting table and another from the stonecutter.

  6. Image titled Make a Minecraft Data Pack Step 24

    6

    Open the recipe’s file in a text editor. There are a few things to note about a given crafting table recipe.

    • «pattern»: This is the pattern of the crafting recipe shown by a 3×3 grid identical to the grid seen in the game. If a recipe doesn’t fill in the entire 3×3 grid, it will be able to be crafted in any row or column of the crafting grid. The pattern can be made using the item key below. Keep in mind that the quotations include a grid. This means that it is very important to leave spaces where necessary in order to keep the desired recipe.
    • «key»: This is where the items are defined. The character shown above the item is what will be used in the crafting recipe.
    • «result»: This is the item that will be crafted once the recipe is completed.
  7. Image titled Make a Minecraft Data Pack Step 25

    7

    Make desired changes to the recipe. Once again, it is highly recommended to stick to modifying current lines of text instead of adding new ones. If adding another item to the recipe is necessary, make sure that there is a comma after every item except for the last one. If you forget a comma, the recipe will not work. If there is only one item in the recipe, a comma is not needed. The example above shows a modified recipe for a cake. The modified recipe includes a horizontal line of milk buckets.

  8. Image titled Make a Minecraft Data Pack Step 26

    8

    Notice the difference between shaped and shapeless crafting recipes. If a shapeless recipe was selected, it will look slightly different. The «item» in the ingredients bracket shows which item will be the input and the «item» in the result bracket shows the item that will be the output. The count at the bottom shows how many of the result item will be crafted.

  9. Image titled Make a Minecraft Data Pack Step 27

    9

    Save the file and test in game. Save the text file and open the world in order to test and see if the loot table was successfully changed. Type the /reload command to reload the world’s data packs and test out the recipe in a crafting table to make sure the change was successful.

  10. Advertisement

  1. Image titled Make a Minecraft Data Pack Step 28

    1

    Create a folder inside the loot_tables folder called blocks. This is where any modified loot tables of blocks will be placed. A block’s loot table is the block that will be dropped when a player mines it.

  2. Image titled Make a Minecraft Data Pack Step 29

    2

    Find the .jar file for the version of Minecraft that you are working with. You can access this by typing %appdata% in your Windows search bar and going to: .minecraftversions and selecting the version you are working with.

  3. Image titled Make a Minecraft Data Pack Step 30

    3

    Open the Minecraft versions .jar file with a program like WinRAR or 7-Zip. This will allow you to view all of the files inside of this specific version.

  4. Image titled Make a Minecraft Data Pack Step 31

    4

    Open the blocks loot tables folder. You can do this by going to dataminecraftloot_tablesblocks. This will allow you to see the files for the loot tables of all blocks in the game.

  5. Image titled Make a Minecraft Data Pack Step 32

    5

    Choose the block file for the loot table that you want to modify. Select the file and copy and paste it into your blocks folder inside your own data pack.

  6. Image titled Make a Minecraft Data Pack Step 33

    6

    Open the block’s file in a text editor. Here you can see many things that affect the loot table of that given block. The essential information that can be gathered from this is as follows:

    • «rolls»: This is how many times that particular table will be rolled. This may affect how many of that item the player may receive.
    • «type»: This decides which item can be dropped. For example if a grass block is mined with a silk touch enchanted pickaxe it will drop a grass block, but if it is mined with anything else, it will drop a dirt block.
    • «name»: This is the item that will drop based on the given type.
  7. Image titled Make a Minecraft Data Pack Step 34

    7

    Look up namespace IDs for possible items to include in the modified loot table. You can see a list of all items by starting to type out the command /give player minecraft. In order for a list of item IDs to pop up, you must be in a world that has cheats enabled.

  8. Image titled Make a Minecraft Data Pack Step 35

    8

    Make desired changes to the block’s loot table. When making basic modifications to loot tables it is highly recommended to stick to changing values and names instead of trying to add new lines of text. In this example, the birch planks block loot table is modified. The change involves a diamond shovel dropping when a birch plank is mined.

  9. Image titled Make a Minecraft Data Pack Step 36

    9

    Save the file and test in game. Save the text file and open the world in order to test and see if the loot table was successfully changed. Type the /reload command to reload the world’s data packs and break the specific block in order to test and see if the data pack was successful.

  10. Advertisement

  1. Image titled Make a Minecraft Data Pack Step 37

    1

    Open the world folder that holds you data pack. You can either do this by going to the same folder that you were working with. Or you can go to the Minecraft main menu and click on edit and then open world folder for that particular world.

  2. Image titled Make a Minecraft Data Pack Step 38

    2

    Open the data packs folder inside the world and the data pack will be there. The data pack can be copy and pasted into any world and will work as long as the versions are the same.

  3. Advertisement

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Video

  • Mob and entity loot tables, as well as recipes, are not the only things that can be modified with a data pack. Advancements, chest loot tables, smelting recipes, and structures are just a few more things that can be changed. Keep in mind that this was a basic guide on data packs and that this is just touching the surface of things that can be done with data packs!

  • If you made changes to your data pack and it is not working in the game, make sure that you saved your file in the correct location and used the reload command in the game. Also, be sure that you didn’t leave out a quotation mark or a comma. If you accidentally delete one, that means the data pack will not work until you add it back.

Show More Tips

  • Mob and entity loot tables, as well as recipes, are not the only things that can be modified with a data pack. Advancements, chest loot tables, smelting recipes, and structures are just a few more things that can be changed. Keep in mind that this was a basic guide on data packs and that this is just touching the surface of things that can be done with data packs!

Show More Tips

Thanks for submitting a tip for review!

Advertisement

About This Article

Thanks to all authors for creating a page that has been read 42,292 times.

Did this article help you?

Get all the best how-tos!

Sign up for wikiHow’s weekly email newsletter

Subscribe

You’re all set!

This series of tutorials will teach you how to create your very own data packs, assuming you know absolutely nothing about commands. Although data packs could just contain files that replace built-in assets like resource packs, these posts will focus on adding new features and mechanics to the game. In every part I assume you’ve read the previous parts.

This post flies through the first five blog posts at an incredibly high speed. If you know your way around computers, JSON, common minecraft commands and want to learn by example, this post is for you. If you prefer a more guided tutorial or get curious about the detailed reasoning behind these instructions, refer to the individual parts, starting here.

Let’s get started with a datapack that allows us to quickly switch between creative and spectator!

But first, what are functions, tags and data packs?

By typing a command in chat, you’re giving minecraft direct instructions to do something for you. Functions are files that consist of a bunch of commands. Tags are groups that can consist of functions, blocks, entities, items and fluids. They are represented by files and any datapack can extend a tag defined elsewhere. Data packs are bundles of functions, but also loot tables, recipes and structures. Players can simply drop a data pack into their world and start using it, they won’t have to mess with the individual files within the data pack.

Data packs are not mods or plug-ins. They are a bit easier to create, but are more limited.

Getting an editor and showing the logs

Download Notepad++, which is an editor that gives suggestions based on previously typed words. Very useful for referencing things you’ve created earlier by name in later tutorials. In the Minecraft Launcher, click Settings and tick the checkbox that says «Open output log when Minecraft: Java Edition starts». If you now launch the game, you see a second window that will list errors in function files which helps during debugging (the process of fixing bugs). Those are the same errors you would otherwise see in chat if you were to type in a broken command like «/gamemode epic».

Creating a data pack

Open the datapacks folder of a world by using the Minecraft client (Edit > Open World Folder > datapacks folder) or navigate to %APPDATA%/.minecraft/saves/<your world>/datapacks. Create a new folder and call it «Creative Utilities». Go inside the folder and create a pack.mcmeta file.

{
"pack": {
"pack_format": 11,
"description": "put some text here"
}
}

Now run the /reload command in your minecraft world followed by /datapack list. Your first datapack should show up, hover over the entry of the data pack to see the description you specified. The description can be any Minecraft JSON text component and visit this page for the latest pack_format number.

During this tutorial we’ll look at multiple other JSON files with references to wiki pages. These external pages use icons to indicate the JSON type, use this page for information on the meaning behind these icons.

Creating your first function

Create a folder named «data» and create another folder inside. It’s name should be something you own, like your username. The folder represents your namespace and should be globally unique, which is only possible by using a name you own. Note that you must replace «<namespace>» with the name of this folder in any of the snippets below.

Create a folder named «functions» inside that, with another folder inside. This last folder should be used to uniquely identify your functions across all data packs created by you. An abbreviation of the data pack name should be enough, so call it «crea-util». Now create a toggle-gamemode.mcfunction file with the following contents:
tag @s[gamemode=spectator] add tut_cu_go_creative
gamemode spectator @s[gamemode=creative]
gamemode creative @s[tag=tut_cu_go_creative]
tag @s[tag=tut_cu_go_creative] remove tut_cu_go_creativef

It should be located at:

.minecraft/saves/<world_name>/datapacks/Creative Utilities/data/<namespace>/functions/crea-util/toggle-gamemode.mcfunction

At the first line, the player is given a tag if in spectator mode. If we were to change the gamemode immediately, it would be changed back right away on the second line. The second and third lines swap gamemodes and the fourth line cleans up the mess we made on the first line.

Now run /reload followed by /function <namespace>:crea-util/toggle-gamemode. As long as you were in creative or spectator, it should have toggled your gamemode.

Hooking into Minecraft

There are two built-in tags: minecraft:load and minecraft:tick. By registering our function into those tags, we can have minecraft automatically run our commands instead of making the players type /function commands. The functions inside the minecraft:tick tag run 20 times a second.

Go back to the data folder. Alongside your namespace folder, create a new folder named «minecraft». Create a folder named «tags» inside that, with another folder named «functions» inside. Now create a load.json file:
{
"values": [
"<namespace>:crea-util/load"
]
}
and a tick.json file:
{
"values": [
"<namespace>:crea-util/tick"
]
}
The file names match the minecraft:load and minecraft:tick tags. The listed values inside match function files we still have to create. The exact JSON structure can be found here. Go back to the data folder again and into your <namespace>/functions/crea-util folder. Create a new load.mcfunction file with these contents:tellraw @a {"text":"Hello World!","color":"yellow","extra":[{"text":"nThe Creative Utilities datapack is created by <your username>","color":"aqua"},{"text":"n Run /function <namespace>:crea-util/uninstall to uninstall.","color":"gray"}]}
Usually you use the load function to setup your datapack. The tellraw command uses JSON to describe text, see this page for the full text component structure. Then create another file named tick.mcfunction with these contents:
execute as @a[x_rotation=-90] at @s run function <namespace>:crea-util/toggle-gamemode
execute as @a[x_rotation=-90] at @s run tp @s ~ ~ ~ ~ 0
The first line calls the toggle-gamemode function when you look up, the second line rotates you back to a horizontal position. Now run the /reload command. A message should be printed to chat and because the commands above are run every tick, you should be able to look up any time to switch gamemodes.

Lastly, create a uninstall.mcfunction file with the following contents:
tellraw @a {"text":"Successfully uninstalled Creative Utilities!","color":"aqua"}
datapack disable "file/Creative Utilities"
datapack disable "file/Creative Utilities.zip"
Although uninstall functions aren’t an official thing, I recommend creating them to clean up any mess your datapack made in the load function. If you do provide an uninstall function, make sure to tell the players on load that they should use a /function command to do an uninstall before removing the data pack.

Challenge Yourself

If you followed this tutorial without looking at the file contents, you probably have no idea what the commands do or why it works. Don’t worry though, that’s the nature of a quickstart guide. If you know a little about commands, maybe you can try adding extra features to the datapack. Regardless, try to understand what everything in the data pack means. Play around and see how modifications affect its behaviour. Maybe even search for information on parts you don’t understand.

Awesome! What’s next?

If this quickstart guide left you with a lot of questions, feel free to have a look at the five individual parts, starting here. If you’re ready to continue, have a look at the Quality Control section that I left out in part 4. Part 6 will be about target selectors, which are the components starting with @ in the commands above and allow you to dynamically select players and other entities. Examples of relative coordinates are the squigly lines (~) in the tick function.

Subscribe if you want to get notified of new posts.

Function Data Packs for Dummies #1 - #5 | Quickstart: Create your first datapack!
Function Data Packs for Dummies #1 - #5 | Quickstart: Create your first datapack!

hello everyone :D

I’ve started writing some tutorials on a website called «the data pack center» so I thought I would share some here.

Prerequisites:

  • none

What is a data pack?
A data pack is a folder which is used to hold and organize Minecraft functions, recipes, structures…

What are Minecraft functions?
Minecraft functions are files with the .mcfunction extension. They are used to store normal Minecraft commands and run them when the function is called.

example of a function file:

# this is a comment
say hi
say this is a function file
execute as @a run say hello world! 

just some normal vanilla Minecraft commands stacked up in one file and ran line by line, that’s a function file.

to create a function file, paste the above commands or your own commands into an empty text file (.txt) and then save the file with the «.mcfunction» extension.

to test this function, we need a data pack to put it in. If you don’t know how to create your own data pack, here’s an empty template which you can download and use for this tutorial: https://www.dropbox.com/sh/r6ulpz0srrze61y/AADhaBGkcr5kReeofSBXgleja?dl=0

This is what the file structure of a data pack looks like (source: Minecraft wiki)

189

the first file you will see is «pack.mcmeta» which looks like this:

{
 "pack": {
 "pack_format": 4,
 "description": "new data pack"
 }
 } 

this file tells Minecraft that this folder is a data pack.
«pack_format» is the version of your data pack, it can be any number
«description» is pretty self-explanatory

next, you will see «(namespace)» which is a folder where your functions, loot tables, recipes, structures, and other things are going to go. Rename the namespace folder to anything you want.

you can have multiple namespace folders with different names to organize things
and each one of those namespaces can contain its own functions, recipes…

now that you know the basic file structure of a data pack, we can continue.

so where do we put the function? go into the template or your own data pack and navigate to data > your_namespace > functions and paste the function file in this folder.

done! your data pack is now ready for use. Go into .minecraft > saves > your_save > datapacks
and paste the data pack you just created into this folder.

if your game is already running, do /reload to register the data pack.

you can view all loaded data packs by doing /datapack list in game. You should see your data pack show up in the list.

so how do we run our function now? to run a function, use the /function command

/function namespace:function_name 

example with namespace called «megacrafter» and function called «myFunction»:

/function megacrafter:myFunction 

This is nice and all but 99% of the time you will want your function file to run all the time in the background. For example, if I put this command into my function file to detect if there is a pig called «bob»:

/execute if entity @e[type=pig,name=bob] run say hi bob 

we would have to run the /function command the whole time if we want the command to keep testing for the condition.

We can tell Minecraft to run our function in the background every tick by registering it into a file called «tick.json».

The «tick.json» file is located in the minecraft namespace, found here: your_datapack > data > minecraft > tags > functions

if you open the «tick.json» file, you should see the following code:

{

 "values":[
 ""
 ]

} 

this file tells the game what function to run every tick.

«values» — any function stored within this tag will run every tick

so let’s add our function to the «values» tag. The syntax is the same as with /function (namespace:function)

{

 "values":[
 "megacrafter:myFunction"
 ]

} 

our function will now run in the background as soon as the world loads.

now you might be wondering what that second file was for, the «load.json»? that file is used to run function only once (when the world loads). Which is perfect for initializing things like scoreboard objectives which only need to be created once.

so for example, if I have to create some scoreboard objectives, I would create another function file, write the commands in it and then register it in the «load.json» file just like we did with «tick.json» so it only runs once.

my other tutorials and data packs: https://datapackcenter.com/members/megacrafter10.102/#resources

Понравилась статья? Поделить с друзьями:

Не пропустите и эти статьи:

  • Как написать дарственную на часть квартиры
  • Как написать дарственную на садовый участок
  • Как написать дарственную на машину сыну
  • Как написать дарственную на машину жене
  • Как написать дарственную на квартиру на сына образец заполнения

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии