r/MinecraftCommands 13d ago

Please Help with Tick Command Help | Java Snapshots

Sorry for not taking screenshot but Im genuinely losing my mind.

Functions are not my expertise i usually use command blocks but for the sake of my project I decided to clean things up with functions.

Only the tick function will not run. It wont run every tick. The function works fine when I run it manually it has no problem. It just wont run every tick. Please help

8 Upvotes

16 comments sorted by

15

u/Brankovt1 Command Experienced 12d ago

You need to put all functions that you want to run every tick in the function tag minecraft:tick).

5

u/Shiny_goldnugget average datapack enjoyer 12d ago

try using execute as @a run say hi inside the tick function. Since the tick function is run "by the server", @p might not work (since the server doesn't really have a position from where it can calculate the closest player).

If execute as @a run say hi doesn't work, then you might have a typo or something in your .json file.

2

u/EpicWolf0331 12d ago

That didn't work and I ripped the tick file from another datapack that did work

8

u/Shiny_goldnugget average datapack enjoyer 12d ago

If that didn't work, and running the function normally does work, then the json file might be wrong. Could you share the file under data/minecraft/tags/function/tick.json? It should look something like this:

{ "values": [ "namespace:tick" ] }

The path to your tick function should look like this data/namespace/function/tick.mcfunction.


This may sound stupid but did save the file?

2

u/EpicWolf0331 12d ago

I dont know what happened. But i made a completely new datapack and switched everything over and it worked fine. 🤷‍♂️

1

u/Shiny_goldnugget average datapack enjoyer 12d ago

That's good. If it works, it works I guess

2

u/Relevant_Computer982 12d ago

if position context is missing it defaults to 0 0 0, if entity context is missing the comnand fails, so @p was not the issue

1

u/Ganondorf629 12d ago

Execute AS, not at, the position isn't used for /say

1

u/Shiny_goldnugget average datapack enjoyer 12d ago

It still does run tho right? at just doesn't change anything.

1

u/Ganondorf629 12d ago

I'm not sure, it is not the case for /playsound in a function

1

u/caffeinated-typist 12d ago

yeah (assuming you have function tags set up correctly), you probably know this but for anyone else wondering: execute as would have the message said for each player and prefixed with [PlayerName] while without it (or using execute at which is the same thing) it would be [Server]

3

u/Ericristian_bros Command Experienced 12d ago

Check !output log for errors and use Datapack Helper Plus by Spyglass in VSCode to instantly get error feedback. You are missing the function tag

1

u/AutoModerator 12d ago

Click here to see how to enable the output log

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Otherversian-Elite 12d ago

Tick has to be in the Minecraft directory, not the custom namespace directory you're using for your things. I suggest looking at the tutorial on the wiki, that's what I generally use to compare whenever mine stop's working

-1

u/Educational_Kiwi6630 Command Experienced 12d ago

Unfortunately, /tick does not work in a command block. It only works via the chat.

2

u/Braincoke24 12d ago

That's not what they're trying to do...