public void onUpdateEntity(boolean flag) {
    super.onUpdate();
    for (int i = 0; i < inventory.getSizeInventory(); i++) {
      ItemStack itemstack = inventory.getStackInSlot(i);
      if (itemstack == null
          || !Item.itemsList[itemstack.itemID].func_28019_b()
          || playerNetServerHandler.getNumChunkDataPackets() > 2) {
        continue;
      }
      Packet packet =
          ((ItemMapBase) Item.itemsList[itemstack.itemID])
              .getUpdatePacket(itemstack, worldObj, this);
      if (packet != null) {
        playerNetServerHandler.sendPacket(packet);
      }
    }

    if (flag && !loadedChunks.isEmpty()) {
      ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) loadedChunks.get(0);
      if (chunkcoordintpair != null) {
        boolean flag1 = false;
        if (playerNetServerHandler.getNumChunkDataPackets() < 4) {
          flag1 = true;
        }
        if (flag1) {
          WorldServer worldserver = mcServer.getWorldManager(dimension);
          loadedChunks.remove(chunkcoordintpair);
          playerNetServerHandler.sendPacket(
              new Packet51MapChunk(
                  chunkcoordintpair.chunkXPos * 16,
                  0,
                  chunkcoordintpair.chunkZPos * 16,
                  16,
                  worldserver.worldYMax,
                  16,
                  worldserver));
          List list =
              worldserver.getTileEntityList(
                  chunkcoordintpair.chunkXPos * 16,
                  0,
                  chunkcoordintpair.chunkZPos * 16,
                  chunkcoordintpair.chunkXPos * 16 + 16,
                  worldserver.worldYMax,
                  chunkcoordintpair.chunkZPos * 16 + 16);
          for (int j = 0; j < list.size(); j++) {
            getTileEntityInfo((TileEntity) list.get(j));
          }
        }
      }
    }
    if (inPortal) {
      if (mcServer.propertyManagerObj.getBooleanProperty("allow-nether", true)) {
        if (currentCraftingInventory != personalCraftingInventory) {
          usePersonalCraftingInventory();
        }
        if (ridingEntity != null) {
          mountEntity(ridingEntity);
        } else {
          timeInPortal += 0.0125F;
          if (timeInPortal >= 1.0F) {
            timeInPortal = 1.0F;
            timeUntilPortal = 10;
            byte byte0 = 0;
            if (dimension == -1) {
              byte0 = 0;
            } else {
              byte0 = -1;
            }
            mcServer.configManager.sendPlayerToOtherDimension(this, byte0);
            field_35220_ce = -1;
            lastHealth = -1;
            field_35221_cc = -1;
            triggerAchievement(AchievementList.portal);
          }
        }
        inPortal = false;
      }
    } else {
      if (timeInPortal > 0.0F) {
        timeInPortal -= 0.05F;
      }
      if (timeInPortal < 0.0F) {
        timeInPortal = 0.0F;
      }
    }
    if (timeUntilPortal > 0) {
      timeUntilPortal--;
    }
    if (getEntityHealth() != lastHealth
        || field_35221_cc != foodStats.getFoodLevel()
        || (foodStats.getSaturationLevel() == 0.0F) != field_35222_cd) {
      playerNetServerHandler.sendPacket(
          new Packet8UpdateHealth(
              getEntityHealth(), foodStats.getFoodLevel(), foodStats.getSaturationLevel()));
      lastHealth = getEntityHealth();
      field_35221_cc = foodStats.getFoodLevel();
      field_35222_cd = foodStats.getSaturationLevel() == 0.0F;
    }
    if (experienceTotal != field_35220_ce) {
      field_35220_ce = experienceTotal;
      playerNetServerHandler.sendPacket(
          new Packet43Experience(experience, experienceTotal, experienceLevel));
    }
  }