Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
feat: dump available commands pk
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Jan 20, 2024
1 parent 3833b9c commit 7a5d3b3
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <mc/nbt/CompoundTagVariant.h>
// Network
#include <mc/network/packet/CraftingDataPacket.h>
#include <mc/network/packet/AvailableCommandsPacket.h>
#include <mc/deps/core/utility/BinaryStream.h>


Expand Down Expand Up @@ -144,6 +145,25 @@ LL_AUTO_TYPE_INSTANCE_HOOK(
hookLogger.info("Create crafting_data_packet.bin success!");
}

//Cmd packet
LL_AUTO_TYPE_INSTANCE_HOOK(
AvailableCommandsPacketHook,
ll::memory::HookPriority::Normal,
AvailableCommandsPacket,
"?write@AvailableCommandsPacket@@UEBAXAEAVBinaryStream@@@Z",
void,
BinaryStream& stream
) {
origin(stream);
const std::string& data = stream.getAndReleaseData();
std::string datacopy = data;
stream.writeString(data, nullptr, nullptr);
auto out = std::ofstream("data/available_commands_packet.bin", std::ofstream::out | std::ofstream::binary | std::ofstream::trunc);
out << datacopy;
out.close();
hookLogger.info("Create available_commands_packet.bin success!");
}

namespace plugin {

void dumpCreativeItemData(ll::Logger& logger) {
Expand Down Expand Up @@ -726,7 +746,7 @@ void ext(ll::Logger& logger) {
createFolder(logger, "data");
}
dumpBiomeData(logger);
// dumpCommandArgData(logger);
//dumpCommandArgData(logger);
dumpCreativeItemData(logger);
dumpBlockAttributesData(logger);
dumpItemData(logger);
Expand Down

0 comments on commit 7a5d3b3

Please sign in to comment.