This commit is contained in:
desyncfy
2024-07-03 12:26:05 -07:00
parent dd4cf8c5a7
commit b16a84f81b
45 changed files with 94 additions and 12 deletions

View File

@@ -0,0 +1,20 @@
package chickenmanfy.scify
object BridgeMixins {
private var num0: Int = 0
private var num1: Int = 0
fun getNum0(): Int {
return num0
}
fun getNum1(): Int {
return num1
}
fun setNum0(number: Int) {
num0 = number
}
fun setNum1(number: Int) {
num1 = number
}
}

View File

@@ -1,7 +1,10 @@
package chickenmanfy.scify.modules
import chickenmanfy.scify.BridgeMixins
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
@@ -17,19 +20,43 @@ class Bars {
val tessellator: Tessellator = Tessellator.getInstance()
val buffer: BufferBuilder = tessellator.buffer
val positionMatrix = drawContext?.matrices?.peek()?.positionMatrix
if (MinecraftClient.getInstance().networkHandler?.serverInfo?.address == "51.222.121.148:25599" ||
MinecraftClient.getInstance().player?.name?.string == debugUser) {
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()
buffer.vertex(positionMatrix, 240F, 460F, 0F).color(1f, 1f, 1f, 1f).texture(0f, 0f).next()
buffer.vertex(positionMatrix, 240F, 500F, 0F).color(1f, 1f, 1f, 1f).texture(0f, 1f).next()
buffer.vertex(positionMatrix, 280F, 500F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 1f).next()
buffer.vertex(positionMatrix, 280F, 460F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 0f).next()
RenderSystem.setShader { GameRenderer.getPositionColorTexProgram() }
RenderSystem.setShaderTexture(0, Identifier("scify", "/Health And Mana/Health/Vials_0001.png"))
if (BridgeMixins.getNum1() < 10) {
RenderSystem.setShaderTexture(0, Identifier("scify", "./HealthMana/Mana/Vials_000${BridgeMixins.getNum1() + 20}.png"))
}
else {
RenderSystem.setShaderTexture(0, Identifier("scify", "./HealthMana/Mana/Vials_00${BridgeMixins.getNum1() + 20}.png"))
}
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
tessellator.draw()
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE)
buffer.vertex(positionMatrix, 215F, 460F, 0F).color(1f, 1f, 1f, 1f).texture(0f, 0f).next()
buffer.vertex(positionMatrix, 215F, 500F, 0F).color(1f, 1f, 1f, 1f).texture(0f, 1f).next()
buffer.vertex(positionMatrix, 255F, 500F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 1f).next()
buffer.vertex(positionMatrix, 255F, 460F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 0f).next()
RenderSystem.setShader { GameRenderer.getPositionColorTexProgram() }
if (BridgeMixins.getNum0() < 10) {
RenderSystem.setShaderTexture(0, Identifier("scify", "./HealthMana/Health/Vials_000${BridgeMixins.getNum0()}.png"))
} else {
RenderSystem.setShaderTexture(0, Identifier("scify", "./HealthMana/Health/Vials_00${BridgeMixins.getNum0()}.png"))
}
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
tessellator.draw()
}
}
})
}
}

View File

@@ -34,11 +34,11 @@ class Menu : Screen(Text.literal("SciFy Menu")) {
}
public override fun init() {
dynamicBars = ButtonWidget.builder(Text.literal("Dynamic Health")) {
dynamicBars = ButtonWidget.builder(Text.literal("Custom Health/Mana")) {
Bars().toggleBars() // Call the function toggleBars() from the bars.kt module
}
.dimensions(width / 2 - 205, 84, 200, 20)
.tooltip(Tooltip.of(Text.literal("Health bar similar to XP")))
.tooltip(Tooltip.of(Text.literal("Custom Health and Mana bars.")))
.build()
fishingNotif = ButtonWidget.builder(Text.literal("Fishing Notifications")) {
FishingNotif().toggleFishingNotif() // Call the function toggleFishingNotif() from the FishingNotif.kt module