diff --git a/src/main/java/com/minecolonies/core/entity/pathfinding/PathingOptions.java b/src/main/java/com/minecolonies/core/entity/pathfinding/PathingOptions.java index ab8d256cae0..b69416ca299 100644 --- a/src/main/java/com/minecolonies/core/entity/pathfinding/PathingOptions.java +++ b/src/main/java/com/minecolonies/core/entity/pathfinding/PathingOptions.java @@ -10,7 +10,7 @@ public class PathingOptions /** * Maximum cost used */ - public static final int MAX_COST = 25; + public static final int MAX_COST = 100; /** * Additional cost of jumping @@ -22,6 +22,11 @@ public class PathingOptions */ public double dropCost = 1D; + /** + * Additional cost of dropping damage + */ + public double dropDamage = 25D; + /** * Cost improvement of paths - base 1. */ @@ -30,22 +35,22 @@ public class PathingOptions /** * Cost improvement of paths - base 1. */ - public double onRailCost = 1 / 10d; + public double onRailCost = 1 / 10D; /** - * The rails exit cost. + * The cost to open a door. */ public double openDoorCost = 4; /** * The rails exit cost. */ - public double railsExitCost = 8d; + public double railsExitCost = 4; /** * Additional cost of swimming - base 1. */ - public double swimCost = 2D; + public double swimCost = 4D; /** * Additional cost of cave air. @@ -55,7 +60,7 @@ public class PathingOptions /** * Additional cost enter entering water */ - public double swimCostEnter = 24D; + public double swimCostEnter = 4D; /** * Cost to traverse trap doors diff --git a/src/main/java/com/minecolonies/core/entity/pathfinding/pathjobs/AbstractPathJob.java b/src/main/java/com/minecolonies/core/entity/pathfinding/pathjobs/AbstractPathJob.java index 6cb5ab7e8ed..76760d97607 100644 --- a/src/main/java/com/minecolonies/core/entity/pathfinding/pathjobs/AbstractPathJob.java +++ b/src/main/java/com/minecolonies/core/entity/pathfinding/pathjobs/AbstractPathJob.java @@ -736,6 +736,7 @@ else if (!node.isCornerNode() && newY - node.y < 0 && (dX != 0 || dZ != 0) && final BlockState aboveState = cachedBlockLookup.getBlockState(nextX, nextY + 1, nextZ); final BlockState state = cachedBlockLookup.getBlockState(nextX, nextY, nextZ); final BlockState belowState = cachedBlockLookup.getBlockState(nextX, nextY - 1, nextZ); + final BlockState lastState = cachedBlockLookup.getBlockState(node.x, node.y, node.z); final boolean isSwimming = calculateSwimming(belowState, state, aboveState, nextNode); if (isSwimming && !pathingOptions.canSwim()) @@ -763,7 +764,7 @@ else if (!node.isCornerNode() && newY - node.y < 0 && (dX != 0 || dZ != 0) && costFrom = node.parent; } - nextCost = computeCost(costFrom, dX, dY, dZ, isSwimming, onRoad, isDiving, onRails, railsExit, swimStart, ladder, state, belowState, nextX, nextY, nextZ); + nextCost = computeCost(costFrom, dX, dY, dZ, isSwimming, onRoad, isDiving, onRails, railsExit, swimStart, ladder, state, belowState, lastState, nextX, nextY, nextZ); nextCost = modifyCost(nextCost, costFrom, swimStart, isSwimming, nextX, nextY, nextZ, state, belowState); if (nextCost > maxCost) @@ -891,7 +892,7 @@ protected double computeCost( final boolean railsExit, final boolean swimStart, final boolean ladder, - final BlockState state, final BlockState below, + final BlockState state, final BlockState below, final BlockState last, final int x, final int y, final int z) { double cost = 1; @@ -937,9 +938,16 @@ protected double computeCost( { cost += pathingOptions.jumpCost; } - else if (pathingOptions.dropCost != 0) + //else if (pathingOptions.dropCost != 0) + //{ + // cost += pathingOptions.dropCost * Math.abs(dY * dY * dY); + //} + if(dY < -3.375 && pathingOptions.dropDamage != 0) { - cost += pathingOptions.dropCost * Math.abs(dY * dY * dY); + //Avoid falling damage. + if(!PathfindingUtils.isWater(world, null, below, null)){ + cost += pathingOptions.dropDamage * (-dY - 3.375); + } } } } @@ -993,7 +1001,7 @@ else if (!ShapeUtil.isEmpty(state.getCollisionShape(cachedBlockLookup, tempWorld if(controlled) { if(targetState) cost += pathingOptions.openDoorCost; - else cost += 1000; //This is a trap!!! + else cost += 100; //This is a trap!!! } else if(open != targetState) {