Added Entity.remove() which marks an entity for removal.

This commit is contained in:
sk89q 2011-02-18 20:02:20 -08:00
parent ec0eec5863
commit acd0344452

View File

@ -46,7 +46,6 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityGiantZombie) { return new CraftGiant( server, (EntityGiantZombie) entity); } else if (entity instanceof EntityGiantZombie) { return new CraftGiant( server, (EntityGiantZombie) entity); }
else if (entity instanceof EntitySkeleton) { return new CraftSkeleton( server, (EntitySkeleton) entity); } else if (entity instanceof EntitySkeleton) { return new CraftSkeleton( server, (EntitySkeleton) entity); }
else if (entity instanceof EntitySpider) { return new CraftSpider( server, (EntitySpider) entity); } else if (entity instanceof EntitySpider) { return new CraftSpider( server, (EntitySpider) entity); }
else if (entity instanceof EntitySlime) { return new CraftSlime( server, (EntitySlime) entity); }
else { return new CraftMonster( server, (EntityMonster) entity); } else { return new CraftMonster( server, (EntityMonster) entity); }
} }
@ -57,6 +56,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
} }
else { return new CraftCreature( server, (EntityCreature) entity); } else { return new CraftCreature( server, (EntityCreature) entity); }
} }
// Slimes are a special (and broken) case
else if (entity instanceof EntitySlime) { return new CraftSlime( server, (EntitySlime) entity); }
// Flying // Flying
else if (entity instanceof EntityFlying) { else if (entity instanceof EntityFlying) {
if (entity instanceof EntityGhast) { return new CraftGhast( server, (EntityGhast) entity); } if (entity instanceof EntityGhast) { return new CraftGhast( server, (EntityGhast) entity); }
@ -130,6 +131,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
entity.fireTicks = ticks; entity.fireTicks = ticks;
} }
public void remove() {
entity.dead = true;
}
public Entity getHandle() { public Entity getHandle() {
return entity; return entity;
} }