your current location:首页 > news>Develop your own data packet![MC] MineCraft Game

Develop your own data packet![MC] MineCraft Game

2024-12-05 23:06:15|Myriagame |source:minecraft skins

This tutorial is set by the author to use the CC by-NC protocol.

If you are too lazy to read words, please read the video tutorial of station B.

This tutorial follows CC: by-NC creation sharing permit:

You (user) can copy, issue, exhibition, performance, screening, broadcast, or spread this work through an information network;

You must sign the work according to the author or licensee.

introduce

As we all know, MC has added data packet function to 1.13.

The data packet allows players to add and modify the content of Minecraft game content such as functions, loot tables, world structure, progress, synthesis, labels, dimensions, and predicates.——In the Chinese Minecraft Wiki.

Simply put, it is a lightweight module.

What are the prohibited matters in developing data packets?

When making or publishing a packet, you should not:

Published a Minecraft version or modified version, so that players who do not buy Minecraft from Mojang can get it;

Publish a countercrap source code in any way (although it is not dead).

What should I prepare for the development of the data packet?

A wiki;

A file editor (almost all editors can, even notepads, recommend vsc);

A software that can compress/decompress (although you can use your own file manager, it is not recommended);

Clear ideas and clear goals;

Ask the question with sincerity, this can solve the problem of 95%;

Search engines are more useful than big guys (unless you are making a small gadget for those who have no ancients);

