net.runelite.api.GroundObject Java Examples

The following examples show how to use net.runelite.api.GroundObject. 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: DevToolsOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void renderGroundObject(Graphics2D graphics, Tile tile, Player player)
{
	GroundObject groundObject = tile.getGroundObject();
	if (groundObject != null)
	{
		if (player.getLocalLocation().distanceTo(groundObject.getLocalLocation()) <= MAX_DISTANCE)
		{
			OverlayUtil.renderTileOverlay(graphics, groundObject, "ID: " + groundObject.getId(), PURPLE);
		}
	}
}
 
Example #2
Source File: ObjectIndicatorsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private TileObject findTileObject(Tile tile, int id)
{
	if (tile == null)
	{
		return null;
	}

	final GameObject[] tileGameObjects = tile.getGameObjects();
	final DecorativeObject tileDecorativeObject = tile.getDecorativeObject();
	final WallObject tileWallObject = tile.getWallObject();
	final GroundObject groundObject = tile.getGroundObject();

	if (objectIdEquals(tileWallObject, id))
	{
		return tileWallObject;
	}

	if (objectIdEquals(tileDecorativeObject, id))
	{
		return tileDecorativeObject;
	}

	if (objectIdEquals(groundObject, id))
	{
		return groundObject;
	}

	for (GameObject object : tileGameObjects)
	{
		if (objectIdEquals(object, id))
		{
			return object;
		}
	}
	return null;
}
 
Example #3
Source File: TelekineticRoom.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void onGroundObjectSpawned(GroundObjectSpawned event)
{
	final GroundObject object = event.getGroundObject();
	if (object.getId() == TELEKINETIC_FINISH)
	{
		finishLocation = object.getWorldLocation();
	}
}
 
Example #4
Source File: ExtUtils.java    From ExternalPlugins with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
public GroundObject findNearestGroundObject(int... ids)
{
	assert client.isClientThread();

	if (client.getLocalPlayer() == null)
	{
		return null;
	}

	return new GroundObjectQuery()
		.idEquals(ids)
		.result(client)
		.nearestTo(client.getLocalPlayer());
}
 
Example #5
Source File: ExtUtils.java    From ExternalPlugins with GNU General Public License v3.0 5 votes vote down vote up
public List<GroundObject> getGroundObjects(int... ids)
{
	assert client.isClientThread();

	if (client.getLocalPlayer() == null)
	{
		return new ArrayList<>();
	}

	return new GroundObjectQuery()
		.idEquals(ids)
		.result(client)
		.list;
}
 
Example #6
Source File: DevToolsOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void renderGroundObject(Graphics2D graphics, Tile tile, Player player)
{
	GroundObject groundObject = tile.getGroundObject();
	if (groundObject != null)
	{
		if (player.getLocalLocation().distanceTo(groundObject.getLocalLocation()) <= MAX_DISTANCE)
		{
			OverlayUtil.renderTileOverlay(graphics, groundObject, "ID: " + groundObject.getId(), PURPLE);
		}
	}
}
 
Example #7
Source File: ObjectIndicatorsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private TileObject findTileObject(Tile tile, int id)
{
	if (tile == null)
	{
		return null;
	}

	final GameObject[] tileGameObjects = tile.getGameObjects();
	final DecorativeObject tileDecorativeObject = tile.getDecorativeObject();
	final WallObject tileWallObject = tile.getWallObject();
	final GroundObject groundObject = tile.getGroundObject();

	if (objectIdEquals(tileWallObject, id))
	{
		return tileWallObject;
	}

	if (objectIdEquals(tileDecorativeObject, id))
	{
		return tileDecorativeObject;
	}

	if (objectIdEquals(groundObject, id))
	{
		return groundObject;
	}

	for (GameObject object : tileGameObjects)
	{
		if (objectIdEquals(object, id))
		{
			return object;
		}
	}

	return null;
}
 
Example #8
Source File: TelekineticRoom.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGroundObjectSpawned(GroundObjectSpawned event)
{
	final GroundObject object = event.getGroundObject();
	if (object.getId() == TELEKINETIC_FINISH)
	{
		finishLocation = object.getWorldLocation();
	}
}
 
Example #9
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);
		}
	}
}
 
Example #10
Source File: ObjectIndicatorsOverlay.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public Dimension render(Graphics2D graphics)
{
	for (ColorTileObject colorTileObject : plugin.getObjects())
	{
		TileObject object = colorTileObject.getTileObject();
		Color color = colorTileObject.getColor();

		if (object.getPlane() != client.getPlane())
		{
			continue;
		}

		if (color == null || !config.rememberObjectColors())
		{
			// Fallback to the current config if the object is marked before the addition of multiple colors
			color = config.markerColor();
		}

		final Shape polygon;
		Shape polygon2 = null;

		if (object instanceof GameObject)
		{
			polygon = ((GameObject) object).getConvexHull();
		}
		else if (object instanceof WallObject)
		{
			polygon = ((WallObject) object).getConvexHull();
			polygon2 = ((WallObject) object).getConvexHull2();
		}
		else if (object instanceof DecorativeObject)
		{
			polygon = ((DecorativeObject) object).getConvexHull();
			polygon2 = ((DecorativeObject) object).getConvexHull2();
		}
		else if (object instanceof GroundObject)
		{
			polygon = ((GroundObject) object).getConvexHull();
		}
		else
		{
			polygon = object.getCanvasTilePoly();
		}

		if (polygon != null)
		{
			OverlayUtil.renderPolygon(graphics, polygon, color);
		}

		if (polygon2 != null)
		{
			OverlayUtil.renderPolygon(graphics, polygon2, color);
		}
	}

	return null;
}
 
Example #11
Source File: SceneUploader.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void reset(Tile tile)
{
	Tile bridge = tile.getBridge();
	if (bridge != null)
	{
		reset(bridge);
	}

	SceneTilePaint sceneTilePaint = tile.getSceneTilePaint();
	if (sceneTilePaint != null)
	{
		sceneTilePaint.setBufferOffset(-1);
	}

	SceneTileModel sceneTileModel = tile.getSceneTileModel();
	if (sceneTileModel != null)
	{
		sceneTileModel.setBufferOffset(-1);
	}

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

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

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

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