diff options
author | h31ix <zero_gravity@outlook.com> | 2013-07-08 20:25:35 -0400 |
---|---|---|
committer | mbax <matt@phozop.net> | 2013-07-10 13:45:43 -0400 |
commit | a192775f0fc6f6a7431da5af4b0e00deff3f64e6 (patch) | |
tree | 6e7ad657262e9b7e82141cc80bae8af16b63042d /src/main/java | |
parent | f665884955e0a664e93125553eb764e2c3d1a763 (diff) | |
download | craftbukkit-a192775f0fc6f6a7431da5af4b0e00deff3f64e6.tar craftbukkit-a192775f0fc6f6a7431da5af4b0e00deff3f64e6.tar.gz craftbukkit-a192775f0fc6f6a7431da5af4b0e00deff3f64e6.tar.lz craftbukkit-a192775f0fc6f6a7431da5af4b0e00deff3f64e6.tar.xz craftbukkit-a192775f0fc6f6a7431da5af4b0e00deff3f64e6.zip |
Add PathfinderGoalTame for diff visibility.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/minecraft/server/PathfinderGoalTame.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTame.java b/src/main/java/net/minecraft/server/PathfinderGoalTame.java new file mode 100644 index 00000000..889dc719 --- /dev/null +++ b/src/main/java/net/minecraft/server/PathfinderGoalTame.java @@ -0,0 +1,63 @@ +package net.minecraft.server; + +public class PathfinderGoalTame extends PathfinderGoal { + + private EntityHorse entity; + private double b; + private double c; + private double d; + private double e; + + public PathfinderGoalTame(EntityHorse entityhorse, double d0) { + this.entity = entityhorse; + this.b = d0; + this.a(1); + } + + public boolean a() { + if (!this.entity.isTame() && this.entity.passenger != null) { + Vec3D vec3d = RandomPositionGenerator.a(this.entity, 5, 4); + + if (vec3d == null) { + return false; + } else { + this.c = vec3d.c; + this.d = vec3d.d; + this.e = vec3d.e; + return true; + } + } else { + return false; + } + } + + public void c() { + this.entity.getNavigation().a(this.c, this.d, this.e, this.b); + } + + public boolean b() { + return !this.entity.getNavigation().g() && this.entity.passenger != null; + } + + public void e() { + if (this.entity.aC().nextInt(50) == 0) { + if (this.entity.passenger instanceof EntityHuman) { + int i = this.entity.getTemper(); + int j = this.entity.cq(); + + if (j > 0 && this.entity.aC().nextInt(j) < i) { + this.entity.g((EntityHuman) this.entity.passenger); + this.entity.world.broadcastEntityEffect(this.entity, (byte) 7); + return; + } + + this.entity.t(5); + } + + this.entity.passenger.mount((Entity) null); + this.entity.passenger = null; + this.entity.cD(); + this.entity.world.broadcastEntityEffect(this.entity, (byte) 6); + } + } +} |