public boolean a() { if (this.a.bO()) { return false; } else { ChunkCoordinates chunkcoordinates = this.a.bP(); Vec3D vec3d = RandomPositionGenerator.a( this.a, 16, 7, this.a .world .getVec3DPool() .create( (double) chunkcoordinates.x, (double) chunkcoordinates.y, (double) chunkcoordinates.z)); if (vec3d == null) { return false; } else { this.b = vec3d.c; this.c = vec3d.d; this.d = vec3d.e; return true; } } }
/** Execute a one shot task or start executing a continuous task */ public void startExecuting() { this.insidePosX = -1; if (this.entityObj.getDistanceSq( (double) this.doorInfo.getInsidePosX(), (double) this.doorInfo.posY, (double) this.doorInfo.getInsidePosZ()) > 256.0D) { Vec3D var1 = RandomPositionGenerator.func_48620_a( this.entityObj, 14, 3, Vec3D.createVector( (double) this.doorInfo.getInsidePosX() + 0.5D, (double) this.doorInfo.getInsidePosY(), (double) this.doorInfo.getInsidePosZ() + 0.5D)); if (var1 != null) { this.entityObj.getNavigator().tryMoveToXYZ(var1.xCoord, var1.yCoord, var1.zCoord, 0.3F); } } else { this.entityObj .getNavigator() .tryMoveToXYZ( (double) this.doorInfo.getInsidePosX() + 0.5D, (double) this.doorInfo.getInsidePosY(), (double) this.doorInfo.getInsidePosZ() + 0.5D, 0.3F); } }
/** Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { targetEntity = theEntity.getAttackTarget(); if (targetEntity == null) { return false; } if (targetEntity.getDistanceSqToEntity(theEntity) > (double) (field_48218_g * field_48218_g)) { return false; } Vec3D vec3d = RandomPositionGenerator.func_48395_a( theEntity, 16, 7, Vec3D.createVector(targetEntity.posX, targetEntity.posY, targetEntity.posZ)); if (vec3d == null) { return false; } else { movePosX = vec3d.xCoord; movePosY = vec3d.yCoord; movePosZ = vec3d.zCoord; return true; } }
/** Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { if (this.targetEntityClass == EntityPlayer.class) { if (this.theEntity instanceof EntityTameable && ((EntityTameable) this.theEntity).isTamed()) { return false; } this.closestLivingEntity = this.theEntity.worldObj.getClosestPlayerToEntity( this.theEntity, (double) this.distanceFromEntity); if (this.closestLivingEntity == null) { return false; } } else { List list = this.theEntity.worldObj.selectEntitiesWithinAABB( this.targetEntityClass, this.theEntity.boundingBox.expand( (double) this.distanceFromEntity, 3.0D, (double) this.distanceFromEntity), this.field_98218_a); if (list.isEmpty()) { return false; } this.closestLivingEntity = (Entity) list.get(0); } Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockAwayFrom( this.theEntity, 16, 7, this.theEntity .worldObj .getWorldVec3Pool() .getVecFromPool( this.closestLivingEntity.posX, this.closestLivingEntity.posY, this.closestLivingEntity.posZ)); if (vec3 == null) { return false; } else if (this.closestLivingEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity)) { return false; } else { this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(vec3.xCoord, vec3.yCoord, vec3.zCoord); return this.entityPathEntity == null ? false : this.entityPathEntity.isDestinationSame(vec3); } }
/** Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { if (!this.field_111180_a.func_110248_bS() && this.field_111180_a.riddenByEntity != null) { Vec3 var1 = RandomPositionGenerator.findRandomTarget(this.field_111180_a, 5, 4); if (var1 == null) { return false; } else { this.field_111179_c = var1.xCoord; this.field_111176_d = var1.yCoord; this.field_111177_e = var1.zCoord; return true; } } else { return false; } }
/** Returns whether the EntityAIBase should begin execution. */ public boolean shouldStartTask() { if (!this.horseHost.isTame() && this.horseHost.rider != null) { Vec3 var1 = RandomPositionGenerator.findRandomTarget(this.horseHost, 5, 4); if (var1 == null) { return false; } else { this.field_111179_c = var1.x; this.field_111176_d = var1.y; this.field_111177_e = var1.z; return true; } } else { return false; } }
@Test public void generatePositionsTest() { positions = RandomPositionGenerator.generatePositions(1000, 1.5, LAT, LON); }