Skip to content

Commit d3f9ef9

Browse files
committed
修复1.21.4虚拟背包点击bug
1 parent c432a59 commit d3f9ef9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

module/bukkit/bukkit-ui/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ dependencies {
88
compileOnly(project(":platform:platform-bukkit-impl"))
99
compileOnly(project(":platform:platform-bukkit"))
1010
// 服务端
11+
compileOnly("ink.ptms.core:v12104:12104-minimize:mapped")
1112
compileOnly("ink.ptms.core:v11904:11904-minimize:mapped")
1213
compileOnly("ink.ptms.core:v11600:11600-minimize")
1314
compileOnly("ink.ptms.core:v11200:11200-minimize")

module/bukkit/bukkit-ui/src/main/kotlin/taboolib/module/ui/virtual/InventoryHandlerImpl.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff 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(NMSPacketPlayOutSetCarriedSlot(Craft19ItemStack.asNMSCopy(itemStack)))
222+
} else {
223+
sendSlotChange(-1, itemStack)
224+
}
221225
}
222226

223227
fun sendDataChange(slot: Int, state: Int) {
@@ -437,6 +441,8 @@ private typealias NMSPacketPlayOutOpenWindow = net.minecraft.network.protocol.ga
437441
private typealias NMSPacketPlayOutWindowItems = net.minecraft.network.protocol.game.PacketPlayOutWindowItems
438442

439443
private typealias NMSPacketPlayOutSetSlot = net.minecraft.network.protocol.game.PacketPlayOutSetSlot
444+
//
445+
private typealias NMSPacketPlayOutSetCarriedSlot = net.minecraft.network.protocol.game.ClientboundSetCursorItemPacket
440446

441447
private typealias NMSPacketPlayOutWindowData = net.minecraft.network.protocol.game.PacketPlayOutWindowData
442448

0 commit comments

Comments
 (0)