Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-24 15:20:19 +01:00
Handle tags packet
Dieser Commit ist enthalten in:
Ursprung
8a2c18863c
Commit
255536e9d0
@ -46,6 +46,7 @@ import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.Clientb
|
||||
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 com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
import java.util.BitSet;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -64,6 +65,9 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
|
||||
protected void registerPackets() {
|
||||
super.registerPackets();
|
||||
|
||||
final TagRewriter<ClientboundPackets1_20_3> tagRewriter = new TagRewriter<>(this);
|
||||
tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS);
|
||||
|
||||
final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND);
|
||||
soundRewriter.registerEntitySound(ClientboundPackets1_20_3.ENTITY_SOUND);
|
||||
@ -305,24 +309,15 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
|
||||
cancelClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_POP.getId());
|
||||
registerServerbound(State.CONFIGURATION, ServerboundConfigurationPackets1_20_2.RESOURCE_PACK, resourcePackStatusHandler());
|
||||
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.RESOURCE_PACK_PUSH.getId(), ServerboundConfigurationPackets1_20_2.RESOURCE_PACK.getId(), resourcePackHandler());
|
||||
registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.UPDATE_TAGS.getId(), ClientboundConfigurationPackets1_20_2.UPDATE_TAGS.getId(), tagRewriter.getGenericHandler());
|
||||
// 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 resourcePackStatusHandler() {
|
||||
return wrapper -> {
|
||||
final ResourcepackIDStorage storage = wrapper.user().get(ResourcepackIDStorage.class);
|
||||
wrapper.write(Type.UUID, storage != null ? storage.uuid() : UUID.randomUUID());
|
||||
|
||||
final int action = wrapper.read(Type.VAR_INT);
|
||||
if (action == 4) { // Downloaded
|
||||
wrapper.cancel();
|
||||
} else if (action > 4) { // Invalid url, failed reload, and discarded
|
||||
wrapper.write(Type.VAR_INT, 2); // Failed download
|
||||
} else {
|
||||
wrapper.write(Type.VAR_INT, action);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,9 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_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;
|
||||
@ -43,7 +43,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
// Protocol1_20_3To1_20_2 (the ViaVersion protocol class the mappings depend on)
|
||||
// ClientboundPackets1_20_3
|
||||
// ServerboundPackets1_20_3
|
||||
// ClientboundConfigurationPackets1_20_2
|
||||
// ClientboundConfigurationPackets1_20_3
|
||||
// ServerboundConfigurationPackets1_20_2
|
||||
// EntityTypes1_19_4 (UNMAPPED type)
|
||||
// 1.99, 1.98
|
||||
@ -114,7 +114,7 @@ public final class Protocol1_98To_99 extends BackwardsProtocol<ClientboundPacket
|
||||
|
||||
@Override
|
||||
protected ClientboundPacketType clientboundFinishConfigurationPacket() {
|
||||
return ClientboundConfigurationPackets1_20_2.FINISH_CONFIGURATION;
|
||||
return ClientboundConfigurationPackets1_20_3.FINISH_CONFIGURATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_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;
|
||||
|
||||
// Replace if needed
|
||||
@ -43,7 +43,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
||||
registerMetadataRewriter(ClientboundPackets1_20_3.ENTITY_METADATA, /*Types1_OLD.METADATA_LIST, */Types1_20_3.METADATA_LIST); // Specify old and new metadata list if changed
|
||||
registerRemoveEntities(ClientboundPackets1_20_3.REMOVE_ENTITIES);
|
||||
|
||||
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.REGISTRY_DATA, new PacketHandlers() {
|
||||
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_3.REGISTRY_DATA, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
map(Type.COMPOUND_TAG); // Registry data
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren