diff options
author | inglettronald <inglettronald@gmail.com> | 2023-03-21 01:15:45 -0500 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-03-21 01:15:45 -0500 |
commit | e1a4e3db0b3033b4099d77f0bb7d08b60f2c7a73 (patch) | |
tree | 6e04ef5c15c4c53f38e44981b1660b9e5e0ab667 /src/main/kotlin/dulkirmod/utils | |
parent | d78b2e302f3dd94afb34c62e5fa282a0b10e6bbf (diff) | |
download | DulkirMod-e1a4e3db0b3033b4099d77f0bb7d08b60f2c7a73.tar.gz DulkirMod-e1a4e3db0b3033b4099d77f0bb7d08b60f2c7a73.tar.bz2 DulkirMod-e1a4e3db0b3033b4099d77f0bb7d08b60f2c7a73.zip |
dragon stuff and some random things i forget
Diffstat (limited to 'src/main/kotlin/dulkirmod/utils')
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/ScoreBoardUtils.kt | 24 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt | 60 |
2 files changed, 83 insertions, 1 deletions
diff --git a/src/main/kotlin/dulkirmod/utils/ScoreBoardUtils.kt b/src/main/kotlin/dulkirmod/utils/ScoreBoardUtils.kt index 520c143..4db1046 100644 --- a/src/main/kotlin/dulkirmod/utils/ScoreBoardUtils.kt +++ b/src/main/kotlin/dulkirmod/utils/ScoreBoardUtils.kt @@ -5,6 +5,7 @@ import net.minecraft.scoreboard.Score import net.minecraft.scoreboard.ScorePlayerTeam object ScoreBoardUtils { + var isInM7: Boolean = false; fun getLines(): MutableList<String> { val scoreboard = DulkirMod.mc.thePlayer.worldScoreboard val sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1) @@ -18,4 +19,27 @@ object ScoreBoardUtils { } return lines } + + fun inM7(): Boolean { + if (!Utils.isInSkyblock()) { + isInM7 = false + return false + } + val lines = getLines() + if (lines.size < 4) { + isInM7 = false + return false + } + val line = lines.getOrNull(3) + var unformattedText = line?.replace("\\p{So}|\\p{Sk}".toRegex(), "") + if (unformattedText != null) { + unformattedText = Utils.stripColorCodes(unformattedText) + } + if (unformattedText == " The Catacombs (M7)") { + isInM7 = true + return true + } + isInM7 = false + return false + } }
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt b/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt index e0febdd..231ab3f 100644 --- a/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt +++ b/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt @@ -5,15 +5,22 @@ import net.minecraft.client.renderer.GlStateManager import net.minecraft.client.renderer.GlStateManager.disableTexture2D import net.minecraft.client.renderer.GlStateManager.enableTexture2D import net.minecraft.client.renderer.Tessellator +import net.minecraft.client.renderer.WorldRenderer +import net.minecraft.client.renderer.entity.RenderManager import net.minecraft.client.renderer.vertex.DefaultVertexFormats import net.minecraft.util.Vec3 import org.lwjgl.opengl.GL11 +import java.awt.Color class WorldRenderUtils { + companion object { - fun render( + private val tessellator: Tessellator = Tessellator.getInstance() + private val worldRenderer: WorldRenderer = tessellator.worldRenderer + private val renderManager: RenderManager = mc.renderManager + fun renderString( location: Vec3, text: String, depthTest: Boolean = true, @@ -114,5 +121,56 @@ class WorldRenderUtils { GL11.glDepthMask(true) } } + + + /** + * Courtesy of Odin, I could not be bothered to deal with rendering code. + */ + fun drawCustomBox(x: Double, xWidth: Double, y: Double, yWidth: Double, z: Double, zWidth: Double, color: Color, thickness: Float = 3f, phase: Boolean) { + GlStateManager.pushMatrix() + + GlStateManager.color(color.red.toFloat() / 255f, color.green.toFloat() / 255f, color.blue.toFloat() / 255f, 1f) + GlStateManager.translate(-renderManager.viewerPosX, -renderManager.viewerPosY, -renderManager.viewerPosZ) + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA) + if (phase) GlStateManager.disableDepth() + disableTexture2D() + GlStateManager.disableLighting() + GlStateManager.enableBlend() + + GL11.glLineWidth(thickness) + + val x1 = x + xWidth + val y1 = y + yWidth + val z1 = z + zWidth + + worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION) + worldRenderer.pos(x1,y1,z1).endVertex() + worldRenderer.pos(x1,y1,z).endVertex() + worldRenderer.pos(x,y1,z).endVertex() + worldRenderer.pos(x,y1,z1).endVertex() + worldRenderer.pos(x1,y1,z1).endVertex() + worldRenderer.pos(x1,y,z1).endVertex() + worldRenderer.pos(x1,y,z).endVertex() + worldRenderer.pos(x,y,z).endVertex() + worldRenderer.pos(x,y,z1).endVertex() + worldRenderer.pos(x,y,z).endVertex() + worldRenderer.pos(x,y1,z).endVertex() + worldRenderer.pos(x,y,z).endVertex() + worldRenderer.pos(x1,y,z).endVertex() + worldRenderer.pos(x1,y1,z).endVertex() + worldRenderer.pos(x1,y,z).endVertex() + worldRenderer.pos(x1,y,z1).endVertex() + worldRenderer.pos(x,y,z1).endVertex() + worldRenderer.pos(x,y1,z1).endVertex() + worldRenderer.pos(x1,y1,z1).endVertex() + + tessellator.draw() + + enableTexture2D() + GlStateManager.disableBlend() + GlStateManager.enableDepth() + + GlStateManager.popMatrix() + } } }
\ No newline at end of file |