public void handleBlockDig(Packet14BlockDig packet14blockdig) {
   WorldServer worldserver = mcServer.getWorldManager(playerEntity.dimension);
   if (packet14blockdig.status == 4) {
     playerEntity.dropCurrentItem();
     return;
   }
   boolean flag =
       worldserver.field_819_z =
           worldserver.worldProvider.worldType != 0
               || mcServer.configManager.isOp(playerEntity.username);
   boolean flag1 = false;
   if (packet14blockdig.status == 0) {
     flag1 = true;
   }
   if (packet14blockdig.status == 2) {
     flag1 = true;
   }
   int i = packet14blockdig.xPosition;
   int j = packet14blockdig.yPosition;
   int k = packet14blockdig.zPosition;
   if (flag1) {
     double d = playerEntity.posX - ((double) i + 0.5D);
     double d1 = playerEntity.posY - ((double) j + 0.5D);
     double d3 = playerEntity.posZ - ((double) k + 0.5D);
     double d5 = d * d + d1 * d1 + d3 * d3;
     if (d5 > 36D) {
       return;
     }
   }
   ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
   int l = (int) MathHelper.abs(i - chunkcoordinates.posX);
   int i1 = (int) MathHelper.abs(k - chunkcoordinates.posZ);
   if (l > i1) {
     i1 = l;
   }
   if (packet14blockdig.status == 0) {
     if (i1 > 16 || flag) {
       playerEntity.itemInWorldManager.func_324_a(i, j, k, packet14blockdig.face);
     } else {
       playerEntity.playerNetServerHandler.sendPacket(
           new Packet53BlockChange(i, j, k, worldserver));
     }
   } else if (packet14blockdig.status == 2) {
     playerEntity.itemInWorldManager.func_22045_b(i, j, k);
     if (worldserver.getBlockId(i, j, k) != 0) {
       playerEntity.playerNetServerHandler.sendPacket(
           new Packet53BlockChange(i, j, k, worldserver));
     }
   } else if (packet14blockdig.status == 3) {
     double d2 = playerEntity.posX - ((double) i + 0.5D);
     double d4 = playerEntity.posY - ((double) j + 0.5D);
     double d6 = playerEntity.posZ - ((double) k + 0.5D);
     double d7 = d2 * d2 + d4 * d4 + d6 * d6;
     if (d7 < 256D) {
       playerEntity.playerNetServerHandler.sendPacket(
           new Packet53BlockChange(i, j, k, worldserver));
     }
   }
   worldserver.field_819_z = false;
 }
 public void func_994_a(Entity entity, AxisAlignedBB axisalignedbb, List list) {
   int i = MathHelper.func_1108_b((axisalignedbb.field_1697_b - 2D) / 16D);
   int j = MathHelper.func_1108_b((axisalignedbb.field_1702_e + 2D) / 16D);
   if (i < 0) {
     i = 0;
   }
   if (j >= field_1528_m.length) {
     j = field_1528_m.length - 1;
   }
   for (int k = i; k <= j; k++) {
     List list1 = field_1528_m[k];
     for (int l = 0; l < list1.size(); l++) {
       Entity entity1 = (Entity) list1.get(l);
       if (entity1 == entity || !entity1.field_601_au.func_1178_a(axisalignedbb)) {
         continue;
       }
       list.add(entity1);
       Entity aentity[] = entity1.func_40048_X();
       if (aentity == null) {
         continue;
       }
       for (int i1 = 0; i1 < aentity.length; i1++) {
         Entity entity2 = aentity[i1];
         if (entity2 != entity && entity2.field_601_au.func_1178_a(axisalignedbb)) {
           list.add(entity2);
         }
       }
     }
   }
 }
 @Override
 protected void executeOverride(final RunningEffect triggerRE, final boolean trigger) {
   if (!this.isValueComputationEnabled()) {
     return;
   }
   if (this.m_caster == null || !(this.m_caster instanceof BasicCharacterInfo)) {
     return;
   }
   if (this.m_nbDepositMin <= 0) {
     return;
   }
   final List<AbstractDepositEffectArea> depositAreas =
       StaticEffectAreaManager.getInstance().getDepositAreas();
   final short casterLevel = ((BasicCharacterInfo) this.m_caster).getLevel();
   final int roll = MathHelper.random(100);
   boolean rareIsDiscovered = false;
   if (roll < this.m_discoverRareDepositPercentage) {
     rareIsDiscovered = true;
   }
   int nbDeposit = MathHelper.random(this.m_nbDepositMin, this.m_nbDepositMax + 1);
   if (rareIsDiscovered) {
     this.spawnRareDeposit(depositAreas, casterLevel);
     --nbDeposit;
   }
   for (int i = 0; i < nbDeposit; ++i) {
     this.spawnDeposit(depositAreas, casterLevel);
   }
 }
 public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
   super.readEntityFromNBT(nbttagcompound);
   NBTTagList nbttaglist = nbttagcompound.getTagList("Inventory");
   inventory.readFromNBT(nbttaglist);
   dimension = nbttagcompound.getInteger("Dimension");
   sleeping = nbttagcompound.getBoolean("Sleeping");
   sleepTimer = nbttagcompound.getShort("SleepTimer");
   currentXP = nbttagcompound.getFloat("XpP");
   playerLevel = nbttagcompound.getInteger("XpLevel");
   totalXP = nbttagcompound.getInteger("XpTotal");
   if (sleeping) {
     bedChunkCoordinates =
         new ChunkCoordinates(
             MathHelper.floor_double(posX),
             MathHelper.floor_double(posY),
             MathHelper.floor_double(posZ));
     wakeUpPlayer(true, true, false);
   }
   if (nbttagcompound.hasKey("SpawnX")
       && nbttagcompound.hasKey("SpawnY")
       && nbttagcompound.hasKey("SpawnZ")) {
     playerSpawnCoordinate =
         new ChunkCoordinates(
             nbttagcompound.getInteger("SpawnX"),
             nbttagcompound.getInteger("SpawnY"),
             nbttagcompound.getInteger("SpawnZ"));
   }
   foodStats.readStatsFromNBT(nbttagcompound);
   capabilities.readCapabilitiesFromNBT(nbttagcompound);
 }
  /** checks to make sure painting can be placed there */
  public boolean onValidSurface() {
    if (worldObj.getCollidingBoundingBoxes(this, boundingBox).size() > 0) {
      return false;
    }

    int i = art.sizeX / 16;
    int j = art.sizeY / 16;
    int k = xPosition;
    int l = yPosition;
    int i1 = zPosition;

    if (direction == 0) {
      k = MathHelper.floor_double(posX - (double) ((float) art.sizeX / 32F));
    }

    if (direction == 1) {
      i1 = MathHelper.floor_double(posZ - (double) ((float) art.sizeX / 32F));
    }

    if (direction == 2) {
      k = MathHelper.floor_double(posX - (double) ((float) art.sizeX / 32F));
    }

    if (direction == 3) {
      i1 = MathHelper.floor_double(posZ - (double) ((float) art.sizeX / 32F));
    }

    l = MathHelper.floor_double(posY - (double) ((float) art.sizeY / 32F));

    for (int j1 = 0; j1 < i; j1++) {
      for (int k1 = 0; k1 < j; k1++) {
        Material material;

        if (direction == 0 || direction == 2) {
          material = worldObj.getBlockMaterial(k + j1, l + k1, zPosition);
        } else {
          material = worldObj.getBlockMaterial(xPosition, l + k1, i1 + j1);
        }

        if (!material.isSolid()) {
          return false;
        }
      }
    }

    List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox);

    for (int l1 = 0; l1 < list.size(); l1++) {
      if (list.get(l1) instanceof EntityPainting) {
        return false;
      }
    }

    return true;
  }
  public List func_22176_b() {
    ArrayList arraylist = new ArrayList();
    File afile[] = field_22180_a.listFiles();
    File afile1[] = afile;
    int i = afile1.length;
    for (int j = 0; j < i; j++) {
      File file = afile1[j];
      if (!file.isDirectory()) {
        continue;
      }
      String s = file.getName();
      WorldInfo worldinfo = func_22173_b(s);
      if (worldinfo == null) {
        continue;
      }
      boolean flag = worldinfo.getSaveVersion() != 19132;
      String s1 = worldinfo.getWorldName();
      if (s1 == null || MathHelper.stringNullOrLengthZero(s1)) {
        s1 = s;
      }
      arraylist.add(
          new SaveFormatComparator(
              s, s1, worldinfo.getLastTimePlayed(), worldinfo.getSizeOnDisk(), flag));
    }

    return arraylist;
  }
 public EntityFireball(
     World p_i3572_1_,
     double p_i3572_2_,
     double p_i3572_4_,
     double p_i3572_6_,
     double p_i3572_8_,
     double p_i3572_10_,
     double p_i3572_12_) {
   super(p_i3572_1_);
   field_70231_e = -1;
   field_70228_f = -1;
   field_70229_g = -1;
   field_70237_h = 0;
   field_70238_i = false;
   field_70234_an = 0;
   func_70105_a(1.0F, 1.0F);
   func_70012_b(p_i3572_2_, p_i3572_4_, p_i3572_6_, field_70177_z, field_70125_A);
   func_70107_b(p_i3572_2_, p_i3572_4_, p_i3572_6_);
   double d =
       MathHelper.func_76133_a(
           p_i3572_8_ * p_i3572_8_ + p_i3572_10_ * p_i3572_10_ + p_i3572_12_ * p_i3572_12_);
   field_70232_b = (p_i3572_8_ / d) * 0.10000000000000001D;
   field_70233_c = (p_i3572_10_ / d) * 0.10000000000000001D;
   field_70230_d = (p_i3572_12_ / d) * 0.10000000000000001D;
 }
 public EntityFireball(
     World p_i3573_1_,
     EntityLiving p_i3573_2_,
     double p_i3573_3_,
     double p_i3573_5_,
     double p_i3573_7_) {
   super(p_i3573_1_);
   field_70231_e = -1;
   field_70228_f = -1;
   field_70229_g = -1;
   field_70237_h = 0;
   field_70238_i = false;
   field_70234_an = 0;
   field_70235_a = p_i3573_2_;
   func_70105_a(1.0F, 1.0F);
   func_70012_b(
       p_i3573_2_.field_70165_t,
       p_i3573_2_.field_70163_u,
       p_i3573_2_.field_70161_v,
       p_i3573_2_.field_70177_z,
       p_i3573_2_.field_70125_A);
   func_70107_b(field_70165_t, field_70163_u, field_70161_v);
   field_70129_M = 0.0F;
   field_70159_w = field_70181_x = field_70179_y = 0.0D;
   p_i3573_3_ += field_70146_Z.nextGaussian() * 0.40000000000000002D;
   p_i3573_5_ += field_70146_Z.nextGaussian() * 0.40000000000000002D;
   p_i3573_7_ += field_70146_Z.nextGaussian() * 0.40000000000000002D;
   double d =
       MathHelper.func_76133_a(
           p_i3573_3_ * p_i3573_3_ + p_i3573_5_ * p_i3573_5_ + p_i3573_7_ * p_i3573_7_);
   field_70232_b = (p_i3573_3_ / d) * 0.10000000000000001D;
   field_70233_c = (p_i3573_5_ / d) * 0.10000000000000001D;
   field_70230_d = (p_i3573_7_ / d) * 0.10000000000000001D;
 }
 private void addMountedMovementStat(double d, double d1, double d2) {
   if (ridingEntity != null) {
     int i = Math.round(MathHelper.sqrt_double(d * d + d1 * d1 + d2 * d2) * 100F);
     if (i > 0) {
       if (ridingEntity instanceof EntityMinecart) {
         addStat(StatList.distanceByMinecartStat, i);
         if (startMinecartRidingCoordinate == null) {
           startMinecartRidingCoordinate =
               new ChunkCoordinates(
                   MathHelper.floor_double(posX),
                   MathHelper.floor_double(posY),
                   MathHelper.floor_double(posZ));
         } else if (startMinecartRidingCoordinate.getSqDistanceTo(
                 MathHelper.floor_double(posX),
                 MathHelper.floor_double(posY),
                 MathHelper.floor_double(posZ))
             >= 1000D) {
           addStat(AchievementList.onARail, 1);
         }
       } else if (ridingEntity instanceof EntityBoat) {
         addStat(StatList.distanceByBoatStat, i);
       } else if (ridingEntity instanceof EntityPig) {
         addStat(StatList.distanceByPigStat, i);
       }
     }
   }
 }
 public void onDeath(DamageSource damagesource) {
   super.onDeath(damagesource);
   setSize(0.2F, 0.2F);
   setPosition(posX, posY, posZ);
   motionY = 0.10000000149011612D;
   if (username.equals("Notch")) {
     dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true);
   }
   inventory.dropAllItems();
   if (damagesource != null) {
     motionX = -MathHelper.cos(((attackedAtYaw + rotationYaw) * 3.141593F) / 180F) * 0.1F;
     motionZ = -MathHelper.sin(((attackedAtYaw + rotationYaw) * 3.141593F) / 180F) * 0.1F;
   } else {
     motionX = motionZ = 0.0D;
   }
   yOffset = 0.1F;
   addStat(StatList.deathsStat, 1);
 }
