Update game tick event to run after packets have been processed

This commit is contained in:
WooxSolo
2018-04-08 16:29:47 -04:00
committed by Adam
parent acf3233d4a
commit 06ad69bda7

View File

@@ -95,9 +95,16 @@ public class Hooks
private static Graphics2D stretchedGraphics;
private static long lastCheck;
private static boolean shouldProcessGameTick;
public static void clientMainLoop(Client client, boolean arg1)
{
if (shouldProcessGameTick)
{
shouldProcessGameTick = false;
eventBus.post(tick);
}
clientThread.invoke();
long now = System.currentTimeMillis();
@@ -403,7 +410,10 @@ public class Hooks
public static void onNpcUpdate(boolean var0, PacketBuffer var1)
{
eventBus.post(tick);
// The NPC update event seem to run every server tick,
// but having the game tick event after all packets
// have been processed is typically more useful.
shouldProcessGameTick = true;
}
public static void onSetCombatInfo(Actor actor, int combatInfoId, int gameCycle, int var3, int var4, int healthRatio, int health)