The Data Pack Knowledge Book (with Challenges!) (2024)

707

Bertiecrafter4/7/20 4:45 pm history

707 emeralds 209.7k 139

3/28/2024 7:16 pm
Megamind5547

The Data Pack Knowledge Book (with Challenges!) (3)


Let's learn about Function Data Packs

Have you thought about creating a data pack, but have no idea how to start or perhaps you already know how to create basic data packs, but would like to learn more? Fortunately, we took the time to create an extensive blog tutorial series that anyone can start reading. Even if your command knowledge doesn't go beyond /time, /kill and /gamemode, you can still start right this second and create your first datapack today. The more experienced data pack creators can skip ahead the first few posts and see if there is anything that we can teach you or you can correct us on.

More posts will be created in the future and existing posts might be improved. Feedback and questions are welcome in the replies below.

flash_on Quickstart

If you know your way around computers, JSON, common minecraft commands and want to learn by example, then feel free to take a nose dive with this quickstart tutorial, covering parts 1 to 5 below.

Create your first data pack today.

build The Tools

Ever wondered how the greatest data packs were made with just "simple commands"? It will all start to make sense after you have discovered all the individual components that can be used during the creation of a data pack. Bertiecrafter will guide you throughout your travels into the world of data packs.
  1. What are data packs and why would I create them?
  2. Who's JSON (and what's /tellraw)?
  3. Creating a new data pack and your first function
  4. Debugging
  5. Let's play tag! (Load, tick, uninstall and other functions)
  6. Who? What? Where? But How? (Target Selectors and Relative Coordinates)
  7. The Scoreboard
    1. The Scoreboard: Where numbers are created, stored and juggled
    2. The Scoreboard (+ Triggers): We've got to go deeper!
  8. The Command Environment (/execute)
  9. Check a lot of things, but only once! (+ /execute if/unless)
  10. Named Binary Tag (NBT) format
    1. NBT: The hidden layer behind all of Minecraft
    2. NBT based targeting (+ /execute if data)
  11. The return of JSON
    1. The return of JSON: The Workshop (+ Custom Recipes)

color_lens The Trade

You have already learned a thing or two about datapacks and commands? Great! You started to wonder how to link them together for more complex functionalities? Even better, because guess what: We've got just the thing for you. Kefaku will help you evolve from a newbie in the world of datapacks to a developer of sophisticated projects.
  1. Helpful and interesting links for datapackers
  2. Repeat it over and over again... | Loops
  3. This is so random... | Randomizing
  4. Help, I'm lagging! | Lag
  5. ... more planned in the near future ...

Resources, Notes & Best Practices

The tutorials provide links to resources whenever they are needed. However, you can use the following list for an overview of these resources, notes and best practices.

