Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Chunk classes with additional member variables #1567

Merged
merged 8 commits into from
Aug 12, 2024
2 changes: 1 addition & 1 deletion src/mc/world/level/chunk/ChunkSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ChunkSource : public ::Bedrock::EnableNonOwnerReferences {
LevelChunkBuilderData* mLevelChunkBuilderData; // this+0x40
std::atomic_bool mShuttingDown; // this+0x48
char pad_0x0049[0x17]; // the other 3 member variables
std::unordered_map<ChunkPos, std::weak_ptr<LevelChunk>> chunkStorage; // this+0x60
std::unordered_map<ChunkPos, std::weak_ptr<LevelChunk>> mChunkStorage; // this+0x60

// uchar filler[0x70 - sizeof(Bedrock::EnableNonOwnerReferences)];

Expand Down
10 changes: 10 additions & 0 deletions src/mc/world/level/chunk/LevelChunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ class LevelChunk {
// NOLINTEND
};

/*These member variables were obtained by analyzing CLIENT-WIN 1.21.2 using IDA.*/

// Align member variables by adding padding to match their respective offsets
int32_t mChunkPosX; // this+0x78
int32_t mChunkPosY; // this+0x7C
int8_t mLoadingStage; // this+0xD8
int32_t mLastTick; // this+0x120
std::vector<class SubChunk> mSubChunks; // this+0x138
int32_t mLoadCompleted; // this+0xDE4
bool mIsLoading; // this+0x11BB
public:
// prevent constructor by default
LevelChunk& operator=(LevelChunk const&);
Expand Down
8 changes: 8 additions & 0 deletions src/mc/world/level/chunk/SubChunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ struct SubChunk {
RequestFinished = 7,
};

/*These member variables were obtained by analyzing CLIENT-WIN 1.21.2 using IDA.*/

// Align member variables by adding padding to match their respective offsets
bool mNeedsInitLighting; // this+0x0020
bool mNeedsClientLighting; // this+0x0021
std::unique_ptr<class SubChunkStorage<class Block>>* mBlocks; // this+0x0028
class SubChunkBlockStorage* mBlockReadPtr; // this+0x0038
int8_t mSubChunkIndex; // this+0x0059
public:
// prevent constructor by default
SubChunk& operator=(SubChunk const&);
Expand Down
3 changes: 3 additions & 0 deletions src/mc/world/level/chunk/SubChunkStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

template <typename T0>
class SubChunkStorage {
public:
uint16_t mElements[1368]; // this+0x8
T0* mTypes; // this+0xAB8
public:
// prevent constructor by default
SubChunkStorage& operator=(SubChunkStorage const&);
Expand Down