GameEventManager: Simulate Actor spawn events

This commit is contained in:
Jordan Atwood
2018-10-12 10:27:02 -07:00
parent b0fbc09013
commit d0464f71b4

View File

@@ -37,7 +37,9 @@ import net.runelite.api.GameState;
import net.runelite.api.InventoryID; import net.runelite.api.InventoryID;
import net.runelite.api.Item; import net.runelite.api.Item;
import net.runelite.api.ItemContainer; import net.runelite.api.ItemContainer;
import net.runelite.api.NPC;
import net.runelite.api.Node; import net.runelite.api.Node;
import net.runelite.api.Player;
import net.runelite.api.Scene; import net.runelite.api.Scene;
import net.runelite.api.Tile; import net.runelite.api.Tile;
import net.runelite.api.events.DecorativeObjectSpawned; import net.runelite.api.events.DecorativeObjectSpawned;
@@ -45,6 +47,8 @@ import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GroundObjectSpawned; import net.runelite.api.events.GroundObjectSpawned;
import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.ItemSpawned; import net.runelite.api.events.ItemSpawned;
import net.runelite.api.events.NpcSpawned;
import net.runelite.api.events.PlayerSpawned;
import net.runelite.api.events.WallObjectSpawned; import net.runelite.api.events.WallObjectSpawned;
@Singleton @Singleton
@@ -113,6 +117,24 @@ public class GameEventManager
} }
} }
for (NPC npc : client.getCachedNPCs())
{
if (npc != null)
{
final NpcSpawned npcSpawned = new NpcSpawned(npc);
eventBus.post(npcSpawned);
}
}
for (Player player : client.getCachedPlayers())
{
if (player != null)
{
final PlayerSpawned playerSpawned = new PlayerSpawned(player);
eventBus.post(playerSpawned);
}
}
forEachTile((tile) -> forEachTile((tile) ->
{ {
Optional.ofNullable(tile.getWallObject()).ifPresent(object -> Optional.ofNullable(tile.getWallObject()).ifPresent(object ->