diff options
author | GJ <gjmcferrin@gmail.com> | 2014-03-24 10:36:41 -0400 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2014-04-18 10:42:54 -0500 |
commit | 3abba823151c87050fb7680c3a7194eb1fe5d64d (patch) | |
tree | 7aa01e1f204cc9b1b658ed99002efd51394d580b /src/main | |
parent | 7df7778ccb13aab76f672f06eea021d2d6020808 (diff) | |
download | craftbukkit-3abba823151c87050fb7680c3a7194eb1fe5d64d.tar craftbukkit-3abba823151c87050fb7680c3a7194eb1fe5d64d.tar.gz craftbukkit-3abba823151c87050fb7680c3a7194eb1fe5d64d.tar.lz craftbukkit-3abba823151c87050fb7680c3a7194eb1fe5d64d.tar.xz craftbukkit-3abba823151c87050fb7680c3a7194eb1fe5d64d.zip |
Add files from mc-dev for diff visibility.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java | 42 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/PathfinderGoalOcelotAttack.java | 57 |
2 files changed, 99 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java new file mode 100644 index 00000000..6686f059 --- /dev/null +++ b/src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java @@ -0,0 +1,42 @@ +package net.minecraft.server; + +import java.util.Iterator; +import java.util.List; + +public class PathfinderGoalHurtByTarget extends PathfinderGoalTarget { + + boolean a; + private int b; + + public PathfinderGoalHurtByTarget(EntityCreature entitycreature, boolean flag) { + super(entitycreature, false); + this.a = flag; + this.a(1); + } + + public boolean a() { + int i = this.c.aJ(); + + return i != this.b && this.a(this.c.getLastDamager(), false); + } + + public void c() { + this.c.setGoalTarget(this.c.getLastDamager()); + this.b = this.c.aJ(); + if (this.a) { + double d0 = this.f(); + List list = this.c.world.a(this.c.getClass(), AxisAlignedBB.a(this.c.locX, this.c.locY, this.c.locZ, this.c.locX + 1.0D, this.c.locY + 1.0D, this.c.locZ + 1.0D).grow(d0, 10.0D, d0)); + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { + EntityCreature entitycreature = (EntityCreature) iterator.next(); + + if (this.c != entitycreature && entitycreature.getGoalTarget() == null && !entitycreature.c(this.c.getLastDamager())) { + entitycreature.setGoalTarget(this.c.getLastDamager()); + } + } + } + + super.c(); + } +} diff --git a/src/main/java/net/minecraft/server/PathfinderGoalOcelotAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalOcelotAttack.java new file mode 100644 index 00000000..8baf68d3 --- /dev/null +++ b/src/main/java/net/minecraft/server/PathfinderGoalOcelotAttack.java @@ -0,0 +1,57 @@ +package net.minecraft.server; + +public class PathfinderGoalOcelotAttack extends PathfinderGoal { + + World a; + EntityInsentient b; + EntityLiving c; + int d; + + public PathfinderGoalOcelotAttack(EntityInsentient entityinsentient) { + this.b = entityinsentient; + this.a = entityinsentient.world; + this.a(3); + } + + public boolean a() { + EntityLiving entityliving = this.b.getGoalTarget(); + + if (entityliving == null) { + return false; + } else { + this.c = entityliving; + return true; + } + } + + public boolean b() { + return !this.c.isAlive() ? false : (this.b.f(this.c) > 225.0D ? false : !this.b.getNavigation().g() || this.a()); + } + + public void d() { + this.c = null; + this.b.getNavigation().h(); + } + + public void e() { + this.b.getControllerLook().a(this.c, 30.0F, 30.0F); + double d0 = (double) (this.b.width * 2.0F * this.b.width * 2.0F); + double d1 = this.b.e(this.c.locX, this.c.boundingBox.b, this.c.locZ); + double d2 = 0.8D; + + if (d1 > d0 && d1 < 16.0D) { + d2 = 1.33D; + } else if (d1 < 225.0D) { + d2 = 0.6D; + } + + this.b.getNavigation().a((Entity) this.c, d2); + this.d = Math.max(this.d - 1, 0); + if (d1 <= d0) { + if (this.d <= 0) { + this.d = 20; + this.b.n(this.c); + } + } + } +} |