All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minecraft.server.PathfinderGoalTakeFlower Maven / Gradle / Ivy

package net.minecraft.server;

import java.util.List;

public class PathfinderGoalTakeFlower extends PathfinderGoal {
	
	private final EntityVillager a;
	private EntityIronGolem b;
	private int c;
	private boolean d;
	
	public PathfinderGoalTakeFlower(EntityVillager entityvillager) {
		this.a = entityvillager;
		this.setMutexBits(3);
	}
	
	public boolean a() {
		if (this.a.getAge() >= 0) {
			return false;
		} else if (!this.a.world.w()) {
			return false;
		} else {
			List list = this.a.world.a(EntityIronGolem.class, this.a.getBoundingBox().grow(6.0D, 2.0D, 6.0D));
			
			if (list.isEmpty()) {
				return false;
			} else {
				
				for (EntityIronGolem entityirongolem : list) {
					if (entityirongolem.cm() > 0) {
						this.b = entityirongolem;
						break;
					}
				}
				
				return this.b != null;
			}
		}
	}
	
	public boolean b() {
		return this.b.cm() > 0;
	}
	
	public void c() {
		this.c = this.a.getRandom().nextInt(320);
		this.d = false;
		this.b.getNavigation().clearPathEntity();
	}
	
	public void d() {
		this.b = null;
		this.a.getNavigation().clearPathEntity();
	}
	
	public void e() {
		this.a.getControllerLook().a(this.b, 30.0F, 30.0F);
		if (this.b.cm() == this.c) {
			this.a.getNavigation().tryMoveToEntity(this.b, 0.5D);
			this.d = true;
		}
		
		if (this.d && this.a.getDistanceSquaredToEntity(this.b) < 4.0D) {
			this.b.a(false);
			this.a.getNavigation().clearPathEntity();
		}
		
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy