Only wrap top level arguments (#392)

This commit is contained in:
IzzelAliz 2021-12-06 15:18:56 +08:00
parent 5140aaf4eb
commit c9981fe9e2
No known key found for this signature in database
GPG Key ID: EE50E123A11D8338

View File

@ -46,6 +46,8 @@ public abstract class ArgumentTypesMixin {
INTERNAL_TYPES.add(new ResourceLocation("forge", "modid")); INTERNAL_TYPES.add(new ResourceLocation("forge", "modid"));
} }
private static boolean arclight$reentrant = false;
/** /**
* @author IzzelAliz * @author IzzelAliz
* @reason * @reason
@ -57,7 +59,12 @@ public abstract class ArgumentTypesMixin {
LOGGER.error("Could not serialize {} ({}) - will not be sent to client!", type, type.getClass()); LOGGER.error("Could not serialize {} ({}) - will not be sent to client!", type, type.getClass());
buffer.writeResourceLocation(new ResourceLocation("")); buffer.writeResourceLocation(new ResourceLocation(""));
} else { } 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) { if (wrap) {
buffer.writeUtf("arclight:wrapped"); buffer.writeUtf("arclight:wrapped");
} }
@ -67,6 +74,7 @@ public abstract class ArgumentTypesMixin {
if (wrap) { if (wrap) {
buffer.writeVarInt(buf.writerIndex()); buffer.writeVarInt(buf.writerIndex());
buffer.writeBytes(buf); buffer.writeBytes(buf);
arclight$reentrant = false;
} }
} }
} }