Cheat sheet

  • Functions are files that consist of multiple commands. Tags are groups of functions.
  • Conventions
    • Give your data pack a unique namespace (like your own username) and also create a folder inside the functions folder to uniquely identify functions across your own data packs.
    • Any kind of tag starts with #, like /function #minecraft:load. Besides minecraft:load, minecraft:tick is another built-in tag that you can register your functions in.
    • You should provide an uninstall function to avoid leaving a mess when your datapack gets uninstalled.
    • Always put an #As/At comment on the first line of a function to avoid spending hours on debugging. You can split it up into separate #As and #At comments if the location is different from the executing entity location.
    • Try to be efficient with checks and avoid duplicates.
  • JSON Basics
  • Target Selectors:
    • Any player arguments in commands can have target selectors, which can target non-player entities as well.
    • All target selector variables and arguments
    • The distance target selector argument needs a range, since an exact distance will never match anything. So use distance=..5 instead of distance=5
    • ~x ~y ~z defines a location relative to the coordinates of the execution location, while ^left ^up ^forwards also takes the rotation of the execution location into account.
  • Scoreboard:
    • The health scoreboard criteria shows up as fancy hearts in the tab list.
    • The display name of scoreboard objectives can contain unicode characters (fun symbols), which show up in the display slots.
    • All scoreboard criteria
    • The scoreboard doesn't allow decimals. Multiply the value by a big number before dividing to see more digits behind the dot.
    • Read-only objectives can be modified by first copying the values to a dummy objective using the "operation" subcommand of /scoreboard
    • The values of an objective with "trigger" criteria can be modified by /trigger. Since /trigger can be used by non-op players, you can create clickable buttons in chat using /tellraw and then fire functions whenever their score is 1.
  • Command Environment:
    • By default data pack commands execute as the "server entity" at worldspawn.
    • The /execute command can change the context of execution.
    • The /execute command has "instructions" that can be chained together as much as you want.
    • Order matters in the /execute command.
    • Full /execute syntax
  • NBT:
    • NBT looks like JSON, but distinguishes between more types (with suffixes) and doesn't require quotes around key names.
    • JSON within NBT must be surrounded by apostrophes!
    • Use /data to edit NBT data.
    • Use /execute to store NBT data on the scoreboard for arithmetic operations, before moving it back.
    • NBT: Color Picker and Hex to Integer conversion
    • NBT: Chunk Format - For all mobs, projectiles, vehicles, falling blocks, block entities and a couple of other things.
    • NBT: Player.dat Format - This page describes the NBT format for the "player" entity and all items.
    • NBT: UUID generator
    • NBT Path syntax
    • Check for NBT using the "nbt=" target selector, the "/execute if data" instruction or the "/execute if block xyz <block>[​states]{nbt}" instruction.
    • You cannot access JSON elements within NBT (for text on signs or in books) using NBT paths, since JSON must always be provided as a string instead of an object.
  • JSON Extended:

Posted by

1861057

Bertiecrafter
Retired Moderator
Level 70 : Legendary Engineer

781

Collaborators Kefaku

Create an account or sign in to comment.

139

  • Hot
  • Newest
  • Oldest
  • Votes

Deadkenny925a

01/17/2024 2:09 pm

Level 18 : Journeyman Pokemon

The Data Pack Knowledge Book (with Challenges!) (6)

how would one make an item unremovable from the player's inventory

2

Megamind5547

03/28/2024 7:16 pm

Level 1 : New Explorer

The Data Pack Knowledge Book (with Challenges!) (7)

Well, that depends on what version of minecraft you're using. If it's bedrock I'm pretty sure you use this command: /give <target> <item> 1 0 {"item lock": {"mode": "lock_in_slot"}}

I believe in java you have to use "/item replace" , I'm not sure what the parameters are for it, though.

2

Moisesgamer8196

11/16/2023 12:16 am

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (8)

Hello guys
I want a data pack to import into Minecraft

2

lytDARK

08/29/2023 1:45 am

Level 4 : Apprentice System

The Data Pack Knowledge Book (with Challenges!) (9)

Bertiecrafter What do you think about function macros?

4

Bertiecrafter

09/12/2023 1:35 am

Level 70 : Legendary Engineer

The Data Pack Knowledge Book (with Challenges!) (10)

