2011-01-08 08:40:42 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
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-07-29 09:33:13 +02:00
|
|
|
this.bw = 0.23F;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.damage = 4;
|
2012-07-29 09:33:13 +02:00
|
|
|
this.getNavigation().b(true);
|
2012-03-01 11:49:23 +01:00
|
|
|
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
|
|
|
this.goalSelector.a(1, new PathfinderGoalBreakDoor(this));
|
2012-07-29 09:33:13 +02:00
|
|
|
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, this.bw, false));
|
|
|
|
this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityVillager.class, this.bw, true));
|
|
|
|
this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, this.bw));
|
|
|
|
this.goalSelector.a(5, new PathfinderGoalMoveThroughVillage(this, this.bw, false));
|
|
|
|
this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, this.bw));
|
2012-03-01 11:49:23 +01:00
|
|
|
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
|
|
|
|
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
|
|
|
|
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
|
|
|
|
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 16.0F, 0, true));
|
|
|
|
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 16.0F, 0, false));
|
2011-01-08 08:40:42 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public int getMaxHealth() {
|
|
|
|
return 20;
|
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public int aO() {
|
2011-11-20 09:01:14 +01:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
protected boolean aV() {
|
2012-03-01 11:49:23 +01:00
|
|
|
return true;
|
2012-01-12 23:10:13 +01:00
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public void d() {
|
2012-08-25 02:51:51 +02:00
|
|
|
if (this.world.s() && !this.world.isStatic) {
|
2012-07-29 09:33:13 +02:00
|
|
|
float f = this.c(1.0F);
|
2011-01-08 08:40:42 +01:00
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
if (f > 0.5F && this.world.j(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
2011-01-11 09:25:13 +01:00
|
|
|
// CraftBukkit start
|
2011-11-29 08:10:05 +01:00
|
|
|
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
|
2011-06-27 00:25:01 +02:00
|
|
|
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()) {
|
2011-11-30 00:17:43 +01:00
|
|
|
this.setOnFire(event.getDuration());
|
2011-01-10 09:30:34 +01:00
|
|
|
}
|
2011-01-11 09:25:13 +01:00
|
|
|
// CraftBukkit end
|
2011-01-08 08:40:42 +01:00
|
|
|
}
|
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
super.d();
|
2011-01-08 08:40:42 +01:00
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
protected String aQ() {
|
2011-01-08 08:40:42 +01:00
|
|
|
return "mob.zombie";
|
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
protected String aR() {
|
2011-01-08 08:40:42 +01:00
|
|
|
return "mob.zombiehurt";
|
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
protected String aS() {
|
2011-01-08 08:40:42 +01:00
|
|
|
return "mob.zombiedeath";
|
|
|
|
}
|
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
protected int getLootId() {
|
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
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public EnumMonsterType getMonsterType() {
|
|
|
|
return EnumMonsterType.UNDEAD;
|
2011-11-20 09:01:14 +01:00
|
|
|
}
|
2012-03-01 11:49:23 +01:00
|
|
|
|
2012-03-21 02:55:45 +01:00
|
|
|
// CraftBukkit start - return rare dropped item instead of dropping it
|
2012-07-29 09:33:13 +02:00
|
|
|
protected ItemStack l(int i) {
|
2012-03-01 11:49:23 +01:00
|
|
|
switch (this.random.nextInt(4)) {
|
2012-07-29 09:33:13 +02:00
|
|
|
case 0:
|
|
|
|
return new ItemStack(Item.IRON_SWORD.id, 1, 0);
|
|
|
|
case 1:
|
|
|
|
return new ItemStack(Item.IRON_HELMET.id, 1, 0);
|
|
|
|
case 2:
|
|
|
|
return new ItemStack(Item.IRON_INGOT.id, 1, 0);
|
|
|
|
case 3:
|
|
|
|
return new ItemStack(Item.IRON_SPADE.id, 1, 0);
|
|
|
|
default:
|
|
|
|
return null;
|
2012-03-01 11:49:23 +01:00
|
|
|
}
|
|
|
|
}
|
2012-03-21 02:55:45 +01:00
|
|
|
// CraftBukkit end
|
2011-01-08 08:40:42 +01:00
|
|
|
}
|