1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
package net.minecraft.server;
import java.util.List;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
// CraftBukkit end
public class EntityPigZombie extends EntityZombie {
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);
this.texture = "/mob/pigzombie.png";
this.az = 0.5F;
this.c = 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);
}
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);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
nbttagcompound.a("Anger", (short) this.a);
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
this.a = nbttagcompound.d("Anger");
}
protected Entity l() {
return this.a == 0 ? null : super.l();
}
public void q() {
super.q();
}
public boolean a(Entity entity, int i) {
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) {
Entity entity1 = (Entity) list.get(j);
if (entity1 instanceof EntityPigZombie) {
EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
entitypigzombie.c(entity);
}
}
this.c(entity);
}
return super.a(entity, i);
}
private void c(Entity entity) {
// CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity bukkitTarget = null;
if (entity != null) {
bukkitTarget = entity.getBukkitEntity();
}
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);
}
}
// CraftBukkit end
}
protected String e() {
return "mob.zombiepig.zpig";
}
protected String f() {
return "mob.zombiepig.zpighurt";
}
protected String g() {
return "mob.zombiepig.zpigdeath";
}
protected int h() {
return Item.GRILLED_PORK.id;
}
}
|