blob: fb01a2fb470d8199e85d61f952eea907507a1136 (
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
46
47
48
49
50
51
|
package moe.nea.firmament.apis.ingame
import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket
import net.minecraft.text.Text
import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.apis.ingame.packets.PartyInfoRequest
import moe.nea.firmament.apis.ingame.packets.PartyInfoResponse
import moe.nea.firmament.commands.thenExecute
import moe.nea.firmament.events.CommandEvent
import moe.nea.firmament.events.FirmamentCustomPayloadEvent
import moe.nea.firmament.events.subscription.SubscriptionOwner
import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.features.debug.DeveloperFeatures
import moe.nea.firmament.util.MC
object HypixelModAPI : SubscriptionOwner {
init {
InGameCodecWrapper.Direction.C2S.customCodec =
InGameCodecWrapper.createStealthyCodec(
PartyInfoRequest.intoType()
)
InGameCodecWrapper.Direction.S2C.customCodec =
InGameCodecWrapper.createStealthyCodec(
PartyInfoResponse.intoType()
)
}
@JvmStatic
fun sendRequest(packet: FirmamentCustomPayload) {
MC.networkHandler?.sendPacket(CustomPayloadC2SPacket(packet))
}
@Subscribe
fun testCommand(event: CommandEvent.SubCommand) {
event.subcommand("sendpartyrequest") {
thenExecute {
sendRequest(PartyInfoRequest(1))
}
}
}
@Subscribe
fun logEvents(event: FirmamentCustomPayloadEvent) {
MC.sendChat(Text.stringifiedTranslatable("firmament.modapi.event", event.toString()))
}
override val delegateFeature: FirmamentFeature
get() = DeveloperFeatures
}
|