Skip to content

Instantly share code, notes, and snippets.

@gnembon
Last active April 24, 2024 14:21
Show Gist options
  • Save gnembon/256538acb59eb4eeea8205aaa0905599 to your computer and use it in GitHub Desktop.
Save gnembon/256538acb59eb4eeea8205aaa0905599 to your computer and use it in GitHub Desktop.
How to use vanilla /tick if you used carpet /tick before

So /tick is now available in vanilla. Well, most of it is. Obviously only one could exist at a time, meaning /tick from carpet is gone, so here is the gist... mhm... of what happened, what is covered, what is lost and what might not be lost forever. This is not a writeup from a Mojang developer, it's a writeup from a mod developer whose part of the mod just got obsolete by a gaming studio.

The good

/tick on its own, as a query command, is moved to vanilla /tick query providing much more information about the health of the game tick. Tick performance and tick targets are also now way better handled in F3 and especially F3+2 screens, but if you are not in singleplayer or run the server with your game, a better information directly from the server through /tick query may come in handy.

/tick rate <rate> now exists as a vanilla command. It is limited on the lower end to 1 tps (not 0.1 tps like in carpet) to get a more responsive chat (the only reason so far tbh), but due to improvements to how tick is handled, the high end has been opened up much wider. Vanilla now handles tick times in nanoseconds, not milliseconds as before, so as long as you have the beef, you can technically run the game as fast as you want. I guess we will be exploring the limits of it through bug reports on MoJira. Thankfully it’s a debug command, if you crash the game with it, it is most likely your conscious decision and I will be happy to slap a Won't Fix or WhAI on things like that. Jokes aside - it is definitely a command to use to crash, but also a command to create things with. You can crash the server with /stop, or crash the client with F3+C, or little [x] in the corner - works 100% of the time. Power and responsibility is yours, as they say, and that's good have than don't have it. The game at low TPS also behaves like having smoothClientAnimations set to true cause that was a choice with a far less janky result at the end. I believe you can still adjust it with carpet, but I may fix it at some point in vanilla entirely by always ticking players at 20 tps no matter what (but that's way more significant change, not sure if that would even work).

/tick freeze is now done in a way less janky way as well. Functionally behaves the same, but more things should be properly frozen, rendered frozen, when the game gets frozen. It is now NOT a toggle - to de-frost the game now you need to use /tick unfreeze to have an explicit on and off switch for the freezing. Functionally (for tech players) this all should make no difference, with a few issues that existed in carpet fixed, like riding stuff while the game is frozen. /tick freeze off is essentially now /tick unfreeze and /tick freeze status is merged with /tick query.

/tick step <n> works as before, but properly fails when you try to run it without the game being frozen first. you can also cancel current stepping with /tick step stop. You can also specify the time in terms of irl seconds and in-game days, like the /time command. Don't even try to do the math on how many in-game seconds are in an irl second - there is no point.

/tick warp <n>, the crowds pleaser... is gone… and replaced with /tick sprint <n>. You can still stop it mid-flight, this time with /tick sprint stop. Unlike in the carpet equivalent, it is better integrated with the rest of the tick command. Running a sprint of a frozen game - de-frosts it for the time of the sprint, refreezing it back when its done. Pressing <ESC> now also properly suspends the freeze.

/tick health and /tick entities still exist, just now the alias in the profile command /profile health and /profile entities is not an alias anymore, but a permanent home for carpet lightweight profiler

The bad

Tail command for /tick warp <n> say hi is gone. If you don't know what I am talking about - that's good, you probably belong to 99% of the carpet audience not knowing anything about its existence. If you need to run something with a delay, find some other way or maybe pair with some /script run schedule(100, _() -> run('say hi')) or something like that. You have got options.

/tick freeze deep is gone. Didn't meet the vanilla quality bar (is that a new type of Halloween candy?). Deep freeze should prevent all chunk actions allowing players to fly freely without loading / unloading of absolutely anything in the game. Maybe we will get there at some point. Not for now.

/tick superHot - well. It’s gone too. It may go back somehow, we will see. Lemme know if you really miss it or not. Drop me a msg on discord if you already got to here: do you miss it being cut (for now, at least) or you couldn't care less.

The ugly

/tick command now requires admin privileges (level 3). This means primarily that you can't run from commandblocks and functions. If you used it in datapacks, or functions, too bad I guess. Maybe you would be able to access it with scarpet by adjusting commandScriptACE and wrapping it with some custom scarpet commands - no guarantees - didn't test that yet, should work just fine (TM).

[EDIT] it does work and indeed it is ugly. It is also safe, since first two commands require you to have level 3, which you have in your singleplayer world.

/carpet commandScriptACE 3
/script run freeze() -> run('tick freeze')
/script invoke freeze
  • by setting /carpet commandScriptACE 3 we increase the permission level required for commandblocks to run /script run from 2 to 3, but we also raise the permission level of scarpet run(...) API to 3 as well. This means we cannot use /script run in commandblocks anymore, but we can still use /script invoke
  • we define a user defined function that freezes the game with /script run freeze() -> run('tick freeze') - this lets anyone with op permission to call it (including command blocks) with invoke
  • we put script invoke freeze inside a command block. This calls a previously defined function with elevated permissions, allowing to freeze the game. Since blocks are frozen, no other command can be triggered from commandblocks that rely on block updates. That's some of the reasons why /tick should not be allowed in commandblocks.

smoothClientAnimations is now flipped and true by default. Flipping it false should allow you to get the old choppy experience at low tps, which is now not the default one.

@Fabian42
Copy link

Dedicated servers can set function permission level, so that way it could be used in datapacks, but still not command blocks.

@ncolyer11
Copy link

what's the benefit of adding tick unfreeze and removing the toggle? seems like it just adds an extra keypress now

@WaterGenie35
Copy link

freeze/unfreeze is idempotent now :)
This should be a welcome change once we give it time and look back on it in the future imo
commands like gamerules weren't toggles either, I'd imagine that would be extremely annoying to work with
Its frequency of use does warrant a toggle though, that I do 100% agree with, but there's always the option of adding a toggle command specifically for it and keep the actual non-toggle verbs for non-toggle actions

@ncolyer11
Copy link

an additional toggle command would be lovely yes please ^

@CygnusGD
Copy link

/tick command now requires admin privileges (level 3). This means primarily that you can't run from commandblocks and functions.

Are there any plans to change this in carpet or vanilla?

@SuperLlama88888
Copy link

W-will this be added to Bedrock? sniffs

@MasterBroNetwork
Copy link

W-will this be added to Bedrock? sniffs

Bedrock has a similar system but it's a dev command called /simscale if I recall correctly, It might, It might not, Just wait and see.

@SAOBunk
Copy link

SAOBunk commented Oct 26, 2023

Are you able to comment at all on the reasoning behind not allowing the execution of the tick command from command blocks?

@sakura-ryoko
Copy link

So I have to ask: Did you implement it in vanilla yourself by chance? Perhaps moving some commonly used Carpet functionality into Vanilla?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment