Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-09-07 21:32:52 +02:00
Revert "Send registry data before finish configuration in 1.20.5->1.20.3 (#778)"
This reverts commit e93e30c235
.
Dieser Commit ist enthalten in:
Ursprung
7bd43e0234
Commit
bfbc086f44
@ -41,7 +41,6 @@ import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
|||||||
import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
|
import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
|
||||||
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
||||||
import com.viaversion.viaversion.protocols.v1_19_3to1_19_4.rewriter.CommandRewriter1_19_4;
|
import com.viaversion.viaversion.protocols.v1_19_3to1_19_4.rewriter.CommandRewriter1_19_4;
|
||||||
import com.viaversion.viaversion.protocols.v1_20to1_20_2.packet.ServerboundConfigurationPackets1_20_2;
|
|
||||||
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.packet.ClientboundConfigurationPackets1_20_3;
|
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.packet.ClientboundConfigurationPackets1_20_3;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.packet.ClientboundPacket1_20_3;
|
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.packet.ClientboundPacket1_20_3;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.packet.ClientboundPackets1_20_3;
|
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.packet.ClientboundPackets1_20_3;
|
||||||
@ -55,6 +54,7 @@ import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundCon
|
|||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPacket1_20_5;
|
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPacket1_20_5;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPackets1_20_5;
|
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundPackets1_20_5;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.storage.BannerPatternStorage;
|
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.storage.BannerPatternStorage;
|
||||||
|
import com.viaversion.viaversion.protocols.v1_20to1_20_2.packet.ServerboundConfigurationPackets1_20_2;
|
||||||
import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType;
|
import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType;
|
||||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||||
@ -78,16 +78,17 @@ public final class Protocol1_20_5To1_20_3 extends BackwardsProtocol<ClientboundP
|
|||||||
super.registerPackets();
|
super.registerPackets();
|
||||||
|
|
||||||
tagRewriter.registerGeneric(ClientboundPackets1_20_5.UPDATE_TAGS);
|
tagRewriter.registerGeneric(ClientboundPackets1_20_5.UPDATE_TAGS);
|
||||||
tagRewriter.registerGeneric(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS);
|
registerClientbound(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS, wrapper -> {
|
||||||
|
// Send off registry data first, needed for tags
|
||||||
registerClientbound(ClientboundPackets1_20_5.START_CONFIGURATION, wrapper -> wrapper.user().get(RegistryDataStorage.class).clear());
|
sendRegistryData(wrapper.user());
|
||||||
|
tagRewriter.getGenericHandler().handle(wrapper);
|
||||||
|
});
|
||||||
|
|
||||||
registerClientbound(ClientboundConfigurationPackets1_20_5.FINISH_CONFIGURATION, wrapper -> {
|
registerClientbound(ClientboundConfigurationPackets1_20_5.FINISH_CONFIGURATION, wrapper -> {
|
||||||
// Send off registry data first
|
// In case the server for some reason does not send tags
|
||||||
final PacketWrapper registryDataPacket = wrapper.create(ClientboundConfigurationPackets1_20_3.REGISTRY_DATA);
|
sendRegistryData(wrapper.user());
|
||||||
registryDataPacket.write(Types.COMPOUND_TAG, wrapper.user().get(RegistryDataStorage.class).registryData().copy());
|
|
||||||
registryDataPacket.send(Protocol1_20_5To1_20_3.class);
|
|
||||||
});
|
});
|
||||||
|
registerClientbound(ClientboundPackets1_20_5.START_CONFIGURATION, wrapper -> wrapper.user().get(RegistryDataStorage.class).clear());
|
||||||
|
|
||||||
final SoundRewriter<ClientboundPacket1_20_5> soundRewriter = new SoundRewriter<>(this);
|
final SoundRewriter<ClientboundPacket1_20_5> soundRewriter = new SoundRewriter<>(this);
|
||||||
soundRewriter.registerSound1_19_3(ClientboundPackets1_20_5.SOUND);
|
soundRewriter.registerSound1_19_3(ClientboundPackets1_20_5.SOUND);
|
||||||
@ -182,6 +183,16 @@ public final class Protocol1_20_5To1_20_3 extends BackwardsProtocol<ClientboundP
|
|||||||
cancelClientbound(ClientboundPackets1_20_5.DEBUG_SAMPLE);
|
cancelClientbound(ClientboundPackets1_20_5.DEBUG_SAMPLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendRegistryData(final UserConnection connection) {
|
||||||
|
final RegistryDataStorage registryDataStorage = connection.get(RegistryDataStorage.class);
|
||||||
|
if (!registryDataStorage.sentRegistryData()) {
|
||||||
|
final PacketWrapper registryDataPacket = PacketWrapper.create(ClientboundConfigurationPackets1_20_3.REGISTRY_DATA, connection);
|
||||||
|
registryDataPacket.write(Types.COMPOUND_TAG, registryDataStorage.registryData().copy());
|
||||||
|
registryDataPacket.send(Protocol1_20_5To1_20_3.class);
|
||||||
|
registryDataStorage.setSentRegistryData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void handleStoreCookie(final PacketWrapper wrapper) {
|
private void handleStoreCookie(final PacketWrapper wrapper) {
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
|
|
||||||
|
@ -17,19 +17,28 @@
|
|||||||
*/
|
*/
|
||||||
package com.viaversion.viabackwards.protocol.v1_20_5to1_20_3.storage;
|
package com.viaversion.viabackwards.protocol.v1_20_5to1_20_3.storage;
|
||||||
|
|
||||||
import com.viaversion.viaversion.api.connection.StorableObject;
|
|
||||||
import com.viaversion.nbt.tag.CompoundTag;
|
import com.viaversion.nbt.tag.CompoundTag;
|
||||||
|
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
public final class RegistryDataStorage implements StorableObject {
|
public final class RegistryDataStorage implements StorableObject {
|
||||||
|
|
||||||
private final CompoundTag registryData = new CompoundTag();
|
private final CompoundTag registryData = new CompoundTag();
|
||||||
private String[] dimensionKeys;
|
private String[] dimensionKeys;
|
||||||
|
private boolean sentRegistryData;
|
||||||
|
|
||||||
public CompoundTag registryData() {
|
public CompoundTag registryData() {
|
||||||
return registryData;
|
return registryData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean sentRegistryData() {
|
||||||
|
return sentRegistryData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSentRegistryData() {
|
||||||
|
this.sentRegistryData = true;
|
||||||
|
}
|
||||||
|
|
||||||
public String @Nullable [] dimensionKeys() {
|
public String @Nullable [] dimensionKeys() {
|
||||||
return dimensionKeys;
|
return dimensionKeys;
|
||||||
}
|
}
|
||||||
@ -41,5 +50,6 @@ public final class RegistryDataStorage implements StorableObject {
|
|||||||
public void clear() {
|
public void clear() {
|
||||||
registryData.clear();
|
registryData.clear();
|
||||||
dimensionKeys = null;
|
dimensionKeys = null;
|
||||||
|
sentRegistryData = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren