adding edited scoreboard to mod, replacing hypixel url with my url, and SKYBLOCK to LILASE, and hiding server id

This commit is contained in:
NK 2023-03-14 00:16:21 +00:00
parent 79d8fa3a4a
commit 9dd3b40f41
5 changed files with 64 additions and 7 deletions

View file

@ -54,12 +54,6 @@ val shade: Configuration by configurations.creating {
configurations.implementation.get().extendsFrom(this)
}
//sourceSets {
// main {
// output.setResourcesDir(java.outputDir)
// }
//}
repositories {
maven("https://repo.polyfrost.cc/releases")
}

View file

@ -0,0 +1,17 @@
package me.night0721.lilase.events;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
@Cancelable
public class ScoreboardRenderEvent extends Event {
public ScoreObjective objective;
public ScaledResolution resolution;
public ScoreboardRenderEvent(ScoreObjective objective, ScaledResolution resolution) {
this.objective = objective;
this.resolution = resolution;
}
}

View file

@ -68,7 +68,7 @@ public class Cofl {
Utils.debugLog("Price: " + Integer.parseInt(priceMatcher.group(1).replaceAll(",", "")));
Utils.debugLog("Name: " + nameMatcher.group(1));
price = Integer.parseInt(priceMatcher.group(1).replaceAll(",", ""));
getQueue().add(new QueueItem(command,nameMatcher.group(1), price));
getQueue().add(new QueueItem(command, nameMatcher.group(1), price));
getQueue().scheduleClear();
}

View file

@ -0,0 +1,45 @@
package me.night0721.lilase.mixins;
import me.night0721.lilase.events.ScoreboardRenderEvent;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.MinecraftForge;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.regex.Pattern;
/*
Credits: Cephetir
*/
@Mixin(GuiIngame.class)
public class MixinGuiIngame {
@ModifyArg(method = "renderScoreboard", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawString(Ljava/lang/String;III)I"))
public String a(String text) {
String txt = keepScoreboardCharacters(stripColor(text)).trim();
if (txt.startsWith("www")) return "§4w§cw§6w§e.§2n§ai§bg§3h§1t§90§d7§42§c1§6.§em§2e";
if (txt.startsWith("SKY")) return "§c§lLILASE";
if (Pattern.compile("\\d{2}/\\d{2}/\\d{2}").matcher(txt).find()) return txt.split(" ")[0];
if (text.startsWith(EnumChatFormatting.RED + "") && Pattern.compile("\\d+").matcher(txt).matches()) return "";
else return text;
}
@Inject(method = "renderScoreboard", at = @At("HEAD"), cancellable = true)
public void renderScoreboard(ScoreObjective s, ScaledResolution score, CallbackInfo ci) {
if (MinecraftForge.EVENT_BUS.post(new ScoreboardRenderEvent(s, score))) ci.cancel();
}
public String keepScoreboardCharacters(String str) {
return str.replaceAll("[^a-z A-Z:\\d/'.]", "");
}
public String stripColor(String str) {
return str.replaceAll("(?i)§[\\dA-FK-OR]", "");
}
}

View file

@ -8,6 +8,7 @@
"MixinNetworkManager"
],
"client": [
"MixinGuiIngame",
"MixinMinecraft",
"MixinNetHandlerPlayClient"
]