summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/EntityMonster.java
diff options
context:
space:
mode:
authorErik Broes <erikbroes@grum.nl>2011-06-27 00:25:01 +0200
committerErik Broes <erikbroes@grum.nl>2011-06-27 00:47:03 +0200
commita98c7ba2c706caa0ba83bddefa5ffecbe658ccd3 (patch)
treef7c9c5db09b72b57a85240cc7fdb2e4bcf7ab875 /src/main/java/net/minecraft/server/EntityMonster.java
parent9e5dba8306f77e0583537efe7d5b3670639e3382 (diff)
downloadcraftbukkit-a98c7ba2c706caa0ba83bddefa5ffecbe658ccd3.tar
craftbukkit-a98c7ba2c706caa0ba83bddefa5ffecbe658ccd3.tar.gz
craftbukkit-a98c7ba2c706caa0ba83bddefa5ffecbe658ccd3.tar.lz
craftbukkit-a98c7ba2c706caa0ba83bddefa5ffecbe658ccd3.tar.xz
craftbukkit-a98c7ba2c706caa0ba83bddefa5ffecbe658ccd3.zip
Massive renaming update in nms. If you bypassed Bukkit, you will likely break.
Also minimized all the nms diffs and generic cleanups all around.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityMonster.java')
-rw-r--r--src/main/java/net/minecraft/server/EntityMonster.java23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java
index 84b1be49..a7f7be92 100644
--- a/src/main/java/net/minecraft/server/EntityMonster.java
+++ b/src/main/java/net/minecraft/server/EntityMonster.java
@@ -1,14 +1,10 @@
package net.minecraft.server;
// CraftBukkit start
-import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity;
-
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityTargetEvent;
-import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
// CraftBukkit end
public class EntityMonster extends EntityCreature implements IMonster {
@@ -38,7 +34,7 @@ public class EntityMonster extends EntityCreature implements IMonster {
}
protected Entity findTarget() {
- EntityHuman entityhuman = this.world.a(this, 16.0D);
+ EntityHuman entityhuman = this.world.findNearbyPlayer(this, 16.0D);
return entityhuman != null && this.e(entityhuman) ? entityhuman : null;
}
@@ -48,14 +44,10 @@ public class EntityMonster extends EntityCreature implements IMonster {
if (this.passenger != entity && this.vehicle != entity) {
if (entity != this) {
// CraftBukkit start
- CraftServer server = ((WorldServer) this.world).getServer();
- org.bukkit.entity.Entity bukkitTarget = null;
- if (entity != null) {
- bukkitTarget = entity.getBukkitEntity();
- }
+ org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
- EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY);
- server.getPluginManager().callEvent(event);
+ EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
+ this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
if (event.getTarget() == null) {
@@ -83,13 +75,10 @@ public class EntityMonster extends EntityCreature implements IMonster {
// 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.
if (entity instanceof EntityLiving && !(entity instanceof EntityHuman)) {
- CraftServer server = ((WorldServer) this.world).getServer();
- org.bukkit.entity.Entity damager = this.getBukkitEntity();
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
- DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
- EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, this.damage);
- server.getPluginManager().callEvent(event);
+ EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(this.getBukkitEntity(), damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, this.damage);
+ this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
entity.damageEntity(this, event.getDamage());