@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);
  }
예제 #2
0
 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;
 }
예제 #3
0
파일: NMS.java 프로젝트: Jun3541/Citizens2
 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();
 }