#how would i make it so when u right click a zombie piglin with a certain item with model data it
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
💬 While you wait, take this time to provide more context and details.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
does the item need to be a carrot on a stick instead of a ghast tear?
i think it might
<@&1166082198152159386> <@&1202694677766348840>
Please note that you still might not immediately get a response since all helpers are human beings and volunteers (and also might be sleeping right now)
View this guide on datapack.wiki: https://datapack.wiki/guide/right-click/
so that was a yes.. got it
Depends which method of right click detection you use
There aren't any items that let you interact with zombified Piglins, so you'd need to make the custom item have right click detection, and when it is right clicked, raycast to find a zombified Piglin, and if it finds one, run a function as it that does all you want
Did you accidentally make a recursive function that runs itself forever
i dont think idid?
Do the logs say anything
letme check
no
ok i fixed it
Its that easy. Please interact with this video as much as you can by subscribing, liking the video, commenting, replying to comments, liking comments, doing anything you can to spread this video out there by telling the algorithm this is a good video, so then other people can have easy access to recovering their worlds this easy!
removed this no idea what it did but it worked
anwyays
back to what we were doing
whats a Interaction Entity?
can it be any item?
No, it's an entity
so how does it work
Like a mob
so u dont use any item?
It's a type of mob which does something when you right click it
ohhh
im just worried about pigs folllowing
could we delete the eye of ender that spawns if we use a eye of ender
oh
"This method is a bit more niche, as it only works in worlds without strongholds. This method also triggers once per tick, not just once per right click." so it wouldnt work in worlds with strongholds
that being said
im in the nether
and u cant use them in the nether
and zombie piglins spawn in the nether
sooo?
fine ill use carot on a stick
ok how do i do this
View this guide on datapack.wiki: https://datapack.wiki/guide/right-click/coas/
ok i set up the right click
so it runs a function when i right click
how do i do this lol
i havent made my own datapack b4 😭
ive only edited them
Try out the guide and if you get stuck on something then ask
why does this not run the convert functiuon
execute as @a[scores={<namespace>.rc_coas=1..}] if items entity @s weapon.mainhand carrot_on_a_stick[custom_data~{item:"lf:piglin_tear"}] run function nb:convert
wait
forgot to replace namepsace lol
yea
still doesnt run
even with it replaced
execute as @a[scores={nb.rc_coas=1..}] if items entity @s weapon.mainhand carrot_on_a_stick[custom_data~{item:"lf:piglin_tear"}] run function nb:convert
m,y give command /give @a minecraft:carrot_on_a_stick[custom_name={"text":"Piglin Tear","italic":false,"color":"#ffaa00"},lore=[{"text":"Reveals the pig beneath the rot.","color": "#801994","italic": true},{"text": "Forged in the old fire to undo the new curse...","color": "#801994","itaalic":true}],item_model="lf:piglin_tear"]
did you create the scoreboard?
no
😳
it didnt tell meto
oh yeah wait i did
in load function
scoreboard objectives add nb.rc_coas minecraft.used:minecraft.carrot_on_a_stick
thats the load function
did you run /reload
yes
ok your give command doesn't have the custom data component - you're checking for when they right-click the item with the custom data, but you never give the item that custom data
it does?
/give @a minecraft:carrot_on_a_stick[custom_name={"text":"Piglin Tear","italic":false,"color":"#ffaa00"},lore=[{"text":"Reveals the pig beneath the rot.","color": "#801994","italic": true},{"text": "Forged in the old fire to undo the new curse...","color": "#801994","itaalic":true}],item_model="lf:piglin_tear"]
that's the item model
ohh
how do i give it custom data?
or can i make execute as @a[scores={nb.rc_coas=1..}] if items entity @s weapon.mainhand carrot_on_a_stick[custom_data~{item:"lf:piglin_tear"}] run function nb:convert check for a item model instead
You can if you want but generally that's considered bad practise
how?
Add this component
cuz it's messy, if you use the model more than once then it doesn't work
although for smaller packs tis not a massive issue
how tho
/give @a minecraft:carrot_on_a_stick[custom_name={"text":"Piglin Tear","italic":false,"color":"#ffaa00"},lore=[{"text":"Reveals the pig beneath the rot.","color": "#801994","italic": true},{"text": "Forged in the old fire to undo the new curse...","color": "#801994","itaalic":true}],item_model="lf:piglin_tear",custom_data={item:"my_custom_item"}]
that?
yeah
stil doesnt work
wait nvm
forgot to set the datas
lmao
doesnt work
execute as @a[scores={nb.rc_coas=1..}] if items entity @s weapon.mainhand carrot_on_a_stick[custom_data~{item:"piglin_tear"}] run function nb:convert
/give @a minecraft:carrot_on_a_stick[custom_name={"text":"Piglin Tear","italic":false,"color":"#ffaa00"},lore=[{"text":"Reveals the pig beneath the rot.","color": "#801994","italic": true},{"text": "Forged in the old fire to undo the new curse...","color": "#801994","itaalic":true}],item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
you need to include lf: before it
oh
wait
no you dont
cuz you changed it in the execute command too
did you give yourself the new item to test it
yes
wait
i guess i didnt wtf
i swear i did
its working now lol
ok next step
how do i make it convert the piglin

😳
I don't think you can force a piglin to convert but you can kill the old one and summon a new one if you want
Assuming you mean convert it from/to zombified
yes
why does this not clear the piglin tear
wait nvm
i had the wrong item
why does this do nothing
/execute if entity @e[type=minecraft:zombified_piglin,distance=10,limit=1] run clear @s minecraft:carrot_on_a_stick[minecraft:item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
@unborn minnow ?
someone pls tell me how to give a tag to a mob
what would you expect it to do?
heres my current conventstart
execute as @a[tag=using_piglin_tear] at @s run execute as @e[type=minecraft:zombified_piglin,distance=..5,limit=1,sort=nearest] run tag @s add convert
clear @s minecraft:carrot_on_a_stick[minecraft:item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
kill @e[type=minecraft:zombified_piglin,tag=convert]
tag @s remove using_piglin_tear```
it clears the iterm
just doesnt give the piglin the tag
which version of minecraft is this by the way?
1.21.5
in that case, if you want to select the nearest entity use @n[...] saves you writing limit=1,sort=nearest
where do i use @n?
instead of having the piglin tag itself, how about you just call tag from the executor
huh
you use @n instead of any @e[limit=1,sort=nearest]
no, it will target nearest entity
ohh
@n[type=zombified_piglin] nearest zombie piglin
so
tag @s[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",tag:{item_model:"lf:piglin_tear",custom_data:{item:"piglin_tear"}}}}] add using_piglin_tear
execute as @n[tag=using_piglin_tear] at @s run execute as @e[type=minecraft:zombified_piglin,distance=..5] run tag @s add convert
clear @s minecraft:carrot_on_a_stick[minecraft:item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
kill @e[type=minecraft:zombified_piglin,tag=convert]
tag @s remove using_piglin_tear
that?
no?
?
u said to use @n tho
oh instead of @ e
tag @s[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",tag:{item_model:"lf:piglin_tear",custom_data:{item:"piglin_tear"}}}}] add using_piglin_tear
execute as @a[tag=using_piglin_tear] at @s run execute as @n[type=minecraft:zombified_piglin,distance=..5,limit=1,sort=nearest] run tag @s add convert
clear @s minecraft:carrot_on_a_stick[minecraft:item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
kill @e[type=minecraft:zombified_piglin,tag=convert]
tag @s remove using_piglin_tear
read again, use @n instead of @e with any sort=nearest,limit=1 restriction.
?
execute as @a[tag=using_piglin_tear] at @s run execute as @n[type=minecraft:zombified_piglin,distance=..5,limit=1,sort=nearest] run tag @s add convert
Can be simpilfied to:
execute as @a[tag=using_piglin_tear] run tag @n[type=minecraft:zombified_piglin,distance=..5] add convert
this says the exact same, for each player with the using tag, tag the nearest piglin with the convert tag
stil doesnt get the tag tho?
also i can click anywhere with the piglin tear and it still clears.. i want it to only clear when u right click the piglin
btw says no entity was found when i do
tag @s[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",tag:{item_model:"lf:piglin_tear",custom_data:{item:"piglin_tear"}}}}] add using_piglin_tear
if you want it to only work when you use it on the piglin I think the current approach isn't the greatest. An enchantment definition could achieve this with a lot less checking.
whats an enchantment definition?
you are on 1.21.5 so you have access
it allows custom enchantments
https://minecraft.wiki/w/Enchantment_definition
https://misode.github.io/enchantment/
You can create an enchantment that can be applied to an item and then do all sorts of things. I recommend using the misode website to help you select the right stuff.
"description": "supe",
"supported_items": "#minecraft:swords",
"weight": 1,
"max_level": 1,
"min_cost": {
"base": 0,
"per_level_above_first": 0
},
"max_cost": {
"base": 0,
"per_level_above_first": 0
},
"anvil_cost": 0,
"slots": [
"mainhand",
"offhand"
],
"effects": {
"minecraft:tick": [
{
"requirements": {
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type_specific": {
"type": "minecraft:player",
"looking_at": {
"targeted_entity": {
"type": "minecraft:zombified_piglin"
}
}
}
}
},
"effect": {
"type": "minecraft:run_function",
"function": "your_namespace:start_piglin_conversion"
}
}
]
}
}```
what does this do
Above enchantment, activates when a player is holding this item in the hands and looking at a zombified piglin
oo nice
where do i put it?
it lacks right click detection but you can add it similar to how you did before.
you create an enchantment folder in the namespace folder of your datapack much like function and advancement
wait
The above has some unfished spots that need changing (you can remove the glint and probably want to change the name)
i wont beable to get this enchantment from a enchanting table right?
cuz i can see supported items
You can enable/disable this
Load it up in the misode website
k
you can name it like any other datapack file, lowercase_no_whitespaces
how would i disable getting it from the enchantment table
it is a json file and supported items just means the item can get it. For enchantment tables etc. the primary_items key is what matters, without it it wont ever show in enchantment tables etc.
so u wont get it from the table with the current code u gave me?
Use the misode website, it allows you to quickly see the possibilities and correct input for your enchantment and you can then copy it at the bottom right.
exactly, it is only obtainable using the /give or /enchant commands etc.
nice
misode.github.io is your go to website when you are in doubt
so do i put the enchantment on the piglin tear? if so how do i disable the enchhantment glint
and how would i disable it showign what enchantments it has

on the piglin tear you can set the custom component enchantment_glint_override:false
how do i do that 😳
depends on the means of obtaining them item
/give @a minecraft:carrot_on_a_stick[custom_name={"text":"Piglin Tear","italic":false,"color":"#ffaa00"},lore=[{"text":"Reveals the pig beneath the rot.","color": "#801994","italic": true},{"text": "Forged in the old fire to undo the new curse...","color": "#801994","itaalic":true}],item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
well
in the datapack
i want it to be a uncommon chance of it dropping from a zombie piglin
give @s some_item[enchantment_glint_override=false,enchantments=...]
etc.
ik but how do i add that to the existing command
I am not sure if this can properly disable the enchantment description
thats fine i guess
the same way you add any other component in your current code
/give @a minecraft:carrot_on_a_stick[minecraft:enchantment_glint_override:false,custom_name={"text":"Piglin Tear","italic":false,"color":"#ffaa00"},lore=[{"text":"Reveals the pig beneath the rot.","color": "#801994","italic": true},{"text": "Forged in the old fire to undo the new curse...","color": "#801994","itaalic":true}],item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
doesnt work
sorry my bad, it should be = not :
wat did u name the enchantment
i dotn ese a name
i dont see a name
in the code
the name of the enchantment should be the name of the file it is in
ohh
you can check if it exists using the /enchant command
enchantments have one drawback
/give @a minecraft:carrot_on_a_stick[minecraft:enchantment_glint_override=false,enchantments=lookingat_piglin,custom_name={"text":"Piglin Tear","italic":false,"color":"#ffaa00"},lore=[{"text":"Reveals the pig beneath the rot.","color": "#801994","italic": true},{"text": "Forged in the old fire to undo the new curse...","color": "#801994","itaalic":true}],item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
doesnt work
you have to restart your world before they show
Data components, or simply components, are structured data used to define and store various properties. They are used on items, where they are referred as item components or item stack components, and block entities, partially replacing NBT format.
Data components are used in various places, including the player's inventory, container block enti...
/give @a minecraft:carrot_on_a_stick[minecraft:enchantment_glint_override=false,enchantments=lookingat_piglin1,custom_name={"text":"Piglin Tear","italic":false,"color":"#ffaa00"},lore=[{"text":"Reveals the pig beneath the rot.","color": "#801994","italic": true},{"text": "Forged in the old fire to undo the new curse...","color": "#801994","itaalic":true}],item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
enchantments={your_namespace:lookingat_piglin:1} etc. I have to go now however.
could u atleast help me with this comand b4 so lol
I recommend you ensure the enchantment exists when you use /enchant command. namespace is required!
/give @a minecraft:carrot_on_a_stick[minecraft:enchantment_glint_override=false,enchantments={lookingat_piglin},custom_name={"text":"Piglin Tear","italic":false,"color":"#ffaa00"},lore=[{"text":"Reveals the pig beneath the rot.","color": "#801994","italic": true},{"text": "Forged in the old fire to undo the new curse...","color": "#801994","itaalic":true}],item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
k
it doesnt
nothing comes up with/enchant Orichalthyl nb
/give @a minecraft:carrot_on_a_stick[minecraft:enchantment_glint_override=false,enchantments={nb:lookingat_piglin1},custom_name={"text":"Piglin Tear","italic":false,"color":"#ffaa00"},lore=[{"text":"Reveals the pig beneath the rot.","color": "#801994","italic": true},{"text": "Forged in the old fire to undo the new curse...","color": "#801994","itaalic":true}],item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
ohh
reloading does not work
yes
is that a bad thing
what if thye disable custom enchaments lol
then my world stops working
no it is the warning you get for datapack stuff that is more advanced and requires a full restart of your world after any changes are made
.
maybe cuz it doesnt support it?
very well possible, the enchantment i gave was for swords
how do i make it support it
carrot on a stikc isnt on the list of supported items
nvm i had to remove the #
ok fixed it thanks to the minecraft discord 
/give @a carrot_on_a_stick[enchantment_glint_override=false,minecraft:tooltip_display={hidden_components:[enchantments]},enchantments={"nb:lookingat_piglin":1},minecraft:item_name={"text":"Piglin Tear","italic":false,"color":"#ffaa00"},lore=[{"text":"Reveals the pig beneath the rot.","color": "#801994","italic": true},{"text": "Forged in the old fire to undo the new curse...","color": "#801994","itaalic":true}],item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
why does this not run the function
"description": "supe",
"supported_items": "minecraft:carrot_on_a_stick",
"weight": 1,
"max_level": 1,
"min_cost": {
"base": 0,
"per_level_above_first": 0
},
"max_cost": {
"base": 0,
"per_level_above_first": 0
},
"anvil_cost": 0,
"slots": [
"mainhand",
"offhand"
],
"effects": {
"minecraft:tick": [
{
"requirements": {
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type_specific": {
"type": "minecraft:player",
"looking_at": {
"targeted_entity": {
"type": "minecraft:zombified_piglin"
}
}
}
}
},
"effect": {
"type": "minecraft:run_function",
"function": "nb:convertstart"
}
}
]
}
}```
or what do i need to do to ru nthe function
anyone?
do i need to make a new post
💀
@unborn minnow ?
Can you explain your problem concisely so we can help because it's difficult to read through loads of messages
well im trying to get the enchantment to run the function convertstart
idk how explain it 😭
heres my convertstart
execute as @a[tag=using_piglin_tear] run tag @n[type=minecraft:zombified_piglin,distance=..5] add convert
clear @s minecraft:carrot_on_a_stick[minecraft:item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
kill @e[type=minecraft:zombified_piglin,tag=convert]
tag @s remove using_piglin_tear
particle minecraft:soul ~ ~0.8 ~ 0.25 0.5 0.25 0.01 15 normal
playsound entity.zombie_villager.cure master @a ~ ~ ~
scoreboard players set @s np.timer 1
scoreboard players set @s np.timer2 1
say convertstart ran```
What do you need the enchantment for
for running the function when im looking at the piglin
except i want it to only happen when ur right clickign it
perfect got it working
nvm
its happening when im too far away
i want it only happen when im close
"description": "Trigger when looking at a zombified piglin",
"supported_items": "minecraft:carrot_on_a_stick",
"weight": 1,
"max_level": 1,
"min_cost": {
"base": 0,
"per_level_above_first": 0
},
"max_cost": {
"base": 0,
"per_level_above_first": 0
},
"anvil_cost": 0,
"slots": [
"mainhand"
],
"effects": {
"minecraft:tick": [
{
"requirements": {
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type_specific": {
"type": "minecraft:player",
"looking_at": {
"type": "minecraft:zombified_piglin"
}
}
}
},
"effect": {
"type": "minecraft:run_function",
"function": "nb:execute"
}
}
]
}
}
execute
execute as @a[scores={nb.rc_coas=1..}] if items entity @s weapon.mainhand carrot_on_a_stick[custom_data~{item:"piglin_tear"}] run function nb:convertstart
scoreboard players reset @a[scores={nb.rc_coas=1..}] nb.rc_coas```
pefect
execute if entity @e[type=minecraft:zombified_piglin,distance=..1,limit=3] run execute as @a[scores={nb.rc_coas=1..}] if items entity @s weapon.mainhand carrot_on_a_stick[custom_data~{item:"piglin_tear"}] run function nb:convertstart
scoreboard players reset @a[scores={nb.rc_coas=1..}] nb.rc_coas```
why does it say no entity was found
tag @s[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",tag:{item_model:"lf:piglin_tear",custom_data:{item:"piglin_tear"}}}}] add using_piglin_tear
@unborn minnow
tag:{} in item nbt no longer exists
although I am busy do
Psst, <@&1166082198152159386>!
tldr for helpers: using an enchantment to check if they are looking at the entity and right click detection
I don't really have time to explain but you need to use components:{"minecraft:component_name":{<component value>} instead of tag
/tag @s[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",components:{item_model:"lf:piglin_tear",custom_data:{item:"piglin_tear"}}}}] add using_piglin_tear?
how do i get the component name
You have the component name
In this case it's custom_data
Also don't do an NBT check like this. Instead do execute if items ... run tag @s add using_piglin_tear
ok i fixed that part but
its still not converting the piglin
load function
scoreboard objectives add np.timer dummy
scoreboard objectives add np.timer2 dummy```
tick function
```execute as @e[tag=magmaslime] at @s align xyz run function nb:place
execute as @e[tag=magmaslime_placed] at @s unless block ~ ~ ~ slime_block run function nb:break
#The stuff for converting the zombie piglin
execute as @e[scores={np.timer2=21,np.timer=..3599}] at @s run function nb:convertproc
execute as @e[scores={np.timer=3600..}] at @s run function nb:convert
execute as @e[tag=convert,scores={np.timer=..3599}] run scoreboard players add @s np.timer 1
execute as @e[tag=convert,scores={np.timer2=..20}] run scoreboard players add @s np.timer2 1```
convertstart
```tag @s[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",tag:{item_model:"lf:piglin_tear",custom_data:{item:"piglin_tear"}}}}] add using_piglin_tear
execute as @a if predicate nb:holding_piglin_tear run tag @n[type=minecraft:zombified_piglin,distance=..5] add convert
clear @s minecraft:carrot_on_a_stick[minecraft:item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
kill @e[type=minecraft:zombified_piglin,tag=convert]
tag @s remove using_piglin_tear
particle minecraft:soul ~ ~0.8 ~ 0.25 0.5 0.25 0.01 15 normal
playsound entity.zombie_villager.cure master @a ~ ~ ~
scoreboard players set @s np.timer 1
scoreboard players set @s np.timer2 1
say convertstart ran```
convertproc
particle minecraft:instant_effect ~ ~1 ~ 0.5 0.5 0.5 5 5 normal
scoreboard players set @s np.timer2 1```
convert
function nb:random_zombie
particle minecraft:poof ~ ~0.75 ~ 0.25 0.5 0.25 0.1 25 normal
playsound minecraft:block.lava.extinguish master @a ~ ~ ~```
random zombie
```scoreboard players random @s zombie_check 0 1
execute if score @s zombie_check matches 0 run summon minecraft:zombie ~ ~ ~
execute if score @s zombie_check matches 1 run summon minecraft:zombie_villager ~ ~ ~```
@robust cypress
It is legitimately really hard to help you when you just throw walls of code at us
idk
Troubleshoot and figure out what part specifically isn't working. You can try to identify which functions are running or not by adding a say command in them. If you don't get a message(s) in chat, then you know that function isn't running, and that gives us something to go off of
Or, if all the functions are running, but something isn't behaving as expected, you can tell us what is happening and what you want to happen instead, ie which functions/lines aren't doing what they're supposed to
But dissecting your whole code frankly sucks
problem is idk what "scoreboard players set @s np.timer2 1" does
💀
and
execute as @e[scores={np.timer2=21,np.timer=..3599}] at @s run function nb:convertproc
execute as @e[scores={np.timer=3600..}] at @s run function nb:convert
execute as @e[tag=convert,scores={np.timer=..3599}] run scoreboard players add @s np.timer 1
execute as @e[tag=convert,scores={np.timer2=..20}] run scoreboard players add @s np.timer2 1
It sets the executing entity's np.timer2 score to 1
what about these?
and what does this do as well
execute if score @s zombie_check matches 0 run summon minecraft:zombie ~ ~ ~
execute if score @s zombie_check matches 1 run summon minecraft:zombie_villager ~ ~ ~```
- Runs the
nb:convertprocfunction as and at all entities that have annp.timer2score of 21, and annp.timerscore that is 3599 or less - Runs the
nb:convertfunction as and at all entities with annp.timerscore of 3600 or more - Increments the
np.timerscore of all entities that have theconverttag and anp.timerscore of 3599 or less - Increments the
np.timer2score of all entities that have theconverttag and annp.timer2score that is 20 or less
i dont ese the timer going up tho
- This line has incorrect syntax
- Summons a Zombie at the executing position if the executing entity's
zombie_checkscore is 0 - Summons a Zombie Villager at the executing position if the executing entity's
zombie_checkscore is 1
How are you testing this?
how would i fix the incorrect syntax
i have the scoreboard displayed on the side
What do you want it to do?
OK, but what are you doing to try and test it?
well spawn a random zombie pretty much
So you want it to randomly select between 0 and 1, so that the next two lines spawn either a Zombie or a Zombie Villager. Correct?
clickking on the zombie piglin with a piglin tear to run the function convertstart
yes
but the zombie villager needs to be as rare as they r currently
execute store result score @s zombie_check run random value 0..1
It's currently 50/50, is that not what you want?
so that does the same thing? as scoreboard players random @s zombie_check 0 1
So start by confirming if that function is even running
It actually works, so no, it doesn't do the same thing
Good, so lets see that function then
execute as @a if predicate nb:holding_piglin_tear run tag @n[type=minecraft:zombified_piglin,distance=..5] add convert
clear @s minecraft:carrot_on_a_stick[minecraft:item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
tag @s remove using_piglin_tear
particle minecraft:soul ~ ~0.8 ~ 0.25 0.5 0.25 0.01 15 normal
playsound entity.zombie_villager.cure master @a ~ ~ ~
scoreboard players set @s np.timer 1
scoreboard players set @s np.timer2 1
say convertstart ran```
And how does this function get run?
.
But how specifically
enchantments
"description": "Trigger when looking at a zombified piglin",
"supported_items": "minecraft:carrot_on_a_stick",
"weight": 1,
"max_level": 1,
"min_cost": {
"base": 0,
"per_level_above_first": 0
},
"max_cost": {
"base": 0,
"per_level_above_first": 0
},
"anvil_cost": 0,
"slots": [
"mainhand"
],
"effects": {
"minecraft:tick": [
{
"requirements": {
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type_specific": {
"type": "minecraft:player",
"looking_at": {
"type": "minecraft:zombified_piglin"
}
}
}
},
"effect": {
"type": "minecraft:run_function",
"function": "nb:execute"
}
}
]
}
}
execute if entity @e[type=minecraft:zombified_piglin,distance=..1,limit=3] run execute as @a[scores={nb.rc_coas=1..}] if items entity @s weapon.mainhand carrot_on_a_stick[custom_data~{item:"piglin_tear"}] run function nb:convertstart
scoreboard players reset @a[scores={nb.rc_coas=1..}] nb.rc_coas```
Great
what?
That explains how the function gets run
ok
Why are you checking if the player is holding a piglin tear a second time? You already check that in the execute function, right?
um
¯_(ツ)_/¯
How do you not know what your code does?
idk
If you don't know what you've written or what it's supposed to do, I don't know how you expect us to help
i do
kind of
So answer this question
idk why i did that.. ive been playing all day 😭
OK, that's okay. But you are checking for the Piglin Tear in the execute function, yes?
i could remove it and see what it does
Well certainly remove it, but it's probably not going to change much yet
yes and addign the tag
I'm just trying to simplify so that it's easier to find the actual issue
But the tag isn't necessary because it's just to easily confirm the player is holding a tear, which already gets checked
so the updated version is
execute run tag @n[type=minecraft:zombified_piglin,distance=..5] add convert
clear @s minecraft:carrot_on_a_stick[minecraft:item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
tag @s remove using_piglin_tear
particle minecraft:soul ~ ~0.8 ~ 0.25 0.5 0.25 0.01 15 normal
playsound entity.zombie_villager.cure master @a ~ ~ ~
scoreboard players set @s np.timer 1
scoreboard players set @s np.timer2 1
say convertstart ran```
No, you don't need that first line at all
ohh
And therefore you don't need to remove the tag later down
Ultimately those things weren't breaking anything, they just weren't necessary. What's left after that?
what do u mean whats left?
What does the function look like now...
ohh
clear @s minecraft:carrot_on_a_stick[minecraft:item_model="lf:piglin_tear",custom_data={item:"piglin_tear"}]
particle minecraft:soul ~ ~0.8 ~ 0.25 0.5 0.25 0.01 15 normal
playsound entity.zombie_villager.cure master @a ~ ~ ~
scoreboard players set @s np.timer 1
scoreboard players set @s np.timer2 1
say convertstart ran```
Alright, that first line doesn't need the execute run, it can just start with the tag
Again, not broken, but not necessary
When the function gets run, is it successfully clearing the Piglin Tear?
yes
Great
So everything here looks fine. Does the Zombified Piglin have the convert tag?
letme check
yes
OK, then I think I see the issue
You're currently checking if the entity tagged with convert has a score less than 3599, but when an entity doesn't have a score assigned, that is not the same as that score being 0, so its np.timer score is never less than 3599, and so never increases
What you need to do is, in your tick function, instead of checking if the score is less than 3599, have it run the command/function unless the score is 3600 or more
so change this line right? execute as @e[tag=convert,scores={np.timer=..3599}] run scoreboard players add @s np.timer 1
Correct, but also probably this one in the same way
execute as @e[scores={np.timer2=21,np.timer=..3599}] at @s run function nb:convertproc
wait im confued how would i run it unless the score?
So right now you're checking the score in the target selector, but instead, you can just check the tag, and then do unless score ...
Or in the case of this line, forgo the target selector arguments altogether
/execute as @e[tag=convert] unless score 3599 np.timer matches 3500
Try writing it in-game to see what the expected syntax is
thats wht im doing thats why theres a /
💀
unless score <entity> <score> matches <value>
And don't forget to do 3600.. to make it 3600 or more
You can do @s here because you're already doing @e[...] first
@s means "the thing this command is being executed as"
so /execute as @e[tag=convert] unless score @s 3599 matches 3600..
Still a mistake there
where
Try and spot it
.. after the 3599?
You have the entity, and you have the value you're trying to compare it to. What is missing? What does the command need to know?
@s[tag=convert]?
Stop randomly guessing and actually put some thought into what you are writing and why
If you don't understand, ask, don't guess
well i dont understamd
understand
What do you not understand?
well
pretty much the whole command 😂
...
What about the rest of it isn't clear
Don't say all of it
What do you follow, and where do you get lost
the score part
like what does unless score do?
then what does 3599 matches 3600.. do
3599 matches 3600.. does nothing
helpful
Because 3599 isn't a scoreboard you have created
There ya go
Do you understand why you needed to make that change?
From 3599 to np.timer?
forgot i also needed to change execute as @e[scores={np.timer2=21,np.timer=..3599}] at @s run function nb:convertproc
The syntax for the command is unless score <entity> <scoreboard> matches <value>. You were checking the entity correctly, and you knew what value you wanted to check, but the command also needs to know which scoreboard of the entity you want to compare to the value. You had written 3599, but that isn't a scoreboard
You'll do that in pretty much the same way, you just won't need the [tag=convert] part
Does this make sense?
sort of
Well you're gonna need to get good at understanding that, because it's one of the simpler parts of data packing
I can't teach you problem solving skills
wait what am i doing with execute as @e[scores={np.timer2=21,np.timer=..3599}] at @s run function nb:convertproc again?
I can only present the information with which to problem solve
same thing?
Basically the same thing we just did.
As I have now said thrice
Why do you think you would do something completely different than what we just did?
i feel stupid
/execute unless score @s np.timer2 matches 3600.. run function nb:convertproc
right?
@robust cypress
Very close, you're missing the as @e at the beginning
/execute as @e unless score @s np.timer2 matches 3600.. run function nb:convertproc
type=zombiepiglin?
or just @e ?
It would be better for performance to include a type=zombie_piglin check, yes. It's not necessary for it to work, but it will make a big difference for how much your data pack slows down the game
heres the final one /execute as @e[type=minecraft:zombified_piglin] unless score @s np.timer2 matches 3600.. run function nb:convertproc (hopefully)
how do i know if its working or not
@robust cypress
Please have any chill
Did you test it yet?
idk how to test it
Technically, it would be even better to have your tick function just have a single line execute as @e[type=zombified_piglin] at @s run function ..., and then that function can contain all the same commands currently in your tick function, but just using @s. Right now I would say it's not necessary as you're learning, but if you're going to get into any more sophisticated behavior with this data pack, it would be a very good idea
Just try using the tear in a zombie Piglin??????????
Like?
Great
how is that great 😭 we want it to only run if u use the piglin tear on the zombie piglin
The zombified Piglin already has the convert tag, because you used the tear on it earlier
So it's working fine
i killed it
so it doesnt have covnert tag anymore
Ok, so what happens when you spawn a new zombified Piglin?
this
Well convertproc is getting run as all zombified piglins
So yeah, that's normal
Is that not what you want?
no?
It's what you had before, it just wasn't working
i only want it to run as the one u use the piglin tear on
where
in what function
In the command that runs the function
so before i do
scoreboard players set @s np.timer 1
scoreboard players set @s np.timer2 1
check for the covnert tag?
convert*
Nope
what then
Think: where does the convertproc function get run?
ohj
Or another way, what command runs the convertproc function?
tick functuon?
There ya go
so before this check for the conver tag?
execute as @e[type=minecraft:zombified_piglin] unless score @s np.timer2 matches 3600.. run function nb:convertproc
/execute as @e[type=minecraft:zombified_piglin,tags=convert] unless score @s np.timer2 matches 3600.. run function nb:convertproc becomes a invalid command tho
Yep, your syntax is wrong
💀
Pay attention to what you have written and where the error says the problem is
Compare to other similar commands
/execute as @e[type=minecraft:zombified_piglin,tag=convert] unless score @s np.timer2 matches 3600.. run function nb:convertproc
that?
i mean it says it not invalid
so ima test it
works
so im cofnuesd
how would i make convertproc run convert?
without saying function run
I don't understand
cuz im the old datapack im looking at it didnt use function run
This is fine, yes
I don't get it
heres the old datapack
tick function (its acually called main but im calling it tick now)
scoreboard players add @e[scores={np.timer=1..}] np.timer 1
scoreboard players add @e[scores={np.timer2=1..}] np.timer2 1
execute as @e[scores={np.timer2=21,np.timer=..3599}] at @s run function np:convertproc
execute as @e[scores={np.timer=3600..}] at @s run function np:convert```
load function
```scoreboard objectives add np.timer dummy
scoreboard objectives add np.timer2 dummy```
convert start
```kill @e[type=item,nbt={Item:{id:"minecraft:golden_carrot",Count:1b}},distance=..1]
particle minecraft:soul ~ ~0.8 ~ 0.25 0.5 0.25 0.01 15 normal
playsound entity.zombie_villager.cure master @a ~ ~ ~
scoreboard players set @s np.timer 1
scoreboard players set @s np.timer2 1```
convert proc
```particle minecraft:instant_effect ~ ~1 ~ 0.5 0.5 0.5 5 5 normal
scoreboard players set @s np.timer2 1```
convert
```tp @s ~ ~-500 ~
summon villager ~ ~ ~
particle minecraft:poof ~ ~0.75 ~ 0.25 0.5 0.25 0.1 25 normal
playsound minecraft:block.lava.extinguish master @a ~ ~ ~```
thats what im looking at
whjen i say old datapack
I don't see how this matters remotely at all to what we're doing right now
i want it to take between 3600 and 6000 ticks to transform the piglin then run the function convert
how would i do this
What do you have so far to try and make that happen?
in convertproc?
scoreboard players set @s np.timer2 1
say convertproc ran```
also i want that particle to keep playing at the piglin
as long as its converting
so how wouldi do it?
execute as @e[type=minecraft:zombified_piglin,tag=convert] run particle minecraft:instant_effect ~ ~1 ~ 0.5 0.5 0.5 5 5 normal doesnt seem to work
just plays it at me
Convertproc should already be executing as and at the Piglin, based on your tick function
Which means this should indeed be playing particles at the Piglin starting 3600 ticks after the tear is used
how
Take a look at the particle command syntax
https://www.youtube.com/shorts/jFXqw7aqO3o is this outdated?
Making Particles in circle shapes has never been so easy!
All you need to do is summon a marker in the centre of the circle like so: summon minecraft:marker ~ ~ ~ {Tags:["particles"]}
Then, in a repeating and chain command block, put the following commands: execute as @e[tag=particles] at @s run tp @s ~ ~ ~ ~10 ~
then: execute as @e[tag=particle...
doesnt seem to work
execute as @e[tag=particles] at @s run tp @s ~ ~ ~ ~10 ~
execute as @e[tag=particles] at @s run particle flame ^ ^ ^1 0 0 0 0 1
thats in convertproc
why what
Why do you want this, and why did you put it in that function?
to play particles why its converting?
would look cool i think
but idk til i see it
Don't try it
why not
It's going to spawn thousands of marker entities
well i can kil @ e type=marker
if it doesnt work
pretty much a circle around the piglin
or if u can think of something better
I literally don't care. I was genuinely trying to help you make something that works at all
But I'm out of patience
well this then
using minecraft:soul_fire_flame

execute as @e[tag=magmaslime_placed] at @s unless block ~ ~ ~ slime_block run function nb:break
#The stuff for converting the zombie piglin
execute as @e[tag=convert] unless score @s np.timer matches 3600..
execute as @e[tag=convert,scores={np.timer2=..20}] run scoreboard players add @s np.timer2 1
execute as @e[type=minecraft:zombified_piglin,tag=convert] unless score @s np.timer2 matches 3600.. run function nb:convertproc
execute as @e[scores={np.timer=3600..}] at @s run function nb:convert```
why is convert not running?
@robust cypress ?
@primal palm ?
someone?
@weak scaffold please just create a function that runs and spawns the particles relative to the executor. Then run it as the piglin that is converting. You can test/modify by the particles by first having a command block as executor.
and as suggested, for your own help, have each function that doesn't run every tick start with something like:
say Starting function_name
This helps you see which functions are called when.