Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- struct CompoundTag {
- };
- struct Block {
- char filler[24];
- CompoundTag tag;
- };
- struct BlockLegacy {
- Block *getStateFromLegacyData(unsigned short) const;
- };
- struct BlockPalette {
- BlockLegacy *getBlockLegacy(std::string const &) const;
- };
- struct Level {
- BlockPalette *getBlockPalette() const;
- };
- struct Minecraft {
- Level *getLevel() const;
- };
- struct ServerInstance {
- Minecraft *getMinecraft();
- };
- struct ReadOnlyBinaryStream {
- void *vt;
- unsigned long offset;
- std::string unk2;
- std::string *buffer;
- };
- struct BinaryStream : ReadOnlyBinaryStream {
- char filler[8];
- std::string unk11;
- template<typename T>
- void writeType(T const &);
- };
- void hexdump(void *ptr, int len, int offset) {
- auto *buf = (unsigned char *) ptr + offset;
- int i, j;
- for (i = 0; i < len; i += 16) {
- printf("%06x: ", i);
- for (j = 0; j < 16; j++)
- if (i + j < len)
- printf("%02x ", buf[i + j]);
- else
- printf(" ");
- printf(" ");
- for (j = 0; j < 16; j++)
- if (i + j < len)
- printf("%c", isprint(buf[i + j]) ? buf[i + j] : '.');
- printf("\n");
- }
- printf("\n");
- }
- extern "C" void *_ZN12BinaryStreamC2Ev(BinaryStream *);
- extern "C" void modloader_on_server_start(ServerInstance *serverInstance) {
- auto palette = serverInstance->getMinecraft()->getLevel()->getBlockPalette();
- auto blockLegacy = palette->getBlockLegacy("minecraft:stone");
- auto block = blockLegacy->getStateFromLegacyData(1);
- auto stream = (BinaryStream *) malloc(sizeof(void *));
- _ZN12BinaryStreamC2Ev(stream);
- printf("%ld\n", sizeof(BinaryStream));
- stream->writeType(block->tag);
- auto buffer = *stream->buffer;
- hexdump((void *) buffer.c_str(), buffer.length(), 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement