Skip to content

Commit

Permalink
Credit
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaz492 committed Jun 25, 2023
1 parent 7dd31fc commit fba77ad
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
import dev.wuffs.bcc.contract.ServerDataExtension;
import dev.wuffs.bcc.data.BetterStatus;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ServerStatusPinger;
import net.minecraft.network.protocol.status.ClientboundStatusResponsePacket;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand All @@ -16,8 +13,9 @@

@Mixin(targets = "net/minecraft/client/multiplayer/ServerStatusPinger$1")
public class ServerStatusPingerMixin {
private static final Field SERVER_DATA_FIELD;
private static final Field SERVER_DATA_FIELD;

// Credit to https://github.com/Aizistral-Studios/No-Chat-Reports/blob/1.20-Unified/forge/src/main/java/com/aizistral/nochatreports/forge/mixins/client/MixinServerStatusPinger%241.java
static {
// We use reflection here because Mixin's AP dies when trying to process @Shadow of this lol
try {
Expand Down Expand Up @@ -49,7 +47,7 @@ void onHandleResponse(ClientboundStatusResponsePacket packet, CallbackInfo ci) {
BetterStatus betterData = ((ServerDataExtension) (Object) packet.status()).getBetterData();
try {
((ServerDataExtension) SERVER_DATA_FIELD.get(this)).setBetterData(betterData);
} catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
}
Expand Down

0 comments on commit fba77ad

Please sign in to comment.