Oooh, thanks for hinting at this new functionality. (I haven't kept up with latest news on new versions). They sound very promising and a long awaited feature in the data pack community. Can't wait to see all the insane stuff that can be done with them.

3

PastelBLACKCat

08/22/2023 3:16 pm

Level 4 : Apprentice Skinner

The Data Pack Knowledge Book (with Challenges!) (11)

Question, can 1.17 datapacks work on 1.20.1?

3

Denistic

10/08/2023 9:50 am

Level 32 : Artisan Crafter

The Data Pack Knowledge Book (with Challenges!) (12)

yes they can. you just need to change the pack.mceta file in the datapack to format:15 or 18.

1

Bertiecrafter

09/12/2023 1:38 am

Level 70 : Legendary Engineer

The Data Pack Knowledge Book (with Challenges!) (13)

It will try to run, but if the command syntax has changed, some commands might prevent certain function files from running. Which ultimately breaks the entire data pack.

2

AnnyParker

09/07/2023 8:41 pm

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (14)

For the most part, yes, barring a few command changes. You may have to do minor tweaking, but not much beyond that

1

lytDARK

08/29/2023 1:44 am

Level 4 : Apprentice System

The Data Pack Knowledge Book (with Challenges!) (15)

Obviously not

2

tcathebluecreper

03/05/2023 2:26 pm

Level 35 : Artisan Engineer

The Data Pack Knowledge Book (with Challenges!) (16)

As a pro datapack developer, reading through the index, this looks very good, but I have not read it yet.

2

Jarorator

03/08/2023 12:56 am

Level 4 : Apprentice Crafter

The Data Pack Knowledge Book (with Challenges!) (17)

Have you read through it now?

2

Bertiecrafter

02/12/2023 10:52 am

Level 70 : Legendary Engineer

The Data Pack Knowledge Book (with Challenges!) (18)

Added in-depth blogs on combining several individual concepts to create more complex mechanics

Written by Kefaku, with more to come!

3

RB22486

08/31/2023 10:40 am

Level 38 : Artisan Lego Builder

The Data Pack Knowledge Book (with Challenges!) (19)

Hm, Sure.

1

Kefaku

02/12/2023 11:25 am

Level 42 : Master Nerd

The Data Pack Knowledge Book (with Challenges!) (20)

yay :D

3

BlockDropian

01/20/2023 10:20 pm

Level 11 : Journeyman Miner

The Data Pack Knowledge Book (with Challenges!) (21)

smh

2

EndermanDotDat

01/06/2023 10:46 am

Level 30 : Artisan Dragonborn

The Data Pack Knowledge Book (with Challenges!) (22)

the memes oh comparing json to jason lol.

5

TheOneWizard

10/28/2022 2:32 pm

Level 20 : Expert Explorer

The Data Pack Knowledge Book (with Challenges!) (23)

Thx I've already needed this

6

amandin

10/06/2022 12:10 pm

Level 57 : Grandmaster uwu

The Data Pack Knowledge Book (with Challenges!) (24)

this is so good actually!

4

eyhoffi

09/25/2022 7:19 pm

Level 59 : Grandmaster Professor

The Data Pack Knowledge Book (with Challenges!) (25)

two years and i din't recogniced this thread. how cool that someone is explainig this stuff. now i need a cool commands tut for dummies , too. very nice. thank you.

5

amandin

10/06/2022 12:10 pm

Level 57 : Grandmaster uwu

The Data Pack Knowledge Book (with Challenges!) (26)

hope you are getting better at it! how is it going ?

4

Alinq1

09/07/2022 2:09 pm

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (27)

like

3

Imposter1234

09/02/2022 4:57 am

Level 25 : Expert Sus

The Data Pack Knowledge Book (with Challenges!) (28)

so how do I make them?

3

Bertiecrafter

09/06/2022 3:29 pm

Level 70 : Legendary Engineer

The Data Pack Knowledge Book (with Challenges!) (29)

Just a text editor is all you need :)
Click the links above to visit the blog posts, one part at a time.

4

PyuDev

09/04/2022 4:06 pm

Level 26 : Expert Cupcake

The Data Pack Knowledge Book (with Challenges!) (30)

I would make datapacks with MCreator

4

Equimano

08/29/2022 4:23 pm

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (31)

550 emerald

4

User4250130G

07/25/2022 10:15 pm

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (32)

ok

4

kelvin conrad

07/19/2022 2:32 pm

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (33)

como criar data packs

4

Redywq

06/29/2022 10:29 pm

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (34)

I know its kind of incovinient but can someone please help me make a datapack to prevent hoglins form spawning at light source 9 or something like that?

2

