From 82f5c21f4a77ed0f82029a82dc3da9a43b93420f Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 16 Aug 2018 15:14:00 -0700 Subject: [PATCH] whoops that didn't actually compile --- .../java/baritone/bot/pathing/calc/Path.java | 21 ++++++++++++++----- .../baritone/bot/pathing/path/CutoffPath.java | 6 +++--- .../java/baritone/bot/utils/PathRenderer.java | 3 ++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/main/java/baritone/bot/pathing/calc/Path.java b/src/main/java/baritone/bot/pathing/calc/Path.java index 982885a1..3df9e387 100644 --- a/src/main/java/baritone/bot/pathing/calc/Path.java +++ b/src/main/java/baritone/bot/pathing/calc/Path.java @@ -19,6 +19,7 @@ package baritone.bot.pathing.calc; import baritone.bot.pathing.movement.Movement; import baritone.bot.pathing.path.IPath; +import baritone.bot.utils.pathing.BetterBlockPos; import net.minecraft.util.math.BlockPos; import java.util.ArrayList; @@ -36,18 +37,18 @@ class Path implements IPath { /** * The start position of this path */ - final BlockPos start; + final BetterBlockPos start; /** * The end position of this path */ - final BlockPos end; + final BetterBlockPos end; /** * The blocks on the path. Guaranteed that path.get(0) equals start and * path.get(path.size()-1) equals end */ - final List path; + final List path; final List movements; @@ -74,7 +75,7 @@ class Path implements IPath { throw new IllegalStateException(); } PathNode current = end; - LinkedList tempPath = new LinkedList<>(); // Repeatedly inserting to the beginning of an arraylist is O(n^2) + LinkedList tempPath = new LinkedList<>(); // Repeatedly inserting to the beginning of an arraylist is O(n^2) LinkedList tempMovements = new LinkedList<>(); // Instead, do it into a linked list, then convert at the end while (!current.equals(start)) { tempPath.addFirst(current.pos); @@ -121,7 +122,7 @@ class Path implements IPath { } @Override - public List positions() { + public List positions() { return Collections.unmodifiableList(path); } @@ -129,4 +130,14 @@ class Path implements IPath { public int getNumNodesConsidered() { return numNodes; } + + @Override + public BetterBlockPos getSrc() { + return start; + } + + @Override + public BetterBlockPos getDest() { + return end; + } } diff --git a/src/main/java/baritone/bot/pathing/path/CutoffPath.java b/src/main/java/baritone/bot/pathing/path/CutoffPath.java index 8cd109c1..2b9516b1 100644 --- a/src/main/java/baritone/bot/pathing/path/CutoffPath.java +++ b/src/main/java/baritone/bot/pathing/path/CutoffPath.java @@ -18,14 +18,14 @@ package baritone.bot.pathing.path; import baritone.bot.pathing.movement.Movement; -import net.minecraft.util.math.BlockPos; +import baritone.bot.utils.pathing.BetterBlockPos; import java.util.Collections; import java.util.List; public class CutoffPath implements IPath { - final List path; + final List path; final List movements; @@ -43,7 +43,7 @@ public class CutoffPath implements IPath { } @Override - public List positions() { + public List positions() { return Collections.unmodifiableList(path); } diff --git a/src/main/java/baritone/bot/utils/PathRenderer.java b/src/main/java/baritone/bot/utils/PathRenderer.java index 92d55b91..88272f2f 100644 --- a/src/main/java/baritone/bot/utils/PathRenderer.java +++ b/src/main/java/baritone/bot/utils/PathRenderer.java @@ -18,6 +18,7 @@ package baritone.bot.utils; import baritone.bot.pathing.path.IPath; +import baritone.bot.utils.pathing.BetterBlockPos; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -55,7 +56,7 @@ public final class PathRenderer implements Helper { GlStateManager.glLineWidth(3.0F); GlStateManager.disableTexture2D(); GlStateManager.depthMask(false); - List positions = path.positions(); + List positions = path.positions(); int next; Tessellator tessellator = Tessellator.getInstance(); fadeStart += startIndex;