Merge branch 'dev'

This commit is contained in:
creeper123123321 2023-03-14 16:31:57 -03:00
commit c0dce2e425
9 changed files with 52 additions and 47 deletions

View File

@ -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"
} }
@ -162,7 +162,7 @@ processResources {
} }
List<String> mcReleases = new ArrayList<>( List<String> mcReleases = new ArrayList<>(
Arrays.asList("1.19.3", "1.18.2", "1.17.1", "1.16.5", "1.15.2", "1.14.4", "1.8.9")) Arrays.asList("1.18.2", "1.17.1", "1.16.5", "1.15.2", "1.14.4", "1.8.9"))
List<String> javaVersions = IntStream.rangeClosed(8, 18) List<String> javaVersions = IntStream.rangeClosed(8, 18)
.mapToObj { n -> (String) "Java $n" } .mapToObj { n -> (String) "Java $n" }
.collect(Collectors.toList()) .collect(Collectors.toList())
@ -220,6 +220,7 @@ modrinth {
dependencies { dependencies {
optional.project "P7dR8mSH" // fabric api optional.project "P7dR8mSH" // fabric api
optional.project "9CJED7xi" // legacy fabric api
} }
} }

View File

@ -1,12 +1,12 @@
# suppress inspection "UnusedProperty" for whole file # suppress inspection "UnusedProperty" for whole file
# rip my ram # rip my ram
org.gradle.jvmargs=-Xms32M -Xmx3G -XX:+UseG1GC -XX:+UseStringDeduplication org.gradle.jvmargs=-Xms32M -Xmx4G -XX:+UseG1GC -XX:+UseStringDeduplication
loader_version=0.14.12 loader_version=0.14.14
viaver_version=4.6.0-1.19.4-rc2-SNAPSHOT viaver_version=4.6.0-1.19.4-rc2-SNAPSHOT
yaml_version=1.33 yaml_version=1.33
# example: 1.19.1-rc2 # example: 1.19.1-rc2
modrinth_mc_snapshot= modrinth_mc_snapshot=1.19.4-rc2
# example: 1.19-Snapshot # example: 1.19-Snapshot
curseforge_mc_snapshot= curseforge_mc_snapshot=1.19-Snapshot

View File

@ -13,7 +13,7 @@
}, },
"depends": { "depends": {
"fabricloader": ">=0.10.0", "fabricloader": ">=0.10.0",
"minecraft": ["1.8.x", "1.14.4", "1.15.2", "~1.16.4", "1.17.1", "1.18.2", "~1.19.3"], "minecraft": ["1.8.x", "1.14.4", "1.15.2", "~1.16.4", "1.17.1", "1.18.2", "~1.19.4-alpha.23.7.a"],
"viaversion": ">=4.0.0" "viaversion": ">=4.0.0"
}, },
"environment": "*", "environment": "*",

View File

@ -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();
} }
} }

View File

@ -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();
} }
} }

View File

@ -1,8 +1,8 @@
dependencies { dependencies {
minecraft("com.mojang:minecraft:1.19.3") minecraft("com.mojang:minecraft:1.19.4-rc2")
mappings("net.fabricmc:yarn:1.19.3+build.2:v2") mappings("net.fabricmc:yarn:1.19.4-rc2+build.1:v2")
modImplementation("net.fabricmc.fabric-api:fabric-api:0.68.1+1.19.3") modImplementation("net.fabricmc.fabric-api:fabric-api:0.75.3+1.19.4")
modImplementation("com.terraformersmc:modmenu:5.0.0-alpha.4") modImplementation("com.terraformersmc:modmenu:5.0.0-alpha.4")
} }

View File

@ -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);
} }

View File

@ -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();
} }
} }

View File

@ -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();
} }
}); });