Minecraft Blogs / Tutorial

How to code simplest datapack ever

  • 182 views, 2 today
  • 1
  • 0
FireX123's Avatar FireX123
Level 19 : Journeyman Modder
2
English: (I recommend using Microsoft Visual Studio Code and these extensions: Blockeption's Minecraft Bedrock Development, Data-pack Helper Plus, language-mcfunction, Minecraft Json Viewer, syntax-mcfunction)
So create a folder on your desktop and name it whatever you want. Then inside the folder create file named pack.mcmeta this is the file that tells minecraft which version datapack uses this is 1.20.1 tutorial so use pack format 15 here is pack.mcmeta file code:
{ "pack": { "pack_format": 15, "description": "#Your description goes here" }}
(You can create pack.png too this is icon of your pack)
then inside the folder you made in desktop create data folder and inside data create minecraft inside minecraft create tags and inside tags create functions then here create files: load.json and tick.json
load.json file code:
{ "values": [ "namespace:load"]}
tick.json file code:
{ "values": [ "namespace:tick"]}
Replace namespace with namespace of your datapack

Go back to data folder and inside data create a folder exactly how you named namespace in tags/functions folder
inside the functions create load.mcfunction and tick.mcfunction

Commands that you put to load.mcfunction will run when you type /reload here is an example for load.mcfunction code:
tellraw @p "Thanks for downloading my datapack!"

And thing you written in tick.mcfunction will run every tick here is an example of code that can crash your game :)
execute at @s run summon wither ~ ~ ~ {NoAI:1}

Also inside functions folder you can create a function that will run when you type /function namespace:function in minecraft chat
here is an example of function that you can name whatever you want and it will run only if you use /function here is a code example that summons 100 camels
execute at @s run summon camel ~ ~ ~

And then paste that command 100 times

How to install your datapack ?
Make a world then exit it and click Edit>Open world folder go to datapacks in this folder and put here your datapack that you have on desktop
Open world again and remember to DONT USE WITHER TICK.MCFUNCTION EXAMPLE CODE
then type /reload see your load message and see your "normal i guess?" tick.mcfunction code cuz for example you can type there idk effect give @a speed 1 255 true and type /function namespace:your_function and summon 100 camels or what you written

Of course you can add to minecraft using datapacks items (if you use custommodeldata resource pack) or recipes, loot tables and more...
CreditBlog by FireX123
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome