diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java index 093fa17d88..1cb4a729a8 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java @@ -76,6 +76,9 @@ public abstract class RSTileMixin implements RSTile @Shadow("clientInstance") private static RSClient client; + @Inject + private static RSGameObject lastGameObject; + @Inject private static RSDeque[][][] lastGroundItems = new RSDeque[Constants.MAX_Z][Constants.SCENE_SIZE][Constants.SCENE_SIZE]; @@ -234,12 +237,26 @@ public abstract class RSTileMixin implements RSTile // Update previous object to current previousGameObjects[idx] = current; + // Last game object + RSGameObject last = lastGameObject; + + // Update last game object + lastGameObject = current; + // Duplicate event, return if (current == previous) { return; } + if (current != null && current == last) + { + // When >1 tile objects are added to the scene, the same GameObject is added to + // multiple tiles. We keep lastGameObject to prevent duplicate spawn events from + // firing for these objects. + return; + } + // actors, projectiles, and graphics objects are added and removed from the scene each frame as GameObjects, // so ignore them. boolean currentInvalid = false, prevInvalid = false;