Disable functions if you aren't playing Dungeonfy ATTEMPT 2

This commit is contained in:
desyncfy
2024-07-03 07:21:42 -07:00
parent 1f28ed8987
commit b1c713ca9b
5 changed files with 58 additions and 33 deletions

View File

@@ -1,7 +1,9 @@
package chickenmanfy.scify.modules
import chickenmanfy.scify.SciFyClient.debugUser
import com.mojang.blaze3d.systems.RenderSystem
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback
import net.minecraft.client.MinecraftClient
import net.minecraft.client.gui.DrawContext
import net.minecraft.client.render.*
import net.minecraft.util.Identifier
@@ -13,23 +15,28 @@ class Bars {
}
fun bars() {
HudRenderCallback.EVENT.register(HudRenderCallback { drawContext: DrawContext?, tickDelta: Float ->
val tessellator: Tessellator = Tessellator.getInstance()
val buffer: BufferBuilder = tessellator.buffer
val positionMatrix = drawContext?.matrices?.peek()?.positionMatrix
if (barsToggle) {
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE)
buffer.vertex(positionMatrix, 20F, 20F, 0F).color(1f, 1f, 1f, 1f).texture(0f, 0f).next()
buffer.vertex(positionMatrix, 20F, 60F, 0F).color(1f, 1f, 1f, 1f).texture(0f, 1f).next()
buffer.vertex(positionMatrix, 60F, 60F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 1f).next()
buffer.vertex(positionMatrix, 60F, 20F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 0f).next()
if (MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "dungeonfy.minehut.gg" ||
MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "51.222.121.148:25599" ||
MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "minehut.com" || // if you join minehut.com and type /join dungeonfy
MinecraftClient.getInstance().player?.name?.string == debugUser) {
HudRenderCallback.EVENT.register(HudRenderCallback { drawContext: DrawContext?, tickDelta: Float ->
val tessellator: Tessellator = Tessellator.getInstance()
val buffer: BufferBuilder = tessellator.buffer
val positionMatrix = drawContext?.matrices?.peek()?.positionMatrix
if (barsToggle) {
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE)
buffer.vertex(positionMatrix, 20F, 20F, 0F).color(1f, 1f, 1f, 1f).texture(0f, 0f).next()
buffer.vertex(positionMatrix, 20F, 60F, 0F).color(1f, 1f, 1f, 1f).texture(0f, 1f).next()
buffer.vertex(positionMatrix, 60F, 60F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 1f).next()
buffer.vertex(positionMatrix, 60F, 20F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 0f).next()
RenderSystem.setShader { GameRenderer.getPositionColorTexProgram() }
RenderSystem.setShaderTexture(0, Identifier("scify", "scify.png"))
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
RenderSystem.setShader { GameRenderer.getPositionColorTexProgram() }
RenderSystem.setShaderTexture(0, Identifier("scify", "scify.png"))
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
tessellator.draw()
tessellator.draw()
}
})
}
})
}
}