3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-07-03 14:18:03 +02:00

1.20.3-pre1 (maybe)

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-11-20 19:09:05 +01:00
Ursprung 8f5683f764
Commit 0949ff4ba9
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
5 geänderte Dateien mit 64 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -23,6 +23,7 @@ import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.rewriter.BlockItemPacketRewriter1_20_3;
import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.rewriter.EntityPacketRewriter1_20_3;
import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.storage.ResourcepackIDStorage;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
@ -40,11 +41,13 @@ import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.Clientbou
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.Protocol1_20_3To1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundConfigurationPackets1_20_3;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3;
import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType;
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
import java.util.BitSet;
import java.util.UUID;
public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundPackets1_20_3, ClientboundPackets1_20_2, ServerboundPackets1_20_3, ServerboundPackets1_20_2> {
@ -228,9 +231,8 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
});
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.DISCONNECT.getId(), ClientboundConfigurationPackets1_20_2.DISCONNECT.getId(), this::convertComponent);
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.RESOURCE_PACK.getId(), ClientboundConfigurationPackets1_20_2.RESOURCE_PACK.getId(), resourcePackHandler());
registerClientbound(ClientboundPackets1_20_3.DISCONNECT, this::convertComponent);
registerClientbound(ClientboundPackets1_20_3.RESOURCE_PACK, resourcePackHandler());
registerClientbound(ClientboundPackets1_20_3.RESOURCE_PACK_PUSH, ClientboundPackets1_20_2.RESOURCE_PACK, resourcePackHandler());
registerClientbound(ClientboundPackets1_20_3.SERVER_DATA, this::convertComponent);
registerClientbound(ClientboundPackets1_20_3.ACTIONBAR, this::convertComponent);
registerClientbound(ClientboundPackets1_20_3.TITLE_TEXT, this::convertComponent);
@ -296,10 +298,29 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
}
}
});
cancelClientbound(ClientboundPackets1_20_3.RESOURCE_PACK_POP);
registerServerbound(ServerboundPackets1_20_2.RESOURCE_PACK_STATUS, wrapper -> {
final ResourcepackIDStorage storage = wrapper.user().get(ResourcepackIDStorage.class);
wrapper.write(Type.UUID, storage != null ? storage.uuid() : UUID.randomUUID());
});
cancelClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_POP.getId());
registerServerbound(State.CONFIGURATION, ServerboundConfigurationPackets1_20_2.RESOURCE_PACK, wrapper -> {
final ResourcepackIDStorage storage = wrapper.user().get(ResourcepackIDStorage.class);
wrapper.write(Type.UUID, storage != null ? storage.uuid() : UUID.randomUUID());
});
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_PUSH.getId(), ServerboundConfigurationPackets1_20_2.RESOURCE_PACK.getId(), resourcePackHandler());
// TODO Auto map via packet types provider
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.UPDATE_ENABLED_FEATURES.getId(), ClientboundConfigurationPackets1_20_2.UPDATE_ENABLED_FEATURES.getId());
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.UPDATE_TAGS.getId(), ClientboundConfigurationPackets1_20_2.UPDATE_TAGS.getId());
}
private PacketHandler resourcePackHandler() {
return wrapper -> {
final UUID uuid = wrapper.read(Type.UUID);
wrapper.user().put(new ResourcepackIDStorage(uuid));
wrapper.passthrough(Type.STRING); // Url
wrapper.passthrough(Type.STRING); // Hash
wrapper.passthrough(Type.BOOLEAN); // Required
@ -331,7 +352,7 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
@Override
protected ClientboundPacketType clientboundFinishConfigurationPacket() {
return ClientboundConfigurationPackets1_20_2.FINISH_CONFIGURATION;
return ClientboundConfigurationPackets1_20_3.FINISH_CONFIGURATION;
}
@Override

Datei anzeigen

@ -0,0 +1,38 @@
/*
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
* Copyright (C) 2023 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.storage;
import com.viaversion.viaversion.api.connection.StorableObject;
import java.util.UUID;
public final class ResourcepackIDStorage implements StorableObject {
private final UUID uuid;
public ResourcepackIDStorage(final UUID uuid) {
this.uuid = uuid;
}
public UUID uuid() {
return uuid;
}
@Override
public boolean clearOnServerSwitch() {
return false;
}
}

Datei anzeigen

@ -1,4 +1,4 @@
projectVersion=4.9.0-23w46a-SNAPSHOT
projectVersion=4.9.0-1.20.3-pre1-SNAPSHOT
# Smile emoji
mcVersions=1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10

Datei anzeigen

@ -3,7 +3,7 @@ metadata.format.version = "1.1"
[versions]
# ViaVersion
viaver = "4.9.0-23w46a-SNAPSHOT"
viaver = "4.9.0-1.20.3-pre1-SNAPSHOT"
# Common provided
netty = "4.0.20.Final"