This repository has been archived by the owner on Nov 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
only render hud widget in modify screen if they should be rendered no…
…rmally
- Loading branch information
Showing
6 changed files
with
22 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ interface HudWidget { | |
} | ||
|
||
fun clear() | ||
fun shouldRender(): Boolean | ||
|
||
fun update() { | ||
clear() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 5 additions & 17 deletions
22
src/main/kotlin/dev/nyon/skylper/skyblock/render/SkylperHud.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,26 @@ | ||
package dev.nyon.skylper.skyblock.render | ||
|
||
import dev.nyon.skylper.config.config | ||
import dev.nyon.skylper.extensions.event.EventHandler.listenEvent | ||
import dev.nyon.skylper.extensions.event.RenderHudEvent | ||
import dev.nyon.skylper.extensions.render.hud.HudWidget | ||
import dev.nyon.skylper.skyblock.data.online.IslandGroups | ||
import dev.nyon.skylper.skyblock.data.session.PlayerSessionData | ||
import dev.nyon.skylper.skyblock.mining.hollows.render.TotalPowderWidget | ||
import dev.nyon.skylper.skyblock.mining.hollows.HollowsModule | ||
import dev.nyon.skylper.skyblock.mining.hollows.tracker.nucleus.CrystalCompletionWidget | ||
import dev.nyon.skylper.skyblock.mining.hollows.tracker.powder.PowderGrindingTracker | ||
import net.minecraft.client.gui.GuiGraphics | ||
|
||
object SkylperHud { | ||
fun init() { | ||
listenEvent<RenderHudEvent, Unit> { | ||
context.renderWidget(CrystalCompletionWidget) { | ||
HollowsModule.isPlayerInHollows && config.mining.crystalHollows.crystalOverlay.enabled | ||
} | ||
|
||
context.renderWidget(PowderGrindingTracker) { | ||
HollowsModule.isPlayerInHollows && config.mining.crystalHollows.powderGrindingOverlay.enabled && PowderGrindingTracker.isGrinding | ||
} | ||
|
||
context.renderWidget(TotalPowderWidget) { | ||
IslandGroups.groups.mining.contains(PlayerSessionData.currentArea) && config.mining.totalPowderOverlay.enabled | ||
} | ||
context.renderWidget(CrystalCompletionWidget) | ||
context.renderWidget(PowderGrindingTracker) | ||
context.renderWidget(TotalPowderWidget) | ||
} | ||
} | ||
|
||
private fun GuiGraphics.renderWidget( | ||
widget: HudWidget, condition: () -> Boolean | ||
widget: HudWidget | ||
) { | ||
if (!condition()) return | ||
if (!widget.shouldRender()) return | ||
widget.render(this, 0, 0) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters