summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/EntityPigZombie.java
diff options
context:
space:
mode:
authorErik Broes <erikbroes@grum.nl>2011-04-20 19:05:14 +0200
committerErik Broes <erikbroes@grum.nl>2011-04-20 19:05:14 +0200
commit483a878b8bcf1feb789cb5fd9374d0a060cc4d8a (patch)
treefb56faee3872a85282e2fa88235580589c826e45 /src/main/java/net/minecraft/server/EntityPigZombie.java
parentac9f297445a6116c5bb314b3be9f38520a58845e (diff)
downloadcraftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.tar
craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.tar.gz
craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.tar.lz
craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.tar.xz
craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.zip
Update for 1.4_00_01 -- if you bypassed Bukkit, you will most likely break.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityPigZombie.java')
-rw-r--r--src/main/java/net/minecraft/server/EntityPigZombie.java46
1 files changed, 25 insertions, 21 deletions
diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java
index 382bcdfb..3f8e1823 100644
--- a/src/main/java/net/minecraft/server/EntityPigZombie.java
+++ b/src/main/java/net/minecraft/server/EntityPigZombie.java
@@ -11,50 +11,50 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
public class EntityPigZombie extends EntityZombie {
- private int a = 0;
- private int b = 0;
+ private int angerLevel = 0;
+ private int soundDelay = 0;
private static final ItemStack f = new ItemStack(Item.GOLD_SWORD, 1);
public EntityPigZombie(World world) {
super(world);
this.texture = "/mob/pigzombie.png";
this.az = 0.5F;
- this.c = 5;
+ this.damage = 5;
this.by = true;
}
public void f_() {
- this.az = this.d != null ? 0.95F : 0.5F;
- if (this.b > 0 && --this.b == 0) {
- this.world.a(this, "mob.zombiepig.zpigangry", this.i() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
+ this.az = this.target != null ? 0.95F : 0.5F;
+ if (this.soundDelay > 0 && --this.soundDelay == 0) {
+ this.world.makeSound(this, "mob.zombiepig.zpigangry", this.i() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
}
super.f_();
}
public boolean b() {
- return this.world.j > 0 && this.world.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox);
+ return this.world.spawnMonsters > 0 && this.world.containsEntity(this.boundingBox) && this.world.getEntities(this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- nbttagcompound.a("Anger", (short) this.a);
+ nbttagcompound.a("Anger", (short) this.angerLevel);
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- this.a = nbttagcompound.d("Anger");
+ this.angerLevel = nbttagcompound.d("Anger");
}
- protected Entity m() {
- return this.a == 0 ? null : super.m();
+ protected Entity findTarget() {
+ return this.angerLevel == 0 ? null : super.findTarget();
}
public void r() {
super.r();
}
- public boolean a(Entity entity, int i) {
+ public boolean damageEntity(Entity entity, int i) {
if (entity instanceof EntityHuman) {
List list = this.world.b((Entity) this, this.boundingBox.b(32.0D, 32.0D, 32.0D));
@@ -71,7 +71,7 @@ public class EntityPigZombie extends EntityZombie {
this.d(entity);
}
- return super.a(entity, i);
+ return super.damageEntity(entity, i);
}
private void d(Entity entity) {
@@ -85,16 +85,20 @@ public class EntityPigZombie extends EntityZombie {
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.PIG_ZOMBIE_TARGET);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled()) {
- if (event.getTarget() == null) {
- this.d = null;
- } else {
- this.d = ((CraftEntity) event.getTarget()).getHandle();
- this.a = 400 + this.random.nextInt(400);
- this.b = this.random.nextInt(40);
- }
+ if (event.isCancelled()) {
+ return;
+ }
+
+ if (event.getTarget() == null) {
+ this.target = null;
+ return;
}
+ entity = ((CraftEntity) event.getTarget()).getHandle();
// CraftBukkit end
+
+ this.target = entity;
+ this.angerLevel = 400 + this.random.nextInt(400);
+ this.soundDelay = this.random.nextInt(40);
}
protected String e() {