示例#1
0
  public void onLightningStrike(EntityLightning entitylightning) {
    if (!this.world.isStatic) {
      EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);

      // CraftBukkit start
      if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
        return;
      }
      // CraftBukkit end

      entitypigzombie.setEquipment(0, new ItemStack(Items.GOLDEN_SWORD));
      entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
      // CraftBukkit - added a reason for spawning this creature
      this.world.addEntity(
          entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
      this.die();
    }
  }
示例#2
0
  public boolean damageEntity(DamageSource damagesource, int i) {
    Entity entity = damagesource.getEntity();

    if ((entity instanceof EntityHuman)) {
      List list = this.world.getEntities(this, this.boundingBox.grow(32.0D, 32.0D, 32.0D));
      Iterator iterator = list.iterator();

      while (iterator.hasNext()) {
        Entity entity1 = (Entity) iterator.next();

        if ((entity1 instanceof EntityPigZombie)) {
          EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;

          entitypigzombie.c(entity);
        }
      }

      c(entity);
    }

    return super.damageEntity(damagesource, i);
  }
 protected void a(EntityCreature var1, EntityLiving var2) {
   super.a(var1, var2);
   if (var1 instanceof EntityPigZombie) {
     ((EntityPigZombie) var1).b((Entity) var2);
   }
 }