From 4f25e7948c7e85151a80c17f7d2b25b72675cecf Mon Sep 17 00:00:00 2001 From: Appability Date: Fri, 21 Oct 2022 23:33:52 -0700 Subject: moving gui stuff (attempt 1) --- .../ambientaddons/features/display/CatOverlay.kt | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/kotlin/com/ambientaddons/features/display/CatOverlay.kt (limited to 'src/main/kotlin/com/ambientaddons/features/display/CatOverlay.kt') 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 -- cgit