Ejemplo n.º 1
0
 @Override
 public void setDead() {
   if (getThrowingEntity() != null && getThrowingEntity() instanceof EntityNatureGuardian) {
     ((EntityNatureGuardian) getThrowingEntity()).hasSickle = true;
   } else if (getThrowingEntity() != null && getThrowingEntity() instanceof EntityPlayer) {
     if (!worldObj.isRemote)
       if (getThrowingEntity().getHealth() <= 0) {
         PlayerTracker.storeSoulboundItemForRespawn(
             (EntityPlayer) getThrowingEntity(), ItemsCommonProxy.natureScytheEnchanted.copy());
       } else {
         if (!((EntityPlayer) getThrowingEntity())
             .inventory.addItemStackToInventory(ItemsCommonProxy.natureScytheEnchanted.copy())) {
           EntityItem item = new EntityItem(worldObj);
           item.setPosition(posX, posY, posZ);
           item.setEntityItemStack(ItemsCommonProxy.natureScytheEnchanted.copy());
           worldObj.spawnEntityInWorld(item);
         }
       }
   }
   super.setDead();
 }
Ejemplo n.º 2
0
  /** Will get destroyed next tick. */
  public void setDead() {
    int var1 = this.getSlimeSize();

    if (!this.worldObj.isClient && var1 > 1 && this.getHealth() <= 0.0F) {
      int var2 = 2 + this.rand.nextInt(3);

      for (int var3 = 0; var3 < var2; ++var3) {
        float var4 = ((float) (var3 % 2) - 0.5F) * (float) var1 / 4.0F;
        float var5 = ((float) (var3 / 2) - 0.5F) * (float) var1 / 4.0F;
        EntitySlime var6 = this.createInstance();
        var6.setSlimeSize(var1 / 2);
        var6.setLocationAndAngles(
            this.posX + (double) var4,
            this.posY + 0.5D,
            this.posZ + (double) var5,
            this.rand.nextFloat() * 360.0F,
            0.0F);
        this.worldObj.spawnEntityInWorld(var6);
      }
    }

    super.setDead();
  }
Ejemplo n.º 3
0
  /** Will get destroyed next tick. */
  public void setDead() {
    int i = this.getSlimeSize();

    if (!this.worldObj.isRemote && i > 1 && this.getHealth() <= 0.0F) {
      int j = 2 + this.rand.nextInt(3);

      for (int k = 0; k < j; ++k) {
        float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
        float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
        EntityBlueSlime entityslime = this.createInstance();
        entityslime.setSlimeSize(i / 2);
        entityslime.setLocationAndAngles(
            this.posX + (double) f,
            this.posY + 0.5D,
            this.posZ + (double) f1,
            this.rand.nextFloat() * 360.0F,
            0.0F);
        this.worldObj.spawnEntityInWorld(entityslime);
      }
    }

    super.setDead();
  }
Ejemplo n.º 4
0
  public static MobData calcMobs(
      ICommandSender sender,
      EntityPlayerMP player,
      boolean details,
      boolean kill,
      MobType type,
      float radius,
      HashMap<Chunk, Integer> mobs,
      WorldMobsVisitor visitor) {
    MobData total = new MobData();

    for (WorldServer s : ForgeTools.server.worldServers) {
      MobData worldData = new MobData();
      boolean playerInWorld =
          (player != null) ? s.getWorldInfo().equals(player.worldObj.getWorldInfo()) : false;

      List loadedEntityList = new ArrayList(s.loadedEntityList);
      for (int id = 0; id < loadedEntityList.size(); id++) {
        Object m = loadedEntityList.get(id);
        Chunk c;

        if (m instanceof EntityLiving) {
          c =
              s.getChunkFromChunkCoords(
                  ((EntityLiving) m).chunkCoordX, ((EntityLiving) m).chunkCoordY);
          if (!c.isChunkLoaded) continue;
        } else continue;

        if (m instanceof EntityMob) {
          if (kill
              && type.is(MobType.hostile)
              && (player == null || ((EntityLiving) m).getDistanceToEntity(player) <= radius)) {
            ((EntityLiving) m).setDead();
            worldData.incAmtRemoved();
          } else worldData.incAmtHos();
        } else if ((m instanceof IAnimals) && !(m instanceof INpc)) {
          if (kill
              && type.is(MobType.passive)
              && (player == null || ((EntityLiving) m).getDistanceToEntity(player) <= radius)) {
            ((EntityLiving) m).setDead();
            worldData.incAmtRemoved();
          } else worldData.incAmtPas();
        } else if (m instanceof INpc) {
          if (kill
              && (type.is(MobType.npc))
              && (player == null || ((EntityLiving) m).getDistanceToEntity(player) <= radius)) {
            ((EntityLiving) m).setDead();
            worldData.incAmtRemoved();
          } else worldData.incAmtNPC();
        }

        if (!kill) {
          if (mobs.get(c) == null) {
            mobs.put(c, 1);
          } else {
            mobs.put(c, mobs.get(c) + 1);
          }
        }
      }

      visitor.visit(sender, playerInWorld, worldData, s, details, kill, type);

      total.incTotal(worldData);
    }
    return total;
  }
 @Override
 public void setDead() {
   super.setDead();
   if (worldObj != null) ; // spawnedEntities--;
 }