Rename Point3D to WorldPoint

This commit is contained in:
Max Weber
2018-03-08 00:57:20 -07:00
parent 5e887ed11c
commit 6f9b855520
5 changed files with 33 additions and 18 deletions

View File

@@ -30,18 +30,18 @@ import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.Getter;
import net.runelite.api.Point3D;
import net.runelite.api.coords.WorldPoint;
class Bookcase
{
public Bookcase(Point3D location)
public Bookcase(WorldPoint location)
{
this.location = location;
this.index = new ArrayList<>();
}
@Getter
private final Point3D location;
private final WorldPoint location;
@Getter
private final List<Integer> index;
@@ -99,7 +99,7 @@ class Bookcase
b.append(" ");
switch (location.getZ())
switch (location.getPlane())
{
case 0:
b.append("ground floor");

View File

@@ -40,7 +40,7 @@ import net.runelite.api.Client;
import net.runelite.api.Perspective;
import net.runelite.api.Player;
import net.runelite.api.Point;
import net.runelite.api.Point3D;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
@@ -93,7 +93,7 @@ public class KourendLibraryOverlay extends Overlay
for (Bookcase bookcase : allBookcases)
{
// AABB
Point3D caseLoc = bookcase.getLocation();
WorldPoint caseLoc = bookcase.getLocation();
if (Math.abs(playerLoc.getX() - caseLoc.getX()) > MAXIMUM_DISTANCE
|| Math.abs(playerLoc.getY() - caseLoc.getY()) > MAXIMUM_DISTANCE)
{
@@ -101,7 +101,7 @@ public class KourendLibraryOverlay extends Overlay
}
Point localBookcase = Perspective.worldToLocal(client, caseLoc.toPoint());
Point screenBookcase = Perspective.worldToCanvas(client, localBookcase.getX(), localBookcase.getY(), caseLoc.getZ(), 25);
Point screenBookcase = Perspective.worldToCanvas(client, localBookcase.getX(), localBookcase.getY(), caseLoc.getPlane(), 25);
if (screenBookcase != null)
{

View File

@@ -37,7 +37,7 @@ import net.runelite.api.Client;
import net.runelite.api.MenuAction;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.Point3D;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.AnimationChanged;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameTick;
@@ -73,8 +73,8 @@ public class KourendLibraryPlugin extends Plugin
private KourendLibraryPanel panel;
private NavigationButton navButton;
private Point3D lastBookcaseClick = null;
private Point3D lastBookcaseAnimatedOn = null;
private WorldPoint lastBookcaseClick = null;
private WorldPoint lastBookcaseAnimatedOn = null;
@Override
protected void startUp() throws Exception
@@ -115,7 +115,7 @@ public class KourendLibraryPlugin extends Plugin
if (MenuAction.GAME_OBJECT_FIRST_OPTION == menuOpt.getMenuAction() && menuOpt.getMenuTarget().contains("Bookshelf"))
{
Point worldPoint = Perspective.regionToWorld(client, new Point(menuOpt.getId() & 127, menuOpt.getId() >> 7 & 127));
lastBookcaseClick = new Point3D(worldPoint.getX(), worldPoint.getY(), client.getPlane());
lastBookcaseClick = new WorldPoint(worldPoint.getX(), worldPoint.getY(), client.getPlane());
}
}

View File

@@ -35,7 +35,7 @@ import java.util.stream.IntStream;
import javax.inject.Singleton;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Point3D;
import net.runelite.api.coords.WorldPoint;
import static net.runelite.client.plugins.kourendlibrary.Book.*;
@@ -59,7 +59,7 @@ import static net.runelite.client.plugins.kourendlibrary.Book.*;
@Slf4j
public class Library
{
private final Map<Point3D, Bookcase> byPoint = new HashMap<>();
private final Map<WorldPoint, Bookcase> byPoint = new HashMap<>();
private final Map<Integer, ArrayList<Bookcase>> byLevel = new HashMap<>();
private final List<Bookcase> byIndex = new ArrayList<>();
@@ -110,7 +110,7 @@ public class Library
log.info("Library is now reset");
}
public synchronized void mark(Point3D loc, Book book)
public synchronized void mark(WorldPoint loc, Book book)
{
Bookcase bookcase = byPoint.get(loc);
if (bookcase == null)
@@ -428,7 +428,7 @@ public class Library
private void add(int x, int y, int z, int i)
{
// 'i' is added as a parameter for readability
Point3D p = new Point3D(x, y, z);
WorldPoint p = new WorldPoint(x, y, z);
Bookcase b = byPoint.get(p);
if (b == null)
{