baritone/src/main/java/baritone/pathing/path/CutoffPath.java

64 lines
1.8 KiB
Java
Raw Normal View History

2018-08-13 19:56:08 +00:00
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
2018-08-13 19:56:08 +00:00
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
2018-08-13 19:56:08 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
2018-08-13 19:56:08 +00:00
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
2018-08-22 20:15:56 +00:00
package baritone.pathing.path;
2018-08-13 19:56:08 +00:00
import baritone.pathing.goals.Goal;
2018-08-22 20:15:56 +00:00
import baritone.pathing.movement.Movement;
import baritone.utils.pathing.BetterBlockPos;
2018-08-13 19:56:08 +00:00
import java.util.Collections;
import java.util.List;
public class CutoffPath implements IPath {
2018-09-17 00:49:19 +00:00
private final List<BetterBlockPos> path;
2018-08-13 19:56:08 +00:00
2018-09-17 00:49:19 +00:00
private final List<Movement> movements;
2018-08-13 19:56:08 +00:00
private final int numNodes;
2018-09-17 00:49:19 +00:00
private final Goal goal;
2018-08-13 19:56:08 +00:00
public CutoffPath(IPath prev, int lastPositionToInclude) {
path = prev.positions().subList(0, lastPositionToInclude + 1);
movements = prev.movements().subList(0, lastPositionToInclude + 1);
numNodes = prev.getNumNodesConsidered();
goal = prev.getGoal();
}
@Override
public Goal getGoal() {
return goal;
2018-08-13 19:56:08 +00:00
}
@Override
public List<Movement> movements() {
return Collections.unmodifiableList(movements);
}
@Override
2018-08-16 22:14:00 +00:00
public List<BetterBlockPos> positions() {
2018-08-13 19:56:08 +00:00
return Collections.unmodifiableList(path);
}
@Override
public int getNumNodesConsidered() {
return numNodes;
}
}