Java Code Examples for net.runelite.api.GameObject#getEntity()

The following examples show how to use net.runelite.api.GameObject#getEntity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZalcanoUtil.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
GameObject getGlowingRock()
{
	for (GameObject gameObject : getGameObjects())
	{
		if (gameObject != null)
		{
			if (gameObject.getId() == ObjectID.ROCK_FORMATION_GLOWING)
			{
				if (client.getLocalPlayer().getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= 2400)
				{
					Entity entity = gameObject.getEntity();
					if (entity instanceof DynamicObject)
					{
						if (((DynamicObject) entity).getAnimationID() == AnimationID.ZALCANO_ROCK_GLOWING)
						{
							return gameObject;
						}
					}
				}
			}
		}
	}
	return null;
}
 
Example 2
Source File: ZalcanoUtil.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
List<GameObject> getRedSymbols()
{
	List<GameObject> list = new ArrayList<>();
	for (GameObject gameObject : getGameObjects())
	{
		if (gameObject != null)
		{
			if (gameObject.getId() == ObjectID.DEMONIC_SYMBOL)
			{
				if (client.getLocalPlayer().getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= 2400)
				{
					Entity entity = gameObject.getEntity();
					if (entity instanceof DynamicObject)
					{
						list.add(gameObject);
					}
				}
			}
		}
	}
	return list.size() > 0 ? list : null;
}
 
Example 3
Source File: DevToolsOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void renderGameObjects(Graphics2D graphics, Tile tile, Player player)
{
	GameObject[] gameObjects = tile.getGameObjects();
	if (gameObjects != null)
	{
		for (GameObject gameObject : gameObjects)
		{
			if (gameObject != null)
			{
				if (player.getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= MAX_DISTANCE)
				{
					Entity entity = gameObject.getEntity();
					if (entity instanceof DynamicObject)
					{
						OverlayUtil.renderTileOverlay(graphics, gameObject, "ID: " + gameObject.getId() + " Anim: " + ((DynamicObject) entity).getAnimationID(), TURQOISE);
					}
					else
					{
						OverlayUtil.renderTileOverlay(graphics, gameObject, "ID: " + gameObject.getId(), GREEN);
					}
				}

				// Draw a polygon around the convex hull
				// of the model vertices
				Shape p = gameObject.getConvexHull();
				if (p != null)
				{
					graphics.draw(p);
				}
				// This is incredibly taxing to run, only uncomment if you know what you're doing.
				/*renderGameObjectWireframe(graphics, gameObject, Color.CYAN);*/
			}
		}
	}
}
 
Example 4
Source File: SceneUploader.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
private void reset(Tile tile)
{
	Tile bridge = tile.getBridge();
	if (bridge != null)
	{
		reset(bridge);
	}

	TilePaint sceneTilePaint = tile.getTilePaint();
	if (sceneTilePaint != null)
	{
		sceneTilePaint.setBufferOffset(-1);
	}

	TileModel sceneTileModel = tile.getTileModel();
	if (sceneTileModel != null)
	{
		sceneTileModel.setBufferOffset(-1);
	}

	WallObject wallObject = tile.getWallObject();
	if (wallObject != null)
	{
		if (wallObject.getEntity1() instanceof Model)
		{
			((Model) wallObject.getEntity1()).setBufferOffset(-1);
		}
		if (wallObject.getEntity2() instanceof Model)
		{
			((Model) wallObject.getEntity2()).setBufferOffset(-1);
		}
	}

	GroundObject groundObject = tile.getGroundObject();
	if (groundObject != null)
	{
		if (groundObject.getEntity() instanceof Model)
		{
			((Model) groundObject.getEntity()).setBufferOffset(-1);
		}
	}

	DecorativeObject decorativeObject = tile.getDecorativeObject();
	if (decorativeObject != null)
	{
		if (decorativeObject.getEntity1() instanceof Model)
		{
			((Model) decorativeObject.getEntity1()).setBufferOffset(-1);
		}
	}

	GameObject[] gameObjects = tile.getGameObjects();
	for (GameObject gameObject : gameObjects)
	{
		if (gameObject == null)
		{
			continue;
		}
		if (gameObject.getEntity() instanceof Model)
		{
			((Model) gameObject.getEntity()).setBufferOffset(-1);
		}
	}
}