mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-12-21 16:17:37 +01:00
23w07a, use synthetic field
This commit is contained in:
parent
3398251281
commit
cd3af46b7a
@ -12,7 +12,7 @@ plugins {
|
||||
id "org.ajoberstar.grgit" version "3.1.1"
|
||||
id "com.matthewprenger.cursegradle" version "1.4.0"
|
||||
id "com.modrinth.minotaur" version "2.2.0"
|
||||
id "fabric-loom" version "1.0-SNAPSHOT" apply false
|
||||
id "fabric-loom" version "1.1-SNAPSHOT" apply false
|
||||
id "com.github.ben-manes.versions" version "0.42.0"
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,11 @@
|
||||
# rip my ram
|
||||
org.gradle.jvmargs=-Xms32M -Xmx4G -XX:+UseG1GC -XX:+UseStringDeduplication
|
||||
|
||||
loader_version=0.14.13
|
||||
viaver_version=4.6.0-23w04a-SNAPSHOT
|
||||
loader_version=0.14.14
|
||||
viaver_version=4.6.0-23w07a-SNAPSHOT
|
||||
yaml_version=1.33
|
||||
|
||||
# example: 1.19.1-rc2
|
||||
modrinth_mc_snapshot=23w04a
|
||||
modrinth_mc_snapshot=23w07a
|
||||
# example: 1.19-Snapshot
|
||||
curseforge_mc_snapshot=1.19-Snapshot
|
||||
|
@ -4,26 +4,26 @@ import com.viaversion.fabric.common.gui.ViaServerInfo;
|
||||
import com.viaversion.fabric.common.handler.FabricDecodeHandler;
|
||||
import com.viaversion.fabric.mc117.mixin.debug.client.MixinClientConnectionAccessor;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.listener.ClientQueryPacketListener;
|
||||
import net.minecraft.network.packet.s2c.query.QueryResponseS2CPacket;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(targets = "net.minecraft.client.network.MultiplayerServerListPinger$1")
|
||||
public abstract class MixinMultiplayerServerListPingerListener implements ClientQueryPacketListener {
|
||||
@Shadow
|
||||
public abstract ClientConnection getConnection();
|
||||
@Accessor
|
||||
abstract ServerInfo getField_3776(); // Synthetic
|
||||
|
||||
@Redirect(method = "onResponse(Lnet/minecraft/network/packet/s2c/query/QueryResponseS2CPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ServerInfo;getIcon()Ljava/lang/String;"))
|
||||
private String onResponseCaptureServerInfo(ServerInfo serverInfo) {
|
||||
@Inject(method = "onResponse(Lnet/minecraft/network/packet/s2c/query/QueryResponseS2CPacket;)V", at = @At(value = "HEAD"))
|
||||
private void onResponseCaptureServerInfo(QueryResponseS2CPacket packet, CallbackInfo ci) {
|
||||
FabricDecodeHandler decoder = ((MixinClientConnectionAccessor) this.getConnection()).getChannel()
|
||||
.pipeline().get(FabricDecodeHandler.class);
|
||||
if (decoder != null) {
|
||||
((ViaServerInfo) serverInfo).setViaTranslating(decoder.getInfo().isActive());
|
||||
((ViaServerInfo) serverInfo).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
|
||||
((ViaServerInfo) getField_3776()).setViaTranslating(decoder.getInfo().isActive());
|
||||
((ViaServerInfo) getField_3776()).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
|
||||
}
|
||||
return serverInfo.getIcon();
|
||||
}
|
||||
}
|
||||
|
@ -4,26 +4,26 @@ import com.viaversion.fabric.common.gui.ViaServerInfo;
|
||||
import com.viaversion.fabric.common.handler.FabricDecodeHandler;
|
||||
import com.viaversion.fabric.mc118.mixin.debug.client.MixinClientConnectionAccessor;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.listener.ClientQueryPacketListener;
|
||||
import net.minecraft.network.packet.s2c.query.QueryResponseS2CPacket;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(targets = "net.minecraft.client.network.MultiplayerServerListPinger$1")
|
||||
public abstract class MixinMultiplayerServerListPingerListener implements ClientQueryPacketListener {
|
||||
@Shadow
|
||||
public abstract ClientConnection getConnection();
|
||||
@Accessor
|
||||
abstract ServerInfo getField_3776(); // synthetic
|
||||
|
||||
@Redirect(method = "onResponse(Lnet/minecraft/network/packet/s2c/query/QueryResponseS2CPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ServerInfo;getIcon()Ljava/lang/String;"))
|
||||
private String onResponseCaptureServerInfo(ServerInfo serverInfo) {
|
||||
@Inject(method = "onResponse(Lnet/minecraft/network/packet/s2c/query/QueryResponseS2CPacket;)V", at = @At(value = "HEAD"))
|
||||
private void onResponseCaptureServerInfo(QueryResponseS2CPacket packet, CallbackInfo ci) {
|
||||
FabricDecodeHandler decoder = ((MixinClientConnectionAccessor) this.getConnection()).getChannel()
|
||||
.pipeline().get(FabricDecodeHandler.class);
|
||||
if (decoder != null) {
|
||||
((ViaServerInfo) serverInfo).setViaTranslating(decoder.getInfo().isActive());
|
||||
((ViaServerInfo) serverInfo).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
|
||||
((ViaServerInfo) getField_3776()).setViaTranslating(decoder.getInfo().isActive());
|
||||
((ViaServerInfo) getField_3776()).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
|
||||
}
|
||||
return serverInfo.getIcon();
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
dependencies {
|
||||
minecraft("com.mojang:minecraft:1.19.3")
|
||||
mappings("net.fabricmc:yarn:1.19.3+build.2:v2")
|
||||
minecraft("com.mojang:minecraft:23w07a")
|
||||
mappings("net.fabricmc:yarn:23w07a+build.10:v2")
|
||||
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.68.1+1.19.3")
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.74.1+1.19.4")
|
||||
modImplementation("com.terraformersmc:modmenu:5.0.0-alpha.4")
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
drawCenteredText(matrices, this.textRenderer, this.title, this.width / 2, 20, 16777215);
|
||||
drawCenteredTextWithShadow(matrices, this.textRenderer, this.title, this.width / 2, 20, 16777215);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
|
@ -6,24 +6,28 @@ import com.viaversion.fabric.mc119.mixin.debug.client.MixinClientConnectionAcces
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.listener.ClientQueryPacketListener;
|
||||
import net.minecraft.network.packet.s2c.query.QueryResponseS2CPacket;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(targets = "net.minecraft.client.network.MultiplayerServerListPinger$1")
|
||||
public abstract class MixinMultiplayerServerListPingerListener implements ClientQueryPacketListener {
|
||||
@Shadow
|
||||
public abstract ClientConnection getConnection();
|
||||
@Accessor
|
||||
abstract ClientConnection getField_3774(); // Synthetic
|
||||
|
||||
@Redirect(method = "onResponse(Lnet/minecraft/network/packet/s2c/query/QueryResponseS2CPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ServerInfo;getIcon()Ljava/lang/String;"))
|
||||
private String onResponseCaptureServerInfo(ServerInfo serverInfo) {
|
||||
FabricDecodeHandler decoder = ((MixinClientConnectionAccessor) this.getConnection()).getChannel()
|
||||
@Accessor
|
||||
abstract ServerInfo getField_3776(); // Synthetic
|
||||
|
||||
@Inject(method = "onResponse(Lnet/minecraft/network/packet/s2c/query/QueryResponseS2CPacket;)V", at = @At(value = "HEAD"))
|
||||
private void onResponseCaptureServerInfo(QueryResponseS2CPacket packet, CallbackInfo ci) {
|
||||
FabricDecodeHandler decoder = ((MixinClientConnectionAccessor) this.getField_3774()).getChannel()
|
||||
.pipeline().get(FabricDecodeHandler.class);
|
||||
if (decoder != null) {
|
||||
((ViaServerInfo) serverInfo).setViaTranslating(decoder.getInfo().isActive());
|
||||
((ViaServerInfo) serverInfo).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
|
||||
((ViaServerInfo) getField_3776()).setViaTranslating(decoder.getInfo().isActive());
|
||||
((ViaServerInfo) getField_3776()).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
|
||||
}
|
||||
return serverInfo.getIcon();
|
||||
}
|
||||
}
|
||||
|
@ -69,10 +69,10 @@ public class ProtocolAutoDetector {
|
||||
clientConnection.setPacketListener(new ClientQueryPacketListener() {
|
||||
@Override
|
||||
public void onResponse(QueryResponseS2CPacket packet) {
|
||||
ServerMetadata meta = packet.getServerMetadata();
|
||||
ServerMetadata.Version version;
|
||||
if (meta != null && (version = meta.getVersion()) != null) {
|
||||
ProtocolVersion ver = ProtocolVersion.getProtocol(version.getProtocolVersion());
|
||||
ServerMetadata meta = packet.metadata();
|
||||
if (meta != null && meta.version().isPresent()) {
|
||||
ProtocolVersion ver = ProtocolVersion.getProtocol(meta.version().get()
|
||||
.protocolVersion());
|
||||
future.complete(ver);
|
||||
ViaFabric.JLOGGER.info("Auto-detected " + ver + " for " + address);
|
||||
} else {
|
||||
@ -92,8 +92,8 @@ public class ProtocolAutoDetector {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientConnection getConnection() {
|
||||
return clientConnection;
|
||||
public boolean isConnectionOpen() {
|
||||
return ch.channel().isOpen();
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user