whoops that didn't actually compile

This commit is contained in:
Leijurv 2018-08-16 15:14:00 -07:00
parent e0f2159276
commit 82f5c21f4a
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
3 changed files with 21 additions and 9 deletions

View File

@ -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<BlockPos> path;
final List<BetterBlockPos> path;
final List<Movement> movements;
@ -74,7 +75,7 @@ class Path implements IPath {
throw new IllegalStateException();
}
PathNode current = end;
LinkedList<BlockPos> tempPath = new LinkedList<>(); // Repeatedly inserting to the beginning of an arraylist is O(n^2)
LinkedList<BetterBlockPos> tempPath = new LinkedList<>(); // Repeatedly inserting to the beginning of an arraylist is O(n^2)
LinkedList<Movement> 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<BlockPos> positions() {
public List<BetterBlockPos> 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;
}
}

View File

@ -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<BlockPos> path;
final List<BetterBlockPos> path;
final List<Movement> movements;
@ -43,7 +43,7 @@ public class CutoffPath implements IPath {
}
@Override
public List<BlockPos> positions() {
public List<BetterBlockPos> positions() {
return Collections.unmodifiableList(path);
}

View File

@ -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<BlockPos> positions = path.positions();
List<BetterBlockPos> positions = path.positions();
int next;
Tessellator tessellator = Tessellator.getInstance();
fadeStart += startIndex;