PaperMC/src/main/java/net/minecraft/server/EntitySkeleton.java

106 lines
2.8 KiB
Java
Raw Normal View History

2011-01-08 08:40:42 +01:00
package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
2011-01-08 08:40:42 +01:00
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityCombustEvent;
// CraftBukkit end
2011-01-08 08:40:42 +01:00
public class EntitySkeleton extends EntityMobs {
2011-01-10 09:30:34 +01:00
private static final ItemStack a;
public EntitySkeleton(World world) {
super(world);
2011-01-14 14:31:10 +01:00
aP = "/mob/skeleton.png";
//CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftLivingEntity(server, this);
//CraftBukkit end
2011-01-10 09:30:34 +01:00
}
2011-01-14 14:31:10 +01:00
protected String e() {
2011-01-10 09:30:34 +01:00
return "mob.skeleton";
}
2011-01-14 14:31:10 +01:00
protected String f() {
2011-01-10 09:30:34 +01:00
return "mob.skeletonhurt";
}
2011-01-14 14:31:10 +01:00
protected String g() {
2011-01-10 09:30:34 +01:00
return "mob.skeletonhurt";
}
2011-01-14 14:31:10 +01:00
public void o() {
2011-01-10 09:30:34 +01:00
if (l.b()) {
float f1 = b(1.0F);
2011-01-14 14:31:10 +01:00
if (f1 > 0.5F && l.i(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 0.4F) * 2.0F) {
// CraftBukkit start
2011-01-10 09:30:34 +01:00
CraftServer server = ((WorldServer) l).getServer();
EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, this.getBukkitEntity());
2011-01-10 09:30:34 +01:00
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
Z = 300;
}
// CraftBukkit end
2011-01-10 09:30:34 +01:00
}
}
2011-01-14 14:31:10 +01:00
super.o();
2011-01-10 09:30:34 +01:00
}
protected void a(Entity entity, float f1) {
if (f1 < 10F) {
2011-01-14 14:31:10 +01:00
double d = entity.p - p;
double d1 = entity.r - r;
2011-01-10 09:30:34 +01:00
2011-01-14 14:31:10 +01:00
if (bf == 0) {
EntityArrow entityarrow = new EntityArrow(l, ((EntityLiving) (this)));
2011-01-10 09:30:34 +01:00
entityarrow.q += 1.3999999761581421D;
2011-01-14 14:31:10 +01:00
double d2 = entity.q - 0.20000000298023224D - entityarrow.q;
float f2 = MathHelper.a(d * d + d1 * d1) * 0.2F;
2011-01-10 09:30:34 +01:00
l.a(((Entity) (this)), "random.bow", 1.0F, 1.0F / (W.nextFloat() * 0.4F + 0.8F));
l.a(((Entity) (entityarrow)));
2011-01-14 14:31:10 +01:00
entityarrow.a(d, d2 + (double) f2, d1, 0.6F, 12F);
bf = 30;
2011-01-10 09:30:34 +01:00
}
2011-01-14 14:31:10 +01:00
v = (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F;
e = true;
2011-01-10 09:30:34 +01:00
}
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
}
2011-01-14 14:31:10 +01:00
protected int h() {
return Item.j.ba;
}
protected void g_() {
int i = W.nextInt(3);
for (int j = 0; j < i; j++) {
a(Item.j.ba, 1);
}
i = W.nextInt(3);
for (int k = 0; k < i; k++) {
a(Item.aV.ba, 1);
}
2011-01-10 09:30:34 +01:00
}
static {
a = new ItemStack(Item.i, 1);
}
2011-01-08 08:40:42 +01:00
}