From 27af372f7928159e16a8c07d941b8967575541f1 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 18 Jan 2024 20:46:25 +0100 Subject: [PATCH] Block entity tags are no longer nullable --- .../rewriter/BlockItemPacketRewriter1_20_5.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java index 3e548a634..2e1326a83 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java @@ -17,6 +17,7 @@ */ package com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.rewriter; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.api.data.ParticleMappings; import com.viaversion.viaversion.api.minecraft.Particle; import com.viaversion.viaversion.api.minecraft.item.Item; @@ -45,7 +46,14 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter { + wrapper.passthrough(Type.POSITION1_14); // Position + wrapper.passthrough(Type.VAR_INT); // Block entity type + + // No longern nullable + final CompoundTag tag = wrapper.read(Type.COMPOUND_TAG); + wrapper.write(Type.COMPOUND_TAG, tag != null ? tag : new CompoundTag()); + }); registerSetCooldown(ClientboundPackets1_20_3.COOLDOWN); registerWindowItems1_17_1(ClientboundPackets1_20_3.WINDOW_ITEMS);