Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DeDiamondPro committed Oct 30, 2022
1 parent 51ef1f5 commit dcb50e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/main/kotlin/dev/dediamondpro/skyguide/hud/MiniMap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MiniMap {
private var prevImage: Textures? = null

@SubscribeEvent
fun draw(event: RenderGameOverlayEvent) {
fun draw(event: RenderGameOverlayEvent.Post) {
if (event.type != RenderGameOverlayEvent.ElementType.ALL || !shouldShow()) return
val island = SkyblockMap.getCurrentIsland() ?: return
val scale = Config.miniMapScale
Expand Down Expand Up @@ -90,9 +90,14 @@ class MiniMap {
if (Config.smoothImages) GL11.GL_LINEAR else GL11.GL_NEAREST
)
UGraphics.color4f(1f, 1f, 1f, 1f)
GL11.glDisable(GL11.GL_SCISSOR_TEST)
UGraphics.GL.popMatrix()
UGraphics.GL.pushMatrix()
GL11.glScissor(
(x * UResolution.scaleFactor).toInt(),
((UResolution.scaledHeight - y - 150 * scale) * UResolution.scaleFactor).toInt(),
(150f * scale * UResolution.scaleFactor).toInt(),
(150f * scale * UResolution.scaleFactor).toInt()
)
UGraphics.GL.translate(x + 75.0 * scale, y + 75.0 * scale, 0.0)
if (!Config.rotateWithPlayer) {
UGraphics.GL.rotate(
Expand All @@ -109,6 +114,7 @@ class MiniMap {
Config.miniMapPointerSize * scale,
Config.miniMapPointerSize * scale
)
GL11.glDisable(GL11.GL_SCISSOR_TEST)
UGraphics.GL.popMatrix()
if (fadeProgress == 1f) {
if (island != prevIsland) prevIsland = island
Expand Down
8 changes: 5 additions & 3 deletions src/main/kotlin/dev/dediamondpro/skyguide/utils/GuiUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import gg.essential.universal.UMinecraft
import net.minecraft.client.gui.GuiScreen
import net.minecraftforge.client.event.GuiScreenEvent
import net.minecraftforge.client.event.RenderGameOverlayEvent
import net.minecraftforge.client.event.RenderWorldEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase
import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent
import org.lwjgl.input.Mouse
Expand All @@ -14,7 +16,7 @@ import kotlin.math.absoluteValue
class GuiUtils {
@SubscribeEvent(priority = EventPriority.HIGHEST)
fun onRenderEvent(event: RenderTickEvent) {
if (event.phase != Phase.START) return
if (event.phase != Phase.START || event.type != TickEvent.Type.RENDER) return
if (time == -1L) {
time = UMinecraft.getTime()
return
Expand Down Expand Up @@ -48,9 +50,9 @@ class GuiUtils {
}

@SubscribeEvent(priority = EventPriority.LOWEST)
fun onHudRenderEvent(event: RenderGameOverlayEvent.Pre) {
fun onHudRenderEvent(event: RenderGameOverlayEvent.Post) {
if (event.type != RenderGameOverlayEvent.ElementType.ALL) return
hudDeltaTime = -1L
hudDeltaTime = 0L
}

companion object {
Expand Down

0 comments on commit dcb50e0

Please sign in to comment.