/** * Instantiates the navigation of an ourEntity. * * @param entity the ourEntity. * @param world the world it is in. */ public PathNavigate(@NotNull final EntityLiving entity, final World world) { super(entity, world); this.ourEntity = entity; this.nodeProcessor = new WalkNodeProcessor(); }
@Override public void setEnterDoors(boolean value) { super.setEnterDoors(value); nodeProcessor.setCanEnterDoors(value); }
@Override public void setCanSwim(boolean value) { super.setCanSwim(value); nodeProcessor.setCanSwim(value); }
@Override protected PathNodeType getPathNodeTypeRaw(IBlockAccess world, int x, int y, int z) { BlockPos blockpos = new BlockPos(x, y, z); IBlockState iblockstate = world.getBlockState(blockpos); Block block = iblockstate.getBlock(); if (block instanceof BlockFenceGate) { return iblockstate.getValue(BlockFenceGate.OPEN) ? PathNodeType.DOOR_OPEN : PathNodeType.DOOR_WOOD_CLOSED; } return super.getPathNodeTypeRaw(world, x, y, z); } }
public Path getPathEntityToEntity(Entity entity, Entity targetEntity, float range) { int targX = MathHelper.floor(targetEntity.posX); int targY = MathHelper.floor(targetEntity.posY + 1.0D); int targZ = MathHelper.floor(targetEntity.posZ); PathFinder pf = new PathFinder(new WalkNodeProcessor()); return pf.findPath(entity.world, (EntityLiving) entity, new BlockPos(targX, targY, targZ), range); }
protected PathFinder getPathFinder() { this.nodeProcessor = new WalkNodeProcessor(); this.nodeProcessor.setCanEnterDoors(true); this.nodeProcessor.setCanSwim(true); return new PathFinder(this.nodeProcessor); }
protected PathFinder getPathFinder() { this.nodeProcessor = new WalkNodeProcessor(); this.nodeProcessor.setCanEnterDoors(true); this.nodeProcessor.setCanSwim(true); return new PathFinder(this.nodeProcessor); }
public Path getPathEntityToEntity(Entity entity, Entity targetEntity, float range) { int targX = MathHelper.floor(targetEntity.posX); int targY = MathHelper.floor(targetEntity.posY + 1.0D); int targZ = MathHelper.floor(targetEntity.posZ); PathFinder pf = new PathFinder(new WalkNodeProcessor()); return pf.findPath(targetEntity.getEntityWorld(), (EntityLiving) entity, new BlockPos(targX, targY, targZ), range); }