#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)

weak scaffold
#

converts to a zombie (chance of it being a zombie villager) and a pig
also kills the pigman

mossy templeBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 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

weak scaffold
#

does the item need to be a carrot on a stick instead of a ghast tear?

#

i think it might

mossy templeBOT
# mossy temple <@&1201956957406109788>

<@&1166082198152159386> <@&1202694677766348840>

🙇 Helpers Arise!

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)

short sunBOT
weak scaffold
unborn minnow
#

Depends which method of right click detection you use

robust cypress
#

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

weak scaffold
#

wtf its not even letting me open the world

#

stuck at loading 100%

#

hehhh????

unborn minnow
#

Did you accidentally make a recursive function that runs itself forever

unborn minnow
#

Do the logs say anything

weak scaffold
#

letme check

#

no

#

ok i fixed it

#

anwyays

#

back to what we were doing

weak scaffold
#

can it be any item?

unborn minnow
#

No, it's an entity

weak scaffold
#

so how does it work

unborn minnow
#

Like a mob

weak scaffold
#

so u dont use any item?

unborn minnow
#

It's a type of mob which does something when you right click it

weak scaffold
#

ohhh

unborn minnow
#

You want one of the other three options

#

I recommend carrot on a stick

weak scaffold
#

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

short sunBOT
weak scaffold
#

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

unborn minnow
#

Try out the guide and if you get stuck on something then ask

weak scaffold
#

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

unborn minnow
#

yea

weak scaffold
#

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"]

unborn minnow
#

did you create the scoreboard?

weak scaffold
#

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

unborn minnow
#

did you run /reload

weak scaffold
#

yes

unborn minnow
#

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

weak scaffold
#

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"]

unborn minnow
#

that's the item model

weak scaffold
#

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

unborn minnow
#

You can if you want but generally that's considered bad practise

weak scaffold
#

how?

unborn minnow
unborn minnow
#

although for smaller packs tis not a massive issue

weak scaffold
#

/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?

unborn minnow
#

yeah

weak scaffold
#

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"}]

unborn minnow
#

you need to include lf: before it

weak scaffold
#

oh

unborn minnow
#

wait

#

no you dont

#

cuz you changed it in the execute command too

#

did you give yourself the new item to test it

weak scaffold
#

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

#

😳

unborn minnow
#

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

weak scaffold
#

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 ?

weak scaffold
#

someone pls tell me how to give a tag to a mob

naive ginkgo
#

what would you expect it to do?

weak scaffold
#

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

naive ginkgo
#

which version of minecraft is this by the way?

weak scaffold
naive ginkgo
#

in that case, if you want to select the nearest entity use @n[...] saves you writing limit=1,sort=nearest

weak scaffold
#

where do i use @n?

naive ginkgo
#

instead of having the piglin tag itself, how about you just call tag from the executor

weak scaffold
#

huh

naive ginkgo
#

you use @n instead of any @e[limit=1,sort=nearest]

weak scaffold
#

but i want it to work in multiplayer

#

and @n wil target the nearest player

naive ginkgo
#

no, it will target nearest entity

weak scaffold
#

ohh

naive ginkgo
#

@n[type=zombified_piglin] nearest zombie piglin

weak scaffold
#

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?

naive ginkgo
#

no?

weak scaffold
#

?

#

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

naive ginkgo
#

read again, use @n instead of @e with any sort=nearest,limit=1 restriction.

naive ginkgo
#

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

weak scaffold
#

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

naive ginkgo
#

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.

weak scaffold
naive ginkgo
#

you are on 1.21.5 so you have access

weak scaffold
#

idk what it is tho

#

😳

naive ginkgo
#

it allows custom enchantments

weak scaffold
#

so?

#

how does that help lol

#

?

