Update for 1.0.0

This commit is contained in:
Erik Broes
2011-11-20 00:01:14 -08:00
committed by Erik Broes
parent 589f66bd1b
commit 345ea36c7b
153 changed files with 6128 additions and 4617 deletions

View File

@@ -13,31 +13,30 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
public EntityMonster(World world) {
super(world);
this.health = 20;
this.ax = 5;
this.az = 5;
}
public void s() {
float f = this.a_(1.0F);
public void d() {
float f = this.a(1.0F);
if (f > 0.5F) {
this.aO += 2;
this.aS += 2;
}
super.s();
super.d();
}
public void s_() {
super.s_();
public void w_() {
super.w_();
if (!this.world.isStatic && this.world.difficulty == 0) {
this.die();
}
}
protected Entity findTarget() {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, 16.0D);
EntityHuman entityhuman = this.world.b(this, 16.0D);
return entityhuman != null && this.f(entityhuman) ? entityhuman : null;
return entityhuman != null && this.g(entityhuman) ? entityhuman : null;
}
public boolean damageEntity(DamageSource damagesource, int i) {
@@ -71,7 +70,17 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
}
protected boolean c(Entity entity) {
protected boolean d(Entity entity) {
int i = this.damage;
if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
i += 3 << this.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
}
if (this.hasEffect(MobEffectList.WEAKNESS)) {
i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier();
}
// CraftBukkit start - this is still duplicated here and EntityHuman because it's possible for lastDamage EntityMonster
// to damage another EntityMonster, and we want to catch those events.
// This does not fire events for slime attacks, av they're not lastDamage EntityMonster.
@@ -80,22 +89,23 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(this.getBukkitEntity(), damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, this.damage);
this.world.getServer().getPluginManager().callEvent(event);
i = event.getDamage();
if (!event.isCancelled()) {
return entity.damageEntity(DamageSource.mobAttack(this), event.getDamage());
return entity.damageEntity(DamageSource.mobAttack(this), i);
}
return false;
}
// CraftBukkit end
return entity.damageEntity(DamageSource.mobAttack((EntityLiving) this), this.damage);
return entity.damageEntity(DamageSource.mobAttack(this), i);
}
protected void a(Entity entity, float f) {
if (this.attackTicks <= 0 && f < 2.0F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
this.attackTicks = 20;
this.c(entity);
this.d(entity);
}
}
@@ -111,7 +121,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
super.a(nbttagcompound);
}
public boolean d() {
protected boolean y() {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ);
@@ -121,7 +131,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
} else {
int l = this.world.getLightLevel(i, j, k);
if (this.world.t()) {
if (this.world.v()) {
int i1 = this.world.k;
this.world.k = 10;
@@ -129,7 +139,11 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
this.world.k = i1;
}
return l <= this.random.nextInt(8) && super.d();
return l <= this.random.nextInt(8);
}
}
public boolean g() {
return this.y() && super.g();
}
}