Check both namespaced and implicit key when replacing registries

This commit is contained in:
Nassim Jahnke 2024-05-01 10:35:48 +02:00
parent ce0e01abec
commit e9db3f040f
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
5 changed files with 5 additions and 9 deletions

View File

@ -68,7 +68,7 @@ import java.util.logging.Logger;
public interface ViaBackwardsPlatform { public interface ViaBackwardsPlatform {
String MINIMUM_VV_VERSION = "4.10.0"; String MINIMUM_VV_VERSION = "4.10.1";
/** /**
* Initialize ViaBackwards. * Initialize ViaBackwards.

View File

@ -155,12 +155,7 @@ public final class EntityPackets1_19 extends EntityRewriter<ClientboundPackets1_
tracker(wrapper.user()).setBiomesSent(biomes.size()); tracker(wrapper.user()).setBiomesSent(biomes.size());
// Cache and remove chat types // Cache and remove chat types
CompoundTag chatTypeRegistry = (CompoundTag) registry.remove("minecraft:chat_type"); final ListTag<CompoundTag> chatTypes = TagUtil.removeRegistryEntries(registry, "chat_type");
if (chatTypeRegistry == null) {
chatTypeRegistry = (CompoundTag) registry.remove("chat_type");
}
final ListTag<CompoundTag> chatTypes = chatTypeRegistry.getListTag("value", CompoundTag.class);
for (final CompoundTag chatType : chatTypes) { for (final CompoundTag chatType : chatTypes) {
final NumberTag idTag = chatType.getNumberTag("id"); final NumberTag idTag = chatType.getNumberTag("id");
dimensionRegistryStorage.addChatType(idTag.asInt(), chatType); dimensionRegistryStorage.addChatType(idTag.asInt(), chatType);

View File

@ -81,6 +81,7 @@ public final class EntityPackets1_19_3 extends EntityRewriter<ClientboundPackets
handler(wrapper -> { handler(wrapper -> {
final ChatTypeStorage1_19_3 chatTypeStorage = wrapper.user().get(ChatTypeStorage1_19_3.class); final ChatTypeStorage1_19_3 chatTypeStorage = wrapper.user().get(ChatTypeStorage1_19_3.class);
chatTypeStorage.clear(); chatTypeStorage.clear();
final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0); final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
final ListTag<CompoundTag> chatTypes = TagUtil.getRegistryEntries(registry, "chat_type"); final ListTag<CompoundTag> chatTypes = TagUtil.getRegistryEntries(registry, "chat_type");
for (final CompoundTag chatType : chatTypes) { for (final CompoundTag chatType : chatTypes) {

View File

@ -103,7 +103,7 @@ public final class Protocol1_19To1_19_1 extends BackwardsProtocol<ClientboundPac
chatTypeStorage.clear(); chatTypeStorage.clear();
final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0); final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
final ListTag<CompoundTag> chatTypes = TagUtil.getRegistryEntries(registry, "chat_type"); final ListTag<CompoundTag> chatTypes = TagUtil.removeRegistryEntries(registry, "chat_type");
for (final CompoundTag chatType : chatTypes) { for (final CompoundTag chatType : chatTypes) {
final NumberTag idTag = chatType.getNumberTag("id"); final NumberTag idTag = chatType.getNumberTag("id");
chatTypeStorage.addChatType(idTag.asInt(), chatType); chatTypeStorage.addChatType(idTag.asInt(), chatType);

View File

@ -3,7 +3,7 @@ metadata.format.version = "1.1"
[versions] [versions]
# ViaVersion # ViaVersion
viaver = "4.10.0" viaver = "4.10.1-SNAPSHOT"
# Common provided # Common provided
netty = "4.0.20.Final" netty = "4.0.20.Final"