mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-11-21 11:35:16 +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 "org.ajoberstar.grgit" version "3.1.1"
|
||||||
id "com.matthewprenger.cursegradle" version "1.4.0"
|
id "com.matthewprenger.cursegradle" version "1.4.0"
|
||||||
id "com.modrinth.minotaur" version "2.2.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"
|
id "com.github.ben-manes.versions" version "0.42.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
# rip my ram
|
# rip my ram
|
||||||
org.gradle.jvmargs=-Xms32M -Xmx4G -XX:+UseG1GC -XX:+UseStringDeduplication
|
org.gradle.jvmargs=-Xms32M -Xmx4G -XX:+UseG1GC -XX:+UseStringDeduplication
|
||||||
|
|
||||||
loader_version=0.14.13
|
loader_version=0.14.14
|
||||||
viaver_version=4.6.0-23w04a-SNAPSHOT
|
viaver_version=4.6.0-23w07a-SNAPSHOT
|
||||||
yaml_version=1.33
|
yaml_version=1.33
|
||||||
|
|
||||||
# example: 1.19.1-rc2
|
# example: 1.19.1-rc2
|
||||||
modrinth_mc_snapshot=23w04a
|
modrinth_mc_snapshot=23w07a
|
||||||
# example: 1.19-Snapshot
|
# example: 1.19-Snapshot
|
||||||
curseforge_mc_snapshot=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.common.handler.FabricDecodeHandler;
|
||||||
import com.viaversion.fabric.mc117.mixin.debug.client.MixinClientConnectionAccessor;
|
import com.viaversion.fabric.mc117.mixin.debug.client.MixinClientConnectionAccessor;
|
||||||
import net.minecraft.client.network.ServerInfo;
|
import net.minecraft.client.network.ServerInfo;
|
||||||
import net.minecraft.network.ClientConnection;
|
|
||||||
import net.minecraft.network.listener.ClientQueryPacketListener;
|
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.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.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")
|
@Mixin(targets = "net.minecraft.client.network.MultiplayerServerListPinger$1")
|
||||||
public abstract class MixinMultiplayerServerListPingerListener implements ClientQueryPacketListener {
|
public abstract class MixinMultiplayerServerListPingerListener implements ClientQueryPacketListener {
|
||||||
@Shadow
|
@Accessor
|
||||||
public abstract ClientConnection getConnection();
|
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;"))
|
@Inject(method = "onResponse(Lnet/minecraft/network/packet/s2c/query/QueryResponseS2CPacket;)V", at = @At(value = "HEAD"))
|
||||||
private String onResponseCaptureServerInfo(ServerInfo serverInfo) {
|
private void onResponseCaptureServerInfo(QueryResponseS2CPacket packet, CallbackInfo ci) {
|
||||||
FabricDecodeHandler decoder = ((MixinClientConnectionAccessor) this.getConnection()).getChannel()
|
FabricDecodeHandler decoder = ((MixinClientConnectionAccessor) this.getConnection()).getChannel()
|
||||||
.pipeline().get(FabricDecodeHandler.class);
|
.pipeline().get(FabricDecodeHandler.class);
|
||||||
if (decoder != null) {
|
if (decoder != null) {
|
||||||
((ViaServerInfo) serverInfo).setViaTranslating(decoder.getInfo().isActive());
|
((ViaServerInfo) getField_3776()).setViaTranslating(decoder.getInfo().isActive());
|
||||||
((ViaServerInfo) serverInfo).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
|
((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.common.handler.FabricDecodeHandler;
|
||||||
import com.viaversion.fabric.mc118.mixin.debug.client.MixinClientConnectionAccessor;
|
import com.viaversion.fabric.mc118.mixin.debug.client.MixinClientConnectionAccessor;
|
||||||
import net.minecraft.client.network.ServerInfo;
|
import net.minecraft.client.network.ServerInfo;
|
||||||
import net.minecraft.network.ClientConnection;
|
|
||||||
import net.minecraft.network.listener.ClientQueryPacketListener;
|
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.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.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")
|
@Mixin(targets = "net.minecraft.client.network.MultiplayerServerListPinger$1")
|
||||||
public abstract class MixinMultiplayerServerListPingerListener implements ClientQueryPacketListener {
|
public abstract class MixinMultiplayerServerListPingerListener implements ClientQueryPacketListener {
|
||||||
@Shadow
|
@Accessor
|
||||||
public abstract ClientConnection getConnection();
|
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;"))
|
@Inject(method = "onResponse(Lnet/minecraft/network/packet/s2c/query/QueryResponseS2CPacket;)V", at = @At(value = "HEAD"))
|
||||||
private String onResponseCaptureServerInfo(ServerInfo serverInfo) {
|
private void onResponseCaptureServerInfo(QueryResponseS2CPacket packet, CallbackInfo ci) {
|
||||||
FabricDecodeHandler decoder = ((MixinClientConnectionAccessor) this.getConnection()).getChannel()
|
FabricDecodeHandler decoder = ((MixinClientConnectionAccessor) this.getConnection()).getChannel()
|
||||||
.pipeline().get(FabricDecodeHandler.class);
|
.pipeline().get(FabricDecodeHandler.class);
|
||||||
if (decoder != null) {
|
if (decoder != null) {
|
||||||
((ViaServerInfo) serverInfo).setViaTranslating(decoder.getInfo().isActive());
|
((ViaServerInfo) getField_3776()).setViaTranslating(decoder.getInfo().isActive());
|
||||||
((ViaServerInfo) serverInfo).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
|
((ViaServerInfo) getField_3776()).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
|
||||||
}
|
}
|
||||||
return serverInfo.getIcon();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
dependencies {
|
dependencies {
|
||||||
minecraft("com.mojang:minecraft:1.19.3")
|
minecraft("com.mojang:minecraft:23w07a")
|
||||||
mappings("net.fabricmc:yarn:1.19.3+build.2:v2")
|
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")
|
modImplementation("com.terraformersmc:modmenu:5.0.0-alpha.4")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
|
|||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||||
this.renderBackground(matrices);
|
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);
|
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.client.network.ServerInfo;
|
||||||
import net.minecraft.network.ClientConnection;
|
import net.minecraft.network.ClientConnection;
|
||||||
import net.minecraft.network.listener.ClientQueryPacketListener;
|
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.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.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")
|
@Mixin(targets = "net.minecraft.client.network.MultiplayerServerListPinger$1")
|
||||||
public abstract class MixinMultiplayerServerListPingerListener implements ClientQueryPacketListener {
|
public abstract class MixinMultiplayerServerListPingerListener implements ClientQueryPacketListener {
|
||||||
@Shadow
|
@Accessor
|
||||||
public abstract ClientConnection getConnection();
|
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;"))
|
@Accessor
|
||||||
private String onResponseCaptureServerInfo(ServerInfo serverInfo) {
|
abstract ServerInfo getField_3776(); // Synthetic
|
||||||
FabricDecodeHandler decoder = ((MixinClientConnectionAccessor) this.getConnection()).getChannel()
|
|
||||||
|
@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);
|
.pipeline().get(FabricDecodeHandler.class);
|
||||||
if (decoder != null) {
|
if (decoder != null) {
|
||||||
((ViaServerInfo) serverInfo).setViaTranslating(decoder.getInfo().isActive());
|
((ViaServerInfo) getField_3776()).setViaTranslating(decoder.getInfo().isActive());
|
||||||
((ViaServerInfo) serverInfo).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
|
((ViaServerInfo) getField_3776()).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
|
||||||
}
|
}
|
||||||
return serverInfo.getIcon();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,10 +69,10 @@ public class ProtocolAutoDetector {
|
|||||||
clientConnection.setPacketListener(new ClientQueryPacketListener() {
|
clientConnection.setPacketListener(new ClientQueryPacketListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(QueryResponseS2CPacket packet) {
|
public void onResponse(QueryResponseS2CPacket packet) {
|
||||||
ServerMetadata meta = packet.getServerMetadata();
|
ServerMetadata meta = packet.metadata();
|
||||||
ServerMetadata.Version version;
|
if (meta != null && meta.version().isPresent()) {
|
||||||
if (meta != null && (version = meta.getVersion()) != null) {
|
ProtocolVersion ver = ProtocolVersion.getProtocol(meta.version().get()
|
||||||
ProtocolVersion ver = ProtocolVersion.getProtocol(version.getProtocolVersion());
|
.protocolVersion());
|
||||||
future.complete(ver);
|
future.complete(ver);
|
||||||
ViaFabric.JLOGGER.info("Auto-detected " + ver + " for " + address);
|
ViaFabric.JLOGGER.info("Auto-detected " + ver + " for " + address);
|
||||||
} else {
|
} else {
|
||||||
@ -92,8 +92,8 @@ public class ProtocolAutoDetector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClientConnection getConnection() {
|
public boolean isConnectionOpen() {
|
||||||
return clientConnection;
|
return ch.channel().isOpen();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user