Exemple #11
0
  /** Main function called by run() every loop. */
  public void tick() {
    long var1 = System.nanoTime();
    ++this.tickCounter;

    if (this.startProfiling) {
      this.startProfiling = false;
      this.theProfiler.profilingEnabled = true;
      this.theProfiler.clearProfiling();
    }

    this.theProfiler.startSection("root");
    this.updateTimeLightAndEntities();

    if (var1 - this.nanoTimeSinceStatusRefresh >= 5000000000L) {
      this.nanoTimeSinceStatusRefresh = var1;
      this.statusResponse.setPlayerCountData(
          new ServerStatusResponse.PlayerCountData(
              this.getMaxPlayers(), this.getCurrentPlayerCount()));
      GameProfile[] var3 = new GameProfile[Math.min(this.getCurrentPlayerCount(), 12)];
      int var4 =
          MathHelper.getRandomIntegerInRange(
              this.random, 0, this.getCurrentPlayerCount() - var3.length);

      for (int var5 = 0; var5 < var3.length; ++var5) {
        var3[var5] =
            ((EntityPlayerMP) this.serverConfigManager.playerEntityList.get(var4 + var5))
                .getGameProfile();
      }

      Collections.shuffle(Arrays.asList(var3));
      this.statusResponse.getPlayerCountData().setPlayers(var3);
    }

    if (this.tickCounter % 900 == 0) {
      this.theProfiler.startSection("save");
      this.serverConfigManager.saveAllPlayerData();
      this.saveAllWorlds(true);
      this.theProfiler.endSection();
    }

    this.theProfiler.startSection("tallying");
    this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - var1;
    this.theProfiler.endSection();
    this.theProfiler.startSection("snooper");

    if (!this.usageSnooper.isSnooperRunning() && this.tickCounter > 100) {
      this.usageSnooper.startSnooper();
    }

    if (this.tickCounter % 6000 == 0) {
      this.usageSnooper.addMemoryStatsToSnooper();
    }

    this.theProfiler.endSection();
    this.theProfiler.endSection();
  }