naive ginkgo
#

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"
                }
            }
        ]
    }
}```
Minecraft Wiki

Enchantments are stored as JSON files within a data pack in the path data/<namespace>/enchantment.

naive ginkgo
#

Above enchantment, activates when a player is holding this item in the hands and looking at a zombified piglin

naive ginkgo
#

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

weak scaffold
#

wait

naive ginkgo
#

The above has some unfished spots that need changing (you can remove the glint and probably want to change the name)

weak scaffold
#

i wont beable to get this enchantment from a enchanting table right?

#

cuz i can see supported items

naive ginkgo
#

You can enable/disable this

weak scaffold
#

how

#

also what should i name the file

naive ginkgo
#

Load it up in the misode website

weak scaffold
#

k

naive ginkgo
#

you can name it like any other datapack file, lowercase_no_whitespaces

weak scaffold
naive ginkgo
#

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.

weak scaffold
#

so u wont get it from the table with the current code u gave me?

naive ginkgo
#

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.

weak scaffold
#

nice

naive ginkgo
weak scaffold
#

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

naive ginkgo
#

on the piglin tear you can set the custom component enchantment_glint_override:false

naive ginkgo
#

depends on the means of obtaining them item

weak scaffold
# naive ginkgo 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

naive ginkgo
#

give @s some_item[enchantment_glint_override=false,enchantments=...]
etc.

weak scaffold
naive ginkgo
#

I am not sure if this can properly disable the enchantment description

naive ginkgo
#

the same way you add any other component in your current code

weak scaffold
#

/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

naive ginkgo
#

sorry my bad, it should be = not :

weak scaffold
#

i dotn ese a name

#

i dont see a name

#

in the code

naive ginkgo
#

the name of the enchantment should be the name of the file it is in

weak scaffold
#

ohh

naive ginkgo
#

you can check if it exists using the /enchant command

#

enchantments have one drawback

weak scaffold
#

/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

naive ginkgo
#

you have to restart your world before they show

weak scaffold
#

oh yeah

#

still doesnt reload

#

i mean

#

still doesnt work after i reloaded

naive ginkgo
#
Minecraft Wiki

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...

weak scaffold
#

/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"}]

naive ginkgo
#

enchantments={your_namespace:lookingat_piglin:1} etc. I have to go now however.

weak scaffold
naive ginkgo
#

I recommend you ensure the enchantment exists when you use /enchant command. namespace is required!

weak scaffold
#

/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

weak scaffold
#

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"}]

naive ginkgo
#

this means your enchantment hasn't loaded

#

enchantments require a full world reboot

weak scaffold
#

ohh

naive ginkgo
#

reloading does not work

weak scaffold
#

💀

naive ginkgo
#

yes

weak scaffold
#

is that a bad thing

#

what if thye disable custom enchaments lol

#

then my world stops working

naive ginkgo
#

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

weak scaffold
#

k

#

it sees the enchantment with the enchant command

#

but the commmand dopesn work

weak scaffold
#

maybe cuz it doesnt support it?

naive ginkgo
#

very well possible, the enchantment i gave was for swords

weak scaffold
#

how do i make it support it

naive ginkgo
#

check supported_item tags, check the output log and check for errors

#

good luck

weak scaffold
#

nvm i had to remove the #

weak scaffold
#

ok fixed it thanks to the minecraft discord Prayge
/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 ?

unborn minnow
#

Can you explain your problem concisely so we can help because it's difficult to read through loads of messages

weak scaffold
weak scaffold
#

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```
unborn minnow
#

What do you need the enchantment for

weak scaffold
#

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

unborn minnow
#

although I am busy do

mossy templeBOT
#

Psst, <@&1166082198152159386>!

weak scaffold
#

im confused

unborn minnow
unborn minnow
# weak scaffold so what do i do

I don't really have time to explain but you need to use components:{"minecraft:component_name":{<component value>} instead of tag

weak scaffold
#

how do i get the component name

robust cypress
#

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

weak scaffold
#

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

robust cypress
#

It is legitimately really hard to help you when you just throw walls of code at us

robust cypress
#

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

weak scaffold
#

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

robust cypress
weak scaffold
#

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 ~ ~ ~```
robust cypress
# weak scaffold execute as @e[scores={np.timer2=21,np.timer=..3599}] at @s run function nb:conve...
  1. Runs the nb:convertproc function as and at all entities that have an np.timer2 score of 21, and an np.timer score that is 3599 or less
  2. Runs the nb:convert function as and at all entities with an np.timer score of 3600 or more
  3. Increments the np.timer score of all entities that have the convert tag and a np.timer score of 3599 or less
  4. Increments the np.timer2 score of all entities that have the convert tag and an np.timer2 score that is 20 or less
weak scaffold
robust cypress
robust cypress
weak scaffold
weak scaffold
robust cypress
robust cypress
weak scaffold
robust cypress
weak scaffold
weak scaffold
#

but the zombie villager needs to be as rare as they r currently

robust cypress
robust cypress
weak scaffold
robust cypress
robust cypress
weak scaffold
#

huh

#

oh

#

lol

#

funny

robust cypress
weak scaffold
# robust cypress 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```
robust cypress
#

And how does this function get run?

robust cypress
#

But how specifically

weak scaffold
#
  "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```
robust cypress
#

Great

weak scaffold
#

what?

robust cypress
#

That explains how the function gets run

weak scaffold
#

ok

robust cypress
robust cypress
#

How do you not know what your code does?

weak scaffold
robust cypress
#

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

weak scaffold
robust cypress
#

OK, that's okay. But you are checking for the Piglin Tear in the execute function, yes?

weak scaffold
#

i could remove it and see what it does

robust cypress
#

Well certainly remove it, but it's probably not going to change much yet

robust cypress
#

I'm just trying to simplify so that it's easier to find the actual issue

robust cypress
weak scaffold
#

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```
robust cypress
#

No, you don't need that first line at all

weak scaffold
#

ohh

robust cypress
#

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?

robust cypress
#

What does the function look like now...

weak scaffold
#

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```
robust cypress
#

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?

robust cypress
#

Great

#

So everything here looks fine. Does the Zombified Piglin have the convert tag?

weak scaffold
#

letme check

robust cypress
#

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

weak scaffold
robust cypress
#

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

weak scaffold
robust cypress
#

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 ...

robust cypress
weak scaffold
#

/execute unless score 3599 np.timer matches 3500

#

so that?

robust cypress
#

Close, you still want to do as @e[tag=convert] first

#

And the syntax is way off

weak scaffold
#

/execute as @e[tag=convert] unless score 3599 np.timer matches 3500

robust cypress
#

Try writing it in-game to see what the expected syntax is

weak scaffold
robust cypress
#

Well you're not paying attention then

#

Cause that's not right

weak scaffold
#

💀

robust cypress
#

unless score <entity> <score> matches <value>

#

And don't forget to do 3600.. to make it 3600 or more

weak scaffold
#

as the entity

robust cypress
#

You can do @s here because you're already doing @e[...] first

#

@s means "the thing this command is being executed as"

weak scaffold
#

so /execute as @e[tag=convert] unless score @s 3599 matches 3600..

robust cypress
#

Still a mistake there

weak scaffold
#

where

robust cypress
#

Try and spot it

weak scaffold
#

.. after the 3599?

robust cypress
#

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?

weak scaffold
#

@s[tag=convert]?

robust cypress
#

No

#

It needs to know what scoreboard it's checking.

weak scaffold
#

😭

#

oh

robust cypress
#

Stop randomly guessing and actually put some thought into what you are writing and why

#

If you don't understand, ask, don't guess

weak scaffold
#

understand

robust cypress
#

What do you not understand?

weak scaffold
weak scaffold
robust cypress
#

...

weak scaffold
#

i understand the excute as @e tho

#

i think

robust cypress
#

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

weak scaffold
robust cypress
#

Elaborate

#

Use whole sentences

weak scaffold
#

then what does 3599 matches 3600.. do

robust cypress
#

3599 matches 3600.. does nothing

weak scaffold
#

helpful

robust cypress
#

Because 3599 isn't a scoreboard you have created

weak scaffold
#

oh

#

so

#

/execute as @e[tag=convert] unless score @s np.timer matches 3600..

robust cypress
#

There ya go

weak scaffold
#

gotta rememeber what im even relacing now lol

#

its been so long

robust cypress
#

Do you understand why you needed to make that change?

robust cypress
#

From 3599 to np.timer?

weak scaffold
#

forgot i also needed to change execute as @e[scores={np.timer2=21,np.timer=..3599}] at @s run function nb:convertproc

robust cypress
#

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

robust cypress
weak scaffold
robust cypress
#

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

weak scaffold
#

wait what am i doing with execute as @e[scores={np.timer2=21,np.timer=..3599}] at @s run function nb:convertproc again?

