diff --git a/src/main/java/noppes/npcs/ai/pathfinder/FlyPathFinder.java b/src/main/java/noppes/npcs/ai/pathfinder/FlyPathFinder.java index 00f7385cd..eec63740b 100644 --- a/src/main/java/noppes/npcs/ai/pathfinder/FlyPathFinder.java +++ b/src/main/java/noppes/npcs/ai/pathfinder/FlyPathFinder.java @@ -351,92 +351,6 @@ public class FlyPathFinder extends PathFinder return i; } - - /** - * Returns a point that the entity can safely move to - */ - private FlyPathPoint getSafePoint(Entity entity, int blockX, int blockY, int blockZ, FlyPathPoint pathPoint, int verticalOffsetFlag) - { - FlyPathPoint pathpoint1 = null; - int verticalOffset = this.getVerticalOffset(entity, blockX, blockY, blockZ, pathPoint); - - if (verticalOffset == 2) - { - return this.openPoint(blockX, blockY, blockZ); - } - else - { - if (verticalOffset == 1) - { - pathpoint1 = this.openPoint(blockX, blockY, blockZ); - } - - if (pathpoint1 == null && verticalOffsetFlag > 0 && verticalOffset != -3 && verticalOffset != -4 && this.getVerticalOffset(entity, blockX, blockY + verticalOffsetFlag, blockZ, pathPoint) == 1) - { - pathpoint1 = this.openPoint(blockX, blockY + verticalOffsetFlag, blockZ); - blockY += verticalOffsetFlag; - } - - if (pathpoint1 != null) - { - int j1 = 0; - int k1 = 0; - - while (blockY > 0) - { - k1 = this.getVerticalOffset(entity, blockX, blockY - 1, blockZ, pathPoint); - - if (this.isPathingInWater && k1 == -1) - { - return null; - } - - if (k1 != 1) - { - break; - } - - if (j1++ >= entity.getMaxSafePointTries()) - { - return null; - } - - --blockY; - - if (blockY > 0) - { - pathpoint1 = this.openPoint(blockX, blockY, blockZ); - } - } - - if (k1 == -2) - { - return null; - } - } - - return pathpoint1; - } - } - - /** - * Returns a mapped point or creates and adds one - */ -// @Nullable -// private FlyPathPoint openPoint(int p_75854_1_, int p_75854_2_, int p_75854_3_) -// { -// int l = FlyPathPoint.makeHash(p_75854_1_, p_75854_2_, p_75854_3_); -// FlyPathPoint pathpoint = (FlyPathPoint)this.pointMap.lookup(l); -// -// if (pathpoint == null) -// { -// pathpoint = new FlyPathPoint(p_75854_1_, p_75854_2_, p_75854_3_); -// this.pointMap.addKey(l, pathpoint); -// } -// -// return pathpoint; -// } - @Nullable protected FlyPathPoint openPoint(int x, int y, int z) { @@ -474,108 +388,6 @@ public class FlyPathFinder extends PathFinder return pathpoint; } - /** - * Checks if an entity collides with blocks at a position. Returns 1 if clear, 0 for colliding with any solid block, - * -1 for water(if avoiding water) but otherwise clear, -2 for lava, -3 for fence, -4 for closed trapdoor, 2 if - * otherwise clear except for open trapdoor or water(if not avoiding) - */ - public int getVerticalOffset(Entity p_75855_1_, int p_75855_2_, int p_75855_3_, int p_75855_4_, FlyPathPoint p_75855_5_) - { - return canEntityStandAt(p_75855_1_, p_75855_2_, p_75855_3_, p_75855_4_, p_75855_5_, this.isPathingInWater, this.isMovementBlockAllowed, this.isWoddenDoorAllowed); - } - - public static int canEntityStandAt(Entity entity, int blockX, int blockY, int blockZ, FlyPathPoint pathPoint, boolean isPathingInWater, boolean isMovementBlockAllowed, boolean isWoddenDoorAllowed) - { - boolean flag3 = false; - - for (int l = blockX; l < blockX + pathPoint.xCoord; ++l) - { - for (int i1 = blockY; i1 < blockY + pathPoint.yCoord; ++i1) - { - for (int j1 = blockZ; j1 < blockZ + pathPoint.zCoord; ++j1) - { - Block block = entity.worldObj.getBlock(l, i1, j1); - - if(block == Blocks.air) - { - boolean heightClear = true; - for (int currentY = blockY; currentY <= Math.ceil(blockY + entity.height); ++currentY) { - Block b = entity.worldObj.getBlock(l, currentY, j1); - if (b != Blocks.air) { - heightClear = false; - break; - } - } - if (heightClear) { - return 2; - } - } - - if (block == Blocks.trapdoor) - { - flag3 = true; - } - else if (block != Blocks.flowing_water && block != Blocks.water) - { - if (!isWoddenDoorAllowed && block == Blocks.wooden_door) - { - return 0; - } - } - else - { - if (isPathingInWater) - { - return -1; - } - - flag3 = true; - } - - int k1 = block.getRenderType(); - - if (entity.worldObj.getBlock(l, i1, j1).getRenderType() == 9) - { - int j2 = MathHelper.floor_double(entity.posX); - int l1 = MathHelper.floor_double(entity.posY); - int i2 = MathHelper.floor_double(entity.posZ); - - if (entity.worldObj.getBlock(j2, l1, i2).getRenderType() != 9 && entity.worldObj.getBlock(j2, l1 - 1, i2).getRenderType() != 9) - { - return -3; - } - } - else if (!block.getBlocksMovement(entity.worldObj, l, i1, j1) && (!isMovementBlockAllowed || block != Blocks.wooden_door)) - { - if (k1 == 11 || block == Blocks.fence_gate || k1 == 32) - { - return -3; - } - - if (block == Blocks.trapdoor) - { - return -4; - } - - Material material = block.getMaterial(); - - if (material != Material.lava) - { - return 0; - } - - if (!entity.handleLavaMovement()) - { - return -2; - } - } - } - } - } - - return flag3 ? 2 : 1; - } - /** * Returns a new FlyPathEntity for a given start and end point */ diff --git a/src/main/java/noppes/npcs/ai/pathfinder/FlyPathPoint.java b/src/main/java/noppes/npcs/ai/pathfinder/FlyPathPoint.java index 8ef5b7cef..e08dd1bd0 100644 --- a/src/main/java/noppes/npcs/ai/pathfinder/FlyPathPoint.java +++ b/src/main/java/noppes/npcs/ai/pathfinder/FlyPathPoint.java @@ -46,7 +46,7 @@ public class FlyPathPoint extends PathPoint /** * Returns the linear distance to another path point */ - public float distanceTo(net.minecraft.pathfinding.PathPoint p_75829_1_) + public float distanceTo(FlyPathPoint p_75829_1_) { float f = (float)(p_75829_1_.xCoord - this.xCoord); float f1 = (float)(p_75829_1_.yCoord - this.yCoord); @@ -57,7 +57,7 @@ public class FlyPathPoint extends PathPoint /** * Returns the squared distance to another path point */ - public float distanceToSquared(net.minecraft.pathfinding.PathPoint p_75832_1_) + public float distanceToSquared(FlyPathPoint p_75832_1_) { float f = (float)(p_75832_1_.xCoord - this.xCoord); float f1 = (float)(p_75832_1_.yCoord - this.yCoord);