The following JSON little knowledge:

 {{

"One item": "What is in a thing", // This is a item

"A list": [// This is a list

"The items in a list" must have space in front of // (but this is just specification and does not affect its identification).

"Another item in one list" // Everything must be wrapped in {}, [], half -angle double/single quotation number

], // ←←← If it is not the last list/item, in}] Be sure to add a half -horn comma!

"Another list": [

"The item in another list"

]

} // Remember to delete the annotation of "//" in front!

Yes, yes, only these 7 points are needed, non -professionals can make data packets!

Related link

Obviously, if you only look at this tutorial, you can only learn the content of the teaching process.And watching Wiki self -study is also a bit difficult, so I list some links that may help you learn data packets, hoping to help you learn.

Other tutorials

Your teaching method may not be in line with your appetite, so I also recommend looking at the tutorials of others.

Datapack Data Package Teaching Notes My World Tutorial By Xiao Lingjun (for a long time for a long time byd) (stop more;

My World Package Teaching Series BY Chuangxiao (BYD, the same is true);

Minecraft original module entry tutorial By Ruhuasiyu (really complete, but the author's information is too lazy to find OVO).Wiki page

Needless to say.

Chinese Minecraft Wiki (English version/mineral ceremony);

Data Pack -Minecraft Wiki;

Progress -Minecraft Wiki;

Tag -Minecraft Wiki.

Formal development

Note: In order to go smoothly in the follow -up development, it is recommended that you close the "hidden file extension" (Baidu/Bing Ying, you know).

pack.mcmeta

Open the "DataPACKS" folder in your own archive, create a folder (the name is self -determined, here is called test datapack), create a pack.mcmeta file and write the following content:

 {{

"PACK": {

"Pack_format": 6,

"Description": "Test Data Pack"

}

}

Pack.mcmeta, it is the core of the packet.

"PACK_FORMAT" represents the version number of the data packet (fill in the corresponding version number when developed by what version you use!), The mainstream version number is:

Version number Representative version Version Number Representative version 41.13–1.14.4121.19.45-1.16.115151.20.161616.16.16.2–1.16.5181.20.271.17–1.17.1261.20.3–1.20.41.18–1.18.1411.20.5–1.20.691.18.21–1.1101.19–19.3 The future has not been released in the future.

"Description" is a brief introduction to the packet, which can be customized.

Now that you have created Pack.mcmeta, try to test it in the game.Open the game, enter the world containing this data package, enter/regoad, and then enter the/datapack list.At this time, two information should be appeared: the first is [vanilla] (original data packet), and the second article should be [File/Test DataPack (the name of your data packet)].When you hang the mouse on the data packet name, you should see the description of the packet, which is what you write in "Description".

Data folder

Create a folder called Data, which is used to put a data packet.

Create a folder in Data, the name is the naming space of your data packet (that is, the ID card of the packet, you cannot use a name space with other packet/modules. Here is named TEST_DATAPACK with a hump).

In the packet, there are only 10 numbers: 10 to 9 numbers from 0 to 9, 26 lowercase letters from A to Z, downline (_) and minus (-) (in short, most of the characters contained in ASCIITo.

The following is the content that the packet can contain (except for the special content added by other mod/packets):

pack.mcmeta;

pack.png (a square picture is the icon of a packet, it is recommended to use the format of 16X16);

DATA:

test_dataPack (Of course, fill in the name space of your data packet here):

Advancements;

Functions;

Loot_tables;

predicates;

Item_modifiers;

Structures;

Recipes;

tags;

Other flowers.

Other MOD data packet custom functions have appeared in other tutorials.

Naming space and ID

If you just develop and use the original data package, you only need to understand this part simply.

But if you want to develop a MOD, you must understand!(Although there is not much content XD)

Naming space

The naming space is a small thing for distinguishing the original and additional content (data packets and MOD).

The original naming space is "MINECRAFT". The namespace of the data packet/module (also known as Modid/Modid) is usually a module name of all sketches. The space is replaced with "_".

For example, "shu_ju_bao", "mo_zu_min_zi" (please do not use Pinyin, this is an extremely important thing !!!).

ID

If you have contacted instructions, ID should be something you often come into contact with.

It is used to distinguish various things such as items, blocks, entities, etc. (similar to the name space).For example "Iron_ingot"

Usually used with naming space, such as "Minecraft: IRON_INGOT"

Simply put, it is "naming space: ID"

Content of the packet

See, right?The above are the content that the packet can be included, but we first come one by one, starting with the simplest formula.

formula

Each formula must be placed in data/[name space]/recipes/(classification).

The name of the file is recommended to use the ID of the finished product, which is simple and clear.

Workbench

As the name suggests, it is the formula of the workbench.

Orderly formula

 {{

"Type": "Minecraft: Crafting_shaped",

"Pattern": [[

"111", // must correspond to the following "key"

"2", // space is blank

"2"

],,,

"Key": {

"1": {

"Item": "Minecraft: Iron_INGOT" // This is obviously an iron ingot

},

"2": {

"Item": "Minecraft: stick" // This is a wooden stick

// You can also use the "tag" you will teach later

}

},

"Result": {// The synthetic finished product "item": "Minecraft: Iron_pickaxe", // Combine above, this is a formula of an iron pick

"Count": 1 // You can replace it with other numbers, of course, this is unreasonable

}

}

Disorder

 {{

"Type": "Minecraft: Crafting_shapeless",

"Result": {

"Item": "Minecraft: Slime_ball", // Slime

"Count": 3 // Quantity

},

"Ingredients": [[

[

{"Item": "minecraft: milk_bucket"} // a bucket of milk

],,,

[

{{

"Item": "Minecraft: Lime_dye" // yellow -green dye

}

],,,

[

{{

"Item": "Minecraft: Lime_dye" // The same above}

]

]

}

Melting formula

Use the formula including melting furnace, blast furnace, smoke furnace, and other MODs (such as a flux melting furnace of the thermal series) added.

Note: All melting formulas can add "Experience" (experience value) and "cookingtime" items below "Result", but after "Result", you must add a half -angle comma ","!

 "Experience": 10, // 10 points of experience

"cookingtime": 20 // 20tick (engraved) = 1 second

Furnace formula

 {{

"Type": "Minecraft: SMELTING",

"Ingredient": {

"Item": "Minecraft: stick" // Enter the wooden stick

},

"Result": "Minecraft: Torch" // Output a torch

}

Blast furnace

 {{

"Type": "Minecraft: Blasting",

"Ingredient": {

"Item": "Minecraft: stick" // Enter the wooden stick

},

"Result": "Minecraft: Torch" // Output a torch

}

Furnace

 {{

"Type": "Minecraft: Smoking",

"Ingredient": {

"Item": "Minecraft: Stick" // Enter the wooden stick},

"Result": "Minecraft: Torch" // Output a torch

}

bonfire

 {{

"Type": "Minecraft: Campfire_Cooking",

"Ingredient": {

"Item": "Minecraft: stick" // Enter the wooden stick

},

"Result": "Minecraft: Torch" // Output a torch

}

Other formula

In 1.14, Minecraft adds a lot of work cubes, and 1.16 also adds functions to the forging table. The following are those formulas.

Forging table formula

Because the forging template is added by 1.20, the formula of this forging table fails;

 {{

"Type": "Minecraft: Smithing",

"Base": {

"Item": "Minecraft: Stick" // Enter the wooden stick as raw materials

},

"Addition": {

"Item": "Minecraft: Coal" // Enter coal as an additional item

},

"Result": {

"Item": "Minecraft: Torch" // Output the torch as the finished product

}

}

1.20+ version (borrow the Fortevis Ho formula of Application Energy 2):

 {{

"Type": "Minecraft: Smithing_transform",

"Addition": {

"Item": "AE2: Fluix_block" // I don't know why, isn't the formula of Faru Ex block deleted?},

"Base": {

"Tag": "ae2: quartz_pickaxe" // Enter the lower quartz Hao as raw materials

},

"Result": {

"Item": "AE2: FLUIX_PICKAXE" // Output Fauxo Ho as the finished product as the finished product

},

"Template": {

"Item": "ae2: fluix_upgrade_smithing_template" // Enter Fourgle

}

}

Stone cutter formula

In fact, it is not just a "stone" machine, it can cut any items/blocks, provided that you add these formulas.

 {{

"Type": "Minecraft: StoneCutting",

"Ingredient": {

"Item": "Minecraft: OAK_PLANKS" // Enter the oak board

},

"Result": "Minecraft: Stick", // Output a wooden stick

"Count": 4 // (Must -fill in this item) Output 4

}

schedule

You have learned to make a packet, then you should make the following content about progress!

 {{

"Criteria": {// criteria (that is, where the hair is touched)

"Stick": {// Customize the name, you can have multiple conditions

"Trigger": "Minecraft: Inventory_changed", // A trigger, the specific usage in the trigger entry

"Conditions": {"items": [

{{

"Item": "Minecraft: Torch"

}

]

}

}

},

"Display": {

"Icon": {// Progress icon, you can use "" icon ":" The path of the picture inside the packet "instead

"Item": "Minecraft: Torch"

},

"Title": {

"Translate": "Fire!"

},

"Description": {

"Translate": "Burn and burn"},

"Frame": "Task", // The type of progress, "Task", "Goal", and "Challenge" are ordinary, goals, challenges

"Annound_to_chat": true, will it be displayed in the chat box after the progress is completed

"Background": "The path of the picture inside the packet", // optional, after use, the progress becomes root, conflict with Parent

"Hidden": false, // Is it a hidden progress

"Show_toast": True // Will the picture be displayed in the upper right corner after the progress is completed

},

"Parent": "Minecraft: Story", // Optional, after use, the improvement degree becomes a child progress, conflict with Background

"Requirements": [// Standard list, only one criterion is required in one content. If there are multiple contents, you need to complete all the content (human beings: do one together, do all of them together)

["Stick"]

],,,

"REWARDS": {// The reward after the progress is completed, the specific content is in the reward entry

"Experience": 10 // Award experience

}

}

trigger

Congratulations!You should learn to use this custom progress!You may find that we can modify its completion!This requires a trigger, but there are many contents of the trigger. This tutorial may not be stuffed, so the specific content can be query on this information!

award

The function of this progress includes "rewarding 10 points of experience", we can modify its reward content!It includes experience, functions, loot tables (this tutorial is temporarily involved), formula (see formula entries).

function

Although it is called "function", unlike the "function" in mathematics, the function is only used to execute instructions, which is equivalent to external command blocks.Although its principle is simple, it can do a lot of things.

The function file has the suffix of ".mcfunction", but it is actually an ordinary text document (that is, you can still use notepad to develop it).

Create a new "test.mcfunction" in/data/[Naming Space] (we use the "test_datapack")/functions/(classification) used by us, open it, write the following in it:

 Say This is a test document for testing data packets!

Enter the world, load the data packet in/regoad, and then enter:

/Function test_dataPack

Then you will see a sentence in the chat box, "This is a test document for the data packet used for testing!"

The function is that simple.However, it is not the same as ordinary instructions. Similar to the command block, there is one less "/" in front of the instruction (such as most of the instructions of the famous module creation of the gods of the gods, two "//", and one less one becomes "/".To.

This tutorial is not continuously updated ~