We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32b9c1f commit 9e7df33Copy full SHA for 9e7df33
scripts/tick-event/index.js
@@ -1,3 +1,6 @@
1
+// Script examples for ScriptAPI
2
+// Author: Jayly#1397 <Jayly Discord>
3
+
4
import { system, TickEvent } from "@minecraft/server";
5
6
let lastTick = NaN;
@@ -9,6 +12,7 @@ const callbacks = [];
9
12
system.runInterval(() => {
10
13
const { currentTick } = system;
11
14
const deltaTime = (Date.now() - lastTick) / 1000;
15
+ lastTick = Date.now();
16
17
for (const callback of callbacks) {
18
callback({ deltaTime, currentTick });
@@ -32,4 +36,4 @@ export class TickEventSignal {
32
36
}
33
37
};
34
38
35
-export const tick = new TickEventSignal();
39
+export const tick = new TickEventSignal();
0 commit comments