it's not much of an improvement, but it won't make it slower

This commit is contained in:
Leijurv 2018-10-03 08:12:42 -07:00
parent 28af41b789
commit 6986f179cd
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 8 additions and 10 deletions

View File

@ -22,8 +22,8 @@ import baritone.api.pathing.goals.Goal;
import baritone.api.pathing.goals.GoalComposite; import baritone.api.pathing.goals.GoalComposite;
import baritone.api.pathing.goals.GoalTwoBlocks; import baritone.api.pathing.goals.GoalTwoBlocks;
import baritone.api.pathing.goals.GoalXZ; import baritone.api.pathing.goals.GoalXZ;
import baritone.pathing.path.IPath;
import baritone.api.utils.interfaces.IGoalRenderPos; import baritone.api.utils.interfaces.IGoalRenderPos;
import baritone.pathing.path.IPath;
import baritone.utils.pathing.BetterBlockPos; import baritone.utils.pathing.BetterBlockPos;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -68,13 +68,15 @@ public final class PathRenderer implements Helper {
int fadeStart = fadeStart0 + startIndex; int fadeStart = fadeStart0 + startIndex;
int fadeEnd = fadeEnd0 + startIndex; int fadeEnd = fadeEnd0 + startIndex;
for (int i = startIndex; i < positions.size() - 1; i = next) { for (int i = startIndex; i < positions.size() - 1; i = next) {
BlockPos start = positions.get(i); BetterBlockPos start = positions.get(i);
next = i + 1; next = i + 1;
BlockPos end = positions.get(next); BetterBlockPos end = positions.get(next);
BlockPos direction = Utils.diff(start, end); int dirX = end.x - start.x;
while (next + 1 < positions.size() && (!fadeOut || next + 1 < fadeStart) && direction.equals(Utils.diff(end, positions.get(next + 1)))) { int dirY = end.y - start.y;
int dirZ = end.z - start.z;
while (next + 1 < positions.size() && (!fadeOut || next + 1 < fadeStart) && (dirX == positions.get(next + 1).x - end.x && dirY == positions.get(next + 1).y - end.y && dirZ == positions.get(next + 1).z - end.z)) {
next++; next++;
end = positions.get(next); end = positions.get(next);
} }

View File

@ -130,8 +130,4 @@ public final class Utils {
public static double radToDeg(double rad) { public static double radToDeg(double rad) {
return rad * RAD_TO_DEG; return rad * RAD_TO_DEG;
} }
public static BlockPos diff(BlockPos a, BlockPos b) {
return new BlockPos(a.getX() - b.getX(), a.getY() - b.getY(), a.getZ() - b.getZ());
}
} }