SEfaught

05/30/2022 2:15 pm

Level 38 : Artisan uwu

The Data Pack Knowledge Book (with Challenges!) (35)

501th emerald

3

juanclack9878

03/14/2022 2:35 pm

Level 23 : Expert Miner

The Data Pack Knowledge Book (with Challenges!) (36)

oko

2

Draguel

02/24/2022 2:17 pm

Level 2 : Apprentice Crafter

The Data Pack Knowledge Book (with Challenges!) (37)

ender dragon

2

02/16/2022 7:55 am

This reply was removed by the poster or a moderator.

deeznuts96

02/16/2022 7:55 am

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (38)

u sus

1

whozclover

01/29/2022 1:45 pm

Level 18 : Journeyman Botanist

The Data Pack Knowledge Book (with Challenges!) (39)

Swaggy af :)

3

User4000068G

01/20/2022 3:08 pm

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (40)

oi ficou muito bom

1

blob_

01/30/2022 5:54 am

Level 48 : Master Blob

The Data Pack Knowledge Book (with Challenges!) (41)

io uuah hakwsnk hnawygds

1

Ziedhamad65

01/18/2022 9:47 am

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (42)

non funziona come potrei fare

2

Your_MoThEr375

01/13/2022 12:14 am

Level 25 : Expert Engineer

The Data Pack Knowledge Book (with Challenges!) (43)

“Who is JSON” that’s really funny cheered me up a bit

10

User3988167G

01/12/2022 2:00 pm

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (44)

Oi

3

MateusCraftGames

07/24/2022 3:48 pm

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (45)

OI

2

pequin369

12/13/2021 2:46 pm

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (46)

hello I found an error that the mobs of the negative layers of 1.18, that is, those of low y0 or less die and revive infinitely and do not move.

2

Bertiecrafter

12/16/2021 2:24 pm

Level 70 : Legendary Engineer

The Data Pack Knowledge Book (with Challenges!) (47)

Please post the comments at the relevant submission.

4

Vesely_skeleton

12/08/2021 9:49 am

Level 2 : Apprentice Explorer

The Data Pack Knowledge Book (with Challenges!) (48)

THANK YOU

5

SSAkhil

12/07/2021 10:10 pm

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (49)

eeeeeeeeeeeeeeee

2

Gnomik31Gnomik

11/28/2021 8:40 am

Level 1 : New Miner

The Data Pack Knowledge Book (with Challenges!) (50)

hhjjhjhj

2

HiMeCoolss

11/23/2021 3:38 am

Level 33 : Artisan Magical Boy

The Data Pack Knowledge Book (with Challenges!) (51)

Boom, just what i needed

3

SoapSoapSoap

11/17/2021 1:32 am

Level 44 : Master Procrastinator Nerd

The Data Pack Knowledge Book (with Challenges!) (52)

I just misread NBT to NFT

5

RoyalQuackOG

01/20/2022 2:09 am

Level 37 : Artisan Electrician

The Data Pack Knowledge Book (with Challenges!) (53)

happened with me too.....

2

Comradeee

11/16/2021 1:17 pm

Level 37 : Artisan Engineer

The Data Pack Knowledge Book (with Challenges!) (54)

very interesting thank you

3

view more replies ( 83 )

The Data Pack Knowledge Book (with Challenges!) (2024)

References

Top Articles
Latest Posts
Article information

Author: Dan Stracke

Last Updated:

Views: 6162

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Dan Stracke

Birthday: 1992-08-25

Address: 2253 Brown Springs, East Alla, OH 38634-0309

Phone: +398735162064

Job: Investor Government Associate

Hobby: Shopping, LARPing, Scrapbooking, Surfing, Slacklining, Dance, Glassblowing

Introduction: My name is Dan Stracke, I am a homely, gleaming, glamorous, inquisitive, homely, gorgeous, light person who loves writing and wants to share my knowledge and understanding with you.