mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-11-25 12:15:14 +01:00
update to 21w20a
This commit is contained in:
parent
c622e4af08
commit
dfcf9cf354
@ -10,7 +10,7 @@ plugins {
|
||||
}
|
||||
|
||||
def ENV = System.getenv()
|
||||
def vvVer = "4.0.0-21w19a-SNAPSHOT"
|
||||
def vvVer = "4.0.0-21w20a-SNAPSHOT"
|
||||
|
||||
description = "Client-side and server-side ViaVersion implementation for Fabric"
|
||||
version = "0.4.0+" + ENV.GITHUB_RUN_NUMBER + "-" + getBranch()
|
||||
|
@ -28,8 +28,7 @@ public class MixinDebugHud {
|
||||
if (protocol != null) {
|
||||
ProtocolVersion serverVer = ProtocolVersion.getProtocol(protocol.getServerProtocolVersion());
|
||||
ProtocolVersion clientVer = ProtocolVersion.getProtocol(protocol.getProtocolVersion());
|
||||
line += " / C: " + clientVer.getName() + " (" + clientVer.getVersion() + ") S: "
|
||||
+ serverVer.getName() + " (" + serverVer.getVersion() + ") A: " + protocol.getUser().isActive();
|
||||
line += " / C: " + clientVer + " S: " + serverVer + " A: " + protocol.getUser().isActive();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,7 @@ public class MixinDebugHud {
|
||||
if (protocol != null) {
|
||||
ProtocolVersion serverVer = ProtocolVersion.getProtocol(protocol.getServerProtocolVersion());
|
||||
ProtocolVersion clientVer = ProtocolVersion.getProtocol(protocol.getProtocolVersion());
|
||||
line += " / C: " + clientVer.getName() + " (" + clientVer.getVersion() + ") S: "
|
||||
+ serverVer.getName() + " (" + serverVer.getVersion() + ") A: " + protocol.getUser().isActive();
|
||||
line += " / C: " + clientVer + " S: " + serverVer + " A: " + protocol.getUser().isActive();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,7 @@ public class MixinDebugHud {
|
||||
if (protocol != null) {
|
||||
ProtocolVersion serverVer = ProtocolVersion.getProtocol(protocol.getServerProtocolVersion());
|
||||
ProtocolVersion clientVer = ProtocolVersion.getProtocol(protocol.getProtocolVersion());
|
||||
line += " / C: " + clientVer.getName() + " (" + clientVer.getVersion() + ") S: "
|
||||
+ serverVer.getName() + " (" + serverVer.getVersion() + ") A: " + protocol.getUser().isActive();
|
||||
line += " / C: " + clientVer + " S: " + serverVer + " A: " + protocol.getUser().isActive();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
version = rootProject.version
|
||||
|
||||
dependencies {
|
||||
minecraft("com.mojang:minecraft:21w19a")
|
||||
mappings("net.fabricmc:yarn:21w19a+build.9:v2")
|
||||
minecraft("com.mojang:minecraft:21w20a")
|
||||
mappings("net.fabricmc:yarn:21w20a+build.2:v2")
|
||||
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.34.4+1.17")
|
||||
modImplementation("com.terraformersmc:modmenu:1.16.9")
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.34.5+1.17")
|
||||
modImplementation("com.terraformersmc:modmenu:2.0.0-beta.4")
|
||||
}
|
||||
|
@ -41,13 +41,13 @@ public class ViaConfigScreen extends Screen {
|
||||
protected void init() {
|
||||
int entries = 0;
|
||||
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 155 + entries % 2 * 160,
|
||||
this.method_37063(new ButtonWidget(this.width / 2 - 155 + entries % 2 * 160,
|
||||
this.height / 6 + 24 * (entries >> 1),
|
||||
150,
|
||||
20, getClientSideText(), this::onClickClientSide));
|
||||
entries++;
|
||||
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 155 + entries % 2 * 160,
|
||||
this.method_37063(new ButtonWidget(this.width / 2 - 155 + entries % 2 * 160,
|
||||
this.height / 6 + 24 * (entries >> 1),
|
||||
150,
|
||||
20, getHideViaButtonText(), this::onHideViaButton));
|
||||
@ -65,14 +65,14 @@ public class ViaConfigScreen extends Screen {
|
||||
int clientSideVersion = ViaFabric.config.getClientSideVersion();
|
||||
protocolVersion.setText(ProtocolUtils.getProtocolName(clientSideVersion));
|
||||
|
||||
this.children.add(protocolVersion);
|
||||
this.method_37063(protocolVersion);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
if (entries % 2 == 1) {
|
||||
entries++;
|
||||
}
|
||||
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 24 * (entries >> 1), 200, 20, ScreenTexts.DONE, (buttonWidget) -> this.client.openScreen(this.parent)));
|
||||
this.method_37063(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 24 * (entries >> 1), 200, 20, ScreenTexts.DONE, (buttonWidget) -> this.client.openScreen(this.parent)));
|
||||
}
|
||||
|
||||
private void onChangeVersionField(String text) {
|
||||
@ -159,7 +159,6 @@ public class ViaConfigScreen extends Screen {
|
||||
this.renderBackground(matrices);
|
||||
drawCenteredText(matrices, this.textRenderer, this.title, this.width / 2, 20, 16777215);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
protocolVersion.render(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,9 +3,7 @@ package com.viaversion.fabric.mc117.mixin.address.client;
|
||||
import com.viaversion.fabric.common.VFAddressParser;
|
||||
import net.minecraft.client.network.Address;
|
||||
import net.minecraft.client.network.AllowedAddressResolver;
|
||||
import net.minecraft.client.network.RedirectResolver;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
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;
|
||||
@ -20,14 +18,10 @@ import java.util.Optional;
|
||||
@Mixin(AllowedAddressResolver.class)
|
||||
public abstract class MixinAllowedAddressResolver {
|
||||
@Shadow
|
||||
@Final
|
||||
private RedirectResolver redirectResolver;
|
||||
|
||||
@Shadow
|
||||
protected abstract Optional<Address> getAllowedAddress(ServerAddress address);
|
||||
public abstract Optional<Address> resolve(ServerAddress address);
|
||||
|
||||
@Inject(method = "resolve", at = @At(value = "HEAD"), cancellable = true)
|
||||
private void resolveVF(ServerAddress address, CallbackInfoReturnable<Optional<Address>> cir) throws UnknownHostException {
|
||||
private void resolveVF(ServerAddress address, CallbackInfoReturnable<Optional<Address>> cir) {
|
||||
VFAddressParser viaAddr = new VFAddressParser().parse(address.getAddress());
|
||||
if (viaAddr.viaSuffix == null) {
|
||||
return;
|
||||
@ -35,20 +29,16 @@ public abstract class MixinAllowedAddressResolver {
|
||||
|
||||
ServerAddress realAddress = new ServerAddress(viaAddr.realAddress, address.getPort());
|
||||
|
||||
cir.setReturnValue(getAllowedAddress(realAddress)
|
||||
.map(it -> redirectResolver.lookupRedirect(realAddress)
|
||||
.flatMap(this::getAllowedAddress)
|
||||
.orElse(it))
|
||||
.map(it -> {
|
||||
try {
|
||||
return Address.create(new InetSocketAddress(InetAddress.getByAddress(
|
||||
it.getHostName() + "." + viaAddr.viaSuffix,
|
||||
it.getInetSocketAddress().getAddress().getAddress()), it.getPort()
|
||||
));
|
||||
} catch (UnknownHostException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
})
|
||||
);
|
||||
cir.setReturnValue(resolve(realAddress).map(it -> viaFabricAddSuffix(it, viaAddr.viaSuffix)));
|
||||
}
|
||||
|
||||
private Address viaFabricAddSuffix(Address it, String viaSuffix) {
|
||||
try {
|
||||
return Address.create(new InetSocketAddress(
|
||||
InetAddress.getByAddress(it.getHostName() + "." + viaSuffix,
|
||||
it.getInetSocketAddress().getAddress().getAddress()), it.getPort()));
|
||||
} catch (UnknownHostException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ public class MixinDebugHud {
|
||||
if (protocol != null) {
|
||||
ProtocolVersion serverVer = ProtocolVersion.getProtocol(protocol.getServerProtocolVersion());
|
||||
ProtocolVersion clientVer = ProtocolVersion.getProtocol(protocol.getProtocolVersion());
|
||||
line += " / C: " + clientVer.getName() + " (" + clientVer.getVersion() + ") S: "
|
||||
+ serverVer.getName() + " (" + serverVer.getVersion() + ") A: " + protocol.getUser().isActive();
|
||||
line += " / C: " + clientVer + " S: " + serverVer + " A: " + protocol.getUser().isActive();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,6 @@ public abstract class MixinMultiplayerScreen extends Screen {
|
||||
it -> MinecraftClient.getInstance().openScreen(new ViaConfigScreen(this)),
|
||||
new TranslatableText("gui.via_button"));
|
||||
if (ViaFabric.config.isHideButton()) enableClientSideViaVersion.visible = false;
|
||||
addButton(enableClientSideViaVersion);
|
||||
this.method_37063(enableClientSideViaVersion);
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ public class MixinDebugHud {
|
||||
if (protocol != null) {
|
||||
ProtocolVersion serverVer = ProtocolVersion.getProtocol(protocol.getServerProtocolVersion());
|
||||
ProtocolVersion clientVer = ProtocolVersion.getProtocol(protocol.getProtocolVersion());
|
||||
line += " / C: " + clientVer.getName() + " (" + clientVer.getVersion() + ") S: "
|
||||
+ serverVer.getName() + " (" + serverVer.getVersion() + ") A: " + protocol.getUser().isActive();
|
||||
line += " / C: " + clientVer + " S: " + serverVer + " A: " + protocol.getUser().isActive();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user