robust cypress
#

I can only present the information with which to problem solve

weak scaffold
#

same thing?

robust cypress
weak scaffold
#

k

#

ill try

robust cypress
#

As I have now said thrice

weak scaffold
#

im having ahard time figuring out it 😳

#

/execute as @e[scores= maybe?

robust cypress
#

Why do you think you would do something completely different than what we just did?

weak scaffold
#

i feel stupid

#

/execute unless score @s np.timer2 matches 3600.. run function nb:convertproc

#

right?

#

@robust cypress

robust cypress
#

Very close, you're missing the as @e at the beginning

weak scaffold
#

type=zombiepiglin?

#

or just @e ?

robust cypress
#

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

weak scaffold
#

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

robust cypress
#

Please have any chill

robust cypress
weak scaffold
robust cypress
# robust cypress It would be better for performance to include a `type=zombie_piglin` check, yes....

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

robust cypress
#

Like?

weak scaffold
#

oh

#

it works and i didnt even use the tear wtf

robust cypress
#

Great

weak scaffold
# robust cypress Great

how is that great 😭 we want it to only run if u use the piglin tear on the zombie piglin

robust cypress
#

The zombified Piglin already has the convert tag, because you used the tear on it earlier

#

So it's working fine

weak scaffold
#

so it doesnt have covnert tag anymore

robust cypress
#

Ok, so what happens when you spawn a new zombified Piglin?

robust cypress
#

Well convertproc is getting run as all zombified piglins

#

So yeah, that's normal

#

Is that not what you want?

weak scaffold
#

no?

robust cypress
#

It's what you had before, it just wasn't working

weak scaffold
#

i only want it to run as the one u use the piglin tear on

robust cypress
#

What should it be running as?

#

So then it needs to check for the convert tag

weak scaffold
#

in what function

robust cypress
#

In the command that runs the function

weak scaffold
#

so before i do
scoreboard players set @s np.timer 1
scoreboard players set @s np.timer2 1
check for the covnert tag?

#

convert*

robust cypress
#

Nope

weak scaffold
#

what then

robust cypress
#

Think: where does the convertproc function get run?

weak scaffold
#

ohj

robust cypress
#

Or another way, what command runs the convertproc function?

weak scaffold
#

tick functuon?

robust cypress
#

There ya go

weak scaffold
#

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

robust cypress
#

In the same place you're checking the type

#

Check the type and the tag

weak scaffold
#

/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

robust cypress
#

Yep, your syntax is wrong

weak scaffold
#

💀

robust cypress
#

Pay attention to what you have written and where the error says the problem is

#

Compare to other similar commands

weak scaffold
#

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

robust cypress
weak scaffold
robust cypress
weak scaffold
# robust cypress 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

robust cypress
#

I don't see how this matters remotely at all to what we're doing right now

weak scaffold
#

i want it to take between 3600 and 6000 ticks to transform the piglin then run the function convert

robust cypress
#

Again, do not throw walls of code at me

#

It is not an acceptable way to get help

robust cypress
#

What do you have so far to try and make that happen?

weak scaffold
#

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

robust cypress
#

Convertproc should already be executing as and at the Piglin, based on your tick function

robust cypress
weak scaffold
#

so um

#

i think this is a bit too many paritcles

#

😳

robust cypress
#

How is that my problem?

#

Reduce it

weak scaffold
#

how

robust cypress
#

Take a look at the particle command syntax

weak scaffold
# robust cypress Take a look at the particle command syntax

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...

▶ Play video
#

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

robust cypress
#

I

#

Why?

weak scaffold
robust cypress
#

Why do you want this, and why did you put it in that function?

weak scaffold
#

would look cool i think

#

but idk til i see it

robust cypress
#

Don't try it

weak scaffold
#

why not

robust cypress
#

It's going to spawn thousands of marker entities

weak scaffold
#

if it doesnt work

robust cypress
#

Fine, do what you want

#

My patience is exhausted

weak scaffold
#

or if u can think of something better

robust cypress
#

I literally don't care. I was genuinely trying to help you make something that works at all

#

But I'm out of patience

weak scaffold
#

using minecraft:soul_fire_flame

weak scaffold
#
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?

naive ginkgo
#

@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.