diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-02-26 15:47:46 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-02-26 15:47:46 +0100 |
commit | a94cdd4331f2d7aa275745c0e44d16bbe69492a1 (patch) | |
tree | 616e1311d03856bc9cb67077452dfc8e85fc74a5 /src/main/java/at/hannibal2/skyhanni | |
parent | c15c3d2db212f2fb73e6063aa5ff3cc2b5a7a4f5 (diff) | |
download | skyhanni-a94cdd4331f2d7aa275745c0e44d16bbe69492a1.tar.gz skyhanni-a94cdd4331f2d7aa275745c0e44d16bbe69492a1.tar.bz2 skyhanni-a94cdd4331f2d7aa275745c0e44d16bbe69492a1.zip |
Using GuiRenderEvent.GameOverlayRenderEvent instead of RenderGameOverlayEvent.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
21 files changed, 41 insertions, 355 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/BackgroundBlur.java b/src/main/java/at/hannibal2/skyhanni/config/core/BackgroundBlur.java deleted file mode 100644 index f71718f0b..000000000 --- a/src/main/java/at/hannibal2/skyhanni/config/core/BackgroundBlur.java +++ /dev/null @@ -1,289 +0,0 @@ -///* -// * Copyright (C) 2022 NotEnoughUpdates contributors -// * -// * This file is part of NotEnoughUpdates. -// * -// * NotEnoughUpdates is free software: you can redistribute it -// * and/or modify it under the terms of the GNU Lesser General Public -// * License as published by the Free Software Foundation, either -// * version 3 of the License, or (at your option) any later version. -// * -// * NotEnoughUpdates is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// * Lesser General Public License for more details. -// * -// * You should have received a copy of the GNU Lesser General Public License -// * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>. -// */ -// -//package at.hannibal2.skyhanni.config.core; -// -//import at.hannibal2.skyhanni.config.core.util.render.GuiRenderUtils; -//import net.minecraft.client.Minecraft; -//import net.minecraft.client.gui.Gui; -//import net.minecraft.client.renderer.GlStateManager; -//import net.minecraft.client.renderer.OpenGlHelper; -//import net.minecraft.client.shader.Framebuffer; -//import net.minecraft.client.shader.Shader; -//import net.minecraft.util.Matrix4f; -//import net.minecraftforge.client.event.EntityViewRenderEvent; -//import net.minecraftforge.client.event.RenderGameOverlayEvent; -//import net.minecraftforge.common.MinecraftForge; -//import net.minecraftforge.fml.common.eventhandler.EventPriority; -//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -//import org.lwjgl.opengl.GL11; -//import org.lwjgl.opengl.GL30; -// -//import java.util.HashMap; -//import java.util.HashSet; -//import java.util.Map; -//import java.util.Set; -// -//public class BackgroundBlur { -// private static class OutputStuff { -// public Framebuffer framebuffer; -// public Shader blurShaderHorz = null; -// public Shader blurShaderVert = null; -// -// public OutputStuff(Framebuffer framebuffer, Shader blurShaderHorz, Shader blurShaderVert) { -// this.framebuffer = framebuffer; -// this.blurShaderHorz = blurShaderHorz; -// this.blurShaderVert = blurShaderVert; -// } -// } -// -// private static final HashMap<Float, OutputStuff> blurOutput = new HashMap<>(); -// private static final HashMap<Float, Long> lastBlurUse = new HashMap<>(); -// private static long lastBlur = 0; -// private static final HashSet<Float> requestedBlurs = new HashSet<>(); -// -// private static int fogColour = 0; -// private static boolean registered = false; -// -// public static void registerListener() { -// if (!registered) { -// registered = true; -// MinecraftForge.EVENT_BUS.register(new BackgroundBlur()); -// } -// } -// -// private static boolean shouldBlur = true; -// -// public static void markDirty() { -// if (Minecraft.getMinecraft().theWorld != null) { -// shouldBlur = true; -// } -// } -// -// public static void processBlurs() { -// if (shouldBlur) { -// shouldBlur = false; -// -// long currentTime = System.currentTimeMillis(); -// -// for (float blur : requestedBlurs) { -// lastBlur = currentTime; -// lastBlurUse.put(blur, currentTime); -// -// int width = Minecraft.getMinecraft().displayWidth; -// int height = Minecraft.getMinecraft().displayHeight; -// -// OutputStuff output = blurOutput.computeIfAbsent(blur, k -> { -// Framebuffer fb = new Framebuffer(width, height, false); -// fb.setFramebufferFilter(GL11.GL_NEAREST); -// return new OutputStuff(fb, null, null); -// }); -// -// if (output.framebuffer.framebufferWidth != width || output.framebuffer.framebufferHeight != height) { -// output.framebuffer.createBindFramebuffer(width, height); -// if (output.blurShaderHorz != null) { -// output.blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height)); -// } -// if (output.blurShaderVert != null) { -// output.blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height)); -// } -// } -// -// blurBackground(output, blur); -// } -// -// Set<Float> remove = new HashSet<>(); -// for (Map.Entry<Float, Long> entry : lastBlurUse.entrySet()) { -// if (currentTime - entry.getValue() > 30 * 1000) { -// remove.add(entry.getKey()); -// } -// } -// remove.remove((float) NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor); -// -// for (Map.Entry<Float, OutputStuff> entry : blurOutput.entrySet()) { -// if (remove.contains(entry.getKey())) { -// entry.getValue().framebuffer.deleteFramebuffer(); -// entry.getValue().blurShaderHorz.deleteShader(); -// entry.getValue().blurShaderVert.deleteShader(); -// } -// } -// -// lastBlurUse.keySet().removeAll(remove); -// blurOutput.keySet().removeAll(remove); -// -// requestedBlurs.clear(); -// } -// } -// -// @SubscribeEvent(priority = EventPriority.HIGHEST) -// public void onScreenRender(RenderGameOverlayEvent.Pre event) { -// if (event.type == RenderGameOverlayEvent.ElementType.ALL) { -// processBlurs(); -// } -// Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false); -// } -// -// @SubscribeEvent -// public void onFogColour(EntityViewRenderEvent.FogColors event) { -// fogColour = 0xff000000; -// fogColour |= ((int) (event.red * 255) & 0xFF) << 16; -// fogColour |= ((int) (event.green * 255) & 0xFF) << 8; -// fogColour |= (int) (event.blue * 255) & 0xFF; -// } -// -// private static Framebuffer blurOutputHorz = null; -// -// /** -// * Creates a projection matrix that projects from our coordinate space [0->width; 0->height] to OpenGL coordinate -// * space [-1 -> 1; 1 -> -1] (Note: flipped y-axis). -// * <p> -// * This is so that we can render to and from the framebuffer in a way that is familiar to us, instead of needing to -// * apply scales and translations manually. -// */ -// private static Matrix4f createProjectionMatrix(int width, int height) { -// Matrix4f projMatrix = new Matrix4f(); -// projMatrix.setIdentity(); -// projMatrix.m00 = 2.0F / (float) width; -// projMatrix.m11 = 2.0F / (float) (-height); -// projMatrix.m22 = -0.0020001999F; -// projMatrix.m33 = 1.0F; -// projMatrix.m03 = -1.0F; -// projMatrix.m13 = 1.0F; -// projMatrix.m23 = -1.0001999F; -// return projMatrix; -// } -// -// private static final double lastBgBlurFactor = -1; -// -// private static void blurBackground(OutputStuff output, float blurFactor) { -// if (!OpenGlHelper.isFramebufferEnabled() || !OpenGlHelper.areShadersSupported()) return; -// -// int width = Minecraft.getMinecraft().displayWidth; -// int height = Minecraft.getMinecraft().displayHeight; -// -// GlStateManager.matrixMode(GL11.GL_PROJECTION); -// GlStateManager.loadIdentity(); -// GlStateManager.ortho(0.0D, width, height, 0.0D, 1000.0D, 3000.0D); -// GlStateManager.matrixMode(GL11.GL_MODELVIEW); -// GlStateManager.loadIdentity(); -// GlStateManager.translate(0.0F, 0.0F, -2000.0F); -// -// if (blurOutputHorz == null) { -// blurOutputHorz = new Framebuffer(width, height, false); -// blurOutputHorz.setFramebufferFilter(GL11.GL_NEAREST); -// } -// if (blurOutputHorz == null || output == null) { -// return; -// } -// if (blurOutputHorz.framebufferWidth != width || blurOutputHorz.framebufferHeight != height) { -// blurOutputHorz.createBindFramebuffer(width, height); -// Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false); -// } -// -// if (output.blurShaderHorz == null) { -// try { -// output.blurShaderHorz = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur", -// output.framebuffer, blurOutputHorz -// ); -// output.blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0); -// output.blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height)); -// } catch (Exception ignored) { -// } -// } -// if (output.blurShaderVert == null) { -// try { -// output.blurShaderVert = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur", -// blurOutputHorz, output.framebuffer -// ); -// output.blurShaderVert.getShaderManager().getShaderUniform("BlurDir").set(0, 1); -// output.blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height)); -// } catch (Exception ignored) { -// } -// } -// if (output.blurShaderHorz != null && output.blurShaderVert != null) { -// if (output.blurShaderHorz.getShaderManager().getShaderUniform("Radius") == null) { -// //Corrupted shader? -// return; -// } -// -// output.blurShaderHorz.getShaderManager().getShaderUniform("Radius").set(blurFactor); -// output.blurShaderVert.getShaderManager().getShaderUniform("Radius").set(blurFactor); -// -// GL11.glPushMatrix(); -// GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, Minecraft.getMinecraft().getFramebuffer().framebufferObject); -// GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, output.framebuffer.framebufferObject); -// GL30.glBlitFramebuffer(0, 0, width, height, -// 0, 0, output.framebuffer.framebufferWidth, output.framebuffer.framebufferHeight, -// GL11.GL_COLOR_BUFFER_BIT, GL11.GL_NEAREST -// ); -// -// output.blurShaderHorz.loadShader(0); -// output.blurShaderVert.loadShader(0); -// GlStateManager.enableDepth(); -// GL11.glPopMatrix(); -// } -// Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false); -// } -// -// public static void renderBlurredBackground( -// float blurStrength, int screenWidth, int screenHeight, -// int x, int y, int blurWidth, int blurHeight -// ) { -// renderBlurredBackground(blurStrength, screenWidth, screenHeight, x, y, blurWidth, blurHeight, false); -// } -// -// /** -// * Renders a subsection of the blurred framebuffer on to the corresponding section of the screen. -// * Essentially, this method will "blur" the background inside the bounds specified by [x->x+blurWidth, y->y+blurHeight] -// */ -// public static void renderBlurredBackground( -// float blurStrength, int screenWidth, int screenHeight, -// int x, int y, int blurWidth, int blurHeight, boolean forcedUpdate -// ) { -// if (!OpenGlHelper.isFramebufferEnabled() || !OpenGlHelper.areShadersSupported()) return; -// if (blurStrength < 0.5) return; -// requestedBlurs.add(blurStrength); -// -// long currentTime = System.currentTimeMillis(); -// if (currentTime - lastBlur > 300) { -// shouldBlur = true; -// if (currentTime - lastBlur > 400 && forcedUpdate) return; -// } -// -// if (blurOutput.isEmpty()) return; -// -// OutputStuff out = blurOutput.get(blurStrength); -// if (out == null) { -// out = blurOutput.values().iterator().next(); -// } -// -// float uMin = x / (float) screenWidth; -// float uMax = (x + blurWidth) / (float) screenWidth; -// float vMin = (screenHeight - y) / (float) screenHeight; -// float vMax = (screenHeight - y - blurHeight) / (float) screenHeight; -// -// GlStateManager.depthMask(false); -// Gui.drawRect(x, y, x + blurWidth, y + blurHeight, fogColour); -// out.framebuffer.bindFramebufferTexture(); -// GlStateManager.color(1f, 1f, 1f, 1f); -// GuiRenderUtils.drawTexturedRect(x, y, blurWidth, blurHeight, uMin, uMax, vMin, vMax); -// out.framebuffer.unbindFramebufferTexture(); -// GlStateManager.depthMask(true); -// } -//} diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt index 4de1f5c51..9130a3723 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt @@ -15,10 +15,10 @@ class RenderGuiData { fun onRenderOverlay(event: RenderGameOverlayEvent.Pre) { if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR) return - val currentScreen = Minecraft.getMinecraft().currentScreen - if (currentScreen != null) { - if (currentScreen is GuiInventory || currentScreen is GuiChest) return - } +// val currentScreen = Minecraft.getMinecraft().currentScreen +// if (currentScreen != null) { +// if (currentScreen is GuiInventory || currentScreen is GuiChest) return +// } GlStateManager.pushMatrix() GlStateManager.translate(0f, 0f, -1f) diff --git a/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt index f0abb1427..ec7f0b5ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.config.core.util.render.TextRenderUtils +import at.hannibal2.skyhanni.events.GuiRenderEvent import net.minecraft.client.Minecraft import net.minecraft.client.gui.ScaledResolution import net.minecraft.client.renderer.GlStateManager -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SendTitleHelper { @@ -20,9 +20,7 @@ class SendTitleHelper { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return - + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (System.currentTimeMillis() > endTime) return val scaledResolution = ScaledResolution(Minecraft.getMinecraft()) diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt index 2666cab01..f1c87bf15 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.bingo import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.bingo.card.CommunityGoal import at.hannibal2.skyhanni.features.bingo.card.PersonalGoal @@ -15,7 +16,6 @@ import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiChat import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent import java.util.regex.Pattern @@ -130,8 +130,7 @@ class BingoCardDisplay { private var displayMode = 0 @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!LorenzUtils.isBingoProfile) return if (!SkyHanniMod.feature.bingo.bingoCard) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt index 663079a90..3364277c2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt @@ -7,7 +7,6 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils.matchRegex import net.minecraft.client.Minecraft import net.minecraft.entity.item.EntityArmorStand -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -126,8 +125,7 @@ class DungeonCopilot { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!isEnabled()) return SkyHanniMod.feature.dungeon.copilotPos.renderString(nextStep) diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt index d64a26df4..61e6df4ff 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt @@ -2,11 +2,11 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.DungeonStartEvent +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils.matchRegex -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -85,8 +85,7 @@ class DungeonDeathCounter { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!isEnabled()) return SkyHanniMod.feature.dungeon.deathCounterPos.renderString(DungeonMilestonesDisplay.color + display) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt index 0487dfa2f..e245c77dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.fishing import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.SoundUtils.playSound @@ -10,7 +11,6 @@ import net.minecraft.client.audio.ISound import net.minecraft.client.audio.PositionedSound import net.minecraft.entity.item.EntityArmorStand import net.minecraft.util.ResourceLocation -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent @@ -88,8 +88,7 @@ class BarnFishingTimer { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.fishing.barnTimer) return if (!rightLocation) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt index 439dcd940..cc89adc39 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt @@ -1,13 +1,13 @@ package at.hannibal2.skyhanni.features.fishing import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.SeaCreatureFishEvent import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.client.Minecraft -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent @@ -54,8 +54,7 @@ class SharkFishCounter { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.fishing.sharkFishCounter) return if (!hasWaterRodInHand) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt index 3794e50d1..407fdb6a9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorTimer.kt @@ -2,11 +2,11 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.TimeUtils -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern @@ -58,8 +58,7 @@ class GardenVisitorTimer { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!isEnabled()) return SkyHanniMod.feature.garden.visitorTimerPos.renderString(render) diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCraftHelper.kt index 742a665f9..f84a21649 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCraftHelper.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.minion import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -11,7 +12,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import io.github.moulberry.notenoughupdates.recipes.CraftingRecipe import io.github.moulberry.notenoughupdates.recipes.NeuRecipe import net.minecraft.client.Minecraft -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent import java.util.regex.Pattern @@ -117,8 +117,7 @@ class MinionCraftHelper { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.minions.minionCraftHelperEnabled) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt index 0235367d5..9da10beeb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi @@ -10,7 +11,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.client.Minecraft -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent @@ -187,8 +187,7 @@ class CollectionCounter { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return SkyHanniMod.feature.misc.collectionCounterPos.renderString(display) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt index bbd411aa9..f2882be33 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt @@ -1,12 +1,12 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.between import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils.matchRegex -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CurrentPetDisplay { @@ -37,8 +37,7 @@ class CurrentPetDisplay { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.misc.petDisplay) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index 7d118c1c5..46a6aff78 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent @@ -13,7 +14,6 @@ import at.hannibal2.skyhanni.utils.TimeUnit import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraft.network.play.server.S30PacketWindowItems import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -193,8 +193,7 @@ class NonGodPotEffectDisplay { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!isEnabled()) return SkyHanniMod.feature.misc.nonGodPotEffectPos.renderStrings(display, extraSpace = 3) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt index c3a43853e..c8b7e6253 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/RealTime.kt @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.text.SimpleDateFormat @@ -12,8 +12,7 @@ class RealTime { private val format = SimpleDateFormat("HH:mm:ss") @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!isEnabled()) return SkyHanniMod.feature.misc.realTimePos.renderString(format.format(System.currentTimeMillis())) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt index 3b9de73de..cb95de102 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt @@ -1,12 +1,12 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.HypixelTickEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.RenderUtils.renderString -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -83,10 +83,9 @@ class TpsCounter { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.misc.tpsDisplayEnabled) return - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return SkyHanniMod.feature.misc.tpsDisplayPosition.renderString(display) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt index 2bafd6507..60e3e3f74 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.ashfang import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager @@ -8,7 +9,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils.matchRegex import at.hannibal2.skyhanni.utils.TimeUtils -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AshfangFreezeCooldown { @@ -26,8 +26,7 @@ class AshfangFreezeCooldown { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!isEnabled()) return val duration = System.currentTimeMillis() - lastHit val maxDuration = 3_000 diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt index 011c716df..c79aae3ee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.ashfang import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.utils.LorenzUtils @@ -9,7 +10,6 @@ import at.hannibal2.skyhanni.utils.TimeUnit import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraft.client.Minecraft import net.minecraft.entity.item.EntityArmorStand -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent @@ -31,8 +31,7 @@ class AshfangNextResetCooldown { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!isEnabled()) return if (spawnTime == -1L) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt index 99c13a58c..5db95b526 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra.DailyKuudraBossHelper import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.DailyQuestHelper @@ -11,7 +12,6 @@ import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.TabListData import com.google.gson.JsonObject -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent @@ -87,8 +87,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { } @SubscribeEvent(priority = EventPriority.LOWEST) - fun renderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun renderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!SkyHanniMod.feature.misc.crimsonIsleReputationHelper) return if (!LorenzUtils.inSkyBlock) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt index fe16ed426..c2da6f5c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.core.util.render.TextRenderUtils import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.events.BlockClickEvent +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -18,7 +19,6 @@ import net.minecraft.client.gui.ScaledResolution import net.minecraft.client.renderer.GlStateManager import net.minecraft.item.ItemStack import net.minecraft.network.play.server.S45PacketTitle -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent import org.lwjgl.input.Keyboard @@ -246,8 +246,7 @@ class BlazeSlayerDaggerHelper { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!isEnabled()) return if (textTopLeft.isEmpty()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt index 0e8fce8dc..6e2194498 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt @@ -1,10 +1,7 @@ package at.hannibal2.skyhanni.features.summonings import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.RenderMobColoredEvent -import at.hannibal2.skyhanni.events.ResetEntityHurtEvent -import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings @@ -12,7 +9,6 @@ import net.minecraft.client.Minecraft import net.minecraft.entity.EntityLiving import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.client.event.RenderLivingEvent import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.EventPriority @@ -137,8 +133,7 @@ class SummoningMobManager { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.summonings.summoningMobDisplay) return if (summoningMobs.isEmpty()) return diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index fefa34668..7251facb1 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent @@ -8,7 +9,6 @@ import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.nbt.NBTTagCompound -import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.common.MinecraftForge import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -128,8 +128,7 @@ class LorenzTest { } @SubscribeEvent - fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { - if (event.type != RenderGameOverlayEvent.ElementType.ALL) return + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.dev.debugEnabled) return |