aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/features/display/CatOverlay.kt
diff options
context:
space:
mode:
authorAppability <appable@icloud.com>2022-10-21 23:33:52 -0700
committerAppability <appable@icloud.com>2022-10-21 23:33:52 -0700
commit4f25e7948c7e85151a80c17f7d2b25b72675cecf (patch)
tree7e152610a0f80f40f5524a231a157ea81ffab0e3 /src/main/kotlin/com/ambientaddons/features/display/CatOverlay.kt
parent1c3359e42f38012dae182e75200cc1f364dcda8f (diff)
downloadAmbientAddons-4f25e7948c7e85151a80c17f7d2b25b72675cecf.tar.gz
AmbientAddons-4f25e7948c7e85151a80c17f7d2b25b72675cecf.tar.bz2
AmbientAddons-4f25e7948c7e85151a80c17f7d2b25b72675cecf.zip
moving gui stuff (attempt 1)
Diffstat (limited to 'src/main/kotlin/com/ambientaddons/features/display/CatOverlay.kt')
-rw-r--r--src/main/kotlin/com/ambientaddons/features/display/CatOverlay.kt29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/kotlin/com/ambientaddons/features/display/CatOverlay.kt b/src/main/kotlin/com/ambientaddons/features/display/CatOverlay.kt
new file mode 100644
index 0000000..ac35729
--- /dev/null
+++ b/src/main/kotlin/com/ambientaddons/features/display/CatOverlay.kt
@@ -0,0 +1,29 @@
+package com.ambientaddons.features.display
+
+import AmbientAddons.Companion.config
+import AmbientAddons.Companion.mc
+import com.ambientaddons.gui.GuiElement
+import com.ambientaddons.utils.render.OverlayUtils
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraft.util.ResourceLocation
+import net.minecraftforge.client.event.RenderGameOverlayEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.math.roundToInt
+
+object CatOverlay {
+ private val cat = ResourceLocation("ambientaddons", "kittycatmodule.png")
+ val element = GuiElement("cat", 100, 100)
+
+ @SubscribeEvent
+ fun onRenderOverlay(event: RenderGameOverlayEvent) {
+ if (!config.cat || event.type != RenderGameOverlayEvent.ElementType.TEXT) return
+ GlStateManager.pushMatrix()
+ GlStateManager.enableAlpha()
+ GlStateManager.color(255f, 255f, 255f, 255f)
+ GlStateManager.translate(element.position.x, element.position.y, 500.0)
+ mc.textureManager.bindTexture(cat)
+ val renderSize = (100 * element.position.scale).roundToInt()
+ OverlayUtils.drawTexturedModalRect(0, 0, renderSize, renderSize)
+ GlStateManager.popMatrix()
+ }
+} \ No newline at end of file