mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-11-16 10:45:15 +01:00
1.19.3, remove 1.19 chat patch
This commit is contained in:
parent
c8e9132e68
commit
7265dcffb7
@ -162,7 +162,7 @@ processResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<String> mcReleases = new ArrayList<>(
|
List<String> mcReleases = new ArrayList<>(
|
||||||
Arrays.asList("1.19.2", "1.19.1", "1.18.2", "1.17.1", "1.16.5", "1.15.2", "1.14.4", "1.8.9"))
|
Arrays.asList("1.19.3", "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())
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
org.gradle.jvmargs=-Xms32M -Xmx3G -XX:+UseG1GC -XX:+UseStringDeduplication
|
org.gradle.jvmargs=-Xms32M -Xmx3G -XX:+UseG1GC -XX:+UseStringDeduplication
|
||||||
|
|
||||||
loader_version=0.14.10
|
loader_version=0.14.10
|
||||||
viaver_version=4.4.3-SNAPSHOT
|
viaver_version=4.5.0
|
||||||
yaml_version=1.33
|
yaml_version=1.33
|
||||||
|
|
||||||
# example: 1.19.1-rc2
|
# example: 1.19.1-rc2
|
||||||
|
@ -36,10 +36,6 @@ public abstract class AbstractFabricVersionProvider extends BaseVersionProvider
|
|||||||
multiconnectIntegration();
|
multiconnectIntegration();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method indicates the correct clientside version, in case Auto Detect is used you still need the version that ViaVersion uses
|
|
||||||
public void onFinallySetVersion(final int realClientsideVersion) {
|
|
||||||
}
|
|
||||||
|
|
||||||
private void multiconnectIntegration() {
|
private void multiconnectIntegration() {
|
||||||
if (!FabricLoader.getInstance().isModLoaded("multiconnect")) return;
|
if (!FabricLoader.getInstance().isModLoaded("multiconnect")) return;
|
||||||
try {
|
try {
|
||||||
@ -106,7 +102,6 @@ public abstract class AbstractFabricVersionProvider extends BaseVersionProvider
|
|||||||
|
|
||||||
if (blocked || !supported) serverVer = info.getProtocolVersion();
|
if (blocked || !supported) serverVer = info.getProtocolVersion();
|
||||||
|
|
||||||
this.onFinallySetVersion(serverVer);
|
|
||||||
return serverVer;
|
return serverVer;
|
||||||
}
|
}
|
||||||
NativeVersionProvider natProvider = Via.getManager().getProviders().get(NativeVersionProvider.class);
|
NativeVersionProvider natProvider = Via.getManager().getProviders().get(NativeVersionProvider.class);
|
||||||
|
@ -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.1"],
|
"minecraft": ["1.8.x", "1.14.4", "1.15.2", "~1.16.4", "1.17.1", "1.18.2", "~1.19.3"],
|
||||||
"viaversion": ">=4.0.0"
|
"viaversion": ">=4.0.0"
|
||||||
},
|
},
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
dependencies {
|
dependencies {
|
||||||
minecraft("com.mojang:minecraft:1.19.2")
|
minecraft("com.mojang:minecraft:1.19.3")
|
||||||
mappings("net.fabricmc:yarn:1.19.2+build.8:v2")
|
mappings("net.fabricmc:yarn:1.19.3+build.2:v2")
|
||||||
|
|
||||||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.60.0+1.19.2")
|
modImplementation("net.fabricmc.fabric-api:fabric-api:0.68.1+1.19.3")
|
||||||
modImplementation("com.terraformersmc:modmenu:4.0.6")
|
modImplementation("com.terraformersmc:modmenu:5.0.0-alpha.4")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.compileJava {
|
tasks.compileJava {
|
||||||
|
@ -12,7 +12,6 @@ import com.viaversion.fabric.common.util.JLoggerToLog4j;
|
|||||||
import com.viaversion.fabric.mc119.commands.VRCommandHandler;
|
import com.viaversion.fabric.mc119.commands.VRCommandHandler;
|
||||||
import com.viaversion.fabric.mc119.platform.FabricPlatform;
|
import com.viaversion.fabric.mc119.platform.FabricPlatform;
|
||||||
import com.viaversion.fabric.mc119.platform.VFLoader;
|
import com.viaversion.fabric.mc119.platform.VFLoader;
|
||||||
import com.viaversion.fabric.mc119.signatures1_19.ProtocolPatcher1_19;
|
|
||||||
import com.viaversion.viaversion.ViaManagerImpl;
|
import com.viaversion.viaversion.ViaManagerImpl;
|
||||||
import com.viaversion.viaversion.api.Via;
|
import com.viaversion.viaversion.api.Via;
|
||||||
import com.viaversion.viaversion.api.data.MappingDataLoader;
|
import com.viaversion.viaversion.api.data.MappingDataLoader;
|
||||||
@ -84,8 +83,6 @@ public class ViaFabric implements ModInitializer {
|
|||||||
config = new VFConfig(FabricLoader.getInstance().getConfigDir().resolve("ViaFabric")
|
config = new VFConfig(FabricLoader.getInstance().getConfigDir().resolve("ViaFabric")
|
||||||
.resolve("viafabric.yml").toFile());
|
.resolve("viafabric.yml").toFile());
|
||||||
|
|
||||||
ProtocolPatcher1_19.patchIfClient();
|
|
||||||
|
|
||||||
INIT_FUTURE.complete(null);
|
INIT_FUTURE.complete(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,14 +31,18 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
|
|||||||
protected void init() {
|
protected void init() {
|
||||||
int entries = 0;
|
int entries = 0;
|
||||||
|
|
||||||
this.addDrawableChild(new ButtonWidget(calculatePosX(this.width, entries),
|
this.addDrawableChild(ButtonWidget
|
||||||
calculatePosY(this.height, entries),
|
.builder(getClientSideText(), this::onClickClientSide)
|
||||||
150, 20, getClientSideText(), this::onClickClientSide));
|
.dimensions(calculatePosX(this.width, entries),
|
||||||
|
calculatePosY(this.height, entries), 150, 20)
|
||||||
|
.build());
|
||||||
entries++;
|
entries++;
|
||||||
|
|
||||||
this.addDrawableChild(new ButtonWidget(calculatePosX(this.width, entries),
|
this.addDrawableChild(ButtonWidget
|
||||||
calculatePosY(this.height, entries),
|
.builder(getHideViaButtonText(), this::onHideViaButton)
|
||||||
150, 20, getHideViaButtonText(), this::onHideViaButton));
|
.dimensions(calculatePosX(this.width, entries),
|
||||||
|
calculatePosY(this.height, entries), 150, 20)
|
||||||
|
.build());
|
||||||
entries++;
|
entries++;
|
||||||
|
|
||||||
protocolVersion = new TextFieldWidget(this.textRenderer,
|
protocolVersion = new TextFieldWidget(this.textRenderer,
|
||||||
@ -54,7 +58,10 @@ public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
|
|||||||
|
|
||||||
this.addDrawableChild(protocolVersion);
|
this.addDrawableChild(protocolVersion);
|
||||||
|
|
||||||
this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height - 40, 200, 20, ScreenTexts.DONE, (buttonWidget) -> this.client.setScreen(this.parent)));
|
this.addDrawableChild(ButtonWidget
|
||||||
|
.builder(ScreenTexts.DONE, (it) -> close())
|
||||||
|
.dimensions(this.width / 2 - 100, this.height - 40, 200, 20)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onChangeVersionField(String text) {
|
private void onChangeVersionField(String text) {
|
||||||
|
@ -34,11 +34,11 @@ public class MixinServerEntry {
|
|||||||
RenderSystem.setShaderTexture(i, identifier);
|
RenderSystem.setShaderTexture(i, identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "render", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/client/gui/screen/multiplayer/MultiplayerScreen;setTooltip(Ljava/util/List;)V"))
|
@Redirect(method = "render", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/client/gui/screen/multiplayer/MultiplayerScreen;setMultiplayerScreenTooltip(Ljava/util/List;)V"))
|
||||||
private void addServerVer(MultiplayerScreen multiplayerScreen, List<Text> tooltipText) {
|
private void addServerVer(MultiplayerScreen multiplayerScreen, List<Text> tooltipText) {
|
||||||
ProtocolVersion proto = ProtocolVersion.getProtocol(((ViaServerInfo) this.server).getViaServerVer());
|
ProtocolVersion proto = ProtocolVersion.getProtocol(((ViaServerInfo) this.server).getViaServerVer());
|
||||||
List<Text> lines = new ArrayList<>(tooltipText);
|
List<Text> lines = new ArrayList<>(tooltipText);
|
||||||
lines.add(Text.translatable("gui.ping_version.translated", proto.getName()));
|
lines.add(Text.translatable("gui.ping_version.translated", proto.getName()));
|
||||||
multiplayerScreen.setTooltip(lines);
|
multiplayerScreen.setMultiplayerScreenTooltip(lines);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,36 +0,0 @@
|
|||||||
package com.viaversion.fabric.mc119.mixin.signatures1_19.client;
|
|
||||||
|
|
||||||
import com.viaversion.fabric.mc119.signatures1_19.MessageSigner1_19;
|
|
||||||
import com.viaversion.fabric.mc119.signatures1_19.ProtocolPatcher1_19;
|
|
||||||
import net.minecraft.command.argument.DecoratableArgumentList;
|
|
||||||
import net.minecraft.network.encryption.Signer;
|
|
||||||
import net.minecraft.network.message.ArgumentSignatureDataMap;
|
|
||||||
import net.minecraft.network.message.MessageMetadata;
|
|
||||||
import net.minecraft.network.message.MessageSignatureData;
|
|
||||||
import net.minecraft.text.Text;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Mixin(ArgumentSignatureDataMap.class)
|
|
||||||
public class ArgumentSignatureDataMapMixin {
|
|
||||||
@Inject(method = "sign", at = @At("HEAD"), cancellable = true)
|
|
||||||
private static void injectSign(DecoratableArgumentList<?> arguments, ArgumentSignatureDataMap.ArgumentSigner signer, CallbackInfoReturnable<ArgumentSignatureDataMap> cir) {
|
|
||||||
if (!ProtocolPatcher1_19.shouldPatchKeys) return;
|
|
||||||
|
|
||||||
final List<ArgumentSignatureDataMap.Entry> list = ArgumentSignatureDataMap.toNameValuePairs(arguments)
|
|
||||||
.stream().map(entry -> {
|
|
||||||
final MessageMetadata metadata = MessageSigner1_19.pollLastMetadata();
|
|
||||||
final MessageSignatureData messageSignatureData = MessageSigner1_19.sign((Signer) signer,
|
|
||||||
Text.literal(entry.getFirst()), metadata.sender(), metadata.timestamp(), metadata.salt());
|
|
||||||
|
|
||||||
return new ArgumentSignatureDataMap.Entry(entry.getFirst(), messageSignatureData);
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
|
|
||||||
cir.setReturnValue(new ArgumentSignatureDataMap(list));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
package com.viaversion.fabric.mc119.mixin.signatures1_19.client;
|
|
||||||
|
|
||||||
import com.mojang.brigadier.ParseResults;
|
|
||||||
import com.viaversion.fabric.mc119.signatures1_19.MessageSigner1_19;
|
|
||||||
import com.viaversion.fabric.mc119.signatures1_19.ProtocolPatcher1_19;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
|
||||||
import net.minecraft.command.CommandSource;
|
|
||||||
import net.minecraft.network.encryption.Signer;
|
|
||||||
import net.minecraft.network.message.*;
|
|
||||||
import net.minecraft.text.Text;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
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.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
@Mixin(ClientPlayerEntity.class)
|
|
||||||
public class ClientPlayerEntityMixin {
|
|
||||||
@Shadow
|
|
||||||
@Final
|
|
||||||
protected MinecraftClient client;
|
|
||||||
|
|
||||||
@Inject(method = "signChatMessage", at = @At("HEAD"), cancellable = true)
|
|
||||||
public void injectSignChatMessage(MessageMetadata metadata, DecoratedContents content, LastSeenMessageList lastSeenMessages, CallbackInfoReturnable<MessageSignatureData> cir) {
|
|
||||||
if (!ProtocolPatcher1_19.shouldPatchKeys) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
final Signer signer = this.client.getProfileKeys().getSigner();
|
|
||||||
|
|
||||||
if (signer != null) {
|
|
||||||
cir.setReturnValue(MessageSigner1_19.sign(signer, content.decorated(), metadata.sender(),
|
|
||||||
metadata.timestamp(), metadata.salt()));
|
|
||||||
}
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
cir.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "signArguments", at = @At(value = "HEAD"))
|
|
||||||
public void injectSignArguments(MessageMetadata signer, ParseResults<CommandSource> parseResults, @Nullable Text preview, LastSeenMessageList lastSeenMessages, CallbackInfoReturnable<ArgumentSignatureDataMap> cir) {
|
|
||||||
MessageSigner1_19.track(signer);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package com.viaversion.fabric.mc119.mixin.signatures1_19.client;
|
|
||||||
|
|
||||||
import com.viaversion.fabric.mc119.signatures1_19.IPublicKeyData;
|
|
||||||
import com.viaversion.fabric.mc119.signatures1_19.ProtocolPatcher1_19;
|
|
||||||
import net.minecraft.network.encryption.NetworkEncryptionUtils;
|
|
||||||
import net.minecraft.network.encryption.PlayerPublicKey;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.security.PublicKey;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Mixin(PlayerPublicKey.PublicKeyData.class)
|
|
||||||
public class PlayerPublicKeyChPublicKeyDataMixin implements IPublicKeyData {
|
|
||||||
|
|
||||||
@Shadow
|
|
||||||
@Final
|
|
||||||
private Instant expiresAt;
|
|
||||||
|
|
||||||
@Shadow
|
|
||||||
@Final
|
|
||||||
PublicKey key;
|
|
||||||
|
|
||||||
@Unique
|
|
||||||
private byte[] key1_19_0;
|
|
||||||
|
|
||||||
@Redirect(method = {"write", "verifyKey"}, at = @At(value = "FIELD", target = "Lnet/minecraft/network/encryption/PlayerPublicKey$PublicKeyData;keySignature:[B"))
|
|
||||||
public byte[] replaceKeys(PlayerPublicKey.PublicKeyData instance) {
|
|
||||||
if (this.key1_19_0 != null && ProtocolPatcher1_19.shouldPatchKeys) {
|
|
||||||
return this.key1_19_0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance.keySignature();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "toSerializedString", at = @At(value = "HEAD"), cancellable = true)
|
|
||||||
public void injectToSerializedString(UUID playerUuid, CallbackInfoReturnable<byte[]> cir) {
|
|
||||||
if (ProtocolPatcher1_19.shouldPatchKeys) {
|
|
||||||
cir.setReturnValue((this.expiresAt.toEpochMilli() + NetworkEncryptionUtils.encodeRsaPublicKey(this.key)).getBytes(StandardCharsets.UTF_8));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void set1_19_0Key(ByteBuffer byteBuffer) {
|
|
||||||
this.key1_19_0 = byteBuffer.array();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package com.viaversion.fabric.mc119.mixin.signatures1_19.client;
|
|
||||||
|
|
||||||
import com.mojang.authlib.yggdrasil.response.KeyPairResponse;
|
|
||||||
import com.viaversion.fabric.mc119.signatures1_19.IPublicKeyData;
|
|
||||||
import net.minecraft.client.util.ProfileKeys;
|
|
||||||
import net.minecraft.network.encryption.PlayerPublicKey;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
@Mixin(ProfileKeys.class)
|
|
||||||
public class ProfileKeysMixin {
|
|
||||||
@Inject(method = "decodeKeyPairResponse", at = @At("RETURN"))
|
|
||||||
private static void trackLegacyKey(KeyPairResponse keyPairResponse, CallbackInfoReturnable<PlayerPublicKey.PublicKeyData> cir) {
|
|
||||||
((IPublicKeyData) (Object) cir.getReturnValue()).set1_19_0Key(keyPairResponse.getLegacyPublicKeySignature());
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,7 +4,6 @@ import com.viaversion.fabric.common.config.VFConfig;
|
|||||||
import com.viaversion.fabric.common.provider.AbstractFabricVersionProvider;
|
import com.viaversion.fabric.common.provider.AbstractFabricVersionProvider;
|
||||||
import com.viaversion.fabric.mc119.ViaFabric;
|
import com.viaversion.fabric.mc119.ViaFabric;
|
||||||
import com.viaversion.fabric.mc119.service.ProtocolAutoDetector;
|
import com.viaversion.fabric.mc119.service.ProtocolAutoDetector;
|
||||||
import com.viaversion.fabric.mc119.signatures1_19.ProtocolPatcher1_19;
|
|
||||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import net.minecraft.network.ClientConnection;
|
import net.minecraft.network.ClientConnection;
|
||||||
@ -29,11 +28,6 @@ public class FabricVersionProvider extends AbstractFabricVersionProvider {
|
|||||||
return ProtocolAutoDetector.detectVersion(address);
|
return ProtocolAutoDetector.detectVersion(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFinallySetVersion(int realClientsideVersion) {
|
|
||||||
ProtocolPatcher1_19.shouldPatchKeys = realClientsideVersion <= ProtocolVersion.v1_19.getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isMulticonnectHandler(ChannelPipeline pipe) {
|
protected boolean isMulticonnectHandler(ChannelPipeline pipe) {
|
||||||
return pipe.get(ClientConnection.class).getPacketListener().getClass().getName().startsWith("net.earthcomputer.multiconnect");
|
return pipe.get(ClientConnection.class).getPacketListener().getClass().getName().startsWith("net.earthcomputer.multiconnect");
|
||||||
|
@ -12,8 +12,8 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
|||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
|
||||||
|
|
||||||
public class VRHandItemProvider extends HandItemProvider {
|
public class VRHandItemProvider extends HandItemProvider {
|
||||||
public Item clientItem = null;
|
public Item clientItem = null;
|
||||||
@ -50,7 +50,7 @@ public class VRHandItemProvider extends HandItemProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Item fromNative(ItemStack original) {
|
private Item fromNative(ItemStack original) {
|
||||||
Identifier iid = Registry.ITEM.getId(original.getItem());
|
Identifier iid = Registries.ITEM.getId(original.getItem());
|
||||||
int id = RemappingUtil.swordId(iid.toString());
|
int id = RemappingUtil.swordId(iid.toString());
|
||||||
return new DataItem(id, (byte) original.getCount(), (short) original.getDamage(), null);
|
return new DataItem(id, (byte) original.getCount(), (short) original.getDamage(), null);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
package com.viaversion.fabric.mc119.signatures1_19;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
|
|
||||||
public interface IPublicKeyData {
|
|
||||||
void set1_19_0Key(final ByteBuffer byteBuffer);
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package com.viaversion.fabric.mc119.signatures1_19;
|
|
||||||
|
|
||||||
import net.minecraft.network.encryption.Signer;
|
|
||||||
import net.minecraft.network.message.MessageMetadata;
|
|
||||||
import net.minecraft.network.message.MessageSignatureData;
|
|
||||||
import net.minecraft.text.Text;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.ByteOrder;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class MessageSigner1_19 {
|
|
||||||
public static final Deque<MessageMetadata> TRACKED_METADATA_LIST = new ArrayDeque<>();
|
|
||||||
|
|
||||||
public static MessageMetadata pollLastMetadata() {
|
|
||||||
return TRACKED_METADATA_LIST.pollLast();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void track(final MessageMetadata metadata) {
|
|
||||||
TRACKED_METADATA_LIST.add(metadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MessageSignatureData sign(Signer signer, Text decorateText, final UUID sender, final Instant timeStamp, final long salt) {
|
|
||||||
return new MessageSignatureData(signer.sign((sign -> {
|
|
||||||
final byte[] data = new byte[32];
|
|
||||||
|
|
||||||
final ByteBuffer buffer = ByteBuffer.wrap(data).order(ByteOrder.BIG_ENDIAN);
|
|
||||||
|
|
||||||
buffer.putLong(salt);
|
|
||||||
buffer.putLong(sender.getMostSignificantBits()).putLong(sender.getLeastSignificantBits());
|
|
||||||
buffer.putLong(timeStamp.getEpochSecond());
|
|
||||||
|
|
||||||
sign.update(data);
|
|
||||||
sign.update(Text.Serializer.toSortedJsonString(decorateText).getBytes(StandardCharsets.UTF_8));
|
|
||||||
})));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
package com.viaversion.fabric.mc119.signatures1_19;
|
|
||||||
|
|
||||||
import com.viaversion.viaversion.api.Via;
|
|
||||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
|
||||||
import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
|
|
||||||
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.Protocol1_19_1To1_19;
|
|
||||||
import net.fabricmc.api.EnvType;
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
|
||||||
|
|
||||||
// This class modifies the 1.19.1 -> 1.19.0 transformers so that they simply pass through the original Minecraft key.
|
|
||||||
public class ProtocolPatcher1_19 {
|
|
||||||
public static boolean shouldPatchKeys = false;
|
|
||||||
|
|
||||||
public static void patchIfClient() {
|
|
||||||
if (FabricLoader.getInstance().getEnvironmentType() != EnvType.CLIENT) return;
|
|
||||||
|
|
||||||
Protocol1_19_1To1_19 protocol = Via.getManager().getProtocolManager().getProtocol(Protocol1_19_1To1_19.class);
|
|
||||||
if (protocol == null) throw new AssertionError();
|
|
||||||
|
|
||||||
protocol.registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
|
||||||
@Override
|
|
||||||
public void registerMap() {
|
|
||||||
this.map(Type.STRING);
|
|
||||||
this.map(Type.OPTIONAL_PROFILE_KEY);
|
|
||||||
this.read(Type.OPTIONAL_UUID);
|
|
||||||
}
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
protocol.registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO.getId(), ClientboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
|
||||||
@Override
|
|
||||||
public void registerMap() {
|
|
||||||
}
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
protocol.registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), new PacketRemapper() {
|
|
||||||
@Override
|
|
||||||
public void registerMap() {
|
|
||||||
}
|
|
||||||
}, true);
|
|
||||||
}
|
|
||||||
}
|
|
@ -50,8 +50,7 @@
|
|||||||
"mixins.viafabric119.address.json",
|
"mixins.viafabric119.address.json",
|
||||||
"mixins.viafabric119.gui.json",
|
"mixins.viafabric119.gui.json",
|
||||||
"mixins.viafabric119.debug.json",
|
"mixins.viafabric119.debug.json",
|
||||||
"mixins.viafabric119.pipeline.json",
|
"mixins.viafabric119.pipeline.json"
|
||||||
"mixins.viafabric119.signatures.json"
|
|
||||||
],
|
],
|
||||||
"custom": {
|
"custom": {
|
||||||
"modmenu": {
|
"modmenu": {
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"required": true,
|
|
||||||
"compatibilityLevel": "JAVA_16",
|
|
||||||
"package": "com.viaversion.fabric.mc119.mixin.signatures1_19",
|
|
||||||
"mixins": [
|
|
||||||
],
|
|
||||||
"client": [
|
|
||||||
"client.ArgumentSignatureDataMapMixin",
|
|
||||||
"client.PlayerPublicKeyChPublicKeyDataMixin",
|
|
||||||
"client.ClientPlayerEntityMixin",
|
|
||||||
"client.ProfileKeysMixin"
|
|
||||||
],
|
|
||||||
"injectors": {
|
|
||||||
"defaultRequire": 0
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user