mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 01:55:47 +01:00
parent
23ba848a69
commit
3b9ac89d73
@ -151,6 +151,8 @@ public final class Protocol1_20_2To1_20 extends AbstractProtocol<ClientboundPack
|
||||
configurationState.setClientInformation(clientInformation);
|
||||
wrapper.cancel();
|
||||
});
|
||||
|
||||
// If these are not queued, they may be received before the server switched its listener state to play
|
||||
registerServerbound(State.CONFIGURATION, ServerboundConfigurationPackets1_20_2.CUSTOM_PAYLOAD.getId(), -1, queueServerboundPacket(ServerboundPackets1_20_2.PLUGIN_MESSAGE));
|
||||
registerServerbound(State.CONFIGURATION, ServerboundConfigurationPackets1_20_2.KEEP_ALIVE.getId(), -1, queueServerboundPacket(ServerboundPackets1_20_2.KEEP_ALIVE));
|
||||
registerServerbound(State.CONFIGURATION, ServerboundConfigurationPackets1_20_2.PONG.getId(), -1, queueServerboundPacket(ServerboundPackets1_20_2.PONG));
|
||||
|
@ -66,6 +66,7 @@ import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.Entit
|
||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.BitSet;
|
||||
import java.util.HashSet;
|
||||
@ -352,16 +353,19 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
|
||||
|
||||
private PacketHandler resourcePackHandler(final ClientboundPacketType popType) {
|
||||
return wrapper -> {
|
||||
wrapper.write(Type.UUID, UUID.randomUUID());
|
||||
wrapper.passthrough(Type.STRING); // Url
|
||||
wrapper.passthrough(Type.STRING); // Hash
|
||||
wrapper.passthrough(Type.BOOLEAN); // Required
|
||||
convertOptionalComponent(wrapper);
|
||||
|
||||
// Drop old resource packs first
|
||||
final PacketWrapper dropPacksPacket = wrapper.create(popType);
|
||||
dropPacksPacket.write(Type.OPTIONAL_UUID, null);
|
||||
dropPacksPacket.send(Protocol1_20_3To1_20_2.class);
|
||||
|
||||
// Use the hash to write a pack uuid
|
||||
final String url = wrapper.read(Type.STRING);
|
||||
final String hash = wrapper.read(Type.STRING);
|
||||
wrapper.write(Type.UUID, UUID.nameUUIDFromBytes(hash.getBytes(StandardCharsets.UTF_8)));
|
||||
wrapper.write(Type.STRING, url);
|
||||
wrapper.write(Type.STRING, hash);
|
||||
wrapper.passthrough(Type.BOOLEAN); // Required
|
||||
convertOptionalComponent(wrapper);
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user