api: add on tick callback
This commit is contained in:
@@ -53,9 +53,14 @@ public interface Callbacks
|
||||
void postDeferred(Object event);
|
||||
|
||||
/**
|
||||
* Called each client cycle.
|
||||
* Called each tick
|
||||
*/
|
||||
void clientMainLoop();
|
||||
void tick();
|
||||
|
||||
/**
|
||||
* Called each frame
|
||||
*/
|
||||
void frame();
|
||||
|
||||
/**
|
||||
* Called after receiving update NPCs packet from server.
|
||||
|
||||
@@ -176,7 +176,7 @@ public class Hooks implements Callbacks
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientMainLoop()
|
||||
public void tick()
|
||||
{
|
||||
if (shouldProcessGameTick)
|
||||
{
|
||||
@@ -190,8 +190,6 @@ public class Hooks implements Callbacks
|
||||
client.setTickCount(tick + 1);
|
||||
}
|
||||
|
||||
eventBus.post(BEFORE_RENDER);
|
||||
|
||||
clientThread.invoke();
|
||||
|
||||
long now = System.nanoTime();
|
||||
@@ -221,6 +219,12 @@ public class Hooks implements Callbacks
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void frame()
|
||||
{
|
||||
eventBus.post(BEFORE_RENDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* When the world map opens it loads about ~100mb of data into memory, which
|
||||
* represents about half of the total memory allocated by the client.
|
||||
|
||||
Reference in New Issue
Block a user