Use SerializerVersion#toTag when converting 1.20.5->1.20.3 block predicates (#4024)

This commit is contained in:
EnZaXD 2024-07-19 10:54:40 +02:00 committed by GitHub
parent cc87c02020
commit 275b09bdbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,7 +17,6 @@
*/ */
package com.viaversion.viaversion.protocols.v1_20_3to1_20_5.rewriter; package com.viaversion.viaversion.protocols.v1_20_3to1_20_5.rewriter;
import com.viaversion.nbt.stringified.SNBT;
import com.viaversion.nbt.tag.ByteTag; import com.viaversion.nbt.tag.ByteTag;
import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.CompoundTag;
import com.viaversion.nbt.tag.IntArrayTag; import com.viaversion.nbt.tag.IntArrayTag;
@ -859,7 +858,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
CompoundTag tag = null; CompoundTag tag = null;
if (tagStartIndex != -1 && tagEndIndex != -1) { if (tagStartIndex != -1 && tagEndIndex != -1) {
try { try {
tag = SNBT.deserializeCompoundTag(rawPredicate.substring(tagStartIndex, tagEndIndex + 1)); tag = (CompoundTag) SerializerVersion.V1_20_3.toTag(rawPredicate.substring(tagStartIndex, tagEndIndex + 1));
} catch (final Exception e) { } catch (final Exception e) {
if (Via.getManager().isDebug()) { if (Via.getManager().isDebug()) {
Protocol1_20_3To1_20_5.LOGGER.log(Level.SEVERE, "Failed to parse block predicate tag: " + rawPredicate.substring(tagStartIndex, tagEndIndex + 1), e); Protocol1_20_3To1_20_5.LOGGER.log(Level.SEVERE, "Failed to parse block predicate tag: " + rawPredicate.substring(tagStartIndex, tagEndIndex + 1), e);