From 06ad69bda789e89d045aaf2bca572ffba68007af Mon Sep 17 00:00:00 2001 From: WooxSolo Date: Sun, 8 Apr 2018 16:29:47 -0400 Subject: [PATCH] Update game tick event to run after packets have been processed --- .../java/net/runelite/client/callback/Hooks.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java b/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java index 459ac6e3d6..eccf79c46e 100644 --- a/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java +++ b/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java @@ -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)