File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed
src/main/kotlin/taboolib/module/ui/virtual
bukkit-util/src/main/kotlin/taboolib/platform/util Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ dependencies {
1212 compileOnly(" ink.ptms.core:v11600:11600-minimize" )
1313 compileOnly(" ink.ptms.core:v11200:11200-minimize" )
1414 compileOnly(" ink.ptms.core:v10900:10900" )
15+ // 降低依赖权重 避免编译报错
16+ compileOnly(" ink.ptms.core:v12104:12104-minimize:mapped" )
1517 // 版本实现
1618 compileOnly(project(" :module:bukkit:bukkit-ui:bukkit-ui-12100" ))
1719 compileOnly(project(" :module:bukkit:bukkit-ui:bukkit-ui-legacy" ))
Original file line number Diff line number Diff line change @@ -217,7 +217,11 @@ class InventoryHandlerImpl : InventoryHandler() {
217217 }
218218
219219 override fun sendCarriedChange (itemStack : ItemStack ) {
220- sendSlotChange(- 1 , itemStack)
220+ if (MinecraftVersion .versionId >= 12104 ) {
221+ viewer.sendPacket(NMSPacketPlayOutSetCursorItem (Craft19ItemStack .asNMSCopy(itemStack)))
222+ } else {
223+ sendSlotChange(- 1 , itemStack)
224+ }
221225 }
222226
223227 fun sendDataChange (slot : Int , state : Int ) {
@@ -438,6 +442,8 @@ private typealias NMSPacketPlayOutWindowItems = net.minecraft.network.protocol.g
438442
439443private typealias NMSPacketPlayOutSetSlot = net.minecraft.network.protocol.game.PacketPlayOutSetSlot
440444
445+ private typealias NMSPacketPlayOutSetCursorItem = net.minecraft.network.protocol.game.ClientboundSetCursorItemPacket
446+
441447private typealias NMSPacketPlayOutWindowData = net.minecraft.network.protocol.game.PacketPlayOutWindowData
442448
443449private typealias NMSPacketPlayOutCloseWindow = net.minecraft.network.protocol.game.PacketPlayOutCloseWindow
Original file line number Diff line number Diff line change @@ -304,12 +304,12 @@ open class ItemBuilder {
304304 // Tooltip Style
305305 try {
306306 itemMeta.tooltipStyle = tooltipStyle
307- } catch (_: NoSuchMethodException ) {
307+ } catch (_: NoSuchMethodError ) {
308308 }
309309 // ItemModel
310310 try {
311311 itemMeta.itemModel = itemModel
312- } catch (_: NoSuchMethodException ) {
312+ } catch (_: NoSuchMethodError ) {
313313 }
314314 // 唯一化
315315 try {
@@ -413,17 +413,17 @@ open class ItemBuilder {
413413 } else {
414414 modelData?.getProperty<Any >(" handle" )?.getProperty<List <Float >>(" floats" )?.firstOrNull()?.cint ? : - 1
415415 }
416- } catch (ignored: NoSuchFieldException ) {
416+ } catch (ignored: NoSuchMethodError ) {
417417 }
418418 // Tooltip Style
419419 try {
420420 tooltipStyle = itemMeta.tooltipStyle
421- } catch (ignored: NoSuchFieldException ) {
421+ } catch (ignored: NoSuchMethodError ) {
422422 }
423423 // ItemModel
424424 try {
425425 itemModel = itemMeta.itemModel
426- } catch (ignored: NoSuchFieldException ) {
426+ } catch (ignored: NoSuchMethodError ) {
427427 }
428428 }
429429}
You can’t perform that action at this time.
0 commit comments