From c9981fe9e2007be8b5d9b79f0ae611302d331413 Mon Sep 17 00:00:00 2001 From: IzzelAliz Date: Mon, 6 Dec 2021 15:18:56 +0800 Subject: [PATCH] Only wrap top level arguments (#392) --- .../commands/synchronization/ArgumentTypesMixin.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/commands/synchronization/ArgumentTypesMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/commands/synchronization/ArgumentTypesMixin.java index 8dbce190..de827365 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/commands/synchronization/ArgumentTypesMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/commands/synchronization/ArgumentTypesMixin.java @@ -46,6 +46,8 @@ public abstract class ArgumentTypesMixin { INTERNAL_TYPES.add(new ResourceLocation("forge", "modid")); } + private static boolean arclight$reentrant = false; + /** * @author IzzelAliz * @reason @@ -57,7 +59,12 @@ public abstract class ArgumentTypesMixin { LOGGER.error("Could not serialize {} ({}) - will not be sent to client!", type, type.getClass()); buffer.writeResourceLocation(new ResourceLocation("")); } else { - boolean wrap = SpigotConfig.bungee && !INTERNAL_TYPES.contains(entry.name); + boolean wrap; + if (!arclight$reentrant && SpigotConfig.bungee && !INTERNAL_TYPES.contains(entry.name)) { + arclight$reentrant = wrap = true; + } else { + wrap = false; + } if (wrap) { buffer.writeUtf("arclight:wrapped"); } @@ -67,6 +74,7 @@ public abstract class ArgumentTypesMixin { if (wrap) { buffer.writeVarInt(buf.writerIndex()); buffer.writeBytes(buf); + arclight$reentrant = false; } } }