Skip to content
This repository was archived by the owner on Dec 26, 2021. It is now read-only.

Commit 70a2bbe

Browse files
committed
fix nbt
1 parent f78573d commit 70a2bbe

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

SDK/CBlockLegacy.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ C_Block* C_BlockSource::getBlock(const vec3_ti& block) {
99
}
1010
C_BlockActor* C_BlockSource::getBlockEntity(const vec3_ti& block) {
1111
using getBlockEntity_t = C_BlockActor*(__fastcall*)(C_BlockSource*, const vec3_ti&);
12-
static getBlockEntity_t getBlockEntity = reinterpret_cast<getBlockEntity_t>(FindSignature("40 53 48 83 EC ?? 8B 02 48 8B DA C1 F8 ?? 89 44 24 ?? 8B 42 ?? 48 8D 54 24 ? C1 F8 04 89 44 24 ?? E8 ? ? ? ? 48 85 C0 74 31"));
12+
static getBlockEntity_t getBlockEntity = reinterpret_cast<getBlockEntity_t>(FindSignature("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 8B 02 48 8B DA C1 F8 ? 48 8B F1 89 44 24 ? 8B 42"));
1313
return getBlockEntity(this, block);
1414
}
1515
C_Block* C_BlockSource::getLiquidBlock(const vec3_ti& block) {

SDK/Tag.cpp

+11-19
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Int64Tag::Int64Tag(__int64 value) {
1212
static uintptr_t** Int64TagVtable = 0x0;
1313
if (Int64TagVtable == 0x0) {
14-
uintptr_t sigOffset = FindSignature("48 8D 05 ? ? ? ? 49 89 00 48 8B 41 ?? 49 89 40 ?? 48 8B 02 C6 40 ? ? C3");
14+
uintptr_t sigOffset = FindSignature("48 8D 05 ? ? ? ? 48 89 47 40 48 89 77 48 C6 47 68 04 48 8B CD E8 ? ? ? ?");
1515
int offset = *reinterpret_cast<int*>(sigOffset + 3);
1616
Int64TagVtable = reinterpret_cast<uintptr_t**>(sigOffset + offset + /*length of instruction*/ 7);
1717
if (Int64TagVtable == 0x0 || sigOffset == 0x0)
@@ -39,7 +39,7 @@ void Int64Tag::read(std::string& string) //throws MojangsonParseException
3939
IntTag::IntTag(int value) {
4040
static uintptr_t** IntTagVtable = 0x0;
4141
if (IntTagVtable == 0x0) {
42-
uintptr_t sigOffset = FindSignature("48 8D 05 ? ? ? ? 49 89 00 8B 41 ?? 41 89 40 ?? 48 8B 02 C6 40 ?? ?? C3");
42+
uintptr_t sigOffset = FindSignature("48 8D 15 ? ? ? ? 48 89 10 89 48 08 48 89 03 48 8B C3 48 8B 5C 24 ?");
4343
int offset = *reinterpret_cast<int*>(sigOffset + 3);
4444
IntTagVtable = reinterpret_cast<uintptr_t**>(sigOffset + offset + /*length of instruction*/ 7);
4545
if (IntTagVtable == 0x0 || sigOffset == 0x0)
@@ -61,7 +61,7 @@ void IntTag::read(std::string& string) //throws MojangsonParseException
6161
StringTag::StringTag(std::string value) {
6262
static uintptr_t** StringTagVtable = 0x0;
6363
if (StringTagVtable == 0x0) {
64-
uintptr_t sigOffset = FindSignature("4C 8D 05 ? ? ? ? 4C 89 00 45 33 C0 4C 89 40 ?? 4C 89 40 ?? 0F 10 41 ?? 0F 11 40 ?? 0F 10 49 ?? 0F 11 48");
64+
uintptr_t sigOffset = FindSignature("48 8D 05 ? ? ? ? 48 89 03 0F 10 44 24 ? 0F 11 43 ? 0F 10 4C 24 ? 0F 11 4B");
6565
int offset = *reinterpret_cast<int*>(sigOffset + 3);
6666
StringTagVtable = reinterpret_cast<uintptr_t**>(sigOffset + offset + /*length of instruction*/ 7);
6767
if (StringTagVtable == 0x0 || sigOffset == 0x0)
@@ -75,7 +75,7 @@ StringTag::StringTag(std::string value) {
7575
ShortTag::ShortTag(short value) {
7676
static uintptr_t** ShortTagVtable = 0x0;
7777
if (ShortTagVtable == 0x0) {
78-
uintptr_t sigOffset = FindSignature("48 8D 05 ? ? ? ? 49 89 00 0F B7 41 ?? 66 41 89 40 ? 48 8B 02 C6 40 ? ? C3");
78+
uintptr_t sigOffset = FindSignature("48 8D 15 ? ? ? ? 48 89 10 66 89 48 ? 48 89 03 48 8B C3 48 8B 5C 24 ?");
7979
int offset = *reinterpret_cast<int*>(sigOffset + 3);
8080
ShortTagVtable = reinterpret_cast<uintptr_t**>(sigOffset + offset + /*length of instruction*/ 7);
8181
if (ShortTagVtable == 0x0 || sigOffset == 0x0)
@@ -103,7 +103,7 @@ void ShortTag::read(std::string& string) //throws MojangsonParseException
103103
FloatTag::FloatTag(float value) {
104104
static uintptr_t** FloatTagVtable = 0x0;
105105
if (FloatTagVtable == 0x0) {
106-
uintptr_t sigOffset = FindSignature("48 8D 05 ? ? ? ? 48 89 07 F3 0F 11 77 ? C6 47 ? ? 48 8B CE E8 ? ? ? ? 48 8D 47 ? 48 8B 4C 24 ? 48 33 CC");
106+
uintptr_t sigOffset = FindSignature("48 8D 05 ? ? ? ? 48 89 06 8B 47 08 89 46 08 48 8B 03 C6 40 28 05");
107107
int offset = *reinterpret_cast<int*>(sigOffset + 3);
108108
FloatTagVtable = reinterpret_cast<uintptr_t**>(sigOffset + offset + /*length of instruction*/ 7);
109109
if (FloatTagVtable == 0x0 || sigOffset == 0x0)
@@ -131,7 +131,7 @@ void FloatTag::read(std::string& string) // MojangsonParseException
131131
DoubleTag::DoubleTag(double value) {
132132
static uintptr_t** DoubleTagVtable = 0x0;
133133
if (DoubleTagVtable == 0x0) {
134-
uintptr_t sigOffset = FindSignature("48 8D 05 ? ? ? ? 49 89 00 48 8B 41 08 49 89 40 08 48 8B 02 C6 40 28 06 C3");
134+
uintptr_t sigOffset = FindSignature("48 8D 0D ? ? ? ? F2 0F 11 40 ? 48 89 08 48 89 03 48 8B C3 48 8B 5C 24 ? 48 83 C4 30");
135135
int offset = *reinterpret_cast<int*>(sigOffset + 3);
136136
DoubleTagVtable = reinterpret_cast<uintptr_t**>(sigOffset + offset + /*length of instruction*/ 7);
137137
if (DoubleTagVtable == 0x0 || sigOffset == 0x0)
@@ -158,7 +158,7 @@ void DoubleTag::read(std::string& string) //throws MojangsonParseException
158158
ByteTag::ByteTag(char value) {
159159
static uintptr_t** ByteTagVtable = 0x0;
160160
if (ByteTagVtable == 0x0) {
161-
uintptr_t sigOffset = FindSignature("48 8D 0D ?? ?? ?? ?? 48 89 08 C6 40 ?? 00 48 89 03 48 8B C3 48 83 C4");
161+
uintptr_t sigOffset = FindSignature("48 8D 15 ? ? ? ? 48 89 10 88 48 ? 48 89 03 48 8B C3 48 8B 5C 24 ?");
162162
int offset = *reinterpret_cast<int*>(sigOffset + 3);
163163
ByteTagVtable = reinterpret_cast<uintptr_t**>(sigOffset + offset + /*length of instruction*/ 7);
164164
if (ByteTagVtable == 0x0 || sigOffset == 0x0)
@@ -186,7 +186,7 @@ void ByteTag::read(std::string& string) //throws MojangsonParseException
186186
ListTag::ListTag() {
187187
static uintptr_t** ListTagVtable = 0x0;
188188
if (ListTagVtable == 0x0) {
189-
uintptr_t sigOffset = FindSignature("48 8D 05 ?? ?? ?? ?? 49 89 45 00 4D 89 65 ?? 4D 89 65 ?? 4D 89 65 ?? 45 88 65 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 44 89 7C 24");
189+
uintptr_t sigOffset = FindSignature("48 8D 0D ? ? ? ? 48 89 08 33 C9 48 89 48 08 48 89 48 10 48 89 48 18 88 48 20 48 89 03");
190190
int offset = *reinterpret_cast<int*>(sigOffset + 3);
191191
ListTagVtable = reinterpret_cast<uintptr_t**>(sigOffset + offset + /*length of instruction*/ 7);
192192
if (ListTagVtable == 0x0 || sigOffset == 0x0)
@@ -198,7 +198,7 @@ ListTag::ListTag() {
198198
}
199199
void ListTag::add(std::unique_ptr<Tag> tag) {
200200
using ListTag__add_t = void(__fastcall*)(ListTag*, std::unique_ptr<Tag>);
201-
static ListTag__add_t func = reinterpret_cast<ListTag__add_t>(FindSignature("40 57 48 83 EC ?? 48 ?? ?? ?? ?? ?? ?? ?? ?? 48 89 5C 24 ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 44 24 ?? 48 8B FA 48 8B D9 48 89 54 24 ?? 48 8B 0A 48 8B 01 FF 50"));
201+
static ListTag__add_t func = reinterpret_cast<ListTag__add_t>(FindSignature("48 89 5C 24 ? 57 48 83 EC 30 48 8B 05 ? ? ? ? 48 33 C4 48 89 44 24 ? 48 8B FA 48 8B D9 48 89 54 24 ? 48 8B 0A 48 8B 01"));
202202
func(this, std::move(tag));
203203
}
204204
void CompoundTag::write(std::stringstream& builder) {
@@ -264,20 +264,12 @@ void CompoundTag::write(std::stringstream& builder) {
264264
CompoundTag::CompoundTag() {
265265
memset(this, 0, sizeof(CompoundTag));
266266
using constructor_t = void(__fastcall*)(CompoundTag*);
267-
static constructor_t func = reinterpret_cast<constructor_t>(FindSignature("48 89 4C 24 ?? 57 48 83 EC ?? 48 ?? ?? ?? ?? ?? ?? ?? ?? 48 89 5C 24 ?? 48 8B F9 48 8D 05 ?? ?? ?? ?? 48 89 01 48 8D 59"));
267+
static constructor_t func = reinterpret_cast<constructor_t>(FindSignature("48 89 5C 24 ? 48 89 4C 24 ? 57 48 83 EC ? 48 8B F9 48 8D 05 ? ? ? ? 48 89 01 48 8D 59 ? 48 89 5C 24 ? 33 C0 48 89 03 48 89 43"));
268268
func(this);
269269
}
270270
void CompoundTag::put(TextHolder& tag, std::unique_ptr<Tag> value) {
271271
using CompoundTag__putF = void(__fastcall*)(CompoundTag*, TextHolder&, std::unique_ptr<Tag>);
272-
static CompoundTag__putF func = nullptr;
273-
274-
if (!func) {
275-
if (g_Data.getVersion() == GAMEVERSION::g_1_16_0)
276-
func = reinterpret_cast<CompoundTag__putF>(FindSignature("4C 8B DC 55 56 57 48 81 EC ? ? ? ? 49 C7 43 ? ? ? ? ? 49 89 5B ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 84 24 ? ? ? ? 49 8B D8 48 8B FA 48 8B E9"));
277-
else
278-
func = reinterpret_cast<CompoundTag__putF>(FindSignature("4C 8B DC 53 56 57 48 81 EC ? ? ? ? 49 C7 43 ? ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 44 24 ? 49 8B F8 48 8B DA"));
279-
}
280-
272+
static CompoundTag__putF func = reinterpret_cast<CompoundTag__putF>(FindSignature("40 53 56 57 48 83 EC ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 44 24 ? 49 8B F8 48 8B DA 48 89 54 24 ? 4C 89 44 24 ? 4D 8B"));
281273
func(this, tag, std::move(value));
282274
}
283275
void Handler::handleWrite(Tag* value, std::stringstream& builder) {

0 commit comments

Comments
 (0)