Bars
@@ -11,7 +11,7 @@ I then remembered when one of my friends (BearCat865) suggested making a Dungeon
|
|||||||
# Roadmap
|
# Roadmap
|
||||||
_Currently in super beta so don't expect something working for a while._
|
_Currently in super beta so don't expect something working for a while._
|
||||||
- Right shift menu to enable and disable mods (90%)
|
- Right shift menu to enable and disable mods (90%)
|
||||||
- Health & Food bars replaced with dynamic bar similar to EXP bar (40%)
|
- Health & Food bars replaced with dynamic bar similar to EXP bar (80%)
|
||||||
- Custom GUIs (0%)
|
- Custom GUIs (0%)
|
||||||
- Built-in guide (CANCELED) **This feature is being worked on in a different mod called "Mythicfy", so it will not be added to this one. We recommend you download that mod.**
|
- Built-in guide (CANCELED) **This feature is being worked on in a different mod called "Mythicfy", so it will not be added to this one. We recommend you download that mod.**
|
||||||
- Auto-Welcome (20%) **WARNING: This feature may prove to be annoying, in which case we will remove it.**
|
- Auto-Welcome (20%) **WARNING: This feature may prove to be annoying, in which case we will remove it.**
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package chickenmanfy.scify.mixin.client;
|
package chickenmanfy.scify.mixin.client;
|
||||||
|
|
||||||
|
|
||||||
|
import chickenmanfy.scify.BridgeMixins;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
@@ -9,12 +11,45 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
import net.minecraft.client.gui.hud.InGameHud;
|
import net.minecraft.client.gui.hud.InGameHud;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@Mixin(InGameHud.class)
|
@Mixin(InGameHud.class)
|
||||||
public class ActionBarMixin {
|
public class ActionBarMixin {
|
||||||
|
@Unique
|
||||||
|
public int finale;
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "setOverlayMessage(Lnet/minecraft/text/Text;Z)V")
|
@Inject(at = @At("HEAD"), method = "setOverlayMessage(Lnet/minecraft/text/Text;Z)V")
|
||||||
private void sendMessage(Text message, boolean tinted, CallbackInfo info) {
|
public void sendMessage(Text message, boolean tinted, CallbackInfo info) {
|
||||||
System.out.println(message.getString());
|
String actionBar = message.getString();
|
||||||
}
|
|
||||||
|
int num0 = 0;
|
||||||
|
int num1 = 0;
|
||||||
|
|
||||||
|
// Fancy Regex
|
||||||
|
Pattern pattern = Pattern.compile("\\[(\\d+)/(\\d+)]");
|
||||||
|
Matcher matcher = pattern.matcher(actionBar);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
while (matcher.find() && count < 2) {
|
||||||
|
int firstNumber = Integer.parseInt(matcher.group(1));
|
||||||
|
int secondNumber = Integer.parseInt(matcher.group(2));
|
||||||
|
|
||||||
|
float divided = (float) secondNumber / 20;
|
||||||
|
|
||||||
|
finale = Math.round((float) firstNumber/divided);
|
||||||
|
|
||||||
|
if (count == 0) {
|
||||||
|
num0 = finale;
|
||||||
|
} else {
|
||||||
|
num1 = finale;
|
||||||
|
}
|
||||||
|
|
||||||
|
BridgeMixins.INSTANCE.setNum0(num0);
|
||||||
|
BridgeMixins.INSTANCE.setNum1(num1);
|
||||||
|
|
||||||
|
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
20
src/client/kotlin/chickenmanfy/scify/BridgeMixins.kt
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
package chickenmanfy.scify.modules
|
package chickenmanfy.scify.modules
|
||||||
|
|
||||||
|
import chickenmanfy.scify.BridgeMixins
|
||||||
|
import chickenmanfy.scify.SciFyClient.debugUser
|
||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback
|
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback
|
||||||
|
import net.minecraft.client.MinecraftClient
|
||||||
import net.minecraft.client.gui.DrawContext
|
import net.minecraft.client.gui.DrawContext
|
||||||
import net.minecraft.client.render.*
|
import net.minecraft.client.render.*
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
@@ -17,19 +20,43 @@ class Bars {
|
|||||||
val tessellator: Tessellator = Tessellator.getInstance()
|
val tessellator: Tessellator = Tessellator.getInstance()
|
||||||
val buffer: BufferBuilder = tessellator.buffer
|
val buffer: BufferBuilder = tessellator.buffer
|
||||||
val positionMatrix = drawContext?.matrices?.peek()?.positionMatrix
|
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) {
|
if (barsToggle) {
|
||||||
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE)
|
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, 240F, 460F, 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, 240F, 500F, 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, 280F, 500F, 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, 280F, 460F, 0F).color(1f, 1f, 1f, 1f).texture(1f, 0f).next()
|
||||||
|
|
||||||
RenderSystem.setShader { GameRenderer.getPositionColorTexProgram() }
|
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)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||||
|
|
||||||
tessellator.draw()
|
tessellator.draw()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,11 +34,11 @@ class Menu : Screen(Text.literal("SciFy Menu")) {
|
|||||||
}
|
}
|
||||||
public override fun init() {
|
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
|
Bars().toggleBars() // Call the function toggleBars() from the bars.kt module
|
||||||
}
|
}
|
||||||
.dimensions(width / 2 - 205, 84, 200, 20)
|
.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()
|
.build()
|
||||||
fishingNotif = ButtonWidget.builder(Text.literal("Fishing Notifications")) {
|
fishingNotif = ButtonWidget.builder(Text.literal("Fishing Notifications")) {
|
||||||
FishingNotif().toggleFishingNotif() // Call the function toggleFishingNotif() from the FishingNotif.kt module
|
FishingNotif().toggleFishingNotif() // Call the function toggleFishingNotif() from the FishingNotif.kt module
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 111 B After Width: | Height: | Size: 111 B |
|
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 122 B |
|
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
|
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 130 B |
|
Before Width: | Height: | Size: 124 B After Width: | Height: | Size: 124 B |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
|
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
|
Before Width: | Height: | Size: 124 B After Width: | Height: | Size: 124 B |
|
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 123 B |
|
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 130 B |
|
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 133 B |
|
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
|
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
|
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 133 B |
|
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 121 B |
|
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 123 B |
|
Before Width: | Height: | Size: 111 B After Width: | Height: | Size: 111 B |
|
Before Width: | Height: | Size: 124 B After Width: | Height: | Size: 124 B |
|
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 127 B |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
|
Before Width: | Height: | Size: 134 B After Width: | Height: | Size: 134 B |
|
Before Width: | Height: | Size: 134 B After Width: | Height: | Size: 134 B |
|
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 130 B |
|
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 127 B |
|
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 135 B |
|
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 127 B |
|
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
|
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 136 B |
|
Before Width: | Height: | Size: 124 B After Width: | Height: | Size: 124 B |
|
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |