net.runelite.api.DecorativeObject Java Examples

The following examples show how to use net.runelite.api.DecorativeObject. 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 6 votes vote down vote up
private void renderDecorObject(Graphics2D graphics, Tile tile, Player player)
{
	DecorativeObject decorObject = tile.getDecorativeObject();
	if (decorObject != null)
	{
		if (player.getLocalLocation().distanceTo(decorObject.getLocalLocation()) <= MAX_DISTANCE)
		{
			OverlayUtil.renderTileOverlay(graphics, decorObject, "ID: " + decorObject.getId(), DEEP_PURPLE);
		}

		Shape p = decorObject.getConvexHull();
		if (p != null)
		{
			graphics.draw(p);
		}

		p = decorObject.getConvexHull2();
		if (p != null)
		{
			graphics.draw(p);
		}
	}
}
 
Example #2
Source File: DevToolsOverlay.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void renderDecorObject(Graphics2D graphics, Tile tile, Player player)
{
	DecorativeObject decorObject = tile.getDecorativeObject();
	if (decorObject != null)
	{
		if (player.getLocalLocation().distanceTo(decorObject.getLocalLocation()) <= MAX_DISTANCE)
		{
			OverlayUtil.renderTileOverlay(graphics, decorObject, "ID: " + decorObject.getId(), DEEP_PURPLE);
		}

		Shape p = decorObject.getConvexHull();
		if (p != null)
		{
			graphics.draw(p);
		}

		p = decorObject.getConvexHull2();
		if (p != null)
		{
			graphics.draw(p);
		}
	}
}
 
Example #3
Source File: AbyssOverlay.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public Dimension render(Graphics2D graphics)
{
	if (config.showRifts() && config.showClickBox())
	{
		for (DecorativeObject object : plugin.getAbyssObjects())
		{
			renderRift(graphics, object);
		}
	}

	if (config.hightlightDarkMage())
	{
		highlightDarkMage(graphics);
	}

	return null;
}
 
Example #4
Source File: AbyssOverlay.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Dimension render(Graphics2D graphics)
{
	if (config.showRifts())
	{
		for (DecorativeObject object : plugin.getAbyssObjects())
		{
			renderRift(graphics, object);
		}
	}

	if (config.hightlightDarkMage())
	{
		highlightDarkMage(graphics);
	}

	return null;
}
 
Example #5
Source File: AbyssOverlay.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
private void renderRift(Graphics2D graphics, DecorativeObject object)
{
	AbyssRifts rift = AbyssRifts.getRift(object.getId());
	if (rift == null || !plugin.getRifts().contains(rift))
	{
		return;
	}

	Point mousePosition = client.getMouseCanvasPosition();
	Shape objectClickbox = object.getClickbox();
	if (objectClickbox != null)
	{
		if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY()))
		{
			graphics.setColor(Color.MAGENTA.darker());
		}
		else
		{
			graphics.setColor(Color.MAGENTA);
		}
		graphics.draw(objectClickbox);
		graphics.setColor(new Color(255, 0, 255, 20));
		graphics.fill(objectClickbox);
	}
}
 
Example #6
Source File: ExtUtils.java    From ExternalPlugins with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
public TileObject findNearestObject(int... ids)
{
	GameObject gameObject = findNearestGameObject(ids);

	if (gameObject != null)
	{
		return gameObject;
	}

	WallObject wallObject = findNearestWallObject(ids);

	if (wallObject != null)
	{
		return wallObject;
	}
	DecorativeObject decorativeObject = findNearestDecorObject(ids);

	if (decorativeObject != null)
	{
		return decorativeObject;
	}

	return findNearestGroundObject(ids);
}
 
Example #7
Source File: AbyssOverlay.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void renderRift(Graphics2D graphics, DecorativeObject object)
{
	AbyssRifts rift = AbyssRifts.getRift(object.getId());
	if (rift == null || !plugin.getRifts().contains(rift))
	{
		return;
	}

	Point mousePosition = client.getMouseCanvasPosition();
	Shape objectClickbox = object.getClickbox();
	if (objectClickbox != null)
	{
		if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY()))
		{
			graphics.setColor(Color.MAGENTA.darker());
		}
		else
		{
			graphics.setColor(Color.MAGENTA);
		}
		graphics.draw(objectClickbox);
		graphics.setColor(new Color(255, 0, 255, 20));
		graphics.fill(objectClickbox);
	}
}
 
Example #8
Source File: RunecraftPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
{
	DecorativeObject decorativeObject = event.getDecorativeObject();
	if (AbyssRifts.getRift(decorativeObject.getId()) != null)
	{
		abyssObjects.add(decorativeObject);
	}
}
 
Example #9
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 #10
Source File: TearsOfGuthixPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
{
	if (streams.isEmpty())
	{
		return;
	}

	DecorativeObject object = event.getDecorativeObject();
	streams.remove(object);
}
 
Example #11
Source File: TearsOfGuthixPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
{
	DecorativeObject object = event.getDecorativeObject();

	if (event.getDecorativeObject().getId() == ObjectID.BLUE_TEARS ||
		event.getDecorativeObject().getId() == ObjectID.BLUE_TEARS_6665)
	{
		if (client.getLocalPlayer().getWorldLocation().getRegionID() == TOG_REGION)
		{
			streams.put(event.getDecorativeObject(), Instant.now());
		}
	}
}
 
Example #12
Source File: PohPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
{
	DecorativeObject decorativeObject = event.getDecorativeObject();
	if (PohIcons.getIcon(decorativeObject.getId()) != null)
	{
		pohObjects.put(decorativeObject, event.getTile());
	}
}
 
Example #13
Source File: ExtUtils.java    From ExternalPlugins with GNU General Public License v3.0 5 votes vote down vote up
public List<DecorativeObject> getDecorObjects(int... ids)
{
	assert client.isClientThread();

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

	return new DecorativeObjectQuery()
		.idEquals(ids)
		.result(client)
		.list;
}
 
Example #14
Source File: ExtUtils.java    From ExternalPlugins with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
public DecorativeObject findNearestDecorObject(int... ids)
{
	assert client.isClientThread();

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

	return new DecorativeObjectQuery()
		.idEquals(ids)
		.result(client)
		.nearestTo(client.getLocalPlayer());
}
 
Example #15
Source File: AbyssMinimapOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Dimension render(Graphics2D graphics)
{
	if (!config.showRifts())
	{
		return null;
	}

	for (DecorativeObject object : plugin.getAbyssObjects())
	{
		AbyssRifts rift = AbyssRifts.getRift(object.getId());
		if (rift == null || !plugin.getRifts().contains(rift))
		{
			continue;
		}

		BufferedImage image = getImage(rift);
		Point miniMapImage = Perspective.getMiniMapImageLocation(client, object.getLocalLocation(), image);

		if (miniMapImage != null)
		{
			graphics.drawImage(image, miniMapImage.getX(), miniMapImage.getY(), null);
		}
	}

	return null;
}
 
Example #16
Source File: AbyssMinimapOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public Dimension render(Graphics2D graphics)
{
	if (!config.showRifts())
	{
		return null;
	}

	for (DecorativeObject object : plugin.getAbyssObjects())
	{
		AbyssRifts rift = AbyssRifts.getRift(object.getId());
		if (rift == null || !plugin.getRifts().contains(rift))
		{
			continue;
		}

		BufferedImage image = getImage(rift);
		Point miniMapImage = Perspective.getMiniMapImageLocation(client, object.getLocalLocation(), image);

		if (miniMapImage != null)
		{
			graphics.drawImage(image, miniMapImage.getX(), miniMapImage.getY(), null);
		}
	}

	return null;
}
 
Example #17
Source File: RunecraftPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
{
	final DecorativeObject decorativeObject = event.getDecorativeObject();
	if (AbyssRifts.getRift(decorativeObject.getId()) != null)
	{
		abyssObjects.add(decorativeObject);
	}
}
 
Example #18
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 #19
Source File: TearsOfGuthixPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
{
	if (streams.isEmpty())
	{
		return;
	}

	DecorativeObject object = event.getDecorativeObject();
	streams.remove(object);
}
 
Example #20
Source File: TearsOfGuthixPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
{
	DecorativeObject object = event.getDecorativeObject();

	if ((object.getId() == ObjectID.BLUE_TEARS ||
		object.getId() == ObjectID.BLUE_TEARS_6665) &&
		client.getLocalPlayer().getWorldLocation().getRegionID() == TOG_REGION)
	{
		streams.put(event.getDecorativeObject(), Instant.now());
	}
}
 
Example #21
Source File: PohPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
{
	DecorativeObject decorativeObject = event.getDecorativeObject();
	if (PohIcons.getIcon(decorativeObject.getId()) != null)
	{
		pohObjects.put(decorativeObject, event.getTile());
	}
}
 
Example #22
Source File: RunecraftPlugin.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Subscribe
public void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
{
	DecorativeObject decorativeObject = event.getDecorativeObject();
	abyssObjects.remove(decorativeObject);
}
 
Example #23
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);
		}
	}
}
 
Example #24
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 #25
Source File: PohPlugin.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Subscribe
public void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
{
	DecorativeObject decorativeObject = event.getDecorativeObject();
	pohObjects.remove(decorativeObject);
}
 
Example #26
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 #27
Source File: RunecraftPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
private void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
{
	final DecorativeObject decorativeObject = event.getDecorativeObject();
	abyssObjects.remove(decorativeObject);
}
 
Example #28
Source File: PohPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
private void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
{
	DecorativeObject decorativeObject = event.getDecorativeObject();
	pohObjects.remove(decorativeObject);
}