your current location:首页 > news>Data packet tutorial 1: How to make the synthetic formula in your data packet return the material?[MC] MineCraft Game

Data packet tutorial 1: How to make the synthetic formula in your data packet return the material?[MC] MineCraft Game

2024-12-10 17:49:06|Myriagame |source:minecraft skins

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

Game version: 1.20.1 (tested, 1.14.4-1.20.1 is common)

Create Data directory and Pack.mcmeta file

Pack.mcmeta used in this tutorial is as follows

 {{

"PACK": {

"PACK_FORMAT": 4,

"Description": "Data packet for tutorial"

}

}

Create a folder under the data, the directory name is the naming space, and the TEST in this tutorial is

Create a folder in TEST, the directory structure is as follows

The current directory structure

pack.mcmeta

Data

Test

Advancements

Return

Functions

Recipes

Create a formula under recipes. Here

 {{

"Type": "Minecraft: Crafting_shapeless",

"Category": "Misc",

"Ingredients": [[

{{

"Item": "Minecraft: GOLD_INGOT"

},

{{

"Item": "Minecraft: Carrot"

}

],,,

"Result": {

"Item": "Minecraft: GOLDEN_CARROT"

}

}

The above is a basic disorderly synthetic formula. If you do n’t understand, you can consult Wiki or tutorials inside and outside the station

Create a file under RETURN, named*.json (replaceable at*, here is get_gold_carrot.json as an example)

 {{

"Criteria": {

"Craft_lantern": {

"Trigger": "Recipe_crafted",

"Conditions": {"recipe_id": "test: Golden_carrot"

}

}

},

"Rewards": {

"Function": "Test: Return_gold"

},

"Sends_telemetry_event": false

}

In the above JSON, we created a progress named Get_gold_carrot (the same as the file name). After the test: Golden_Carrot synthesis, get test: get_gold_carrot and execute the function test: Return_gold. Let's write this function below

Create a file under the Function folder, named*.mcfunction (*You need to and the above "Function": "Test: Return_gold" in JSON

The same part of the name space is the same, here is RETURN_GOLD.MCMETA)

 Execute as @S AT @S Run Give @s Minecraft: Gold_nugget 1

Advancement Revoke @S only test: Return/GOLDEN_CARROT

In the above functions, we gave the player who triggered the progress a golden granules and removed the progress, so that the next synthesis will still be triggered normally

Okay, you can pack it in the game and test

-The tutorial for the first time, please correct me if you have any mistakes-