Skip to content

Commit

Permalink
Update TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
NateKomodo committed Aug 19, 2019
1 parent 8658cb3 commit 61d57c7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class Node implements INode {
private Node me = this;


Node(NodeType type, IPathingProvider master, INode parent, int currentCost, int myCost, Pos myPos, Pos destination, int TTL) {
Node(NodeType type, IPathingProvider master, INode parent, int currentCost, int myCost, Pos myPos, Pos destination, int TTL) { //TODO am i a replicant or not
this.myType = type;
this.master = master;
this.parent = parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public INode parent() {
}

@Override
public IOption EvaluatePosition(Pos pos) { //TODO parkour handler
public IOption EvaluatePosition(Pos pos) { //TODO parkour handler, check chunk is loaded, diagonals
Pos parent = this.parent.pos();
Pos entry = new Pos(parent.x, parent.y, parent.z);
if (this.parent.parent() != null) {
Expand All @@ -39,9 +39,10 @@ public IOption EvaluatePosition(Pos pos) { //TODO parkour handler
return null;
}
Block b = Minecraft.getMinecraft().world.getBlockState(pos.ConvertToBlockPos()).getBlock();
ArrayList<Block> pBlocks = new PassableBlocks().blocks;
if (pos.y - parent.y == 1) {
//Ascend
if (new PassableBlocks().blocks.contains(b)) {
if (pBlocks.contains(b)) {
return new Option(CostResolve.Resolve(NodeType.ASCEND_TOWER, pos, dest), NodeType.ASCEND_TOWER, pos);
} else if (b != Blocks.LADDER && b != Blocks.BEDROCK && !AdjacentLavaHelper.Check(pos.ConvertToBlockPos())) {
return new Option(CostResolve.Resolve(NodeType.ASCEND_BREAK_AND_TOWER, pos, dest), NodeType.ASCEND_BREAK_AND_TOWER, pos);
Expand All @@ -50,33 +51,38 @@ public IOption EvaluatePosition(Pos pos) { //TODO parkour handler
}
} else if (pos.y - parent.y == -1) {
//Descend
if (new PassableBlocks().blocks.contains(b)) {
if (pBlocks.contains(b)) {
return new Option(CostResolve.Resolve(NodeType.DESCEND, pos, dest), NodeType.DESCEND, pos);
} else if (b != Blocks.LADDER && b != Blocks.BEDROCK && !AdjacentLavaHelper.Check(pos.ConvertToBlockPos())) {
return new Option(CostResolve.Resolve(NodeType.DESCEND_MINE, pos, dest), NodeType.DESCEND_MINE, pos);
} else if (b == Blocks.LADDER) {
return new Option(CostResolve.Resolve(NodeType.DESCEND, pos, dest), NodeType.DESCEND, pos);
}
} else { //TODO lava, step up and break for head collisions
} else { //TODO lava
//Side nodes
if (new PassableBlocks().blocks.contains(b) && !(new PassableBlocks().blocks.contains(AdjacentBlocksHelper.Below(pos)) && new PassableBlocks().blocks.contains(AdjacentBlocksHelper.Above(pos)))) {
if (pBlocks.contains(b) && !(pBlocks.contains(AdjacentBlocksHelper.Below(pos)) && pBlocks.contains(AdjacentBlocksHelper.Above(pos)))) {
//Walk floor
return new Option(CostResolve.Resolve(NodeType.MOVE, pos, dest), NodeType.MOVE, pos);
} else if (!(new PassableBlocks().blocks.contains(b)) && new PassableBlocks().blocks.contains(AdjacentBlocksHelper.Above(pos))) {
} else if (!(pBlocks.contains(b)) && pBlocks.contains(AdjacentBlocksHelper.Above(pos)) && pBlocks.contains(AdjacentBlocksHelper.Above(new Pos(pos.x, pos.y + 1, pos.z)))) {
//Step up
pos.y++;
return new Option(CostResolve.Resolve(NodeType.STEP_UP, pos, dest), NodeType.STEP_UP, pos);
} else if (new PassableBlocks().blocks.contains(b) && new PassableBlocks().blocks.contains(AdjacentBlocksHelper.Below(pos)) && !(new PassableBlocks().blocks.contains(AdjacentBlocksHelper.Below(new Pos(pos.x, pos.y - 1, pos.z))))) {
} else if (!(pBlocks.contains(b)) && pBlocks.contains(AdjacentBlocksHelper.Above(pos)) && !(pBlocks.contains(AdjacentBlocksHelper.Above(new Pos(pos.x, pos.y + 1, pos.z))))) {
//Step up and break
pos.y++;
return new Option(CostResolve.Resolve(NodeType.STEP_UP_AND_BREAK, pos, dest), NodeType.STEP_UP_AND_BREAK, pos);
}
else if (pBlocks.contains(b) && pBlocks.contains(AdjacentBlocksHelper.Below(pos)) && !(pBlocks.contains(AdjacentBlocksHelper.Below(new Pos(pos.x, pos.y - 1, pos.z))))) {
//Step down
pos.y--;
return new Option(CostResolve.Resolve(NodeType.STEP_DOWN, pos, dest), NodeType.STEP_DOWN, pos);
} else if (!(new PassableBlocks().blocks.contains(b)) && !(new PassableBlocks().blocks.contains(AdjacentBlocksHelper.Above(pos))) && !AdjacentLavaHelper.Check(pos.ConvertToBlockPos())) {
} else if (!(pBlocks.contains(b)) && !(pBlocks.contains(AdjacentBlocksHelper.Above(pos))) && !AdjacentLavaHelper.Check(pos.ConvertToBlockPos())) {
//Break and move into
return new Option(CostResolve.Resolve(NodeType.BREAK_AND_MOVE, pos, dest), NodeType.BREAK_AND_MOVE, pos);
} else if (new PassableBlocks().blocks.contains(b) && !(new PassableBlocks().blocks.contains(AdjacentBlocksHelper.Above(pos))) && !AdjacentLavaHelper.Check(pos.ConvertToBlockPos())) {
} else if (pBlocks.contains(b) && !(pBlocks.contains(AdjacentBlocksHelper.Above(pos))) && !AdjacentLavaHelper.Check(pos.ConvertToBlockPos())) {
//Break and move into
return new Option(CostResolve.Resolve(NodeType.BREAK_AND_MOVE, pos, dest), NodeType.BREAK_AND_MOVE, pos);
} else if (new PassableBlocks().blocks.contains(b) && new PassableBlocks().blocks.contains(AdjacentBlocksHelper.Below(pos)) && new PassableBlocks().blocks.contains(AdjacentBlocksHelper.Below(new Pos(pos.x, pos.y - 1, pos.z)))) {
} else if (pBlocks.contains(b) && pBlocks.contains(AdjacentBlocksHelper.Below(pos)) && pBlocks.contains(AdjacentBlocksHelper.Below(new Pos(pos.x, pos.y - 1, pos.z)))) {
//TODO choose decent node or bridge
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Pos destination() {
}

@Override
public void StartPathfinding(Pos destination, Pos start, IPathingCallback callbackClass) {
public void StartPathfinding(Pos destination, Pos start, IPathingCallback callbackClass) { //TODO fix jankyness of it going all of the place
dest = destination;
this.callback = callbackClass;
initial = new Node(NodeType.PLAYER, this, null, 0,0, start, destination, (int)DistanceHelper.CalcDistance(start, destination) * 3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ public static int Resolve(NodeType type, Pos pos, Pos dest) {
int dist = (int)DistanceHelper.CalcDistance(pos, dest);
switch (type) {
case MOVE:
case STEP_UP:
case STEP_DOWN:
case PLAYER:
case DESCEND:
case ASCEND:
return 1 + dist;
case STEP_UP:
case STEP_DOWN:
return 2 + dist;
case BRIDGE:
case PARKOUR:
case BRIDGE_AND_PARKOUR:
Expand All @@ -24,6 +25,7 @@ public static int Resolve(NodeType type, Pos pos, Pos dest) {
case DESCEND_MINE:
case BREAK_AND_MOVE:
case ASCEND_BREAK_AND_TOWER:
case STEP_UP_AND_BREAK:
return 4 + dist;
default:
return 99;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public enum NodeType {
MOVE,
STEP_UP,
STEP_UP_AND_BREAK,
STEP_DOWN,
ASCEND,
DESCEND,
Expand Down

0 comments on commit 61d57c7

Please sign in to comment.