diff --git a/gradle.properties b/gradle.properties index 79926eb..5d24fef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,20 +1,20 @@ # Project -mod_version=5.1.0 +mod_version=5.1.1 group=dev.wuffs.bcc # Common minecraft_version=1.20.4 # Forge -forge_version=49.0.13 +forge_version=49.0.14 forge_gradle=[6.0.18,6.2) # Neo -neo_version=20.4.70-beta +neo_version=20.4.80-beta neo_gradle=[7.0.76,) # Fabric -fabric_version=0.92.0+1.20.4 +fabric_version=0.92.1+1.20.4 fabric_loader_version=0.15.3 # Mod options diff --git a/neoforge/src/main/java/dev/wuffs/bcc/mixin/ForgeClientHooksMixin.java b/neoforge/src/main/java/dev/wuffs/bcc/mixin/ForgeClientHooksMixin.java deleted file mode 100644 index fa0ac6c..0000000 --- a/neoforge/src/main/java/dev/wuffs/bcc/mixin/ForgeClientHooksMixin.java +++ /dev/null @@ -1,43 +0,0 @@ -package dev.wuffs.bcc.mixin; - -import dev.wuffs.bcc.client.screen.BCCMultiplayerAddon; -import dev.wuffs.bcc.contract.ServerDataExtension; -import dev.wuffs.bcc.data.BetterStatus; -import dev.wuffs.bcc.data.BetterStatusServerHolder; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen; -import net.minecraft.client.multiplayer.ServerData; -import net.minecraft.network.protocol.status.ServerStatus; -import net.neoforged.neoforge.client.ClientHooks; -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.callback.CallbackInfo; - -@Mixin(value = ClientHooks.class, remap = false) -public class ForgeClientHooksMixin { - - @Inject(method = "Lnet/neoforged/neoforge/client/ClientHooks;drawForgePingInfo(Lnet/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen;Lnet/minecraft/client/multiplayer/ServerData;Lnet/minecraft/client/gui/GuiGraphics;IIIII)V", at = @At("HEAD"), remap = false, cancellable = true) - private static void drawForgePingInfo(JoinMultiplayerScreen gui, ServerData oldTarget, GuiGraphics guiGraphics, int x, int y, int width, int relativeMouseX, int relativeMouseY, CallbackInfo ci) { - ServerDataExtension data = ((ServerDataExtension) oldTarget); - - BetterStatus betterData = data.getBetterData(); - - if (betterData == null || BetterStatusServerHolder.INSTANCE.getStatus() == null) { - return; - } - - BCCMultiplayerAddon.drawBCCChecker(gui, betterData, guiGraphics, x, y, width, relativeMouseX, relativeMouseY); - ci.cancel(); - } - - @Inject(method = "processForgeListPingData(Lnet/minecraft/network/protocol/status/ServerStatus;Lnet/minecraft/client/multiplayer/ServerData;)V", at = @At("HEAD"), remap = false, cancellable = true) - private static void processForgeListPingData(ServerStatus oldPacket, ServerData serverData, CallbackInfo ci) { - ServerDataExtension data = (ServerDataExtension) serverData; - BetterStatus betterData = data.getBetterData(); - if (betterData != null) { - data.setBetterData(betterData); - ci.cancel(); - } - } -} diff --git a/neoforge/src/main/java/dev/wuffs/bcc/mixin/MinecraftServerMixin.java b/neoforge/src/main/java/dev/wuffs/bcc/mixin/MinecraftServerMixin.java deleted file mode 100644 index 12310ba..0000000 --- a/neoforge/src/main/java/dev/wuffs/bcc/mixin/MinecraftServerMixin.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.wuffs.bcc.mixin; - -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonParser; -import com.mojang.serialization.JsonOps; -import dev.wuffs.bcc.data.BetterStatus; -import dev.wuffs.bcc.data.BetterStatusServerHolder; -import net.minecraft.server.MinecraftServer; -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.callback.CallbackInfoReturnable; - -@Mixin(MinecraftServer.class) -public class MinecraftServerMixin { - @Inject(method = "getStatusJson", at = @At("RETURN"), cancellable = true, remap = false) - public void modifyStatusJson(CallbackInfoReturnable cir) { - JsonElement jsonElement = JsonParser.parseString(cir.getReturnValue()); - - JsonElement betterStatus = BetterStatus.CODEC.encodeStart(JsonOps.INSTANCE, BetterStatusServerHolder.INSTANCE.getStatus()) - .result() - .orElse(null); - - // TODO: Error catching. If error, return original. - jsonElement.getAsJsonObject().add("better-status", betterStatus); - cir.setReturnValue(new Gson().toJson(jsonElement)); - } -}