Beispiel #1
0
  public void updateTimeLightAndEntities() {
    this.theProfiler.startSection("jobs");
    Queue var1 = this.futureTaskQueue;

    synchronized (this.futureTaskQueue) {
      while (!this.futureTaskQueue.isEmpty()) {
        try {
          ((FutureTask) this.futureTaskQueue.poll()).run();
        } catch (Throwable var9) {
          logger.fatal(var9);
        }
      }
    }

    this.theProfiler.endStartSection("levels");
    int var11;

    for (var11 = 0; var11 < this.worldServers.length; ++var11) {
      long var2 = System.nanoTime();

      if (var11 == 0 || this.getAllowNether()) {
        WorldServer var4 = this.worldServers[var11];
        this.theProfiler.startSection(var4.getWorldInfo().getWorldName());

        if (this.tickCounter % 20 == 0) {
          this.theProfiler.startSection("timeSync");
          this.serverConfigManager.sendPacketToAllPlayersInDimension(
              new S03PacketTimeUpdate(
                  var4.getTotalWorldTime(),
                  var4.getWorldTime(),
                  var4.getGameRules().getGameRuleBooleanValue("doDaylightCycle")),
              var4.provider.getDimensionId());
          this.theProfiler.endSection();
        }

        this.theProfiler.startSection("tick");
        CrashReport var6;

        try {
          var4.tick();
        } catch (Throwable var8) {
          var6 = CrashReport.makeCrashReport(var8, "Exception ticking world");
          var4.addWorldInfoToCrashReport(var6);
          throw new ReportedException(var6);
        }

        try {
          var4.updateEntities();
        } catch (Throwable var7) {
          var6 = CrashReport.makeCrashReport(var7, "Exception ticking world entities");
          var4.addWorldInfoToCrashReport(var6);
          throw new ReportedException(var6);
        }

        this.theProfiler.endSection();
        this.theProfiler.startSection("tracker");
        var4.getEntityTracker().updateTrackedEntities();
        this.theProfiler.endSection();
        this.theProfiler.endSection();
      }

      this.timeOfLastDimensionTick[var11][this.tickCounter % 100] = System.nanoTime() - var2;
    }

    this.theProfiler.endStartSection("connection");
    this.getNetworkSystem().networkTick();
    this.theProfiler.endStartSection("players");
    this.serverConfigManager.onTick();
    this.theProfiler.endStartSection("tickables");

    for (var11 = 0; var11 < this.playersOnline.size(); ++var11) {
      ((IUpdatePlayerListBox) this.playersOnline.get(var11)).update();
    }

    this.theProfiler.endSection();
  }