Query: TileQuery (#2161)
* Adding tile query, updating tile to extend tileobject * adding copyright to retrigger CI * fixing checkstyle
This commit is contained in:
@@ -24,14 +24,12 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.api;
|
package net.runelite.api;
|
||||||
|
|
||||||
import net.runelite.api.coords.LocalPoint;
|
|
||||||
import net.runelite.api.coords.WorldPoint;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a tile in the game.
|
* Represents a tile in the game.
|
||||||
*/
|
*/
|
||||||
public interface Tile
|
public interface Tile extends TileObject
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Gets the decoration on the tile.
|
* Gets the decoration on the tile.
|
||||||
@@ -82,13 +80,6 @@ public interface Tile
|
|||||||
*/
|
*/
|
||||||
TileModel getTileModel();
|
TileModel getTileModel();
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the location coordinate of the tile in the world.
|
|
||||||
*
|
|
||||||
* @return the world location
|
|
||||||
*/
|
|
||||||
WorldPoint getWorldLocation();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the location coordinate of the tile in scene coords
|
* Gets the location coordinate of the tile in scene coords
|
||||||
*
|
*
|
||||||
@@ -96,20 +87,6 @@ public interface Tile
|
|||||||
*/
|
*/
|
||||||
Point getSceneLocation();
|
Point getSceneLocation();
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the local coordinate of the tile.
|
|
||||||
*
|
|
||||||
* @return the local location
|
|
||||||
*/
|
|
||||||
LocalPoint getLocalLocation();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the plane that this tile is on.
|
|
||||||
*
|
|
||||||
* @return the plane
|
|
||||||
*/
|
|
||||||
int getPlane();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plane this tile is rendered on, which is where the tile heights are from.
|
* Get the plane this tile is rendered on, which is where the tile heights are from.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
package net.runelite.api;
|
package net.runelite.api;
|
||||||
|
|
||||||
import net.runelite.api.coords.LocalPoint;
|
import net.runelite.api.coords.LocalPoint;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Polygon;
|
import java.awt.Polygon;
|
||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
@@ -65,10 +64,6 @@ public interface TileObject extends Locatable
|
|||||||
*/
|
*/
|
||||||
int getId();
|
int getId();
|
||||||
|
|
||||||
WorldPoint getWorldLocation();
|
|
||||||
|
|
||||||
LocalPoint getLocalLocation();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the position of the center of this tile on the canvas
|
* Calculates the position of the center of this tile on the canvas
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019, tha23rd <https://https://github.com/tha23rd>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.api.queries;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.LocatableQueryResults;
|
||||||
|
import net.runelite.api.Tile;
|
||||||
|
|
||||||
|
public class TileQuery extends TileObjectQuery<Tile, TileQuery>
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public LocatableQueryResults<Tile> result(Client client)
|
||||||
|
{
|
||||||
|
return new LocatableQueryResults<>(getTiles(client).stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(predicate)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user