diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-11-20 00:01:14 -0800 |
---|---|---|
committer | Erik Broes <erikbroes@ripe.net> | 2011-11-20 00:01:33 -0800 |
commit | 345ea36c7bb3383c6e4825355d0043a646194eaa (patch) | |
tree | df116b57d92315c0a13c2fdc87d792b031c7239a /src/main/java/net/minecraft/server/EntityMonster.java | |
parent | 589f66bd1b766dc1fdd737ee885304196a2ed86a (diff) | |
download | craftbukkit-345ea36c7bb3383c6e4825355d0043a646194eaa.tar craftbukkit-345ea36c7bb3383c6e4825355d0043a646194eaa.tar.gz craftbukkit-345ea36c7bb3383c6e4825355d0043a646194eaa.tar.lz craftbukkit-345ea36c7bb3383c6e4825355d0043a646194eaa.tar.xz craftbukkit-345ea36c7bb3383c6e4825355d0043a646194eaa.zip |
Update for 1.0.0
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityMonster.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityMonster.java | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java index 2edf909f..79600d57 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -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(); + } } |