Clean up PathingBehavior#findPath

This commit is contained in:
Brady 2018-09-16 21:18:39 -05:00
parent bc82276e62
commit aa2caf63d3
No known key found for this signature in database
GPG Key ID: 73A788379A197567
5 changed files with 8 additions and 12 deletions

View File

@ -33,6 +33,7 @@ import baritone.pathing.path.PathExecutor;
import baritone.utils.BlockStateInterface;
import baritone.utils.Helper;
import baritone.utils.PathRenderer;
import baritone.utils.interfaces.IGoalRenderPos;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.chunk.EmptyChunk;
@ -309,18 +310,9 @@ public final class PathingBehavior extends Behavior implements Helper {
}
if (Baritone.settings().simplifyUnloadedYCoord.get()) {
BlockPos pos = null;
if (goal instanceof GoalBlock) {
pos = ((GoalBlock) goal).getGoalPos();
}
if (goal instanceof GoalTwoBlocks) {
pos = ((GoalTwoBlocks) goal).getGoalPos();
}
if (goal instanceof GoalNear) {
pos = ((GoalNear) goal).getGoalPos();
}
if (goal instanceof GoalGetToBlock) {
pos = ((GoalGetToBlock) goal).getGoalPos();
}
if (goal instanceof IGoalRenderPos)
pos = ((IGoalRenderPos) goal).getGoalPos();
// TODO simplify each individual goal in a GoalComposite
if (pos != null && world().getChunk(pos) instanceof EmptyChunk) {
logDebug("Simplifying " + goal.getClass() + " to GoalXZ due to distance");

View File

@ -73,6 +73,7 @@ public class GoalBlock implements Goal, IGoalRenderPos {
/**
* @return The position of this goal as a {@link BlockPos}
*/
@Override
public BlockPos getGoalPos() {
return new BlockPos(x, y, z);
}

View File

@ -39,6 +39,7 @@ public class GoalGetToBlock implements Goal, IGoalRenderPos {
this.z = pos.getZ();
}
@Override
public BlockPos getGoalPos() {
return new BetterBlockPos(x, y, z);
}

View File

@ -49,6 +49,7 @@ public class GoalNear implements Goal, IGoalRenderPos {
return GoalBlock.calculate(diffX, diffY, diffZ);
}
@Override
public BlockPos getGoalPos() {
return new BlockPos(x, y, z);
}

View File

@ -69,6 +69,7 @@ public class GoalTwoBlocks implements Goal, IGoalRenderPos {
return GoalBlock.calculate(xDiff, yDiff, zDiff);
}
@Override
public BlockPos getGoalPos() {
return new BlockPos(x, y, z);
}