diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-08-22 04:27:26 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-08-22 04:27:26 +0200 |
commit | 900bc9058a90130ac7bb0f88c6b30ef1bf390504 (patch) | |
tree | 587f8560ffcc6e73671c981744c98281d5a3c285 /src | |
parent | b79e61949903e365362c17338acfb8b09d84f54f (diff) | |
download | skyhanni-900bc9058a90130ac7bb0f88c6b30ef1bf390504.tar.gz skyhanni-900bc9058a90130ac7bb0f88c6b30ef1bf390504.tar.bz2 skyhanni-900bc9058a90130ac7bb0f88c6b30ef1bf390504.zip |
code cleanup
Diffstat (limited to 'src')
10 files changed, 34 insertions, 41 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt index f0e8e033e..a4c25846b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/CurrentPetDisplay.kt @@ -2,10 +2,10 @@ package at.hannibal2.skyhanni.features import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.utils.GuiRender.renderString import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.between import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex +import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt b/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt index 016e39b23..4fe0707cc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.features import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.utils.GuiRender.renderString 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 diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt index e97ff5817..a8940028d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt @@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.features.bazaar import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiContainerEvent -import at.hannibal2.skyhanni.utils.GuiRender.renderString import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil +import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest import net.minecraftforge.client.event.GuiScreenEvent 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 70709bc7f..c59f5a3cb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonDeathCounter.kt @@ -3,9 +3,9 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.DungeonEnterEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.utils.GuiRender.renderString import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex +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.SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestoneDisplay.kt index 8feeb9a5c..cd8464730 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestoneDisplay.kt @@ -3,9 +3,9 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.DungeonEnterEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.utils.GuiRender.renderString import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex +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.SubscribeEvent 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 7cc7b54a3..af36884ca 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 @@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.features.nether.ashfang import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.utils.GuiRender.renderString import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex +import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.text.DecimalFormat 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 59a98552a..7828b28b2 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,8 +1,8 @@ package at.hannibal2.skyhanni.features.nether.ashfang import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.utils.GuiRender.renderString import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.client.Minecraft import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.client.event.RenderGameOverlayEvent diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index e628ec124..67f00bee9 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.PacketEvent -import at.hannibal2.skyhanni.utils.GuiRender.renderString import at.hannibal2.skyhanni.utils.LorenzDebug import at.hannibal2.skyhanni.utils.LorenzLogger +import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.nbt.NBTTagCompound import net.minecraft.network.play.server.S0EPacketSpawnObject import net.minecraft.network.play.server.S0FPacketSpawnMob diff --git a/src/main/java/at/hannibal2/skyhanni/utils/GuiRender.kt b/src/main/java/at/hannibal2/skyhanni/utils/GuiRender.kt deleted file mode 100644 index 15495b6a0..000000000 --- a/src/main/java/at/hannibal2/skyhanni/utils/GuiRender.kt +++ /dev/null @@ -1,33 +0,0 @@ -package at.hannibal2.skyhanni.utils - -import at.hannibal2.skyhanni.config.gui.core.config.Position -import at.hannibal2.skyhanni.utils.StringUtils.removeColor -import net.minecraft.client.Minecraft -import net.minecraft.client.gui.ScaledResolution -import net.minecraft.client.renderer.GlStateManager - -object GuiRender { - - fun Position.renderString(string: String) { - if (string == "") return - val textToRender = "§f$string" - - GlStateManager.pushMatrix() - val resolution = ScaledResolution(Minecraft.getMinecraft()) - - val renderer = Minecraft.getMinecraft().renderManager.fontRenderer - - val offsetX = (200 - renderer.getStringWidth(textToRender.removeColor())) / 2 - - val x = getAbsX(resolution, 200) + offsetX - val y = getAbsY(resolution, 16) - - - - GlStateManager.translate(x + 1.0, y + 1.0, 0.0) - renderer.drawStringWithShadow(textToRender, 0f, 0f, 0) - - - GlStateManager.popMatrix() - } -}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 49b5f74ef..b75180a5c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -1,7 +1,10 @@ package at.hannibal2.skyhanni.utils +import at.hannibal2.skyhanni.config.gui.core.config.Position +import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.client.Minecraft import net.minecraft.client.gui.Gui +import net.minecraft.client.gui.ScaledResolution import net.minecraft.client.renderer.GlStateManager import net.minecraft.client.renderer.Tessellator import net.minecraft.client.renderer.vertex.DefaultVertexFormats @@ -392,4 +395,27 @@ object RenderUtils { fun interpolate(currentValue: Double, lastValue: Double, multiplier: Float): Double { return lastValue + (currentValue - lastValue) * multiplier } + + fun Position.renderString(string: String) { + if (string == "") return + val textToRender = "§f$string" + + GlStateManager.pushMatrix() + val resolution = ScaledResolution(Minecraft.getMinecraft()) + + val renderer = Minecraft.getMinecraft().renderManager.fontRenderer + + val offsetX = (200 - renderer.getStringWidth(textToRender.removeColor())) / 2 + + val x = getAbsX(resolution, 200) + offsetX + val y = getAbsY(resolution, 16) + + + + GlStateManager.translate(x + 1.0, y + 1.0, 0.0) + renderer.drawStringWithShadow(textToRender, 0f, 0f, 0) + + + GlStateManager.popMatrix() + } }
\ No newline at end of file |