Paper/src/main/java/net/minecraft/server/EntityZombie.java

70 Zeilen
1.9 KiB
Java

2011-01-08 08:40:42 +01:00
package net.minecraft.server;
import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
2011-01-08 08:40:42 +01:00
2011-01-29 22:50:29 +01:00
public class EntityZombie extends EntityMonster {
2011-01-08 08:40:42 +01:00
public EntityZombie(World world) {
super(world);
2011-01-29 22:50:29 +01:00
this.texture = "/mob/zombie.png";
2012-01-12 23:10:13 +01:00
this.bb = 0.5F;
2011-11-20 09:01:14 +01:00
this.damage = 4;
2012-01-12 23:10:13 +01:00
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, world, 16.0F));
this.goalSelector.a(3, new PathfinderGoalRandomStroll(this));
this.goalSelector.a(4, new PathfinderGoalLookAtPlayer(this, world, 8.0F));
this.goalSelector.a(4, new PathfinderGoalRandomLookaround(this));
2011-01-08 08:40:42 +01:00
}
2011-11-20 09:01:14 +01:00
public int getMaxHealth() {
return 20;
}
2012-01-12 23:10:13 +01:00
public int P() {
2011-11-20 09:01:14 +01:00
return 2;
}
2012-01-12 23:10:13 +01:00
protected boolean as() {
return false;
}
2011-11-20 09:01:14 +01:00
public void d() {
if (this.world.e() && !this.world.isStatic) {
float f = this.a(1.0F);
2011-01-08 08:40:42 +01:00
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
this.world.getServer().getPluginManager().callEvent(event);
2011-02-23 13:56:36 +01:00
2011-01-10 09:30:34 +01:00
if (!event.isCancelled()) {
this.setOnFire(event.getDuration());
2011-01-10 09:30:34 +01:00
}
// CraftBukkit end
2011-01-08 08:40:42 +01:00
}
}
2011-01-29 22:50:29 +01:00
2011-11-20 09:01:14 +01:00
super.d();
2011-01-08 08:40:42 +01:00
}
2011-11-20 09:01:14 +01:00
protected String c_() {
2011-01-08 08:40:42 +01:00
return "mob.zombie";
}
2011-11-20 09:01:14 +01:00
protected String m() {
2011-01-08 08:40:42 +01:00
return "mob.zombiehurt";
}
2011-11-20 09:01:14 +01:00
protected String n() {
2011-01-08 08:40:42 +01:00
return "mob.zombiedeath";
}
2011-11-20 09:01:14 +01:00
protected int e() {
2011-09-15 02:23:52 +02:00
return Item.ROTTEN_FLESH.id;
2011-01-08 08:40:42 +01:00
}
2011-11-20 09:01:14 +01:00
public MonsterType getMonsterType() {
return MonsterType.UNDEAD;
2011-11-20 09:01:14 +01:00
}
2011-01-08 08:40:42 +01:00
}