Exemple #12
0
 public void getEntitiesOfTypeWithinAAAB(Class class1, AxisAlignedBB axisalignedbb, List list) {
   int i = MathHelper.floor_double((axisalignedbb.minY - 2D) / 16D);
   int j = MathHelper.floor_double((axisalignedbb.maxY + 2D) / 16D);
   if (i < 0) {
     i = 0;
   }
   if (j >= entities.length) {
     j = entities.length - 1;
   }
   for (int k = i; k <= j; k++) {
     List list1 = entities[k];
     for (int l = 0; l < list1.size(); l++) {
       Entity entity = (Entity) list1.get(l);
       if (class1.isAssignableFrom(entity.getClass())
           && entity.boundingBox.intersectsWith(axisalignedbb)) {
         list.add(entity);
       }
     }
   }
 }
Exemple #13
0
 public void getEntitiesWithinAABBForEntity(
     Entity entity, AxisAlignedBB axisalignedbb, List list) {
   int i = MathHelper.floor_double((axisalignedbb.minY - 2D) / 16D);
   int j = MathHelper.floor_double((axisalignedbb.maxY + 2D) / 16D);
   if (i < 0) {
     i = 0;
   }
   if (j >= entities.length) {
     j = entities.length - 1;
   }
   for (int k = i; k <= j; k++) {
     List list1 = entities[k];
     for (int l = 0; l < list1.size(); l++) {
       Entity entity1 = (Entity) list1.get(l);
       if (entity1 != entity && entity1.boundingBox.intersectsWith(axisalignedbb)) {
         list.add(entity1);
       }
     }
   }
 }
 @SuppressWarnings("unchecked")
 @Override
 public List<ItemStack> getDrops(
     IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
   return new ArrayList<ItemStack>(
       Arrays.asList(
           new ItemStack[] {
             new ItemStack(
                 UItems.infectedcrop, MathHelper.getRandomIntegerInRange(new Random(), 1, 4))
           }));
 }
 public void func_1000_a(Entity entity) {
   field_1523_r = true;
   int i = MathHelper.func_1108_b(entity.field_611_ak / 16D);
   int j = MathHelper.func_1108_b(entity.field_609_am / 16D);
   if (i != field_1531_j || j != field_1530_k) {
     System.out.println(
         (new StringBuilder()).append("Wrong location! ").append(entity).toString());
     Thread.dumpStack();
   }
   int k = MathHelper.func_1108_b(entity.field_610_al / 16D);
   if (k < 0) {
     k = 0;
   }
   if (k >= field_1528_m.length) {
     k = field_1528_m.length - 1;
   }
   entity.field_621_aZ = true;
   entity.field_657_ba = field_1531_j;
   entity.field_656_bb = k;
   entity.field_654_bc = field_1530_k;
   field_1528_m[k].add(entity);
 }
