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(); }
public void updateTimeLightAndEntities() { this.theProfiler.startSection("levels"); int i; Integer[] ids = DimensionManager.getIDs(this.tickCounter % 200 == 0); for (int x = 0; x < ids.length; x++) { int id = ids[x]; long j = System.nanoTime(); if (id == 0 || this.getAllowNether()) { WorldServer worldserver = DimensionManager.getWorld(id); this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); this.theProfiler.startSection("pools"); worldserver.getWorldVec3Pool().clear(); this.theProfiler.endSection(); if (this.tickCounter % 20 == 0) { this.theProfiler.startSection("timeSync"); this.serverConfigManager.sendPacketToAllPlayersInDimension( new Packet4UpdateTime(worldserver.getTotalWorldTime(), worldserver.getWorldTime()), worldserver.provider.dimensionId); this.theProfiler.endSection(); } this.theProfiler.startSection("tick"); FMLCommonHandler.instance().onPreWorldTick(worldserver); CrashReport crashreport; try { worldserver.tick(); } catch (Throwable throwable) { crashreport = CrashReport.makeCrashReport(throwable, "Exception ticking world"); worldserver.addWorldInfoToCrashReport(crashreport); throw new ReportedException(crashreport); } try { worldserver.updateEntities(); } catch (Throwable throwable1) { crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world entities"); worldserver.addWorldInfoToCrashReport(crashreport); throw new ReportedException(crashreport); } FMLCommonHandler.instance().onPostWorldTick(worldserver); this.theProfiler.endSection(); this.theProfiler.startSection("tracker"); worldserver.getEntityTracker().updateTrackedEntities(); this.theProfiler.endSection(); this.theProfiler.endSection(); } worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - j; } this.theProfiler.endStartSection("dim_unloading"); DimensionManager.unloadWorlds(worldTickTimes); this.theProfiler.endStartSection("connection"); this.getNetworkThread().networkTick(); this.theProfiler.endStartSection("players"); this.serverConfigManager.sendPlayerInfoToAllPlayers(); this.theProfiler.endStartSection("tickables"); for (i = 0; i < this.tickables.size(); ++i) { ((IUpdatePlayerListBox) this.tickables.get(i)).update(); } this.theProfiler.endSection(); }