blob: 1970f5c4cc0e92422f8483722d4f4d90c2982ae8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package com.walkerselby.wheelchair.client
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps
import net.fabricmc.api.ClientModInitializer
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback
import net.minecraft.item.ItemStack
import net.minecraft.item.Items
import net.minecraft.network.packet.c2s.play.ClickSlotC2SPacket
import net.minecraft.screen.slot.SlotActionType
import net.minecraft.text.Text
class Wheelchair : ClientModInitializer {
override fun onInitializeClient() {
ClientCommandRegistrationCallback.EVENT.register(ClientCommandRegistrationCallback { dispatcher, registryAccess ->
dispatcher.register(
literal("wheelchair")
.then(
literal("packet")
.executes {
val packet = ClickSlotC2SPacket(
0,
1,
2,
3,
SlotActionType.SWAP,
ItemStack(Items.IRON_HOE),
Int2ObjectMaps.emptyMap()
)
try {
it.source.sendFeedback(Formatter.prettyPrintPacket(packet))
} catch (e: Exception) {
e.printStackTrace()
it.source.sendFeedback(Text.literal("Excepted"))
}
return@executes 0
}
)
)
})
}
}
|