Java Code Examples for net.minecraft.entity.ai.RandomPositionGenerator#findRandomTargetBlockTowards()

The following examples show how to use net.minecraft.entity.ai.RandomPositionGenerator#findRandomTargetBlockTowards() . 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: EntityAIMoveIntoArea.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
public boolean shouldExecute() {

		if (!enabled) {
			return false;
		}

		if (inCorrectPosition()) {
			return false;
		}

		Vec3d vec3d = RandomPositionGenerator.findRandomTargetBlockTowards(this.entity, 16, 7, new Vec3d((double) centerX, (double) entity.posY, (double) centerZ));

		if (vec3d == null) {
			return false;
		} else {
			this.movePosX = vec3d.x;
			this.movePosY = vec3d.y;
			this.movePosZ = vec3d.z;
			return true;
		}

	}
 
Example 2
Source File: Job.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Vec3d getSurfaceVecToward(EntityCreature ent, Vec3d vec, int xrad, int yrad)
{
	Vec3d vecRand = RandomPositionGenerator.findRandomTargetBlockTowards(ent, xrad, yrad, vec);
	return Job.groundify(ent.world, vecRand);
}