From 87f34724bee1937a3ea846aa0d287e2aeaf9f3f7 Mon Sep 17 00:00:00 2001 From: Boy Date: Mon, 15 Jan 2024 22:08:24 +0100 Subject: [PATCH] fix: writeNbt CastException due to Tag being instance of StringTag --- .../com/mineinabyss/emojy/nms/v1_20_R3/EmojyNMSHandler.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/v1_20_R3/src/main/kotlin/com/mineinabyss/emojy/nms/v1_20_R3/EmojyNMSHandler.kt b/v1_20_R3/src/main/kotlin/com/mineinabyss/emojy/nms/v1_20_R3/EmojyNMSHandler.kt index fc1a091..aef36d0 100644 --- a/v1_20_R3/src/main/kotlin/com/mineinabyss/emojy/nms/v1_20_R3/EmojyNMSHandler.kt +++ b/v1_20_R3/src/main/kotlin/com/mineinabyss/emojy/nms/v1_20_R3/EmojyNMSHandler.kt @@ -168,7 +168,10 @@ class EmojyNMSHandler : IEmojyNMSHandler { override fun writeNbt(compound: Tag?): FriendlyByteBuf { return super.writeNbt(compound?.apply { - transform(this as CompoundTag, EmojyNMSHandlers.transformer()) + when (this) { + is CompoundTag -> transform(this, EmojyNMSHandlers.transformer()) + is StringTag -> transform(this, EmojyNMSHandlers.transformer()) + } }) }