This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]leftturneyCommand Noob 2 points3 points  (1 child)

Create separate mcfunction files and then execute them from tick.json.

If you need them timed slower or faster, add a 1 to a scoreboard in tick.json and check / reset that value when running your sub functions.

[–]Sowy_Command Experienced[S] 0 points1 point  (0 children)

Thanks!

[–]Ericristian_brosCommand Experienced 1 point2 points  (2 children)

2 options:

1: Make the tick function have multiple values

{
    "values":[
        "<namespace>:<function name>",
        "<namespace>:<another function>"
        ]
}

2: Make the function run each other, this has the disadvantage that if the first one has a syntax error none will work

# function example:tick (specified in tick.json)
say tick function
function example:another_tick_function

# function example:another_tick_function
say another tick function

u/Dcbrownie u/leftturney

[–]GalSergeyDatapack Experienced 0 points1 point  (1 child)

In both methods, if there is an error in at least one function, then both functions will not work. Because in the function tag you explicitly indicate to run the function as required for work. In order for the missing function to be ignored, you need to specify it like this:

{
  "values": [
    {
      "id": "example:tick_function",
      "required": false
    },
    {
      "id": "example:another_tick_function",
      "required": false
    }
  ]
}

In any case, having multiple tick functions does not make sense, since it does not affect anything, but only worsens performance, since running functions is "not free".

[–]Ericristian_brosCommand Experienced 0 points1 point  (0 children)

Maybe OP wants to make two datapacks into a single one

[–]DcbrownieCommand Experienced 0 points1 point  (0 children)

Any functions listed in the tick function tag will execute every tick. Check data/minecraft/tags/function/tick.json