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

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

package net.minecraft.server;

public class PathfinderGoalBeg extends PathfinderGoal {
	
	private final EntityWolf a;
	private EntityHuman b;
	private final World c;
	private final float d;
	private int e;
	
	public PathfinderGoalBeg(EntityWolf entitywolf, float f) {
		this.a = entitywolf;
		this.c = entitywolf.world;
		this.d = f;
		this.setMutexBits(2);
	}
	
	public boolean a() {
		this.b = this.c.findNearbyPlayer(this.a, this.d);
		return this.b != null && this.a(this.b);
	}
	
	public boolean b() {
		return this.b.isAlive() && (!(this.a.getDistanceSquaredToEntity(this.b) > (double) (this.d * this.d)) && this.e > 0 && this.a(this.b));
	}
	
	public void c() {
		this.a.p(true);
		this.e = 40 + this.a.getRandom().nextInt(40);
	}
	
	public void d() {
		this.a.p(false);
		this.b = null;
	}
	
	public void e() {
		this.a.getControllerLook().a(this.b.locX, this.b.locY + (double) this.b.getHeadHeight(), this.b.locZ, 10.0F, (float) this.a.getVerticalFaceSpeed());
		--this.e;
	}
	
	private boolean a(EntityHuman entityhuman) {
		ItemStack itemstack = entityhuman.inventory.getItemInHand();
		
		return itemstack != null && (!this.a.isTamed() && itemstack.getItem() == Items.BONE || this.a.d(itemstack));
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy