Clean up PathingBehavior#findPath
This commit is contained in:
parent
bc82276e62
commit
aa2caf63d3
@ -33,6 +33,7 @@ import baritone.pathing.path.PathExecutor;
|
|||||||
import baritone.utils.BlockStateInterface;
|
import baritone.utils.BlockStateInterface;
|
||||||
import baritone.utils.Helper;
|
import baritone.utils.Helper;
|
||||||
import baritone.utils.PathRenderer;
|
import baritone.utils.PathRenderer;
|
||||||
|
import baritone.utils.interfaces.IGoalRenderPos;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.chunk.EmptyChunk;
|
import net.minecraft.world.chunk.EmptyChunk;
|
||||||
@ -309,18 +310,9 @@ public final class PathingBehavior extends Behavior implements Helper {
|
|||||||
}
|
}
|
||||||
if (Baritone.settings().simplifyUnloadedYCoord.get()) {
|
if (Baritone.settings().simplifyUnloadedYCoord.get()) {
|
||||||
BlockPos pos = null;
|
BlockPos pos = null;
|
||||||
if (goal instanceof GoalBlock) {
|
if (goal instanceof IGoalRenderPos)
|
||||||
pos = ((GoalBlock) goal).getGoalPos();
|
pos = ((IGoalRenderPos) 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();
|
|
||||||
}
|
|
||||||
// TODO simplify each individual goal in a GoalComposite
|
// TODO simplify each individual goal in a GoalComposite
|
||||||
if (pos != null && world().getChunk(pos) instanceof EmptyChunk) {
|
if (pos != null && world().getChunk(pos) instanceof EmptyChunk) {
|
||||||
logDebug("Simplifying " + goal.getClass() + " to GoalXZ due to distance");
|
logDebug("Simplifying " + goal.getClass() + " to GoalXZ due to distance");
|
||||||
|
@ -73,6 +73,7 @@ public class GoalBlock implements Goal, IGoalRenderPos {
|
|||||||
/**
|
/**
|
||||||
* @return The position of this goal as a {@link BlockPos}
|
* @return The position of this goal as a {@link BlockPos}
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BlockPos getGoalPos() {
|
public BlockPos getGoalPos() {
|
||||||
return new BlockPos(x, y, z);
|
return new BlockPos(x, y, z);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ public class GoalGetToBlock implements Goal, IGoalRenderPos {
|
|||||||
this.z = pos.getZ();
|
this.z = pos.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BlockPos getGoalPos() {
|
public BlockPos getGoalPos() {
|
||||||
return new BetterBlockPos(x, y, z);
|
return new BetterBlockPos(x, y, z);
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ public class GoalNear implements Goal, IGoalRenderPos {
|
|||||||
return GoalBlock.calculate(diffX, diffY, diffZ);
|
return GoalBlock.calculate(diffX, diffY, diffZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BlockPos getGoalPos() {
|
public BlockPos getGoalPos() {
|
||||||
return new BlockPos(x, y, z);
|
return new BlockPos(x, y, z);
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ public class GoalTwoBlocks implements Goal, IGoalRenderPos {
|
|||||||
return GoalBlock.calculate(xDiff, yDiff, zDiff);
|
return GoalBlock.calculate(xDiff, yDiff, zDiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BlockPos getGoalPos() {
|
public BlockPos getGoalPos() {
|
||||||
return new BlockPos(x, y, z);
|
return new BlockPos(x, y, z);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user