Skip to content

Commit

Permalink
fix the logic to check if the tablist is being rendered (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexdoru authored Aug 30, 2024
1 parent 4b4105d commit 5f674c3
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions src/main/java/com/github/lunatrius/ingameinfo/handler/Ticker.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraftforge.client.event.RenderGameOverlayEvent;

import com.github.lunatrius.ingameinfo.InGameInfoCore;
Expand Down Expand Up @@ -54,31 +56,35 @@ public void onRenderGUI(RenderGameOverlayEvent.Post event) {
}

private boolean isRunning() {
if (ConfigurationHandler.showHUD) {
if (this.client.mcProfiler.profilingEnabled) {
return true;
}
if (!ConfigurationHandler.showHUD) return false;

// a && b || !a && !b --> a == b
if (this.client.gameSettings != null
&& ConfigurationHandler.replaceDebug == this.client.gameSettings.showDebugInfo) {
if (!ConfigurationHandler.showOnPlayerList
&& this.client.gameSettings.keyBindPlayerList.getIsKeyPressed()) {
return false;
}
if (this.client.mcProfiler.profilingEnabled) {
return true;
}

if (this.client.gameSettings.hideGUI) {
return false;
}
if (ConfigurationHandler.replaceDebug == this.client.gameSettings.showDebugInfo) {

if (this.client.currentScreen == null) {
return true;
}
if (this.client.gameSettings.hideGUI) {
return false;
}

if (ConfigurationHandler.showInChat && this.client.currentScreen instanceof GuiChat) {
return true;
if (!ConfigurationHandler.showOnPlayerList
&& this.client.gameSettings.keyBindPlayerList.getIsKeyPressed()) {
if (this.client.theWorld != null && this.client.thePlayer != null) {
final ScoreObjective scoreobjective = this.client.theWorld.getScoreboard().func_96539_a(0);
final NetHandlerPlayClient handler = this.client.thePlayer.sendQueue;
if (!this.client.isIntegratedServerRunning() || handler.playerInfoList.size() > 1
|| scoreobjective != null) {
return false;
}
}
}

if (this.client.currentScreen == null) {
return true;
}

return ConfigurationHandler.showInChat && this.client.currentScreen instanceof GuiChat;
}

return false;
Expand Down

0 comments on commit 5f674c3

Please sign in to comment.