net.minecraft.pathfinding.PathNavigate Java Examples
The following examples show how to use
net.minecraft.pathfinding.PathNavigate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityTofuGandlem.java From TofuCraftReload with MIT License | 5 votes |
@Override protected PathNavigate createNavigator(World worldIn) { PathNavigateFlying pathnavigateflying = new PathNavigateFlying(this, worldIn); pathnavigateflying.setCanOpenDoors(false); pathnavigateflying.setCanFloat(true); pathnavigateflying.setCanEnterDoors(true); return pathnavigateflying; }
Example #2
Source File: EntityTofuTurret.java From TofuCraftReload with MIT License | 5 votes |
protected PathNavigate createNavigator(World worldIn) { PathNavigateFlying pathnavigateflying = new PathNavigateFlying(this, worldIn); pathnavigateflying.setCanOpenDoors(false); pathnavigateflying.setCanFloat(true); pathnavigateflying.setCanEnterDoors(true); return pathnavigateflying; }
Example #3
Source File: EntityAICustomDoorInteract.java From Et-Futurum with The Unlicense | 5 votes |
@Override public boolean shouldExecute() { if (!theEntity.isCollidedHorizontally) return false; else { PathNavigate pathnavigate = theEntity.getNavigator(); PathEntity pathentity = pathnavigate.getPath(); if (pathentity != null && !pathentity.isFinished() && pathnavigate.getCanBreakDoors()) { for (int i = 0; i < Math.min(pathentity.getCurrentPathIndex() + 2, pathentity.getCurrentPathLength()); ++i) { PathPoint pathpoint = pathentity.getPathPointFromIndex(i); entityPosX = pathpoint.xCoord; entityPosY = pathpoint.yCoord + 1; entityPosZ = pathpoint.zCoord; if (theEntity.getDistanceSq(entityPosX, theEntity.posY, entityPosZ) <= 2.25D) { field_151504_e = func_151503_a(entityPosX, entityPosY, entityPosZ); if (field_151504_e != null) return true; } } entityPosX = MathHelper.floor_double(theEntity.posX); entityPosY = MathHelper.floor_double(theEntity.posY + 1.0D); entityPosZ = MathHelper.floor_double(theEntity.posZ); field_151504_e = func_151503_a(entityPosX, entityPosY, entityPosZ); return field_151504_e != null; } else return false; } }
Example #4
Source File: EntityTofuFish.java From TofuCraftReload with MIT License | 4 votes |
protected PathNavigate createNavigator(World worldIn) { return new PathNavigateSwimmer(this, worldIn); }
Example #5
Source File: EntityDabSquirrel.java From CommunityMod with GNU Lesser General Public License v2.1 | 4 votes |
@Override protected PathNavigate createNavigator(World worldIn) { return new PathNavigateClimber(this, worldIn); }
Example #6
Source File: EntityFairy.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
@NotNull @Override public PathNavigate createNavigator(@NotNull World worldIn) { return new WizardryFlyablePathNavigator(this, worldIn); }
Example #7
Source File: EntityUnicorn.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
@NotNull @Override protected PathNavigate createNavigator(@NotNull World worldIn) { return new WizardryFlyablePathNavigator(this, world); }
Example #8
Source File: BodyguardGolemCore.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
@Override public PathNavigate getNavigator() { return golem.getNavigator(); }
Example #9
Source File: EntityAIHerdMove.java From TFC2 with GNU General Public License v3.0 | 4 votes |
@Nullable public static Vec3d generateRandomPos(EntityCreature entity, int xz, int y, @Nullable Vec3d target, boolean p_191379_4_) { PathNavigate pathnavigate = entity.getNavigator(); Random random = entity.getRNG(); boolean flag; if (entity.hasHome()) { double d0 = entity.getHomePosition().distanceSq((double)MathHelper.floor(entity.posX), (double)MathHelper.floor(entity.posY), (double)MathHelper.floor(entity.posZ)) + 4.0D; double d1 = (double)(entity.getMaximumHomeDistance() + (float)xz); flag = d0 < d1 * d1; } else { flag = false; } boolean flag1 = false; float weight = -99999.0F; int outX = 0; int outY = 0; int outZ = 0; for (int k = 0; k < 10; ++k) { int _x = random.nextInt(2 * xz + 1) - xz; int _y = random.nextInt(2 * y + 1) - y; int _z = random.nextInt(2 * xz + 1) - xz; if (target == null || (double)_x * target.xCoord + (double)_z * target.zCoord >= 0.0D) { if (entity.hasHome() && xz > 1) { BlockPos blockpos = entity.getHomePosition(); if (entity.posX > (double)blockpos.getX()) { _x -= random.nextInt(xz / 2); } else { _x += random.nextInt(xz / 2); } if (entity.posZ > (double)blockpos.getZ()) { _z -= random.nextInt(xz / 2); } else { _z += random.nextInt(xz / 2); } } BlockPos blockpos1 = new BlockPos((double)_x + entity.posX, (double)_y + entity.posY, (double)_z + entity.posZ); if ((!flag || entity.isWithinHomeDistanceFromPosition(blockpos1)) && pathnavigate.canEntityStandOnPos(blockpos1)) { if (!p_191379_4_) { blockpos1 = moveAboveSolid(blockpos1, entity); if (isWaterDestination(blockpos1, entity)) { continue; } } float _weight = entity.getBlockPathWeight(blockpos1); if (_weight > weight) { weight = _weight; outX = _x; outY = _y; outZ = _z; flag1 = true; } } } } if (flag1) { return new Vec3d((double)outX + entity.posX, (double)outY + entity.posY, (double)outZ + entity.posZ); } else { return null; } }
Example #10
Source File: EntityAIWanderHex.java From TFC2 with GNU General Public License v3.0 | 4 votes |
@Nullable public static Vec3d generateRandomPosInCenter(EntityCreature entity, int xz, int y,boolean pathThroughWater, IslandMap map, Center c) { PathNavigate pathnavigate = entity.getNavigator(); Random random = entity.getRNG(); boolean flag; BlockPos centerPos = c.point.toBlockPos().add(map.getParams().getWorldX(), 0, map.getParams().getWorldZ()); if (entity.hasHome()) { double d0 = entity.getHomePosition().distanceSq((double)MathHelper.floor(entity.posX), (double)MathHelper.floor(entity.posY), (double)MathHelper.floor(entity.posZ)) + 4.0D; double d1 = (double)(entity.getMaximumHomeDistance() + (float)xz); flag = d0 < d1 * d1; } else { flag = false; } boolean flag1 = false; float weight = -99999.0F; int outX = 0; int outY = 0; int outZ = 0; for (int k = 0; k < 10; ++k) { int _x = random.nextInt(2 * xz + 1) - xz; int _y = random.nextInt(2 * y + 1) - y; int _z = random.nextInt(2 * xz + 1) - xz; if (entity.hasHome() && xz > 1) { BlockPos blockpos = entity.getHomePosition(); if (entity.posX > (double)blockpos.getX()) { _x -= random.nextInt(xz / 2); } else { _x += random.nextInt(xz / 2); } if (entity.posZ > (double)blockpos.getZ()) { _z -= random.nextInt(xz / 2); } else { _z += random.nextInt(xz / 2); } } BlockPos blockpos1 = new BlockPos((double)_x + centerPos.getX(), (double)_y + centerPos.getY(), (double)_z + centerPos.getZ()); if ((!flag || entity.isWithinHomeDistanceFromPosition(blockpos1)) && pathnavigate.canEntityStandOnPos(blockpos1)) { if (!pathThroughWater) { blockpos1 = moveAboveSolid(blockpos1, entity); if (isWaterDestination(blockpos1, entity)) { continue; } } float _weight = entity.getBlockPathWeight(blockpos1); if (_weight > weight) { weight = _weight; outX = _x; outY = _y; outZ = _z; flag1 = true; } } } if (flag1) { return new Vec3d((double)outX + centerPos.getX(), (double)outY + centerPos.getY(), (double)outZ + centerPos.getZ()); } else { return null; } }
Example #11
Source File: EntityAIMountedAttackOnCollide.java From EnderZoo with Creative Commons Zero v1.0 Universal | 4 votes |
/** * Execute a one shot task or start executing a continuous task */ public void startExecuting() { PathNavigate nav = getNavigator(); nav.setPath(entityPathEntity, speedTowardsTarget); pathUpdateTimer = 0; }
Example #12
Source File: EntityAIMountedAttackOnCollide.java From EnderZoo with Creative Commons Zero v1.0 Universal | 4 votes |
protected PathNavigate getNavigator() { return attacker.getNavigator(); }
Example #13
Source File: EntityAIMountedArrowAttack.java From EnderZoo with Creative Commons Zero v1.0 Universal | 4 votes |
protected PathNavigate getNavigator() { return entityHost.getNavigator(); }
Example #14
Source File: EntityOwl.java From EnderZoo with Creative Commons Zero v1.0 Universal | 4 votes |
@Override protected PathNavigate createNavigator(World worldIn) { return new FlyingPathNavigate(this, worldIn); }