Exemple #16
0
 public void addEntity(Entity entity) {
   hasEntities = true;
   int i = MathHelper.floor_double(entity.posX / 16D);
   int j = MathHelper.floor_double(entity.posZ / 16D);
   if (i != xPosition || j != zPosition) {
     System.out.println(
         (new StringBuilder()).append("Wrong location! ").append(entity).toString());
     Thread.dumpStack();
   }
   int k = MathHelper.floor_double(entity.posY / 16D);
   if (k < 0) {
     k = 0;
   }
   if (k >= entities.length) {
     k = entities.length - 1;
   }
   entity.addedToChunk = true;
   entity.chunkCoordX = xPosition;
   entity.chunkCoordY = k;
   entity.chunkCoordZ = zPosition;
   entities[k].add(entity);
 }
Exemple #17
0
 public void update(final DisplayedScreenWorld world, final int deltaTime) {
   this.m_position += deltaTime;
   final ArrayList<DisplayedScreenMap> maps = world.getMaps();
   for (int i = maps.size() - 1; i >= 0; --i) {
     final DisplayedScreenMap map = maps.get(i);
     if (map != null) {
       final DisplayedScreenElement[] elts = map.getElements();
       if (elts != null) {
         for (final DisplayedScreenElement elt : elts) {
           if (elt.isVisible()) {
             final int id = elt.getElement().getCommonProperties().getId();
             if (Sea.WATER_ELEMENTS.contains(id)) {
               final float x = elt.getWorldCellX();
               final float y = elt.getWorldCellY();
               final float d =
                   (float) Math.sqrt(x * x + y * y) + this.m_speed * this.m_position / 1000.0f;
               float amplitude = this.m_amplitude * MathHelper.sinf(6.2831855f * d / this.m_width);
               if (amplitude < 0.0f) {
                 amplitude *= 0.2f;
               }
               final BatchTransformer batchTransformer = elt.getEntitySprite().getTransformer();
               final float tx = batchTransformer.getMatrix().getBuffer()[12];
               final float ty = batchTransformer.getMatrix().getBuffer()[13];
               batchTransformer
                   .getMatrix()
                   .set(
                       new float[] {
                         1.0f + amplitude,
                         0.0f,
                         0.0f,
                         0.0f,
                         0.0f,
                         1.0f + amplitude,
                         0.0f,
                         0.0f,
                         0.0f,
                         0.0f,
                         0.0f,
                         0.0f,
                         tx,
                         ty,
                         0.0f,
                         1.0f
                       });
             }
           }
         }
       }
     }
   }
 }
 public void doEffects(boolean flag) {
   worldObj.playSoundEffect(
       explosionX,
       explosionY,
       explosionZ,
       "random.explode",
       4F,
       (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
   ArrayList arraylist = new ArrayList();
   arraylist.addAll(destroyedBlockPositions);
   for (int i = arraylist.size() - 1; i >= 0; i--) {
     ChunkPosition chunkposition = (ChunkPosition) arraylist.get(i);
     int j = chunkposition.x;
     int k = chunkposition.y;
     int l = chunkposition.z;
     int i1 = worldObj.getBlockId(j, k, l);
     if (flag) {
       double d = (float) j + worldObj.rand.nextFloat();
       double d1 = (float) k + worldObj.rand.nextFloat();
       double d2 = (float) l + worldObj.rand.nextFloat();
       double d3 = d - explosionX;
       double d4 = d1 - explosionY;
       double d5 = d2 - explosionZ;
       double d6 = MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5);
       d3 /= d6;
       d4 /= d6;
       d5 /= d6;
       double d7 = 0.5D / (d6 / (double) explosionSize + 0.10000000000000001D);
       d7 *= worldObj.rand.nextFloat() * worldObj.rand.nextFloat() + 0.3F;
       d3 *= d7;
       d4 *= d7;
       d5 *= d7;
       worldObj.spawnParticle(
           "explode",
           (d + explosionX * 1.0D) / 2D,
           (d1 + explosionY * 1.0D) / 2D,
           (d2 + explosionZ * 1.0D) / 2D,
           d3,
           d4,
           d5);
       worldObj.spawnParticle("smoke", d, d1, d2, d3, d4, d5);
     }
     if (i1 > 0) {
       Block.blocksList[i1].dropBlockAsItemWithChance(
           worldObj, j, k, l, worldObj.getBlockMetadata(j, k, l), 0.3F);
       worldObj.setBlockWithNotify(j, k, l, 0);
       Block.blocksList[i1].onBlockDestroyedByExplosion(worldObj, j, k, l);
     }
   }
 }
 public void addMovementStat(double d, double d1, double d2) {
   if (ridingEntity != null) {
     return;
   }
   if (isInsideOfMaterial(Material.water)) {
     int i = Math.round(MathHelper.sqrt_double(d * d + d1 * d1 + d2 * d2) * 100F);
     if (i > 0) {
       addStat(StatList.distanceDoveStat, i);
       addExhaustion(0.015F * (float) i * 0.01F);
     }
   } else if (isInWater()) {
     int j = Math.round(MathHelper.sqrt_double(d * d + d2 * d2) * 100F);
     if (j > 0) {
       addStat(StatList.distanceSwumStat, j);
       addExhaustion(0.015F * (float) j * 0.01F);
     }
   } else if (isOnLadder()) {
     if (d1 > 0.0D) {
       addStat(StatList.distanceClimbedStat, (int) Math.round(d1 * 100D));
     }
   } else if (onGround) {
     int k = Math.round(MathHelper.sqrt_double(d * d + d2 * d2) * 100F);
     if (k > 0) {
       addStat(StatList.distanceWalkedStat, k);
       if (isSprinting()) {
         addExhaustion(0.09999999F * (float) k * 0.01F);
       } else {
         addExhaustion(0.01F * (float) k * 0.01F);
       }
     }
   } else {
     int l = Math.round(MathHelper.sqrt_double(d * d + d2 * d2) * 100F);
     if (l > 25) {
       addStat(StatList.distanceFlownStat, l);
     }
   }
 }
Exemple #20
0
  public void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper) {
    playerSnooper.addClientStat("whitelist_enabled", Boolean.valueOf(false));
    playerSnooper.addClientStat("whitelist_count", Integer.valueOf(0));

    if (this.serverConfigManager != null) {
      playerSnooper.addClientStat("players_current", Integer.valueOf(this.getCurrentPlayerCount()));
      playerSnooper.addClientStat("players_max", Integer.valueOf(this.getMaxPlayers()));
      playerSnooper.addClientStat(
          "players_seen", Integer.valueOf(this.serverConfigManager.getAvailablePlayerDat().length));
    }

    playerSnooper.addClientStat("uses_auth", Boolean.valueOf(this.onlineMode));
    playerSnooper.addClientStat("gui_state", this.getGuiEnabled() ? "enabled" : "disabled");
    playerSnooper.addClientStat(
        "run_time",
        Long.valueOf(
            (getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L));
    playerSnooper.addClientStat(
        "avg_tick_ms", Integer.valueOf((int) (MathHelper.average(this.tickTimeArray) * 1.0E-6D)));
    int var2 = 0;

    if (this.worldServers != null) {
      for (int var3 = 0; var3 < this.worldServers.length; ++var3) {
        if (this.worldServers[var3] != null) {
          WorldServer var4 = this.worldServers[var3];
          WorldInfo var5 = var4.getWorldInfo();
          playerSnooper.addClientStat(
              "world[" + var2 + "][dimension]", Integer.valueOf(var4.provider.getDimensionId()));
          playerSnooper.addClientStat("world[" + var2 + "][mode]", var5.getGameType());
          playerSnooper.addClientStat("world[" + var2 + "][difficulty]", var4.getDifficulty());
          playerSnooper.addClientStat(
              "world[" + var2 + "][hardcore]", Boolean.valueOf(var5.isHardcoreModeEnabled()));
          playerSnooper.addClientStat(
              "world[" + var2 + "][generator_name]", var5.getTerrainType().getWorldTypeName());
          playerSnooper.addClientStat(
              "world[" + var2 + "][generator_version]",
              Integer.valueOf(var5.getTerrainType().getGeneratorVersion()));
          playerSnooper.addClientStat(
              "world[" + var2 + "][height]", Integer.valueOf(this.buildLimit));
          playerSnooper.addClientStat(
              "world[" + var2 + "][chunks_loaded]",
              Integer.valueOf(var4.getChunkProvider().getLoadedChunkCount()));
          ++var2;
        }
      }
    }

    playerSnooper.addClientStat("worlds", Integer.valueOf(var2));
  }
  private void getPathOrWalkableBlock(Entity entity, float f) {
    PathEntity pathentity = worldObj.getPathToEntity(this, entity, 16F);

    if (pathentity == null && f > 20F) {
      int i = MathHelper.floor_double(entity.posX) - 2;
      int j = MathHelper.floor_double(entity.posZ) - 2;
      int k = MathHelper.floor_double(entity.boundingBox.minY);
      for (int l = 0; l <= 4; l++) {
        for (int i1 = 0; i1 <= 4; i1++) {
          if ((l < 1 || i1 < 1 || l > 3 || i1 > 3)
              && worldObj.isBlockNormalCube(i + l, k - 1, j + i1)
              && !worldObj.isBlockNormalCube(i + l, k, j + i1)
              && !worldObj.isBlockNormalCube(i + l, k + 1, j + i1)) {
            setLocationAndAngles(
                (float) (i + l) + 0.5F, k, (float) (j + i1) + 0.5F, rotationYaw, rotationPitch);
            return;
          }
        }
      }

    } else {
      setPathToEntity(pathentity);
    }
  }
 public void func_1013_a(Class class1, AxisAlignedBB axisalignedbb, List list) {
   int i = MathHelper.func_1108_b((axisalignedbb.field_1697_b - 2D) / 16D);
   int j = MathHelper.func_1108_b((axisalignedbb.field_1702_e + 2D) / 16D);
   if (i < 0) {
     i = 0;
   } else if (i >= field_1528_m.length) {
     i = field_1528_m.length - 1;
   }
   if (j >= field_1528_m.length) {
     j = field_1528_m.length - 1;
   } else if (j < 0) {
     j = 0;
   }
   for (int k = i; k <= j; k++) {
     List list1 = field_1528_m[k];
     for (int l = 0; l < list1.size(); l++) {
       Entity entity = (Entity) list1.get(l);
       if (class1.isAssignableFrom(entity.getClass())
           && entity.field_601_au.func_1178_a(axisalignedbb)) {
         list.add(entity);
       }
     }
   }
 }
 private void spawnDeposit(
     final List<AbstractDepositEffectArea> depositAreas, final short casterLevel) {
   final int roll = MathHelper.random(100);
   AbstractDepositEffectArea deposit = null;
   for (int i = 0, n = depositAreas.size(); i < n; ++i) {
     final AbstractDepositEffectArea area = depositAreas.get(i);
     if (deposit == null) {
       deposit = area;
     } else if ((roll < deposit.getDepositLevel() && roll > area.getDepositLevel())
         || (roll > area.getDepositLevel()
             && area.getDepositLevel() > deposit.getDepositLevel())) {
       deposit = area;
     }
   }
   this.spawnDeposit((int) deposit.getBaseId());
 }
 public void onLivingUpdate() {
   if (flyToggleTimer > 0) {
     flyToggleTimer--;
   }
   if (worldObj.difficultySetting == 0
       && getEntityHealth() < getMaxHealth()
       && (ticksExisted % 20) * 12 == 0) {
     heal(1);
   }
   inventory.decrementAnimations();
   prevCameraYaw = cameraYaw;
   super.onLivingUpdate();
   landMovementFactor = speedOnGround;
   jumpMovementFactor = speedInAir;
   if (isSprinting()) {
     landMovementFactor += (double) speedOnGround * 0.29999999999999999D;
     jumpMovementFactor += (double) speedInAir * 0.29999999999999999D;
   }
   float f = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
   float f1 = (float) Math.atan(-motionY * 0.20000000298023224D) * 15F;
   if (f > 0.1F) {
     f = 0.1F;
   }
   if (!onGround || getEntityHealth() <= 0) {
     f = 0.0F;
   }
   if (onGround || getEntityHealth() <= 0) {
     f1 = 0.0F;
   }
   cameraYaw += (f - cameraYaw) * 0.4F;
   cameraPitch += (f1 - cameraPitch) * 0.8F;
   if (getEntityHealth() > 0) {
     List list =
         worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(1.0D, 0.0D, 1.0D));
     if (list != null) {
       for (int i = 0; i < list.size(); i++) {
         Entity entity = (Entity) list.get(i);
         if (!entity.isDead) {
           collideWithPlayer(entity);
         }
       }
     }
   }
 }
  public List getSaveList() {
    ArrayList arraylist = new ArrayList();
    File afile[] = savesDirectory.listFiles();
    File afile1[] = afile;
    int i = afile1.length;

    for (int j = 0; j < i; j++) {
      File file = afile1[j];

      if (!file.isDirectory()) {
        continue;
      }

      String s = file.getName();
      WorldInfo worldinfo = getWorldInfo(s);

      if (worldinfo == null
          || worldinfo.getSaveVersion() != 19132 && worldinfo.getSaveVersion() != 19133) {
        continue;
      }

      boolean flag = worldinfo.getSaveVersion() != getSaveVersion();
      String s1 = worldinfo.getWorldName();

      if (s1 == null || MathHelper.stringNullOrLengthZero(s1)) {
        s1 = s;
      }

      long l = 0L;
      arraylist.add(
          new SaveFormatComparator(
              s,
              s1,
              worldinfo.getLastTimePlayed(),
              l,
              worldinfo.getGameType(),
              flag,
              worldinfo.isHardcoreModeEnabled(),
              worldinfo.areCommandsAllowed()));
    }

    return arraylist;
  }
 private Point3 getRandomCellInEffectArea(final FightMap fightMap) {
   final AreaOfEffect areaOfEffect = ((WakfuEffect) this.m_genericEffect).getAreaOfEffect();
   if (areaOfEffect.getType() == AreaOfEffectEnum.EMPTY) {
     return fightMap.getInsideRandomCell();
   }
   final Direction8 dir = this.m_caster.getDirection();
   final Point3 casterCell = this.m_caster.getPosition();
   final Iterable<int[]> iterable =
       ((WakfuEffect) this.m_genericEffect)
           .getAreaOfEffect()
           .getCells(
               this.m_targetCell.getX(),
               this.m_targetCell.getY(),
               this.m_targetCell.getZ(),
               casterCell.getX(),
               casterCell.getY(),
               casterCell.getZ(),
               dir);
   final ArrayList<int[]> cells = new ArrayList<int[]>();
   for (final int[] next : iterable) {
     final int cellX = next[0];
     final int cellY = next[1];
     if (!fightMap.isInMap(cellX, cellY)) {
       continue;
     }
     if (!fightMap.isInside(cellX, cellY)) {
       continue;
     }
     final short cellHeight = fightMap.getCellHeight(cellX, cellY);
     if (cellHeight == -32768) {
       continue;
     }
     cells.add(next);
   }
   if (cells.isEmpty()) {
     EnutrofDepositPlacement.m_logger.error(
         (Object)
             ("Pas de cellule trouvee pour le spawn d'un gisement " + areaOfEffect.getType()));
     return null;
   }
   return new Point3(cells.get(MathHelper.random(cells.size())));
 }
 public void func_71860_a(
     World p_71860_1_, int p_71860_2_, int p_71860_3_, int p_71860_4_, EntityLiving p_71860_5_) {
   int i = p_71860_1_.func_72798_a(p_71860_2_, p_71860_3_, p_71860_4_ - 1);
   int j = p_71860_1_.func_72798_a(p_71860_2_, p_71860_3_, p_71860_4_ + 1);
   int k = p_71860_1_.func_72798_a(p_71860_2_ - 1, p_71860_3_, p_71860_4_);
   int l = p_71860_1_.func_72798_a(p_71860_2_ + 1, p_71860_3_, p_71860_4_);
   byte byte0 = 0;
   int i1 = MathHelper.func_76128_c((double) ((p_71860_5_.field_70177_z * 4F) / 360F) + 0.5D) & 3;
   if (i1 == 0) {
     byte0 = 2;
   }
   if (i1 == 1) {
     byte0 = 5;
   }
   if (i1 == 2) {
     byte0 = 3;
   }
   if (i1 == 3) {
     byte0 = 4;
   }
   if (i != field_71990_ca && j != field_71990_ca && k != field_71990_ca && l != field_71990_ca) {
     p_71860_1_.func_72921_c(p_71860_2_, p_71860_3_, p_71860_4_, byte0);
   } else {
     if ((i == field_71990_ca || j == field_71990_ca) && (byte0 == 4 || byte0 == 5)) {
       if (i == field_71990_ca) {
         p_71860_1_.func_72921_c(p_71860_2_, p_71860_3_, p_71860_4_ - 1, byte0);
       } else {
         p_71860_1_.func_72921_c(p_71860_2_, p_71860_3_, p_71860_4_ + 1, byte0);
       }
       p_71860_1_.func_72921_c(p_71860_2_, p_71860_3_, p_71860_4_, byte0);
     }
     if ((k == field_71990_ca || l == field_71990_ca) && (byte0 == 2 || byte0 == 3)) {
       if (k == field_71990_ca) {
         p_71860_1_.func_72921_c(p_71860_2_ - 1, p_71860_3_, p_71860_4_, byte0);
       } else {
         p_71860_1_.func_72921_c(p_71860_2_ + 1, p_71860_3_, p_71860_4_, byte0);
       }
       p_71860_1_.func_72921_c(p_71860_2_, p_71860_3_, p_71860_4_, byte0);
     }
   }
 }
 public WorldRenderer(World world, List list, int i, int j, int k, int l, int i1) {
   field_1744_C = -1;
   field_1749_o = false;
   field_1748_p = new boolean[2];
   field_1734_x = true;
   field_1739_E = false;
   field_1745_B = new ArrayList();
   field_1763_a = world;
   field_1737_F = list;
   field_1758_f = field_1757_g = field_1756_h = l;
   field_1740_t =
       MathHelper.func_1113_c(
               field_1758_f * field_1758_f
                   + field_1757_g * field_1757_g
                   + field_1756_h * field_1756_h)
           / 2.0F;
   field_1744_C = i1;
   field_1761_c = -999;
   func_1197_a(i, j, k);
   field_1738_u = false;
 }
 protected void bp() {
   if (--profession <= 0) {
     world.villages.a(MathHelper.floor(locX), MathHelper.floor(locY), MathHelper.floor(locZ));
     profession = 70 + random.nextInt(50);
     village =
         world.villages.getClosestVillage(
             MathHelper.floor(locX), MathHelper.floor(locY), MathHelper.floor(locZ), 32);
     if (village == null) {
       bV();
     } else {
       ChunkCoordinates chunkcoordinates = village.getCenter();
       a(
           chunkcoordinates.x,
           chunkcoordinates.y,
           chunkcoordinates.z,
           (int) ((float) village.getSize() * 0.6F));
       if (bz) {
         bz = false;
         village.b(5);
       }
     }
   }
   if (!ca() && bv > 0) {
     bv--;
     if (bv <= 0) {
       if (bw) {
         if (bu.size() > 1) {
           Iterator iterator = bu.iterator();
           do {
             if (!iterator.hasNext()) break;
             MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
             if (merchantrecipe.g()) merchantrecipe.a(random.nextInt(6) + random.nextInt(6) + 2);
           } while (true);
         }
         t(1);
         bw = false;
         if (village != null && by != null) {
           world.broadcastEntityEffect(this, (byte) 14);
           village.a(by, 1);
         }
       }
       addEffect(new MobEffect(MobEffectList.REGENERATION.id, 200, 0));
     }
   }
   super.bp();
 }
 public void dropPlayerItemWithRandomChoice(ItemStack itemstack, boolean flag) {
   if (itemstack == null) {
     return;
   }
   EntityItem entityitem =
       new EntityItem(
           worldObj,
           posX,
           (posY - 0.30000001192092896D) + (double) getEyeHeight(),
           posZ,
           itemstack);
   entityitem.delayBeforeCanPickup = 40;
   float f = 0.1F;
   if (flag) {
     float f2 = rand.nextFloat() * 0.5F;
     float f4 = rand.nextFloat() * 3.141593F * 2.0F;
     entityitem.motionX = -MathHelper.sin(f4) * f2;
     entityitem.motionZ = MathHelper.cos(f4) * f2;
     entityitem.motionY = 0.20000000298023224D;
   } else {
     float f1 = 0.3F;
     entityitem.motionX =
         -MathHelper.sin((rotationYaw / 180F) * 3.141593F)
             * MathHelper.cos((rotationPitch / 180F) * 3.141593F)
             * f1;
     entityitem.motionZ =
         MathHelper.cos((rotationYaw / 180F) * 3.141593F)
             * MathHelper.cos((rotationPitch / 180F) * 3.141593F)
             * f1;
     entityitem.motionY = -MathHelper.sin((rotationPitch / 180F) * 3.141593F) * f1 + 0.1F;
     f1 = 0.02F;
     float f3 = rand.nextFloat() * 3.141593F * 2.0F;
     f1 *= rand.nextFloat();
     entityitem.motionX += Math.cos(f3) * (double) f1;
     entityitem.motionY += (rand.nextFloat() - rand.nextFloat()) * 0.1F;
     entityitem.motionZ += Math.sin(f3) * (double) f1;
   }
   joinEntityItemWithWorld(entityitem);
   addStat(StatList.dropStat, 1);
 }