@Override public void collide(Entity inEntity) { if (this.getRemoteEntity() == null) { super.collide(inEntity); return; } if (((RemoteBaseEntity) this.m_remoteEntity).onCollide(inEntity.getBukkitEntity())) super.collide(inEntity); }
public boolean attack(Entity entity, DamageSource damageSource, float damage) { PetAttackEvent attackEvent = new PetAttackEvent(this.getPet(), entity.getBukkitEntity(), f); EchoPet.getPlugin().getServer().getPluginManager().callEvent(attackEvent); if (!attackEvent.isCancelled()) { if (entity instanceof EntityPlayer) { if (!(EchoPet.getConfig().getBoolean("canAttackPlayers", false))) { return false; } } return entity.damageEntity(damageSource, (float) attackEvent.getDamage()); } return false; }
public static org.bukkit.entity.Entity spawnCustomEntity( org.bukkit.World world, Location at, Class<? extends Entity> clazz, EntityType type) { World handle = ((CraftWorld) world).getHandle(); Entity entity = null; try { Constructor<?> constructor = getCustomEntityConstructor(clazz, type); entity = (Entity) constructor.newInstance(handle); } catch (Exception e) { Messaging.logTr(Messages.ERROR_SPAWNING_CUSTOM_ENTITY, e.getMessage()); return null; } entity.setLocation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch()); handle.addEntity(entity); entity.setLocation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch()); return entity.getBukkitEntity(); }