diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java index c14ba1f21..ec312538a 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java @@ -387,6 +387,13 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter structuredData : data.data().values()) { dataConverter.writeToTag(connection, structuredData, tag); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/StructuredDataConverter.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/StructuredDataConverter.java index 3e0c2c3b0..27837639a 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/StructuredDataConverter.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/StructuredDataConverter.java @@ -234,14 +234,16 @@ public final class StructuredDataConverter { }); register(StructuredDataKey.FIREWORKS, (data, tag) -> { final CompoundTag fireworksTag = new CompoundTag(); - fireworksTag.putInt("Flight", data.flightDuration()); + fireworksTag.putByte("Flight", (byte) data.flightDuration()); tag.put("Fireworks", fireworksTag); - final ListTag explosionsTag = new ListTag<>(CompoundTag.class); - for (final FireworkExplosion explosion : data.explosions()) { - explosionsTag.add(convertExplosion(explosion)); + if (data.explosions().length > 0) { + final ListTag explosionsTag = new ListTag<>(CompoundTag.class); + for (final FireworkExplosion explosion : data.explosions()) { + explosionsTag.add(convertExplosion(explosion)); + } + fireworksTag.put("Explosions", explosionsTag); } - fireworksTag.put("Explosions", explosionsTag); }); register(StructuredDataKey.FIREWORK_EXPLOSION, (data, tag) -> tag.put("Explosion", convertExplosion(data))); register(StructuredDataKey.PROFILE, (data, tag) -> { @@ -871,6 +873,10 @@ public final class StructuredDataConverter { rewriters.put(key, c); } + public boolean backupInconvertibleData() { + return backupInconvertibleData; + } + @FunctionalInterface interface SimpleDataConverter {