Port to new mc-dev format.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
@@ -13,52 +12,48 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
|
||||
public class EntityPigZombie extends EntityZombie {
|
||||
|
||||
private int a;
|
||||
private int b;
|
||||
private static final ItemStack f;
|
||||
private int a = 0;
|
||||
private int b = 0;
|
||||
private static final ItemStack f = new ItemStack(Item.GOLD_SWORD, 1);
|
||||
|
||||
public EntityPigZombie(World world) {
|
||||
super(world);
|
||||
a = 0;
|
||||
b = 0;
|
||||
aP = "/mob/pigzombie.png";
|
||||
bC = 0.5F;
|
||||
c = 5;
|
||||
ae = true;
|
||||
this.texture = "/mob/pigzombie.png";
|
||||
this.bC = 0.5F;
|
||||
this.c = 5;
|
||||
this.ae = true;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
this.bukkitEntity = new CraftPigZombie(server, this);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void b_() {
|
||||
bC = d == null ? 0.5F : 0.95F;
|
||||
if (b > 0 && --b == 0) {
|
||||
l.a(((Entity) (this)), "mob.zombiepig.zpigangry", i() * 2.0F, ((W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F) * 1.8F);
|
||||
this.bC = 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);
|
||||
}
|
||||
|
||||
super.b_();
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return l.k > 0 && l.a(z) && l.a(((Entity) (this)), z).size() == 0 && !l.b(z);
|
||||
return this.world.k > 0 && this.world.a(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.b(this.boundingBox);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
nbttagcompound.a("Anger", (short) a);
|
||||
nbttagcompound.a("Anger", (short) this.a);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
a = ((int) (nbttagcompound.c("Anger")));
|
||||
this.a = nbttagcompound.c("Anger");
|
||||
}
|
||||
|
||||
protected Entity l() {
|
||||
if (a == 0) {
|
||||
return null;
|
||||
} else {
|
||||
return super.l();
|
||||
}
|
||||
return this.a == 0 ? null : super.l();
|
||||
}
|
||||
|
||||
public void o() {
|
||||
@@ -66,10 +61,10 @@ public class EntityPigZombie extends EntityZombie {
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, int i) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
List list = l.b(((Entity) (this)), z.b(32D, 32D, 32D));
|
||||
if (entity instanceof EntityHuman) {
|
||||
List list = this.world.b((Entity) this, this.boundingBox.b(32.0D, 32.0D, 32.0D));
|
||||
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
|
||||
if (entity1 instanceof EntityPigZombie) {
|
||||
@@ -79,27 +74,28 @@ public class EntityPigZombie extends EntityZombie {
|
||||
}
|
||||
}
|
||||
|
||||
g(entity);
|
||||
this.g(entity);
|
||||
}
|
||||
|
||||
return super.a(entity, i);
|
||||
}
|
||||
|
||||
private void g(Entity entity) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.entity.Entity bukkitTarget = null;
|
||||
if(entity != null) {
|
||||
if (entity != null) {
|
||||
bukkitTarget = entity.getBukkitEntity();
|
||||
}
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.PIG_ZOMBIE_TARGET);
|
||||
CraftServer server = ((WorldServer) this.l).getServer();
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) {
|
||||
if(event.getTarget() == null) {
|
||||
d = null;
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.d = null;
|
||||
} else {
|
||||
d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
a = 400 + W.nextInt(400);
|
||||
b = W.nextInt(40);
|
||||
this.d = ((CraftEntity) event.getTarget()).getHandle();
|
||||
this.a = 400 + this.random.nextInt(400);
|
||||
this.b = this.random.nextInt(40);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -118,10 +114,6 @@ public class EntityPigZombie extends EntityZombie {
|
||||
}
|
||||
|
||||
protected int h() {
|
||||
return Item.ap.ba;
|
||||
}
|
||||
|
||||
static {
|
||||
f = new ItemStack(Item.E, 1);
|
||||
return Item.GRILLED_PORK.id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user