#Tick function not working

1 messages · Page 1 of 1 (latest)

silk root
#

I've been upgrading a 1.20.4 pack of mine to 1.21, and for some reason the tick function will not work. Could someone help me with the issue?

nimble houndBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

silk root
warm talonBOT
#
Updating Datapacks Past 1.21

1.21 renamed many folders that make up a Minecraft datapack, breaking virtually all datapacks from prior versions. Now, all folders which previously had plural names, except tags, now have singular names.
Below is a list of all folder names changed in 1.21:
structures -> structure
advancements -> advancement
recipes -> recipe
loot_tables -> loot_table
predicates -> predicate
item_modifiers -> item_modifier
functions -> function
tags/functions -> tags/function
tags/items -> tags/item
tags/blocks -> tags/block
tags/entity_types -> tags/entity_type
tags/fluids -> tags/fluid
tags/game_events -> tags/game_event

vernal ingot
#

If you use items anywhere in your pack, you will also have to update them to the new component system which replaces NBT for items

silk root
#

yeah i did that for some of them

#

i shortened functions to function

#

& all the other thigns

#

i updated all the things

#

the tick function still doesnt owrk

short jetty
#

Can you please show us your tick function?

silk root
#

ill js send it

#

like it appears

#

when doing /function phazics:tick

#

but its not happening every tick

short jetty
#

Ah, let's see the tick function tag then

silk root
#

i can send the whole pack if neccessary

short jetty
#

I'd rather you didn't, at this moment

#

Have you checked the logs?

silk root
#

not atm

short jetty
#

Let's start there

silk root
#

What should I be looking for?

short jetty
#

Any errors or warnings related to your pack or functions

silk root
#

not that i see

#

Yeah no issues

short jetty
#

Have you tried putting a say command in your tick function?

silk root
#

yep

short jetty
#

And?

silk root
#

It doesn't work

short jetty
#

Hm

#

You're sure this pack is the one you're actually testing in-game with? You didn't leave it on your desktop or something?

silk root
#

nope

short jetty
#

Then there's not really a reason the tick function wouldn't be running 🤷‍♂️ Your tag is correct, your folders are correct, there's no syntax error

silk root
#

huh

#

thats strange

#

when i do /reload the init function works

open sequoia
#

I know Kano said not to, but could you send the pack?

#

I'm sure it's something dumb and silly.

silk root
#

thats not how it is in the folder btw

#

its js the folder w/ the data & pack.mcmeta

silk root
#

@open sequoia

open sequoia
#

I'm looking through it rn

silk root
#

alr mb

#

sorry to bother

open sequoia
#

It's probably because you are checking for item nbt, but in 1.21 you need to use components.

silk root
#

oh

#

so

open sequoia
#

I'm guessing these commands would throw an error if you tried to run them in the chat.

silk root
#

how would i fix that easily

short jetty
#

But the function shows up when they use /function

silk root
#

^^^

#

yea and i deleted all of them

open sequoia
#

Hmm

silk root
#

and when i did

short jetty
#

I would have thought the same thing but if it were a syntax error preventing the whole thing from running, it shouldn't appear in chat at all

silk root
#

i added a /say command

#

and it still didnt work

open sequoia
#

I loaded the pack in a new world, and it works perfectly fine

silk root
#

interesting

open sequoia
#

Have you tried restarting the world?

silk root
#

maybe something wrong with my world

#

just did

open sequoia
#

Does it work?

silk root
#

nope

#

ill create a new world

open sequoia
#

Yes, good idea.

silk root
#

nah

#

still doesnt work

open sequoia
#

Okay, this may sound stupid, but are you on the right Minecraft version?

silk root
#

yep

#

1.21

open sequoia
#

Any mods?

silk root
#

lunar client

short jetty
#

Could be that, Lunar is super weird

open sequoia
#

Try in vanilla

silk root
#

yeah ill try it in vanilla

#

nope

#

doesnt work

#

im on 1.21

#

When I try and do the /function phazics:dagger_craft (when holding should give you speed) it doesn't work. No mods, correct version, right nbt things & right items

#

The folder is in the datapacks folder

short jetty
#

We're not worried about that right now, the tick function is what's important

silk root
#

Yes, but I used that to test if the tick function was working

short jetty
#

Well don't, cause it's not gonna work regardless 😅

silk root
#

and I updated the components via McStacker

short jetty
#

Ah, if you already did that then let's see what you have

silk root
#

wait

#

i got it to work

#

with /say hi

short jetty
#

There we go, so the tick function is working

silk root
#

now how would i update this

#

execute as @a[nbt={Inventory:[{Slot:103b,id:"minecraft:leather_helmet",tag:{dragon:1b}}]}] at @s run function phazics:dragon/effect

#

to the new component system

short jetty
#

I thought you said you did already? 😅

silk root
#

for the /give things

#

i did

short jetty
#

I see

#

So tag doesn't exist anymore on items

silk root
#

ok

#

thank you both btw ❤️

short jetty
#

The dragon:1b, if you converted it correctly, is now inside the custom data component, so you'll need to check the path components:{"minecraft:custom_data":{dragon:1b}}

silk root
#

ok

short jetty
#

That's from memory so it may not be 100% accurate

#

But I'd also recommend changing this to an execute if items ... command, as that'll make it even easier to check the components of the item in that slot, or indeed, use a predicate

#

That's also not to mention that optimizing your tick function will not only improve performance, but make updating most everything a lot easier for you

silk root
#

wasn't really focusing on optimizitation

#

just getting it done

short jetty
#

Once you're familiar with the concepts, writing optimized code is actually a lot lazier 😄

silk root
#

alr

#

alr i figured it out

#

thank you guys so much

nimble houndBOT
# silk root alr i figured it out
🎗️ Is your question resolved?

If your question is resolved, that's great to hear! Make sure to run /resolve or click the Resolve Question button. Otherwise, feel free to continue asking for help! :D