
Deltatime
Keep track of the real time even on laggy servers (uses the worldborder method)
- Загрузки
- 682
- Подписчики
- 1
- Обновлён
- 25 июня 2024 г.
- Лицензия
- GPL-3.0-or-later
Опубликован 11 апреля 2024 г.
WARNING!
- this pack was designed to be used with Multi world border mod
- if you don't use this mod, you need to adjust the minimal diameter of the worldborder in the datapack (decreasing accuracy) to avoid getting unexpected worldborder damage
Scoreboard values
Scoreboard objective: deltatime
- tickdelta -> previous tick duration (defaultly in milliseconds) (maxes out at 10 seconds by default)
- tickstoadd -> number to add to a counter, which you don't want to be affected by lags (more info below on how to use it effectively)
- accuracy <- the accuracy of the timings (defaults to 1000 -> milliseconds)
- for even more accuracy, you need to edit this datapack's worldborder's minimal values
- for even even more accuracy, you need to use my mod with the same name
How to use tickstoadd
example:
scoreboard players operation untilactionprev objective = untilaction objective
scoreboard players operation untilaction objective -= tickstoadd deltatime
execute if score untilaction objective matches ..20 unless score untilactionprev objective matches ..20 run function my:action1
execute if score untilaction objective matches ..0 unless score untilactionprev objective matches ..0 run function my:action2
- In this example, we are trying to run "function my:action2" after "untilaction objective" ticks run and a "function my:action1" 1 second before it.
- If we want to make it independant of server performance, we need to add a larger number of ticks to the counter, if the server lags.
- This means that there is a possibility that the counter jumps over the 20 or 0.
- In order to prevent the actions from not executing, we need to have another variable, which tells us the tickcount before the tickstoadd get added (subtracted). Then we need to check if the previous count is higher than our desired value and the current count is exactly or less than our desired value.
If you just want to time one action, you can just check for ..0 without the helper variable
(note that if you set the counter to a lower/higher (according to the direction of counting) value while the counter is counting and you won't also change the previous count, it will execute everything in between the previous and current value)
How does the datapack work?
- worldborder in minecraft does not time itself based on ticks but on real seconds
- this makes it possible to calculate the time by changing the border's size with a set duration
- the next tick just get the border's size and calculate how much time passed based on how much has the border changed
Also check out the mod version for even better accuracy! (although even less maintained)
Центр версий
4 версийЧенджлог
0.0.3Альфа1.21 · 25 июня 2024 г.
- adjusted max worldborder and default accuracy to further improve precision
0.0.2Альфа1.21 · 23 июня 2024 г.
- rewrote the logic
- default accuracy is now 1000
- the datapack makes a new dimension where it changes the worldborder (you need to have the multiworldborder mod for this to work properly!)
- the info function now returns 1 so it essentially works as a check if the datapack is loaded
- updated to 1.21 - no plans to backport
0.0.1Альфа1.20.2, 1.20.3, 1.20.4 · 11 апреля 2024 г.
fixed the actual thing... changed the worldborder sizes because of precision problems and changed the default accuracy
Комментарии
Загружаем…