January 12, 20188 yr You could pre-define these doors (at least the ones you care about): public enum Door { // DEFINE DOORS HERE VARROCK_DOOR_A("Big door", 1000, 2000, 0), VARROCK_DOOR_B("Doory door", 2000, 3000, 1), FALADOR_DOOR_A("White door", 3000, 4000, 2), // etc. ; // OOP CODE HERE private final String name; private final int x; private final int y; private final int z; // -1 = ignore plane check private Door(String name, int x, int y, int z) { this.name = name; this.x = x; this.y = y; this.z. = z; } private Door(String name, int x, int y, int z) { this(name, x, y, -1); } @Override public String toString() { return String.format("[name=%s, x=%s, y=%s, z=%s]", name, x, y, z); } public boolean isDefined(RS2Object gameObject) { return gameObject.getName().equals(name) && gameObject.getX() == x && gameObject.getY() == y && (z == -1 || gameObject.getZ() == z); } // static methdo (it belongs to Door class, not instantiated Door objects) public static boolean isDefined(RS2Object gameObject) { boolean defined = false; for (Door door : values()) { if (door.isDefined(gameObject)) { defined = true; break; } } return defined; } } It's pretty verbose and isn't very future proof, but you can get very nitty-gritty with how exact it is the things you want to find are, then you can do: List<RS2Object> openableDoors = s.objects.getAll().stream().filter(Door::isDefined).collect(Collectors.toList()); With this, you don't necessarily need to search for the doors because the information about those doors are already defined. You'd only need to actually find those doors in-game when you intend to interact with them. (Also there might be problems because this is ad-hoc code I wrote in notepad) Edited January 12, 20188 yr by liverare
January 12, 20188 yr Author Quote You'd only need to actually find those doors in-game when you intend to interact with them. Thanks for the reply. But this was the actual problem where getAll() didn't find the predefined objects, though they were quire close.
Create an account or sign in to comment