Skip to content

Commit

Permalink
Fix showInChat, showInGui and showInDebug
Browse files Browse the repository at this point in the history
  • Loading branch information
Detlev1 committed Feb 12, 2024
1 parent 0ce9cee commit f7665da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions src/main/java/dev/meyi/bn/modules/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import cc.polyfrost.oneconfig.config.annotations.Switch;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.hud.Hud;
import cc.polyfrost.oneconfig.platform.GuiPlatform;
import cc.polyfrost.oneconfig.platform.Platform;
import dev.meyi.bn.BazaarNotifier;
import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -36,24 +37,21 @@ public Module() {

@Override
protected boolean shouldShow() {
if(BazaarNotifier.inBazaar || Platform.getGuiPlatform().getCurrentScreen() != null){
//Drawing at this case is handled by the ChestTickHandler to keep it above the gray gui background;
return false;
}
if (showInGuis && Platform.getGuiPlatform().getCurrentScreen() != null &&
(Platform.getGuiPlatform().getCurrentScreen() instanceof OneConfigGui)) return false;
if(enabled) {
if (showInChat && Platform.getGuiPlatform().isInChat()) return true;
if (showInDebug && Platform.getGuiPlatform().isInDebug()) return true;
GuiPlatform guiPlatform = Platform.getGuiPlatform();
if(BazaarNotifier.inBazaar){
//Drawing at this case is handled by the ChestTickHandler to keep it above the gray gui background;
return false;
}
if (showInGuis && (guiPlatform.getCurrentScreen() instanceof OneConfigGui)) return false;
if (showInChat && guiPlatform.isInChat()) return true;
if (showInDebug && guiPlatform.isInDebug()) return true;
if (showInGuis && guiPlatform.getCurrentScreen() != null) return true;
return showEverywhere;
}else {
return false;
}
}

public boolean shouldShowGui(){
return enabled && (BazaarNotifier.inBazaar || showInGuis || showInChat || showInDebug || showEverywhere);
}
public abstract void draw();

protected abstract void reset();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dev/meyi/bn/modules/ModuleList.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void pageFlipCheck() {
public void drawAllGui(){
if (BazaarNotifier.config.enabled && BazaarNotifier.activeBazaar) {
for (Module m : this) {
if (m.shouldShowGui()) {
if (m.isEnabled() && BazaarNotifier.inBazaar) {
m.position.setSize(m.getModuleWidth(), m.getModuleHeight());
m.draw();
}
Expand Down

0 comments on commit f7665da

Please sign in to comment.