From 28da5499b575bad9f7a2a03d86213eb10ae7209d Mon Sep 17 00:00:00 2001 From: Connor Slade Date: Thu, 4 Jan 2024 23:55:44 -0500 Subject: [PATCH] Start on map border renderer --- .../modules/rendering/MapBorder.java | 27 +++++++++++++++++++ src/main/resources/modules/modules.json | 1 + 2 files changed, 28 insertions(+) create mode 100644 src/main/java/com/connorcode/sigmautils/modules/rendering/MapBorder.java diff --git a/src/main/java/com/connorcode/sigmautils/modules/rendering/MapBorder.java b/src/main/java/com/connorcode/sigmautils/modules/rendering/MapBorder.java new file mode 100644 index 0000000..6e608f9 --- /dev/null +++ b/src/main/java/com/connorcode/sigmautils/modules/rendering/MapBorder.java @@ -0,0 +1,27 @@ +package com.connorcode.sigmautils.modules.rendering; + +import com.connorcode.sigmautils.event.EventHandler; +import com.connorcode.sigmautils.event.render.WorldRender; +import com.connorcode.sigmautils.module.Module; +import com.connorcode.sigmautils.module.ModuleInfo; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.WorldRenderer; + +import static com.connorcode.sigmautils.SigmaUtils.client; +import static com.connorcode.sigmautils.misc.util.WorldRenderUtils.getMatrices; + +@ModuleInfo(description = "Renders a border around the current map section you are in. Useful for positioning map arts.") +public class MapBorder extends Module { + @EventHandler + void onRender(WorldRender.PostWorldRenderEvent event) { + if (!enabled || client.player == null || client.world == null) return; + var pos = client.player.getPos(); + var x = (int) pos.x / 128; + var z = (int) pos.z / 128; + + var layer = client.getBufferBuilders().getEntityVertexConsumers().getBuffer(RenderLayer.getLines()); + var matrices = getMatrices(client.player.getPos()); + WorldRenderer.drawBox(matrices, layer, x * 128, client.world.getBottomY(), z * 128, x * 128 + 128, client.world.getTopY(), z * 128 + 128, 1, 1, 1, 1); +// DebugRenderer.drawBlockBox(event.getMatrices(), layer, client.player.getBlockPos(), 1f, 1f, 1f); + } +} diff --git a/src/main/resources/modules/modules.json b/src/main/resources/modules/modules.json index c5507ce..1351cc9 100644 --- a/src/main/resources/modules/modules.json +++ b/src/main/resources/modules/modules.json @@ -59,6 +59,7 @@ "misc.SoundControl", "misc.TickSpeed", "misc.WindowTitle", + "rendering.MapBorder", "rendering.AllowShowBarrier", "rendering.Deadmau5Ears", "rendering.DebugRenderers",