public void runTick() {
if (this.rightClickDelayTimer > 0) {
--this.rightClickDelayTimer;
}
this.profiler.startSection("gui");
if (!this.isGamePaused) {
this.ingameGUI.tick();
}
this.profiler.endSection();
this.gameRenderer.getMouseOver(1.0F);
this.tutorial.onMouseHover(this.world, this.objectMouseOver);
this.profiler.startSection("gameMode");
if (!this.isGamePaused && this.world != null) {
this.playerController.tick();
}
this.profiler.endStartSection("textures");
if (this.world != null) {
this.textureManager.tick();
}
if (this.currentScreen == null && this.player != null) {
if (this.player.getShouldBeDead() && !(this.currentScreen instanceof DeathScreen)) {
this.displayGuiScreen((Screen) null);
} else if (this.player.isSleeping() && this.world != null) {
this.displayGuiScreen(new SleepInMultiplayerScreen());
}
} else if (this.currentScreen != null && this.currentScreen instanceof SleepInMultiplayerScreen
&& !this.player.isSleeping()) {
this.displayGuiScreen((Screen) null);
}
if (this.currentScreen != null) {
this.leftClickCounter = 10000;
}
if (this.currentScreen != null) {
Screen.wrapScreenError(() -> {
this.currentScreen.tick();
}, "Ticking screen", this.currentScreen.getClass().getCanonicalName());
}
if (!this.gameSettings.showDebugInfo) {
this.ingameGUI.reset();
}
if (this.loadingGui == null && (this.currentScreen == null || this.currentScreen.passEvents)) {
this.profiler.endStartSection("Keybindings");
this.processKeyBinds();
if (this.leftClickCounter > 0) {
--this.leftClickCounter;
}
}
if (this.world != null) {
Felon.getInstance().getEventBus().post(player.tick);
this.profiler.endStartSection("gameRenderer");
if (!this.isGamePaused) {
this.gameRenderer.tick();
}
this.profiler.endStartSection("levelRenderer");
if (!this.isGamePaused) {
this.worldRenderer.tick();
}
this.profiler.endStartSection("level");
if (!this.isGamePaused) {
if (this.world.getTimeLightningFlash() > 0) {
this.world.setTimeLightningFlash(this.world.getTimeLightningFlash() - 1);
}
this.world.tickEntities();
}
} else if (this.gameRenderer.getShaderGroup() != null) {
this.gameRenderer.stopUseShader();
}
if (!this.isGamePaused) {
this.musicTicker.tick();
}
this.soundHandler.tick(this.isGamePaused);
if (this.world != null) {
if (!this.isGamePaused) {
if (!this.gameSettings.field_244601_E && this.func_244600_aM()) {
ITextComponent itextcomponent = new TranslationTextComponent("tutorial.socialInteractions.title");
ITextComponent itextcomponent1 = new TranslationTextComponent(
"tutorial.socialInteractions.description",
Tutorial.createKeybindComponent("socialInteractions"));
this.field_244598_aV = new TutorialToast(TutorialToast.Icons.SOCIAL_INTERACTIONS, itextcomponent,
itextcomponent1, true);
this.tutorial.func_244698_a(this.field_244598_aV, 160);
this.gameSettings.field_244601_E = true;
this.gameSettings.saveOptions();
}
this.tutorial.tick();
try {
this.world.tick(() -> {
return true;
});
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception in world tick");
if (this.world == null) {
CrashReportCategory crashreportcategory = crashreport.makeCategory("Affected level");
crashreportcategory.addDetail("Problem", "Level is null!");
} else {
this.world.fillCrashReport(crashreport);
}
throw new ReportedException(crashreport);
}
}
this.profiler.endStartSection("animateTick");
if (!this.isGamePaused && this.world != null) {
this.world.animateTick(MathHelper.floor(this.player.getPosX()), MathHelper.floor(this.player.getPosY()),
MathHelper.floor(this.player.getPosZ()));
}
this.profiler.endStartSection("particles");
if (!this.isGamePaused) {
this.particles.tick();
}
} else if (this.networkManager != null) {
this.profiler.endStartSection("pendingConnection");
this.networkManager.tick();
}
this.profiler.endStartSection("keyboard");
this.keyboardListener.tick();
this.profiler.endSection();
ClientUtil.MainMenu();
}