#I need help in making my first datapack(Crown Datapack)
1 messages · Page 1 of 1 (latest)
plugins just for recipe
as i heard recipes is a nightmare in datapacks
not really
I can agree they aren't that bad to deal with
but i am a complete newbie into this
Continuing from #💬┃general
{
"criteria": {
"requirement": {
"trigger": "minecraft:tick"
}
},
"rewards": {
"function": "<your namespace>:give_crown"
}
}
```This is your advancement
It will run the function once per player
thnx nice community guys. you all are very helpfull
just use this file and change the pattern and materials
i have to put this in tick mc function?
No, put this in data/<your namespace (the function that isn't minecraft)>/advancements/first_join.json
first_join.json can be whatever ig but this makes it easier to understand
then replace <your namespace> with your actual namespace
ihave to make an advancement folder and then firs_join.json
Yes
data/<your namespace>/advancements
ohk
<@&935561184806060073> help this guy plz i must leave
after all that all you have to do is if they die then you reset that advancement you just made, it will run again once, and give them the item (crown 5)
ohk
give me 15 mins imma finish my hw then imma hop on coding my super cool idea
ok baby i am back
i wanted to ask if i have to put anything else in first_join.json
or just this command
Tip - File > Open Folder > select the datapack folder
That way everything works together
You also should install the datapack helper visual studio code extension
now this is the advancement made. what is the next thing i have to do. nothing else is made except this advancement
done. everything i hv done in the legitmoose first video
In data/crown/functions create give_crown.mcfunction. In that function you can put the give command
ok
i have to give a custom id to the tier 5 crown?
and a specific custom id to every tier crown
hi can u help me bro?
@outer wasp can u help man?
anyone
please dont ping random people
ohk sorry
idk you can give them a crown or something
so can u tell me the command for the tier 5 crown
i have no idea what you want your tier 5 crown to... be
datapacks can't directly add custom items
you have to use an item that already exists
and do stuff with it
it should be a gold crown which gives permanent resistance
using this crown base ill make other crowns
with prot x
and unbreakable
permanent resistance, prot x and unbreakable
will you eventually want the custom helmet to have a different model/texture?
like idk
if not (you can use a gold crown) then its easier
but yeah if a custom texture would be there then
its going to be cool
ill use the normal crown texture
which i hv no worries
then you can give the player a golden helmet with the Unbreakable NBT tag and a enchantment
just can u tell what command i should give in give_Crown
give_crown.mcfunction* it has to be lower case
ohk and how the perma resistance
yeah it is lowercase all
for that, then in your tick function you need to check when the player is wearing it and give them the resistance effect
should i give a model id also?
a what
ohk thnx
whom should i target?
but if i have to add potione effects, i need to give it a custom id also right because then anyone wearing a gold helmet will get these effects
ok
oh yeah
so for that
give it a custom tag here
then you can get any item that has the Crown:5b tag
ok
also one last thing what is NBT?
u kinda free right, like I am not annoying u right?
ig not
NBT is basically data that the item (or mobs, blocks) can hold. you can add your own NBT (in this case Crown:5b), or you can use built-in tags (such as Unbreakable:1b will make it unbreakable)
its fine dw
i can add 2 NBT?
add as many as you want
make sure it follows the format tag:value, tag:value, tag:value
ohk
you can do some other stuff with it but thats a bit more advanced
ohk
there is attribute modifier in it
can i add changes to max health?
yes
ok
ohk thnx man
ok i checked and i am getting extra hearts so yeah
now @pliant parcel how should i add custom potion effects
you are an angel from heaven @pliant parcel . and u have godlike skills
in your tick mcfunction, just do this: hs execute as @a[nbt={Inventory:[{Slot:103b, id:"minecraft:golden_helmet",Count:1b,tag:{Crown:5b}}]}] run effect give @s resistance 1 1
basically: tell all players who have a helmet with a tag of Crown:5b in slot 103 (the head slot) to give the resistance effect
ohk
and can i do something to uk schedule this after every 60 ticks?
so that it reduces lag
as many players gon play on the server
or will the perfomance impact will be negligible?
it won't be very visible - but if you want to schedule it every 3 seconds then thats definitely possible
now i got how to make other 4 crowns
and i will add the recipes from a plugin which i have called custom crafting
load mcfunction: hs schedule function crown:3s 3s
data/crown/functions/3s.mcfunction:hs execute as @a[nbt={Inventory:[{Slot:103b, id:"minecraft:golden_helmet",Count:1b,tag:{Crown:5b}}]}] run effect give @s resistance 4 1 schedule function crown:3s 3s
so man i kinda finished my very own datapack thnx @pliant parcel
i hv to do the same for every crown?
nah not exactly
and i kinda don't have to put anything in tick.mcfunction
for another crown just add one more command in 3s function:```hs
execute as @a[nbt={Inventory:[{Slot:103b, id:"minecraft:golden_helmet",Count:1b,tag:{Crown:5b}}]}] run effect give @s resistance 4 1
execute as @a[nbt={Inventory:[{Slot:103b, id:"minecraft:golden_helmet",Count:1b,tag:{Crown:4b}}]}] run effect give @s . . .
schedule function crown:3s 3s```
right and just do this step
<3 glad you got the datapack working!
yes
🙂
one last thing xD
like i wanna make a function which i manually run to get the other tier crowns. so where i have to put other 4 crowns command
@pliant parcel
you can just create a function called give_all_crowns.mcfunction and in that function just put all the give commands (for example, the one in give_crown.mcfunction)
i have added some custom attributes in the helmet, it won't affect this right?
@pliant parcel
not at all
okkk
yes it has
i am not getting resistance
@pliant parcel
less leave this optimization. imma do it normally in tick.mcfunction
i aint getting the effect still
wait
give @p[limit=1] golden_helmet{display:{Name:'{"text":"Tier 5 Crown","bold":true,"italic":true}',Lore:['{"text":"You get permanent Resistance from this","italic":true}']},Unbreakable:1b,Crown:5b,Enchantments:[{id:"minecraft:protection",lvl:10s}],AttributeModifiers:[{AttributeName:"generic.max_health",Name:"generic.max_health",Amount:15,Operation:0,UUID:[I;-676575865,-1053276835,-1923275262,-472214491],Slot:"head"}]} 1
ok can you wear the helmet and run /data get entity @s Inventory[{Slot:103b}] to see if its in the wrong place
then like
screenshot the result
can you give me a give command
and run /reload
yes
that command should be fine
everything saved and reloaded 3-4 times
execute as @a[nbt={Inventory:[{Slot:103b, id:"minecraft:golden_helmet",Count:1b,tag:{Crown:5b}}]}] run effect give @s resistance 4 1 run this in chat manually and see if it works
i can remove these attributes though
they dont cause a problem
okay okay
so the problem is in tick.json and load.json (because the command works, but its not getting run by the datapack)
could you send whats in those files plz
and thats saved where
{
"values": [
"crown:loop"
]
}
this is tick.json
is your tick function called loop.mcfunction
no
its tick.mcfunction only
change it to loop.mcfunction
ig very deep issue happened lol
because the tick.json is looking for loop.mcfunction
did still nothing happened
ohhk
all functions gotta be in the functions folder :P
just a minor mistake caused so much nuisance xD
it happens
i am doing this but i am getting resistance 2
execute as @a[nbt={Inventory:[{Slot:103b, id:"minecraft:golden_helmet",Count:1b,tag:{Crown:5b}}]}] run effect give @s resistance 1 1
execute as @a[nbt={Inventory:[{Slot:103b, id:"minecraft:golden_helmet",Count:1b,tag:{Crown:5b}}]}] run effect give @s resistance 1 ```
ohk niceee
thnx baby love you @pliant parcel
:P
everything is ggs now
epic
imma sleep for now and finish my project tommorow
gn
imma do some more projects like this and soon be the master of coding
epic
you do coding as a job or you are a student?
I'm a student but I taught myself everything I know about coding
Nah
It won't affect the datapack that much but there isn't really a need. Plus, you have give_all_crowns function and that would not make as much sense if there were multiple namespaces
99% of datapacks use one namespace (and minecraft namespace)
yeh true
also one more thing
sure
gn
hey
@pliant parcel I made everything
all crowns
and also i took help from my friend and made a mechanism in which whenever a player dies, no matter what tier his crown is at, he recieves Tier 5 crown
@here I finished the datapack @pliant parcel
that's cool but i doubt that pinging 200+ people would be a good idea :P
xD
epic!
@pliant parcel
thnx man
I subbed