Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class NMSItemTag12005 : NMSItemTag() {
}

// 不支持的类型
else -> ItemComponent.instance.getTagData(nbtTag) ?: error("Unsupported type: ${nbtTag::class.java}}")
else -> error("Unsupported type: ${nbtTag::class.java}}")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class NMSItemTag12105 : NMSItemTag() {
override fun getItemTag(itemStack: ItemStack, onlyCustom: Boolean): ItemTag {
val nmsItem = getNMSCopy(itemStack)
return if (onlyCustom) {
val a = any.filter { nmsItem.get(it) != null }.map { it.toString() to itemTagToBukkitCopy(nmsItem.get(it)!!, true) }
ItemTag(a.associate { it.first to it.second })
val tag = nmsItem.get(DataComponents.CUSTOM_DATA)?.copyTag()
if (tag != null) itemTagToBukkitCopy(tag).asCompound() else ItemTag()
} else {
val tag = nmsItem.save(CraftRegistry.getMinecraftRegistry())
if (tag != null) itemTagToBukkitCopy(tag, true).asCompound() else ItemTag12105() // 返回一个特殊的 ItemTag
Expand Down Expand Up @@ -217,7 +217,7 @@ class NMSItemTag12105 : NMSItemTag() {
is Boolean -> ItemTagData(nbtTag)

// 不支持的类型
else -> ItemComponent.instance.getTagData(nbtTag) ?: error("Unsupported type: ${nbtTag::class.java}}")
else -> error("Unsupported type: ${nbtTag::class.java}}")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ class NMSItemTag12106 : NMSItemTag() {
override fun getItemTag(itemStack: ItemStack, onlyCustom: Boolean): ItemTag {
val nmsItem = getNMSCopy(itemStack)
return if (onlyCustom) {
val filter = components.filter { nmsItem.get(it) != null }.map { it.toString() to itemTagToBukkitCopy(nmsItem.get(it)!!, true) }
ItemTag(filter.associate { it.first to it.second })
val tag = nmsItem.get(DataComponents.CUSTOM_DATA)?.copyTag()
if (tag != null) itemTagToBukkitCopy(tag).asCompound() else ItemTag()
} else {
val tag = nmsItem.toNbt()
if (tag != null) itemTagToBukkitCopy(tag).asCompound() else ItemTag12106() // 返回一个特殊的 ItemTag
if (tag != null) itemTagToBukkitCopy(tag, true).asCompound() else ItemTag12106() // 返回一个特殊的 ItemTag
}
}

Expand Down Expand Up @@ -220,7 +220,7 @@ class NMSItemTag12106 : NMSItemTag() {
is Boolean -> ItemTagData(nbtTag)

// 不支持的类型
else -> ItemComponent.instance.getTagData(nbtTag) ?: error("Unsupported type: ${nbtTag::class.java}")
else -> error("Unsupported type: ${nbtTag::class.java}")
}
}

Expand Down
Loading