|
48 | 48 | #include "mc/network/NetEventCallback.h" |
49 | 49 | #include "mc/network/ServerNetworkHandler.h" |
50 | 50 | #include "mc/network/packet/BossEventPacket.h" |
| 51 | +#include "mc/network/packet/ClientboundCloseFormPacket.h" |
51 | 52 | #include "mc/network/packet/LevelChunkPacket.h" |
52 | | -#include "mc/network/packet/ModalFormRequestPacket.h" |
53 | 53 | #include "mc/network/packet/RemoveObjectivePacket.h" |
54 | 54 | #include "mc/network/packet/ScorePacketInfo.h" |
55 | 55 | #include "mc/network/packet/SetDisplayObjectivePacket.h" |
@@ -260,6 +260,7 @@ ClassDefine<PlayerClass> PlayerClassBuilder = |
260 | 260 | .instanceFunction("sendModalForm", &PlayerClass::sendModalForm) |
261 | 261 | .instanceFunction("sendCustomForm", &PlayerClass::sendCustomForm) |
262 | 262 | .instanceFunction("sendForm", &PlayerClass::sendForm) |
| 263 | + .instanceFunction("closeForm", &PlayerClass::closeForm) |
263 | 264 | .instanceFunction("sendPacket", &PlayerClass::sendPacket) |
264 | 265 |
|
265 | 266 | .instanceFunction("setExtraData", &PlayerClass::setExtraData) |
@@ -2609,6 +2610,17 @@ Local<Value> PlayerClass::sendForm(const Arguments& args) { |
2609 | 2610 | CATCH("Fail in sendForm!"); |
2610 | 2611 | } |
2611 | 2612 |
|
| 2613 | +Local<Value> PlayerClass::closeForm(const Arguments&) { |
| 2614 | + try { |
| 2615 | + Player* player = get(); |
| 2616 | + if (!player) return Local<Value>(); |
| 2617 | + |
| 2618 | + ClientboundCloseFormPacket().sendTo(*player); |
| 2619 | + return Boolean::newBoolean(true); |
| 2620 | + } |
| 2621 | + CATCH("Fail in sendForm!"); |
| 2622 | +} |
| 2623 | + |
2612 | 2624 | Local<Value> PlayerClass::sendPacket(const Arguments& args) { |
2613 | 2625 | CHECK_ARGS_COUNT(args, 1); |
2614 | 2626 | CHECK_ARG_TYPE(args[0], ValueKind::kObject); |
|
0 commit comments