From ad8cd35083770623040a52986c879d649409012f Mon Sep 17 00:00:00 2001 From: KAMKEEL Date: Sat, 5 Nov 2022 03:35:55 -0400 Subject: [PATCH] Kam is a Legend --- .../net/minecraft/util/math/BlockPos.java | 3 +- .../net/minecraft/util/math/IntHashMap.java | 255 ++++++++++++++ .../npcs/ai/pathfinder/FlyPathFinder.java | 314 +++++++++++++++--- .../npcs/ai/pathfinder/FlyPathPoint.java | 2 + .../ai/pathfinder/PathNavigateFlying.java | 4 +- .../npcs/ai/pathfinder/PathNodeType.java | 34 ++ 6 files changed, 571 insertions(+), 41 deletions(-) create mode 100644 src/main/java/net/minecraft/util/math/IntHashMap.java create mode 100644 src/main/java/noppes/npcs/ai/pathfinder/PathNodeType.java diff --git a/src/main/java/net/minecraft/util/math/BlockPos.java b/src/main/java/net/minecraft/util/math/BlockPos.java index 04472fb26..f1904b4fe 100644 --- a/src/main/java/net/minecraft/util/math/BlockPos.java +++ b/src/main/java/net/minecraft/util/math/BlockPos.java @@ -19,6 +19,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; /** + * Pasted in from 1.9, with the Vec3d constructor removed */ @Immutable public class BlockPos extends Vec3i @@ -553,4 +554,4 @@ public class BlockPos extends Vec3i return (BlockPos.PooledMutableBlockPos)super.move(p_189538_1_, p_189538_2_); } } -} \ No newline at end of file +} diff --git a/src/main/java/net/minecraft/util/math/IntHashMap.java b/src/main/java/net/minecraft/util/math/IntHashMap.java new file mode 100644 index 000000000..797013de5 --- /dev/null +++ b/src/main/java/net/minecraft/util/math/IntHashMap.java @@ -0,0 +1,255 @@ +package net.minecraft.util.math; + +public class IntHashMap { + private transient IntHashMap.Entry[] slots = new IntHashMap.Entry[16]; + /** + * The number of items stored in this map + */ + private transient int count; + /** + * The grow threshold + */ + private int threshold = 12; + /** + * The scale factor used to determine when to grow the table + */ + private final float growFactor = 0.75F; + + /** + * Makes the passed in integer suitable for hashing by a number of shifts + */ + private static int computeHash(int integer) { + integer = integer ^ integer >>> 20 ^ integer >>> 12; + return integer ^ integer >>> 7 ^ integer >>> 4; + } + + /** + * Computes the index of the slot for the hash and slot count passed in. + */ + private static int getSlotIndex(int hash, int slotCount) { + return hash & slotCount - 1; + } + + /** + * Returns the object associated to a key + */ + public V lookup(int p_76041_1_) { + int i = computeHash(p_76041_1_); + + for (IntHashMap.Entry entry = this.slots[getSlotIndex(i, this.slots.length)]; entry != null; entry = entry.nextEntry) { + if (entry.hashEntry == p_76041_1_) { + return entry.valueEntry; + } + } + + return (V) null; + } + + /** + * Returns true if this hash table contains the specified item. + */ + public boolean containsItem(int p_76037_1_) { + return this.lookupEntry(p_76037_1_) != null; + } + + final IntHashMap.Entry lookupEntry(int p_76045_1_) { + int i = computeHash(p_76045_1_); + + for (IntHashMap.Entry entry = this.slots[getSlotIndex(i, this.slots.length)]; entry != null; entry = entry.nextEntry) { + if (entry.hashEntry == p_76045_1_) { + return entry; + } + } + + return null; + } + + /** + * Adds a key and associated value to this map + */ + public void addKey(int p_76038_1_, V p_76038_2_) { + int i = computeHash(p_76038_1_); + int j = getSlotIndex(i, this.slots.length); + + for (IntHashMap.Entry entry = this.slots[j]; entry != null; entry = entry.nextEntry) { + if (entry.hashEntry == p_76038_1_) { + entry.valueEntry = p_76038_2_; + return; + } + } + + this.insert(i, p_76038_1_, p_76038_2_, j); + } + + /** + * Increases the number of hash slots + */ + private void grow(int p_76047_1_) { + IntHashMap.Entry[] entry = this.slots; + int i = entry.length; + + if (i == 1073741824) { + this.threshold = Integer.MAX_VALUE; + } else { + IntHashMap.Entry[] entry1 = new IntHashMap.Entry[p_76047_1_]; + this.copyTo(entry1); + this.slots = entry1; + this.threshold = (int) ((float) p_76047_1_ * this.growFactor); + } + } + + /** + * Copies the hash slots to a new array + */ + private void copyTo(IntHashMap.Entry[] p_76048_1_) { + IntHashMap.Entry[] entry = this.slots; + int i = p_76048_1_.length; + + for (int j = 0; j < entry.length; ++j) { + IntHashMap.Entry entry1 = entry[j]; + + if (entry1 != null) { + entry[j] = null; + + while (true) { + IntHashMap.Entry entry2 = entry1.nextEntry; + int k = getSlotIndex(entry1.slotHash, i); + entry1.nextEntry = p_76048_1_[k]; + p_76048_1_[k] = entry1; + entry1 = entry2; + + if (entry2 == null) { + break; + } + } + } + } + } + + /** + * Removes the specified object from the map and returns it + */ + public V removeObject(int p_76049_1_) { + IntHashMap.Entry entry = this.removeEntry(p_76049_1_); + return (V) (entry == null ? null : entry.valueEntry); + } + + final IntHashMap.Entry removeEntry(int p_76036_1_) { + int i = computeHash(p_76036_1_); + int j = getSlotIndex(i, this.slots.length); + IntHashMap.Entry entry = this.slots[j]; + IntHashMap.Entry entry1; + IntHashMap.Entry entry2; + + for (entry1 = entry; entry1 != null; entry1 = entry2) { + entry2 = entry1.nextEntry; + + if (entry1.hashEntry == p_76036_1_) { + --this.count; + + if (entry == entry1) { + this.slots[j] = entry2; + } else { + entry.nextEntry = entry2; + } + + return entry1; + } + + entry = entry1; + } + + return entry1; + } + + /** + * Removes all entries from the map + */ + public void clearMap() { + IntHashMap.Entry[] entry = this.slots; + + for (int i = 0; i < entry.length; ++i) { + entry[i] = null; + } + + this.count = 0; + } + + /** + * Adds an object to a slot + */ + private void insert(int p_76040_1_, int p_76040_2_, V p_76040_3_, int p_76040_4_) { + IntHashMap.Entry entry = this.slots[p_76040_4_]; + this.slots[p_76040_4_] = new IntHashMap.Entry(p_76040_1_, p_76040_2_, p_76040_3_, entry); + + if (this.count++ >= this.threshold) { + this.grow(2 * this.slots.length); + } + } + + static class Entry { + /** + * The hash code of this entry + */ + final int hashEntry; + /** + * The object stored in this entry + */ + V valueEntry; + IntHashMap.Entry nextEntry; + /** + * The id of the hash slot computed from the hash + */ + final int slotHash; + + Entry(int p_i1552_1_, int p_i1552_2_, V p_i1552_3_, IntHashMap.Entry p_i1552_4_) { + this.valueEntry = p_i1552_3_; + this.nextEntry = p_i1552_4_; + this.hashEntry = p_i1552_2_; + this.slotHash = p_i1552_1_; + } + + /** + * Returns the hash code for this entry + */ + public final int getHash() { + return this.hashEntry; + } + + /** + * Returns the object stored in this entry + */ + public final V getValue() { + return this.valueEntry; + } + + public final boolean equals(Object p_equals_1_) { + if (!(p_equals_1_ instanceof IntHashMap.Entry)) { + return false; + } else { + IntHashMap.Entry entry = (IntHashMap.Entry) p_equals_1_; + Object object = Integer.valueOf(this.getHash()); + Object object1 = Integer.valueOf(entry.getHash()); + + if (object == object1 || object != null && object.equals(object1)) { + Object object2 = this.getValue(); + Object object3 = entry.getValue(); + + if (object2 == object3 || object2 != null && object2.equals(object3)) { + return true; + } + } + + return false; + } + } + + public final int hashCode() { + return IntHashMap.computeHash(this.hashEntry); + } + + public final String toString() { + return this.getHash() + "=" + this.getValue(); + } + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/ai/pathfinder/FlyPathFinder.java b/src/main/java/noppes/npcs/ai/pathfinder/FlyPathFinder.java index a9041c619..00f7385cd 100644 --- a/src/main/java/noppes/npcs/ai/pathfinder/FlyPathFinder.java +++ b/src/main/java/noppes/npcs/ai/pathfinder/FlyPathFinder.java @@ -1,18 +1,23 @@ package noppes.npcs.ai.pathfinder; -import net.minecraft.block.Block; +import com.google.common.collect.Maps; +import net.minecraft.block.*; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; import net.minecraft.init.Blocks; import net.minecraft.pathfinding.PathFinder; import net.minecraft.pathfinding.PathPoint; -import net.minecraft.util.IntHashMap; import net.minecraft.util.MathHelper; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.IntHashMap; import net.minecraft.world.IBlockAccess; import noppes.npcs.entity.EntityNPCInterface; import javax.annotation.Nullable; +import java.util.EnumSet; +import java.util.Map; public class FlyPathFinder extends PathFinder { @@ -21,7 +26,7 @@ public class FlyPathFinder extends PathFinder /** The path being generated */ private FlyPath path = new FlyPath(); /** The points in the path */ - private IntHashMap pointMap = new IntHashMap(); + protected final IntHashMap pointMap = new IntHashMap(); /** Selection of path points to add to the path */ private FlyPathPoint[] pathOptions = new FlyPathPoint[32]; /** should the PathFinder go through wodden door blocks */ @@ -32,10 +37,13 @@ public class FlyPathFinder extends PathFinder /** tells the FathFinder to not stop pathing underwater */ private boolean canEntityDrown; private static final String __OBFID = "CL_00000576"; + private Entity theEntity; + private final Map mapPathPriority = Maps.newEnumMap(PathNodeType.class); - public FlyPathFinder(IBlockAccess p_i2137_1_, boolean p_i2137_2_, boolean p_i2137_3_, boolean p_i2137_4_, boolean p_i2137_5_) + public FlyPathFinder(IBlockAccess p_i2137_1_, boolean p_i2137_2_, boolean p_i2137_3_, boolean p_i2137_4_, boolean p_i2137_5_, Entity p_72865_1_) { super(p_i2137_1_,p_i2137_2_,p_i2137_3_,p_i2137_4_,p_i2137_5_); + this.theEntity = p_72865_1_; this.worldMap = p_i2137_1_; this.isWoddenDoorAllowed = p_i2137_2_; this.isMovementBlockAllowed = p_i2137_3_; @@ -62,33 +70,6 @@ public class FlyPathFinder extends PathFinder /** * Internal implementation of creating a path from an entity to a point */ -// private FlyPathEntity createEntityPathTo(Entity p_75857_1_, double p_75857_2_, double p_75857_4_, double p_75857_6_, float p_75857_8_) -// { -// this.path.clearPath(); -// this.pointMap.clearMap(); -// boolean flag = this.isPathingInWater; -// int i = MathHelper.floor_double(p_75857_1_.boundingBox.minY + 0.5D); -// -// if (this.canEntityDrown && p_75857_1_.isInWater()) -// { -// i = (int)p_75857_1_.boundingBox.minY; -// -// for (Block block = this.worldMap.getBlock(MathHelper.floor_double(p_75857_1_.posX), i, MathHelper.floor_double(p_75857_1_.posZ)); block == Blocks.flowing_water || block == Blocks.water; block = this.worldMap.getBlock(MathHelper.floor_double(p_75857_1_.posX), i, MathHelper.floor_double(p_75857_1_.posZ))) -// { -// ++i; -// } -// -// flag = this.isPathingInWater; -// this.isPathingInWater = false; -// } -// -// FlyPathPoint pathpoint2 = this.openPoint(MathHelper.floor_double(p_75857_1_.boundingBox.minX), i, MathHelper.floor_double(p_75857_1_.boundingBox.minZ)); -// FlyPathPoint pathpoint = this.openPoint(MathHelper.floor_double(p_75857_2_ - (double)(p_75857_1_.width / 2.0F)), MathHelper.floor_double(p_75857_4_), MathHelper.floor_double(p_75857_6_ - (double)(p_75857_1_.width / 2.0F))); -// FlyPathPoint pathpoint1 = new FlyPathPoint(MathHelper.floor_float(p_75857_1_.width + 1.0F), MathHelper.floor_float(p_75857_1_.height + 1.0F), MathHelper.floor_float(p_75857_1_.width + 1.0F)); -// FlyPathEntity pathentity = this.addToPath(p_75857_1_, pathpoint2, pathpoint, pathpoint1, p_75857_8_); -// this.isPathingInWater = flag; -// return pathentity; -// } private FlyPathEntity createEntityPathTo(Entity entityIn, double x, double y, double z, float distance) { @@ -441,16 +422,53 @@ public class FlyPathFinder extends PathFinder /** * 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 - private FlyPathPoint openPoint(int p_75854_1_, int p_75854_2_, int p_75854_3_) + protected FlyPathPoint openPoint(int x, int y, int z) { - int l = FlyPathPoint.makeHash(p_75854_1_, p_75854_2_, p_75854_3_); - FlyPathPoint pathpoint = (FlyPathPoint)this.pointMap.lookup(l); + FlyPathPoint pathpoint = null; + BlockPos blockPos = new BlockPos(x, y, z); + PathNodeType pathnodetype = this.getPathNodeType((EntityLiving) this.theEntity, blockPos); + float f = getPathPriority(pathnodetype); + + if (f >= 0.0F) + { + pathpoint = openPoint(x, y, z, x); + pathpoint.nodeType = pathnodetype; + pathpoint.costMalus = Math.max(pathpoint.costMalus, f); + + if (pathnodetype == PathNodeType.WALKABLE) + { + ++pathpoint.costMalus; + } + } + + return pathnodetype != PathNodeType.OPEN && pathnodetype != PathNodeType.WALKABLE ? pathpoint : pathpoint; + } + + protected FlyPathPoint openPoint(int x, int y, int z, int b) + { + int i = FlyPathPoint.makeHash(x, y, z); + FlyPathPoint pathpoint = this.pointMap.lookup(i); if (pathpoint == null) { - pathpoint = new FlyPathPoint(p_75854_1_, p_75854_2_, p_75854_3_); - this.pointMap.addKey(l, pathpoint); + pathpoint = new FlyPathPoint(x, y, z); + this.pointMap.addKey(i, pathpoint); } return pathpoint; @@ -484,8 +502,8 @@ public class FlyPathFinder extends PathFinder 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; + heightClear = false; + break; } } if (heightClear) { @@ -583,4 +601,224 @@ public class FlyPathFinder extends PathFinder return new FlyPathEntity(apathpoint); } + + + + + public PathNodeType getPathNodeType(IBlockAccess blockaccessIn, int x, int y, int z, EntityLiving entitylivingIn, int xSize, int ySize, int zSize, boolean canBreakDoorsIn, boolean canEnterDoorsIn) + { + EnumSet enumset = EnumSet.noneOf(PathNodeType.class); + PathNodeType pathnodetype = PathNodeType.BLOCKED; + double d0 = (double)entitylivingIn.width / 2.0D; + BlockPos blockpos = new BlockPos(entitylivingIn); + pathnodetype = this.getPathNodeType(blockaccessIn, x, y, z, xSize, ySize, zSize, canBreakDoorsIn, canEnterDoorsIn, enumset, pathnodetype, blockpos); + + if (enumset.contains(PathNodeType.FENCE)) + { + return PathNodeType.FENCE; + } + else + { + PathNodeType pathnodetype1 = PathNodeType.BLOCKED; + + for (PathNodeType pathnodetype2 : enumset) + { + if (getPathPriority(pathnodetype2) < 0.0F) + { + return pathnodetype2; + } + + if (getPathPriority(pathnodetype2) >= getPathPriority(pathnodetype1)) + { + pathnodetype1 = pathnodetype2; + } + } + + if (pathnodetype == PathNodeType.OPEN && getPathPriority(pathnodetype1) == 0.0F) + { + return PathNodeType.OPEN; + } + else + { + return pathnodetype1; + } + } + } + + public PathNodeType getPathNodeType(IBlockAccess p_193577_1_, int x, int y, int z, int xSize, int ySize, int zSize, boolean canOpenDoorsIn, boolean canEnterDoorsIn, EnumSet p_193577_10_, PathNodeType p_193577_11_, BlockPos p_193577_12_) + { + for (int i = 0; i < xSize; ++i) + { + for (int j = 0; j < ySize; ++j) + { + for (int k = 0; k < zSize; ++k) + { + int l = i + x; + int i1 = j + y; + int j1 = k + z; + PathNodeType pathnodetype = this.getPathNodeType(p_193577_1_, l, i1, j1); + + if (pathnodetype == PathNodeType.DOOR_WOOD_CLOSED && canOpenDoorsIn && canEnterDoorsIn) + { + pathnodetype = PathNodeType.WALKABLE; + } + + if (pathnodetype == PathNodeType.DOOR_OPEN && !canEnterDoorsIn) + { + pathnodetype = PathNodeType.BLOCKED; + } + + if (pathnodetype == PathNodeType.RAIL && !(p_193577_1_.getBlock(p_193577_12_.getX(), p_193577_12_.getY(), p_193577_12_.getZ()) instanceof BlockRailBase) && !(p_193577_1_.getBlock(p_193577_12_.down().getX(), p_193577_12_.down().getY(), p_193577_12_.down().getZ()) instanceof BlockRailBase)) + { + pathnodetype = PathNodeType.FENCE; + } + + if (i == 0 && j == 0 && k == 0) + { + p_193577_11_ = pathnodetype; + } + + p_193577_10_.add(pathnodetype); + } + } + } + + return p_193577_11_; + } + + public PathNodeType getPathNodeType(IBlockAccess blockaccessIn, int x, int y, int z) + { + PathNodeType pathnodetype = this.getPathNodeTypeRaw(blockaccessIn, x, y, z); + + if (pathnodetype == PathNodeType.OPEN && y >= 1) + { + PathNodeType pathnodetype1 = this.getPathNodeTypeRaw(blockaccessIn, x, y - 1, z); + pathnodetype = pathnodetype1 != PathNodeType.WALKABLE && pathnodetype1 != PathNodeType.OPEN && pathnodetype1 != PathNodeType.WATER && pathnodetype1 != PathNodeType.LAVA ? PathNodeType.WALKABLE : PathNodeType.OPEN; + + if (pathnodetype1 == PathNodeType.DAMAGE_FIRE) + { + pathnodetype = PathNodeType.DAMAGE_FIRE; + } + + if (pathnodetype1 == PathNodeType.DAMAGE_CACTUS) + { + pathnodetype = PathNodeType.DAMAGE_CACTUS; + } + + if (pathnodetype1 == PathNodeType.DAMAGE_OTHER) pathnodetype = PathNodeType.DAMAGE_OTHER; + } + + pathnodetype = this.checkNeighborBlocks(blockaccessIn, x, y, z, pathnodetype); + return pathnodetype; + } + + public PathNodeType checkNeighborBlocks(IBlockAccess worldmap, int x, int y, int z, PathNodeType p_193578_5_) + { + BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(); + + if (p_193578_5_ == PathNodeType.WALKABLE) + { + for (int i = -1; i <= 1; ++i) + { + for (int j = -1; j <= 1; ++j) + { + if (i != 0 || j != 0) + { + blockpos$pooledmutableblockpos.setPos(i + x, y, j + z); + Block block = worldmap.getBlock(blockpos$pooledmutableblockpos.getX(), blockpos$pooledmutableblockpos.getY(), blockpos$pooledmutableblockpos.getZ()); + if (block == Blocks.cactus) + { + p_193578_5_ = PathNodeType.DANGER_CACTUS; + } + else if (block == Blocks.fire) + { + p_193578_5_ = PathNodeType.DANGER_FIRE; + } + } + } + } + } + + blockpos$pooledmutableblockpos.release(); + return p_193578_5_; + } + + protected PathNodeType getPathNodeTypeRaw(IBlockAccess worldmap, int p_189553_2_, int p_189553_3_, int p_189553_4_) + { + BlockPos blockpos = new BlockPos(p_189553_2_, p_189553_3_, p_189553_4_); + Block block = worldmap.getBlock(blockpos.getX(), blockpos.getY(), blockpos.getZ()); + Material material = block.getMaterial(); + + if (material == Material.air) + { + return PathNodeType.OPEN; + } + else if (block != Blocks.trapdoor && block != Blocks.waterlily) + { + if (block == Blocks.fire) + { + return PathNodeType.DAMAGE_FIRE; + } + else if (block == Blocks.cactus) + { + return PathNodeType.DAMAGE_CACTUS; + } + else if (block instanceof BlockDoor && material == Material.wood) + { + return PathNodeType.DOOR_WOOD_CLOSED; + } + else if (block instanceof BlockDoor && material == Material.iron) + { + return PathNodeType.DOOR_IRON_CLOSED; + } + else if (block instanceof BlockRailBase) + { + return PathNodeType.RAIL; + } + else if (!(block instanceof BlockFence) && !(block instanceof BlockWall) && (!(block instanceof BlockFenceGate))) + { + if (material == Material.water) + { + return PathNodeType.WATER; + } + else if (material == Material.lava) + { + return PathNodeType.LAVA; + } + else + { + return block.getBlocksMovement(worldmap, blockpos.getX(), blockpos.getY(), blockpos.getZ()) ? PathNodeType.OPEN : PathNodeType.BLOCKED; + } + } + else + { + return PathNodeType.FENCE; + } + } + else + { + return PathNodeType.TRAPDOOR; + } + } + + private PathNodeType getPathNodeType(EntityLiving p_192559_1_, BlockPos p_192559_2_) + { + return this.getPathNodeType(p_192559_1_, p_192559_2_.getX(), p_192559_2_.getY(), p_192559_2_.getZ()); + } + + private PathNodeType getPathNodeType(EntityLiving p_192558_1_, int p_192558_2_, int p_192558_3_, int p_192558_4_) + { + int entitySizeX = MathHelper.floor_double(p_192558_1_.width + 1.0F); + int entitySizeY = MathHelper.floor_double(p_192558_1_.height + 1.0F); + int entitySizeZ = MathHelper.floor_double(p_192558_1_.width + 1.0F); + return this.getPathNodeType(this.worldMap, p_192558_2_, p_192558_3_, p_192558_4_, p_192558_1_, entitySizeX, entitySizeY, entitySizeZ, false, false); + } + + public float getPathPriority(PathNodeType nodeType) + { + Float f = this.mapPathPriority.get(nodeType); + return f == null ? nodeType.getPriority() : f.floatValue(); + } + + } diff --git a/src/main/java/noppes/npcs/ai/pathfinder/FlyPathPoint.java b/src/main/java/noppes/npcs/ai/pathfinder/FlyPathPoint.java index 87af78ae7..8ef5b7cef 100644 --- a/src/main/java/noppes/npcs/ai/pathfinder/FlyPathPoint.java +++ b/src/main/java/noppes/npcs/ai/pathfinder/FlyPathPoint.java @@ -25,6 +25,8 @@ public class FlyPathPoint extends PathPoint public FlyPathPoint previous; /** Indicates this is the origin */ public boolean isFirst; + public float costMalus; + public PathNodeType nodeType = PathNodeType.BLOCKED; private static final String __OBFID = "CL_00000574"; public FlyPathPoint(int p_i2135_1_, int p_i2135_2_, int p_i2135_3_) diff --git a/src/main/java/noppes/npcs/ai/pathfinder/PathNavigateFlying.java b/src/main/java/noppes/npcs/ai/pathfinder/PathNavigateFlying.java index 944d87d55..9692c60a3 100644 --- a/src/main/java/noppes/npcs/ai/pathfinder/PathNavigateFlying.java +++ b/src/main/java/noppes/npcs/ai/pathfinder/PathNavigateFlying.java @@ -488,7 +488,7 @@ public class PathNavigateFlying extends PathNavigate { int i2 = j + l; int j2 = k + l; ChunkCache chunkcache = new ChunkCache(this.theEntity.worldObj, i1, j1, k1, l1, i2, j2, 0); - FlyPathEntity pathentity = (new FlyPathFinder(chunkcache, p_72865_4_, p_72865_5_, p_72865_6_, p_72865_7_)).createEntityPathTo(p_72865_1_, p_72865_2_, p_72865_3_); + FlyPathEntity pathentity = (new FlyPathFinder(chunkcache, p_72865_4_, p_72865_5_, p_72865_6_, p_72865_7_, p_72865_1_)).createEntityPathTo(p_72865_1_, p_72865_2_, p_72865_3_); this.theEntity.worldObj.theProfiler.endSection(); return pathentity; } @@ -507,7 +507,7 @@ public class PathNavigateFlying extends PathNavigate { int l2 = i1 + k1; int i3 = j1 + k1; ChunkCache chunkcache = new ChunkCache(this.theEntity.worldObj, l1, i2, j2, k2, l2, i3, 0); - FlyPathEntity pathentity = (new FlyPathFinder(chunkcache, p_72844_6_, p_72844_7_, p_72844_8_, p_72844_9_)).createEntityPathTo(p_72844_1_, p_72844_2_, p_72844_3_, p_72844_4_, p_72844_5_); + FlyPathEntity pathentity = (new FlyPathFinder(chunkcache, p_72844_6_, p_72844_7_, p_72844_8_, p_72844_9_, p_72844_1_)).createEntityPathTo(p_72844_1_, p_72844_2_, p_72844_3_, p_72844_4_, p_72844_5_); this.theEntity.worldObj.theProfiler.endSection(); return pathentity; } diff --git a/src/main/java/noppes/npcs/ai/pathfinder/PathNodeType.java b/src/main/java/noppes/npcs/ai/pathfinder/PathNodeType.java new file mode 100644 index 000000000..f49fe3c59 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/pathfinder/PathNodeType.java @@ -0,0 +1,34 @@ +package noppes.npcs.ai.pathfinder; + +public enum PathNodeType +{ + BLOCKED(-1.0F), + OPEN(0.0F), + WALKABLE(0.0F), + TRAPDOOR(0.0F), + FENCE(-1.0F), + LAVA(-1.0F), + WATER(8.0F), + RAIL(0.0F), + DANGER_FIRE(8.0F), + DAMAGE_FIRE(16.0F), + DANGER_CACTUS(8.0F), + DAMAGE_CACTUS(-1.0F), + DANGER_OTHER(8.0F), + DAMAGE_OTHER(-1.0F), + DOOR_OPEN(0.0F), + DOOR_WOOD_CLOSED(-1.0F), + DOOR_IRON_CLOSED(-1.0F); + + private final float priority; + + private PathNodeType(float priorityIn) + { + this.priority = priorityIn; + } + + public float getPriority() + { + return this.priority; + } +} \ No newline at end of file