From 9399512a9979bdd2db39af14e927350298905fe8 Mon Sep 17 00:00:00 2001 From: Qiuzhizhe <42761326+quizhizhe@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:35:36 +0800 Subject: [PATCH] fix: fix `Dimension` and `Generator` of vtable and size (#1462) --- src/mc/world/level/dimension/Dimension.h | 327 +++++++++++++----- src/mc/world/level/dimension/IDimension.h | 19 +- .../world/level/dimension/NetherDimension.h | 32 +- .../level/dimension/OverworldDimension.h | 20 +- .../level/dimension/end/TheEndDimension.h | 51 +-- src/mc/world/level/levelgen/VoidGenerator.h | 12 +- src/mc/world/level/levelgen/WorldGenerator.h | 114 ++++-- .../level/levelgen/flat/FlatWorldGenerator.h | 20 +- .../level/levelgen/v1/OverworldGenerator.h | 36 +- 9 files changed, 432 insertions(+), 199 deletions(-) diff --git a/src/mc/world/level/dimension/Dimension.h b/src/mc/world/level/dimension/Dimension.h index 7edf024f69..6bc79cef6a 100644 --- a/src/mc/world/level/dimension/Dimension.h +++ b/src/mc/world/level/dimension/Dimension.h @@ -1,6 +1,21 @@ #pragma once #include "mc/_HeaderOutputPredefine.h" +#include "mc/common/BrightnessPair.h" +#include "mc/deps/core/common/bedrock/EnableNonOwnerReferences.h" +#include "mc/enums/StorageVersion.h" +#include "mc/network/packet/UpdateSubChunkBlocksPacket.h" +#include "mc/world/level/ChunkPos.h" +#include "mc/world/level/LevelListener.h" +#include "mc/world/level/SubChunkPos.h" +#include "mc/world/level/chunk/ChunkKey.h" +#include "mc/world/level/chunk/LevelChunkGarbageCollector.h" +#include "mc/world/level/dimension/ActorChunkTransferEntry.h" +#include "mc/world/level/dimension/ActorUnloadedChunkTransferEntry.h" +#include "mc/world/level/dimension/DimensionHeightRange.h" +#include "mc/world/level/dimension/IDimension.h" +#include "mc/world/level/levelgen/v1/FeatureTerrainAdjustments.h" +#include "mc/world/level/saveddata/SavedData.h" // auto generated inclusion list #include "mc/common/wrapper/OwnerPtr.h" @@ -15,7 +30,36 @@ namespace br::worldgen { class StructureSetRegistry; } namespace mce { class Color; } // clang-format on -class Dimension { +class ServerPlayer; +class BaseLightTextureImageBuilder; +class DimensionBrightnessRamp; +class LevelChunkMetaData; +class TaskGroup; +class PostprocessingManager; +class SubChunkInterlocker; +class WireframeQueue; +class RuntimeLightingManager; +class LevelChunkBuilderData; +class BlockEventDispatcher; +class TickingAreaList; +class WorldGenerator; +class Weather; +class Seasons; +class GameEventDispatcher; +class ChunkBuildOrderPolicyBase; +class VillageManager; +class CircuitSystem; +struct NetworkIdentifierWithSubId; +class ChunkLoadActionList; +class DelayActionList; +class ILevel; +class ChunkSource; + +class Dimension : public IDimension, + public LevelListener, + public SavedData, + public Bedrock::EnableNonOwnerReferences, + public std::enable_shared_from_this { public: // Dimension inner types declare // clang-format off @@ -24,11 +68,13 @@ class Dimension { // Dimension inner types define struct PlayerReplicationStructures { - public: - // prevent constructor by default - PlayerReplicationStructures& operator=(PlayerReplicationStructures const&); - PlayerReplicationStructures(PlayerReplicationStructures const&); - PlayerReplicationStructures(); + struct PlayerAtChunk { + ChunkPos chunkPos; // this+0x0 + ushort playerIndex{}; // this+0x8 + }; + std::unordered_map> mPlayersAtChunks; // this+0x0 + std::vector mPlayerInterestMap; // this+0x40 + std::vector> unwrappedPlayerList; // this+0x58 public: // NOLINTBEGIN @@ -40,6 +86,70 @@ class Dimension { // NOLINTEND }; + std::vector mActorChunkTransferQueue; // this+0x68 + std::unordered_map> + mActorUnloadedChunkTransferQueue; // this+0x80 + + ILevel& mLevel; // this+0xC0 + DimensionHeightRange mHeightRange; // this+0xC4 + short mSeaLevel; // this+0xCC + uchar mBlockSource[8]; // this+0xCE + float mMobsPerChunkSurface[8]; // this+0xE0 + float mMobsPerChunkUnderground[8]; // this+0xF8 + BrightnessPair mDefaultBrightness; // this+0x118 + std::unique_ptr mLightTextureImageBuilder; // this+0x120 + std::unique_ptr mDimensionBrightnessRamp; // this+0x128 + std::shared_ptr mTargetMetaData; // this+0x130 + std::string mName; // this+0x140 + DimensionType mId; // this+0x160 + bool mUltraWarm; // this+0x164 + bool mHasCeiling; // this+0x165 + bool mHasWeather; // this+0x166 + bool mHasSkylight; // this+0x167 + Brightness mSkyDarken; // this+0x168 + std::unique_ptr mDispatcher; // this+0x170 + std::unique_ptr mTaskGroup; // this+0x178 + std::unique_ptr mChunkGenTaskGroup; // this+0x180 + std::unique_ptr mPostProcessingManager; // this+0x188 + std::unique_ptr mSubChunkInterlocker; // this+0x190 + std::unique_ptr mChunkSource; // this+0x198 + WorldGenerator* mWorldGenerator; // this+0x1A0 + std::unique_ptr mWeather; // this+0x1A8 + std::unique_ptr mSeasons; // this+0x1B0 + std::unique_ptr mGameEventDispatcher; // this+0x1B8 + std::unique_ptr mCircuitSystem; // this+0x1C0 + int CIRCUIT_TICK_RATE; // this+0x1C8 + int mCircuitSystemTickRate; // this+0x1CC + std::unordered_map mActorIDEntityIDMap; // this+0x1D0 + std::vector mDisplayEntities; // this+0x210 + std::shared_ptr mWireframeQueue; // this+0x228 + FeatureTerrainAdjustments mFeatureTerrainAdjustments; // this+0x238 + + std::unordered_map>> mLimboEntities; // this+0x280 + + std::set mEntitiesToMoveChunks; // this+0x2C0 + std::shared_ptr mTickingAreaList; // this+0x2D0 + LevelChunkGarbageCollector mLevelChunkGarbageCollector; // this+0x2E0 + std::set mWitherIDs; // this+0x558 + std::unique_ptr mRuntimeLightingManager; // this+0x568 + std::unique_ptr mLevelChunkBuilderData; // this+0x570 + std::chrono::steady_clock::time_point mLastPruneTime; // this+0x578 + std::unique_ptr mChunkBuildOrderPolicy; // this+0x580 + std::unique_ptr mVillageManager; // this+0x588 + std::vector mTemporaryPlayerIds; // this+0x590 + std::unique_ptr mChunkLoadActionList; // this+0x5A8 + std::unique_ptr mDelayActionList; // this+0x5B0 + + std::unordered_map + mBlocksChangedBySubChunkMap; // this+0x5B8 + + // Scripting::StrongObjectHandle + uchar mClientScriptDimension[0x48]; // this+0x5F8 + + std::unique_ptr mReplicationStructures; // this+0x640 + std::vector mPlayersToReplicate; // this+0x648 + bool mRunChunkGenWatchDog; // this+0x660 + public: // prevent constructor by default Dimension& operator=(Dimension const&); @@ -48,97 +158,139 @@ class Dimension { public: // NOLINTBEGIN - // symbol: - // ?_createChunkBuildOrderPolicy@Dimension@@EEAA?AV?$unique_ptr@VChunkBuildOrderPolicyBase@@U?$default_delete@VChunkBuildOrderPolicyBase@@@std@@@std@@XZ - MCVAPI std::unique_ptr _createChunkBuildOrderPolicy(); + // symbol: ??1Dimension@@UEAA@XZ + virtual ~Dimension(); - // symbol: ?deserialize@Dimension@@UEAAXAEBVCompoundTag@@@Z - MCVAPI void deserialize(class CompoundTag const& tag); + // vIndex: 1, symbol: ?isNaturalDimension@Dimension@@UEBA_NXZ + virtual bool isNaturalDimension() const; - // symbol: ?flushLevelChunkGarbageCollector@Dimension@@UEAAXXZ - MCVAPI void flushLevelChunkGarbageCollector(); + // vIndex: 2, symbol: ?getDimensionId@Dimension@@UEBA?AV?$AutomaticID@VDimension@@H@@XZ + virtual DimensionType getDimensionId() const; - // symbol: ?forceCheckAllNeighChunkSavedStat@Dimension@@UEBA_NXZ - MCVAPI bool forceCheckAllNeighChunkSavedStat() const; + // vIndex: 3, symbol: ?sendPacketForPosition@Dimension@@UEAAXAEBVBlockPos@@AEBVPacket@@PEBVPlayer@@@Z + virtual void + sendPacketForPosition(class BlockPos const& position, class Packet const& packet, class Player const* except); - // symbol: ?getBiomeRegistry@Dimension@@UEAAAEAVBiomeRegistry@@XZ - MCVAPI class BiomeRegistry& getBiomeRegistry(); + // vIndex: 4, symbol: ?flushLevelChunkGarbageCollector@Dimension@@UEAAXXZ + virtual void flushLevelChunkGarbageCollector(); - // symbol: ?getBiomeRegistry@Dimension@@UEBAAEBVBiomeRegistry@@XZ - MCVAPI class BiomeRegistry const& getBiomeRegistry() const; + // vIndex: 5, symbol: ?initializeWithLevelStorageManager@Dimension@@UEAAXAEAVLevelStorageManager@@@Z + virtual void initializeWithLevelStorageManager(class LevelStorageManager&); - // symbol: ?getBrightnessDependentFogColor@Dimension@@UEBA?AVColor@mce@@AEBV23@M@Z - MCVAPI class mce::Color getBrightnessDependentFogColor(class mce::Color const& baseColor, float brightness) const; + // vIndex: 6, symbol: ?getBiomeRegistry@Dimension@@UEAAAEAVBiomeRegistry@@XZ + virtual class BiomeRegistry& getBiomeRegistry(); - // symbol: ?getBrightnessRamp@Dimension@@UEBAAEBVDimensionBrightnessRamp@@XZ - MCVAPI class DimensionBrightnessRamp const& getBrightnessRamp() const; + // vIndex: 7, symbol: ?getBiomeRegistry@Dimension@@UEBAAEBVBiomeRegistry@@XZ + virtual class BiomeRegistry const& getBiomeRegistry() const; - // symbol: ?getClearColorScale@Dimension@@UEAAMXZ - MCVAPI float getClearColorScale(); + // vIndex: 9, symbol: ?init@Dimension@@UEAAXAEBVStructureSetRegistry@worldgen@br@@@Z + virtual void init(class br::worldgen::StructureSetRegistry const&); - // symbol: ?getCloudHeight@Dimension@@UEBAFXZ - MCVAPI short getCloudHeight() const; + // vIndex: 10, symbol: ?tick@Dimension@@UEAAXXZ + virtual void tick(); - // symbol: ?getDefaultBiome@Dimension@@UEBA?AVHashedString@@XZ - MCVAPI class HashedString getDefaultBiome() const; + // vIndex: 11, symbol: ?tickRedstone@Dimension@@UEAAXXZ + virtual void tickRedstone(); - // symbol: ?getDimensionId@Dimension@@UEBA?AV?$AutomaticID@VDimension@@H@@XZ - MCVAPI DimensionType getDimensionId() const; + // vIndex: 12 + virtual std::unique_ptr createGenerator(class br::worldgen::StructureSetRegistry const&) = 0; - // symbol: ?getLightTextureImageBuilder@Dimension@@UEBAPEAVBaseLightTextureImageBuilder@@XZ - MCVAPI class BaseLightTextureImageBuilder* getLightTextureImageBuilder() const; + // vIndex: 13 + virtual void + upgradeLevelChunk(class ChunkSource& source, class LevelChunk& lc, class LevelChunk& generatedChunk) = 0; - // symbol: ?getSpawnPos@Dimension@@UEBA?AVBlockPos@@XZ - MCVAPI class BlockPos getSpawnPos() const; + // vIndex: 14 + virtual void fixWallChunk(class ChunkSource&, class LevelChunk&) = 0; - // symbol: ?getSpawnYPosition@Dimension@@UEBAHXZ - MCVAPI int getSpawnYPosition() const; + // vIndex: 15 + virtual bool levelChunkNeedsUpgrade(class LevelChunk const&) const = 0; - // symbol: ?getSunIntensity@Dimension@@UEBAMMAEBVVec3@@M@Z - MCVAPI float getSunIntensity(float a, class Vec3 const& viewVector, float minInfluenceAngle) const; + // vIndex: 16, symbol: ?isValidSpawn@Dimension@@UEBA_NHH@Z + virtual bool isValidSpawn(int x, int z) const; - // symbol: ?getTimeOfDay@Dimension@@MEBAMHM@Z - MCVAPI float getTimeOfDay(int time, float a) const; + // vIndex: 17, symbol: ?getBrightnessDependentFogColor@Dimension@@UEBA?AVColor@mce@@AEBV23@M@Z + virtual class mce::Color getBrightnessDependentFogColor(class mce::Color const& baseColor, float brightness) const; - // symbol: ?hasBedrockFog@Dimension@@UEAA_NXZ - MCVAPI bool hasBedrockFog(); + // vIndex: 18, symbol: ?isFoggyAt@Dimension@@UEBA_NHH@Z + virtual bool isFoggyAt(int x, int z) const; - // symbol: ?hasGround@Dimension@@UEBA_NXZ - MCVAPI bool hasGround() const; + // vIndex: 19, symbol: ?hasPrecipitationFog@Dimension@@UEBA_NXZ + virtual bool hasPrecipitationFog() const; - // symbol: ?hasPrecipitationFog@Dimension@@UEBA_NXZ - MCVAPI bool hasPrecipitationFog() const; + // vIndex: 20, symbol: ?getCloudHeight@Dimension@@UEBAFXZ + virtual short getCloudHeight() const; - // symbol: ?init@Dimension@@UEAAXAEBVStructureSetRegistry@worldgen@br@@@Z - MCVAPI void init(class br::worldgen::StructureSetRegistry const&); + // vIndex: 21, symbol: ?getDefaultBiome@Dimension@@UEBA?AVHashedString@@XZ + virtual class HashedString getDefaultBiome() const; - // symbol: ?initializeWithLevelStorageManager@Dimension@@UEAAXAEAVLevelStorageManager@@@Z - MCVAPI void initializeWithLevelStorageManager(class LevelStorageManager&); + // vIndex: 22, symbol: ?mayRespawnViaBed@Dimension@@UEBA_NXZ + virtual bool mayRespawnViaBed() const; - // symbol: ?is2DPositionRelevantForPlayer@Dimension@@UEBA_NAEBVBlockPos@@AEAVPlayer@@@Z - MCVAPI bool is2DPositionRelevantForPlayer(class BlockPos const& position, class Player& player) const; + // vIndex: 23, symbol: ?hasGround@Dimension@@UEBA_NXZ + virtual bool hasGround() const; - // symbol: ?isActorRelevantForPlayer@Dimension@@UEBA_NAEAVPlayer@@AEBVActor@@@Z - MCVAPI bool isActorRelevantForPlayer(class Player& player, class Actor const& actor) const; + // vIndex: 24, symbol: ?getSpawnPos@Dimension@@UEBA?AVBlockPos@@XZ + virtual class BlockPos getSpawnPos() const; - // symbol: ?isDay@Dimension@@UEBA_NXZ - MCVAPI bool isDay() const; + // vIndex: 25, symbol: ?getSpawnYPosition@Dimension@@UEBAHXZ + virtual int getSpawnYPosition() const; - // symbol: ?isFoggyAt@Dimension@@UEBA_NHH@Z - MCVAPI bool isFoggyAt(int x, int z) const; + // vIndex: 26, symbol: ?hasBedrockFog@Dimension@@UEAA_NXZ + virtual bool hasBedrockFog(); - // symbol: ?isNaturalDimension@Dimension@@UEBA_NXZ - MCVAPI bool isNaturalDimension() const; + // vIndex: 27, symbol: ?getClearColorScale@Dimension@@UEAAMXZ + virtual float getClearColorScale(); - // symbol: ?isValidSpawn@Dimension@@UEBA_NHH@Z - MCVAPI bool isValidSpawn(int x, int z) const; + // vIndex: 28, symbol: ?showSky@Dimension@@UEBA_NXZ + virtual bool showSky() const; - // symbol: ?mayRespawnViaBed@Dimension@@UEBA_NXZ - MCVAPI bool mayRespawnViaBed() const; + // vIndex: 29, symbol: ?isDay@Dimension@@UEBA_NXZ + virtual bool isDay() const; - // symbol: + // vIndex: 30, symbol: ?getTimeOfDay@Dimension@@MEBAMHM@Z + virtual float getTimeOfDay(int time, float a) const; + + // vIndex: 31, symbol: ?getSunIntensity@Dimension@@UEBAMMAEBVVec3@@M@Z + virtual float getSunIntensity(float a, class Vec3 const& viewVector, float minInfluenceAngle) const; + + // vIndex: 32, symbol: ?forceCheckAllNeighChunkSavedStat@Dimension@@UEBA_NXZ + virtual bool forceCheckAllNeighChunkSavedStat() const; + + // vIndex: 33, vIndex: 34, symbol: ?sendBroadcast@Dimension@@UEAAXAEBVPacket@@PEAVPlayer@@@Z + virtual void sendBroadcast(class Packet const& packet, class Player* except); + + // vIndex: 34, symbol: ?is2DPositionRelevantForPlayer@Dimension@@UEBA_NAEBVBlockPos@@AEAVPlayer@@@Z + virtual bool is2DPositionRelevantForPlayer(class BlockPos const& position, class Player& player) const; + + // vIndex: 35, symbol: ?isActorRelevantForPlayer@Dimension@@UEBA_NAEAVPlayer@@AEBVActor@@@Z + virtual bool isActorRelevantForPlayer(class Player& player, class Actor const& actor) const; + + // vIndex: 36, symbol: ?getLightTextureImageBuilder@Dimension@@UEBAPEAVBaseLightTextureImageBuilder@@XZ + virtual class BaseLightTextureImageBuilder* getLightTextureImageBuilder() const; + + // vIndex: 37, symbol: ?getBrightnessRamp@Dimension@@UEBAAEBVDimensionBrightnessRamp@@XZ + virtual class DimensionBrightnessRamp const& getBrightnessRamp() const; + + // vIndex: 38, symbol: ?startLeaveGame@Dimension@@UEAAXXZ + virtual void startLeaveGame(); + + // vIndex: 39, symbol: + // ?_createChunkBuildOrderPolicy@Dimension@@EEAA?AV?$unique_ptr@VChunkBuildOrderPolicyBase@@U?$default_delete@VChunkBuildOrderPolicyBase@@@std@@@std@@XZ + virtual std::unique_ptr _createChunkBuildOrderPolicy(); + + // vIndex: 40 + virtual void _upgradeOldLimboEntity(class CompoundTag& tag, ::LimboEntitiesVersion vers) = 0; + + // vIndex: 41 + virtual std::unique_ptr _wrapStorageForVersionCompatibility( + std::unique_ptr storageSource, + ::StorageVersion levelVersion + ) = 0; + + // LevelListener vtable overloaded functions + // vIndex: 4, symbol: // ?onBlockChanged@Dimension@@UEAAXAEAVBlockSource@@AEBVBlockPos@@IAEBVBlock@@2HPEBUActorBlockSyncMessage@@W4BlockChangedEventTarget@@PEAVActor@@@Z - MCVAPI void onBlockChanged( + virtual void onBlockChanged( class BlockSource& source, class BlockPos const& pos, uint layer, @@ -150,39 +302,24 @@ class Dimension { class Actor* blockChangeSource ); - // symbol: ?onBlockEvent@Dimension@@UEAAXAEAVBlockSource@@HHHHH@Z - MCVAPI void onBlockEvent(class BlockSource& source, int x, int y, int z, int b0, int b1); + // LevelListener->BlockSourceListener vtable overloaded function + // vIndex: 8, symbol: ?onBlockEvent@Dimension@@UEAAXAEAVBlockSource@@HHHHH@Z + virtual void onBlockEvent(class BlockSource& source, int x, int y, int z, int b0, int b1); - // symbol: ?onChunkLoaded@Dimension@@UEAAXAEAVChunkSource@@AEAVLevelChunk@@@Z - MCVAPI void onChunkLoaded(class ChunkSource& source, class LevelChunk& lc); + // LevelListener vtable overloaded functions + // vIndex: 19,symbol: ?onChunkLoaded@Dimension@@UEAAXAEAVChunkSource@@AEAVLevelChunk@@@Z + virtual void onChunkLoaded(class ChunkSource& source, class LevelChunk& lc); - // symbol: ?onLevelDestruction@Dimension@@UEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z - MCVAPI void onLevelDestruction(std::string const&); + // vIndex: 23, symbol: + // ?onLevelDestruction@Dimension@@UEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z + virtual void onLevelDestruction(std::string const&); - // symbol: ?sendBroadcast@Dimension@@UEAAXAEBVPacket@@PEAVPlayer@@@Z - MCVAPI void sendBroadcast(class Packet const& packet, class Player* except); - - // symbol: ?sendPacketForPosition@Dimension@@UEAAXAEBVBlockPos@@AEBVPacket@@PEBVPlayer@@@Z - MCVAPI void - sendPacketForPosition(class BlockPos const& position, class Packet const& packet, class Player const* except); + // SavedData vtable overloaded functions + // symbol: ?deserialize@Dimension@@UEAAXAEBVCompoundTag@@@Z + virtual void deserialize(class CompoundTag const& tag); // symbol: ?serialize@Dimension@@UEBAXAEAVCompoundTag@@@Z - MCVAPI void serialize(class CompoundTag& tag) const; - - // symbol: ?showSky@Dimension@@UEBA_NXZ - MCVAPI bool showSky() const; - - // symbol: ?startLeaveGame@Dimension@@UEAAXXZ - MCVAPI void startLeaveGame(); - - // symbol: ?tick@Dimension@@UEAAXXZ - MCVAPI void tick(); - - // symbol: ?tickRedstone@Dimension@@UEAAXXZ - MCVAPI void tickRedstone(); - - // symbol: ??1Dimension@@UEAA@XZ - MCVAPI ~Dimension(); + virtual void serialize(class CompoundTag& tag) const; // symbol: // ??0Dimension@@QEAA@AEAVILevel@@V?$AutomaticID@VDimension@@H@@VDimensionHeightRange@@AEAVScheduler@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z diff --git a/src/mc/world/level/dimension/IDimension.h b/src/mc/world/level/dimension/IDimension.h index 9127c70ac1..607997b56b 100644 --- a/src/mc/world/level/dimension/IDimension.h +++ b/src/mc/world/level/dimension/IDimension.h @@ -14,20 +14,29 @@ class IDimension { // vIndex: 0, symbol: ??1IDimension@@UEAA@XZ virtual ~IDimension(); - // vIndex: 0, symbol: ?isNaturalDimension@Dimension@@UEBA_NXZ + // vIndex: 1 virtual bool isNaturalDimension() const = 0; - // vIndex: 1, symbol: ?getDimensionId@Dimension@@UEBA?AV?$AutomaticID@VDimension@@H@@XZ + // vIndex: 2 virtual DimensionType getDimensionId() const = 0; - // vIndex: 2, symbol: ?sendPacketForPosition@Dimension@@UEAAXAEBVBlockPos@@AEBVPacket@@PEBVPlayer@@@Z + // vIndex: 3 virtual void sendPacketForPosition(class BlockPos const&, class Packet const&, class Player const*) = 0; - // vIndex: 3, symbol: ?flushLevelChunkGarbageCollector@Dimension@@UEAAXXZ + // vIndex: 4 virtual void flushLevelChunkGarbageCollector() = 0; - // vIndex: 4, symbol: ?initializeWithLevelStorageManager@Dimension@@UEAAXAEAVLevelStorageManager@@@Z + // vIndex: 5 virtual void initializeWithLevelStorageManager(class LevelStorageManager&) = 0; + // vIndex: 6 + virtual class BiomeRegistry& getBiomeRegistry() = 0; + + // vIndex: 7 + virtual class BiomeRegistry const& getBiomeRegistry() const = 0; + + // vIndex: 8 + virtual class Vec3 translatePosAcrossDimension(class Vec3 const&, DimensionType) const = 0; + // NOLINTEND }; diff --git a/src/mc/world/level/dimension/NetherDimension.h b/src/mc/world/level/dimension/NetherDimension.h index 59828fb9b0..2a97310ab2 100644 --- a/src/mc/world/level/dimension/NetherDimension.h +++ b/src/mc/world/level/dimension/NetherDimension.h @@ -23,57 +23,57 @@ class NetherDimension : public ::Dimension { public: // NOLINTBEGIN // symbol: ?_upgradeOldLimboEntity@NetherDimension@@EEAAXAEAVCompoundTag@@W4LimboEntitiesVersion@@@Z - MCVAPI void _upgradeOldLimboEntity(class CompoundTag& tag, ::LimboEntitiesVersion vers); + virtual void _upgradeOldLimboEntity(class CompoundTag& tag, ::LimboEntitiesVersion vers); // symbol: // ?_wrapStorageForVersionCompatibility@NetherDimension@@EEAA?AV?$unique_ptr@VChunkSource@@U?$default_delete@VChunkSource@@@std@@@std@@V23@W4StorageVersion@@@Z - MCVAPI std::unique_ptr _wrapStorageForVersionCompatibility( + virtual std::unique_ptr _wrapStorageForVersionCompatibility( std::unique_ptr storageSource, ::StorageVersion levelVersion ); // symbol: // ?createGenerator@NetherDimension@@UEAA?AV?$unique_ptr@VWorldGenerator@@U?$default_delete@VWorldGenerator@@@std@@@std@@AEBVStructureSetRegistry@worldgen@br@@@Z - MCVAPI std::unique_ptr createGenerator(class br::worldgen::StructureSetRegistry const&); + virtual std::unique_ptr createGenerator(class br::worldgen::StructureSetRegistry const&); // symbol: ?fixWallChunk@NetherDimension@@UEAAXAEAVChunkSource@@AEAVLevelChunk@@@Z - MCVAPI void fixWallChunk(class ChunkSource& source, class LevelChunk& lc); + virtual void fixWallChunk(class ChunkSource& source, class LevelChunk& lc); // symbol: ?forceCheckAllNeighChunkSavedStat@NetherDimension@@UEBA_NXZ - MCVAPI bool forceCheckAllNeighChunkSavedStat() const; + virtual bool forceCheckAllNeighChunkSavedStat() const; // symbol: ?getDefaultBiome@NetherDimension@@UEBA?AVHashedString@@XZ - MCVAPI class HashedString getDefaultBiome() const; + virtual class HashedString getDefaultBiome() const; // symbol: ?getTimeOfDay@NetherDimension@@UEBAMHM@Z - MCVAPI float getTimeOfDay(int time, float a) const; + virtual float getTimeOfDay(int time, float a) const; // symbol: ?init@NetherDimension@@UEAAXAEBVStructureSetRegistry@worldgen@br@@@Z - MCVAPI void init(class br::worldgen::StructureSetRegistry const&); + virtual void init(class br::worldgen::StructureSetRegistry const&); // symbol: ?isFoggyAt@NetherDimension@@UEBA_NHH@Z - MCVAPI bool isFoggyAt(int x, int z) const; + virtual bool isFoggyAt(int x, int z) const; // symbol: ?isNaturalDimension@NetherDimension@@UEBA_NXZ - MCVAPI bool isNaturalDimension() const; + virtual bool isNaturalDimension() const; // symbol: ?isValidSpawn@NetherDimension@@UEBA_NHH@Z - MCVAPI bool isValidSpawn(int x, int z) const; + virtual bool isValidSpawn(int x, int z) const; // symbol: ?levelChunkNeedsUpgrade@NetherDimension@@UEBA_NAEBVLevelChunk@@@Z - MCVAPI bool levelChunkNeedsUpgrade(class LevelChunk const& lc) const; + virtual bool levelChunkNeedsUpgrade(class LevelChunk const& lc) const; // symbol: ?mayRespawnViaBed@NetherDimension@@UEBA_NXZ - MCVAPI bool mayRespawnViaBed() const; + virtual bool mayRespawnViaBed() const; // symbol: ?showSky@NetherDimension@@UEBA_NXZ - MCVAPI bool showSky() const; + virtual bool showSky() const; // symbol: ?translatePosAcrossDimension@NetherDimension@@UEBA?AVVec3@@AEBV2@V?$AutomaticID@VDimension@@H@@@Z - MCVAPI class Vec3 translatePosAcrossDimension(class Vec3 const& originalPos, DimensionType fromId) const; + virtual class Vec3 translatePosAcrossDimension(class Vec3 const& originalPos, DimensionType fromId) const; // symbol: ?upgradeLevelChunk@NetherDimension@@UEAAXAEAVChunkSource@@AEAVLevelChunk@@1@Z - MCVAPI void upgradeLevelChunk(class ChunkSource& source, class LevelChunk& lc, class LevelChunk& generatedChunk); + virtual void upgradeLevelChunk(class ChunkSource& source, class LevelChunk& lc, class LevelChunk& generatedChunk); // symbol: ??0NetherDimension@@QEAA@AEAVILevel@@AEAVScheduler@@@Z MCAPI NetherDimension(class ILevel& level, class Scheduler& callbackContext); diff --git a/src/mc/world/level/dimension/OverworldDimension.h b/src/mc/world/level/dimension/OverworldDimension.h index c3f6bc2f4f..722ebc9f7d 100644 --- a/src/mc/world/level/dimension/OverworldDimension.h +++ b/src/mc/world/level/dimension/OverworldDimension.h @@ -24,39 +24,39 @@ class OverworldDimension : public ::Dimension { public: // NOLINTBEGIN // symbol: ?_upgradeOldLimboEntity@OverworldDimension@@EEAAXAEAVCompoundTag@@W4LimboEntitiesVersion@@@Z - MCVAPI void _upgradeOldLimboEntity(class CompoundTag& tag, ::LimboEntitiesVersion vers); + virtual void _upgradeOldLimboEntity(class CompoundTag& tag, ::LimboEntitiesVersion vers); // symbol: // ?_wrapStorageForVersionCompatibility@OverworldDimension@@EEAA?AV?$unique_ptr@VChunkSource@@U?$default_delete@VChunkSource@@@std@@@std@@V23@W4StorageVersion@@@Z - MCVAPI std::unique_ptr _wrapStorageForVersionCompatibility( + virtual std::unique_ptr _wrapStorageForVersionCompatibility( std::unique_ptr storageSource, ::StorageVersion levelVersion ); // symbol: // ?createGenerator@OverworldDimension@@UEAA?AV?$unique_ptr@VWorldGenerator@@U?$default_delete@VWorldGenerator@@@std@@@std@@AEBVStructureSetRegistry@worldgen@br@@@Z - MCVAPI std::unique_ptr createGenerator(class br::worldgen::StructureSetRegistry const&); + virtual std::unique_ptr createGenerator(class br::worldgen::StructureSetRegistry const&); // symbol: ?fixWallChunk@OverworldDimension@@UEAAXAEAVChunkSource@@AEAVLevelChunk@@@Z - MCVAPI void fixWallChunk(class ChunkSource& source, class LevelChunk& lc); + virtual void fixWallChunk(class ChunkSource& source, class LevelChunk& lc); // symbol: ?getBrightnessDependentFogColor@OverworldDimension@@UEBA?AVColor@mce@@AEBV23@M@Z - MCVAPI class mce::Color getBrightnessDependentFogColor(class mce::Color const& baseColor, float brightness) const; + virtual class mce::Color getBrightnessDependentFogColor(class mce::Color const& baseColor, float brightness) const; // symbol: ?getCloudHeight@OverworldDimension@@UEBAFXZ - MCVAPI short getCloudHeight() const; + virtual short getCloudHeight() const; // symbol: ?hasPrecipitationFog@OverworldDimension@@UEBA_NXZ - MCVAPI bool hasPrecipitationFog() const; + virtual bool hasPrecipitationFog() const; // symbol: ?levelChunkNeedsUpgrade@OverworldDimension@@UEBA_NAEBVLevelChunk@@@Z - MCVAPI bool levelChunkNeedsUpgrade(class LevelChunk const& lc) const; + virtual bool levelChunkNeedsUpgrade(class LevelChunk const& lc) const; // symbol: ?translatePosAcrossDimension@OverworldDimension@@UEBA?AVVec3@@AEBV2@V?$AutomaticID@VDimension@@H@@@Z - MCVAPI class Vec3 translatePosAcrossDimension(class Vec3 const& originalPos, DimensionType fromId) const; + virtual class Vec3 translatePosAcrossDimension(class Vec3 const& originalPos, DimensionType fromId) const; // symbol: ?upgradeLevelChunk@OverworldDimension@@UEAAXAEAVChunkSource@@AEAVLevelChunk@@1@Z - MCVAPI void upgradeLevelChunk(class ChunkSource& source, class LevelChunk& lc, class LevelChunk& generatedChunk); + virtual void upgradeLevelChunk(class ChunkSource& source, class LevelChunk& lc, class LevelChunk& generatedChunk); // NOLINTEND }; diff --git a/src/mc/world/level/dimension/end/TheEndDimension.h b/src/mc/world/level/dimension/end/TheEndDimension.h index 3385253e4a..9d16981219 100644 --- a/src/mc/world/level/dimension/end/TheEndDimension.h +++ b/src/mc/world/level/dimension/end/TheEndDimension.h @@ -13,8 +13,11 @@ namespace br::worldgen { class StructureSetRegistry; } // clang-format on +class EndDragonFight; + class TheEndDimension : public ::Dimension { public: + std::unique_ptr mDragonFight; // prevent constructor by default TheEndDimension& operator=(TheEndDimension const&); TheEndDimension(TheEndDimension const&); @@ -23,81 +26,81 @@ class TheEndDimension : public ::Dimension { public: // NOLINTBEGIN // symbol: ?_upgradeOldLimboEntity@TheEndDimension@@EEAAXAEAVCompoundTag@@W4LimboEntitiesVersion@@@Z - MCVAPI void _upgradeOldLimboEntity(class CompoundTag& tag, ::LimboEntitiesVersion vers); + virtual void _upgradeOldLimboEntity(class CompoundTag& tag, ::LimboEntitiesVersion vers); // symbol: // ?_wrapStorageForVersionCompatibility@TheEndDimension@@EEAA?AV?$unique_ptr@VChunkSource@@U?$default_delete@VChunkSource@@@std@@@std@@V23@W4StorageVersion@@@Z - MCVAPI std::unique_ptr _wrapStorageForVersionCompatibility( + virtual std::unique_ptr _wrapStorageForVersionCompatibility( std::unique_ptr storageSource, ::StorageVersion levelVersion ); // symbol: // ?createGenerator@TheEndDimension@@UEAA?AV?$unique_ptr@VWorldGenerator@@U?$default_delete@VWorldGenerator@@@std@@@std@@AEBVStructureSetRegistry@worldgen@br@@@Z - MCVAPI std::unique_ptr createGenerator(class br::worldgen::StructureSetRegistry const&); + virtual std::unique_ptr createGenerator(class br::worldgen::StructureSetRegistry const&); // symbol: ?deserialize@TheEndDimension@@UEAAXAEBVCompoundTag@@@Z - MCVAPI void deserialize(class CompoundTag const& tag); + virtual void deserialize(class CompoundTag const& tag); // symbol: ?fixWallChunk@TheEndDimension@@UEAAXAEAVChunkSource@@AEAVLevelChunk@@@Z - MCVAPI void fixWallChunk(class ChunkSource& source, class LevelChunk& lc); + virtual void fixWallChunk(class ChunkSource& source, class LevelChunk& lc); // symbol: ?getCloudHeight@TheEndDimension@@UEBAFXZ - MCVAPI short getCloudHeight() const; + virtual short getCloudHeight() const; // symbol: ?getDefaultBiome@TheEndDimension@@UEBA?AVHashedString@@XZ - MCVAPI class HashedString getDefaultBiome() const; + virtual class HashedString getDefaultBiome() const; // symbol: ?getSpawnPos@TheEndDimension@@UEBA?AVBlockPos@@XZ - MCVAPI class BlockPos getSpawnPos() const; + virtual class BlockPos getSpawnPos() const; // symbol: ?getSpawnYPosition@TheEndDimension@@UEBAHXZ - MCVAPI int getSpawnYPosition() const; + virtual int getSpawnYPosition() const; // symbol: ?getSunIntensity@TheEndDimension@@UEBAMMAEBVVec3@@M@Z - MCVAPI float getSunIntensity(float a, class Vec3 const& viewVector, float minInfluenceAngle) const; + virtual float getSunIntensity(float a, class Vec3 const& viewVector, float minInfluenceAngle) const; // symbol: ?getTimeOfDay@TheEndDimension@@UEBAMHM@Z - MCVAPI float getTimeOfDay(int time, float a) const; + virtual float getTimeOfDay(int time, float a) const; // symbol: ?hasGround@TheEndDimension@@UEBA_NXZ - MCVAPI bool hasGround() const; + virtual bool hasGround() const; // symbol: ?init@TheEndDimension@@UEAAXAEBVStructureSetRegistry@worldgen@br@@@Z - MCVAPI void init(class br::worldgen::StructureSetRegistry const&); + virtual void init(class br::worldgen::StructureSetRegistry const&); // symbol: ?isDay@TheEndDimension@@UEBA_NXZ - MCVAPI bool isDay() const; + virtual bool isDay() const; // symbol: ?isFoggyAt@TheEndDimension@@UEBA_NHH@Z - MCVAPI bool isFoggyAt(int x, int z) const; + virtual bool isFoggyAt(int x, int z) const; // symbol: ?isNaturalDimension@TheEndDimension@@UEBA_NXZ - MCVAPI bool isNaturalDimension() const; + virtual bool isNaturalDimension() const; // symbol: ?isValidSpawn@TheEndDimension@@UEBA_NHH@Z - MCVAPI bool isValidSpawn(int x, int z) const; + virtual bool isValidSpawn(int x, int z) const; // symbol: ?levelChunkNeedsUpgrade@TheEndDimension@@UEBA_NAEBVLevelChunk@@@Z - MCVAPI bool levelChunkNeedsUpgrade(class LevelChunk const& lc) const; + virtual bool levelChunkNeedsUpgrade(class LevelChunk const& lc) const; // symbol: ?mayRespawnViaBed@TheEndDimension@@UEBA_NXZ - MCVAPI bool mayRespawnViaBed() const; + virtual bool mayRespawnViaBed() const; // symbol: ?serialize@TheEndDimension@@UEBAXAEAVCompoundTag@@@Z - MCVAPI void serialize(class CompoundTag& tag) const; + virtual void serialize(class CompoundTag& tag) const; // symbol: ?startLeaveGame@TheEndDimension@@UEAAXXZ - MCVAPI void startLeaveGame(); + virtual void startLeaveGame(); // symbol: ?tick@TheEndDimension@@UEAAXXZ - MCVAPI void tick(); + virtual void tick(); // symbol: ?translatePosAcrossDimension@TheEndDimension@@UEBA?AVVec3@@AEBV2@V?$AutomaticID@VDimension@@H@@@Z - MCVAPI class Vec3 translatePosAcrossDimension(class Vec3 const& originalPos, DimensionType fromId) const; + virtual class Vec3 translatePosAcrossDimension(class Vec3 const& originalPos, DimensionType fromId) const; // symbol: ?upgradeLevelChunk@TheEndDimension@@UEAAXAEAVChunkSource@@AEAVLevelChunk@@1@Z - MCVAPI void upgradeLevelChunk(class ChunkSource& source, class LevelChunk& lc, class LevelChunk& generatedChunk); + virtual void upgradeLevelChunk(class ChunkSource& source, class LevelChunk& lc, class LevelChunk& generatedChunk); // symbol: ?AMBIENT_MULTIPLIER@TheEndDimension@@2MB MCAPI static float const AMBIENT_MULTIPLIER; diff --git a/src/mc/world/level/levelgen/VoidGenerator.h b/src/mc/world/level/levelgen/VoidGenerator.h index 88a4c27d1e..60613e5976 100644 --- a/src/mc/world/level/levelgen/VoidGenerator.h +++ b/src/mc/world/level/levelgen/VoidGenerator.h @@ -47,16 +47,16 @@ class VoidGenerator : public ::WorldGenerator { class Random& random ) const; - // vIndex: 42, symbol: ?findSpawnPosition@VoidGenerator@@UEBA?AVBlockPos@@XZ + // vIndex: 43, symbol: ?findSpawnPosition@VoidGenerator@@UEBA?AVBlockPos@@XZ virtual class BlockPos findSpawnPosition() const; - // vIndex: 39, symbol: ?getBiomeArea@VoidGenerator@@UEBA?AVBiomeArea@@AEBVBoundingBox@@I@Z + // vIndex: 40, symbol: ?getBiomeArea@VoidGenerator@@UEBA?AVBiomeArea@@AEBVBoundingBox@@I@Z virtual class BiomeArea getBiomeArea(class BoundingBox const& area, uint scale) const; - // vIndex: 40, symbol: ?getBiomeSource@VoidGenerator@@UEBAAEBVBiomeSource@@XZ + // vIndex: 41, symbol: ?getBiomeSource@VoidGenerator@@UEBAAEBVBiomeSource@@XZ virtual class BiomeSource const& getBiomeSource() const; - // vIndex: 41, symbol: ?getBlockVolumeDimensions@VoidGenerator@@UEBA?AUBlockVolumeDimensions@WorldGenerator@@XZ + // vIndex: 42, symbol: ?getBlockVolumeDimensions@VoidGenerator@@UEBA?AUBlockVolumeDimensions@WorldGenerator@@XZ virtual struct WorldGenerator::BlockVolumeDimensions getBlockVolumeDimensions() const; // vIndex: 11, symbol: ?loadChunk@VoidGenerator@@UEAAXAEAVLevelChunk@@_N@Z @@ -65,7 +65,7 @@ class VoidGenerator : public ::WorldGenerator { // vIndex: 9, symbol: ?postProcess@VoidGenerator@@UEAA_NAEAVChunkViewSource@@@Z virtual bool postProcess(class ChunkViewSource& neighborhood); - // vIndex: 38, symbol: + // vIndex: 39, symbol: // ?prepareAndComputeHeights@VoidGenerator@@UEAAXAEAVBlockVolume@@AEBVChunkPos@@AEAV?$vector@FV?$allocator@F@std@@@std@@_NH@Z virtual void prepareAndComputeHeights( class BlockVolume& box, @@ -75,7 +75,7 @@ class VoidGenerator : public ::WorldGenerator { int skipTopN ); - // vIndex: 37, symbol: ?prepareHeights@VoidGenerator@@UEAAXAEAVBlockVolume@@AEBVChunkPos@@_N@Z + // vIndex: 38, symbol: ?prepareHeights@VoidGenerator@@UEAAXAEAVBlockVolume@@AEBVChunkPos@@_N@Z virtual void prepareHeights(class BlockVolume& box, class ChunkPos const& chunkPos, bool factorInBeardsAndShavers); // symbol: ??0VoidGenerator@@QEAA@AEAVDimension@@@Z diff --git a/src/mc/world/level/levelgen/WorldGenerator.h b/src/mc/world/level/levelgen/WorldGenerator.h index 09dbc3cc22..cd5421418e 100644 --- a/src/mc/world/level/levelgen/WorldGenerator.h +++ b/src/mc/world/level/levelgen/WorldGenerator.h @@ -1,13 +1,22 @@ #pragma once #include "mc/_HeaderOutputPredefine.h" +#include "mc/deps/core/threading/SpinLock.h" +#include "mc/world/level/chunk/ChunkSource.h" +#include "mc/world/level/levelgen/v1/IPreliminarySurfaceProvider.h" // auto generated inclusion list #include "mc/deps/core/data/DividedPos2d.h" #include "mc/deps/core/utility/buffer_span.h" #include "mc/world/level/levelgen/structure/StructureFeatureType.h" -class WorldGenerator { +class HardcodedSpawnAreaRegistry; +class StructureFeatureRegistry; +class AirBlockCache; +class BiomeArea; +class HashedString; + +class WorldGenerator : public ChunkSource, public IPreliminarySurfaceProvider { public: // WorldGenerator inner types declare // clang-format off @@ -16,13 +25,20 @@ class WorldGenerator { // WorldGenerator inner types define struct BlockVolumeDimensions { - public: - // prevent constructor by default - BlockVolumeDimensions& operator=(BlockVolumeDimensions const&); - BlockVolumeDimensions(BlockVolumeDimensions const&); - BlockVolumeDimensions(); + uint mWidth; // this+0x0 + uint mDepth; // this+0x4 + uint mHeight; // this+0x8 }; + AirBlockCache* airBlockCache; // this+0x78 + std::unique_ptr mHardcodedSpawnTypes; // this+0x80 + std::unique_ptr mStructureFeatureRegistry; // this+0x88 + uchar unk_144[160]; + + // unk_304 is std::unordered_map but unknown key and value + uchar unk_304[64]; + SpinLock mSpinLock; + public: // prevent constructor by default WorldGenerator& operator=(WorldGenerator const&); @@ -31,39 +47,83 @@ class WorldGenerator { public: // NOLINTBEGIN - // symbol: ?addHardcodedSpawnAreas@WorldGenerator@@UEAAXAEAVLevelChunk@@@Z - MCVAPI void addHardcodedSpawnAreas(class LevelChunk& lc); + // symbol: ??1WorldGenerator@@UEAA@XZ + virtual ~WorldGenerator(); - // symbol: ?debugRender@WorldGenerator@@UEAAXXZ - MCVAPI void debugRender(); + // symbol: ?init@WorldGenerator@@UEAAXXZ + virtual void init(); + + // symbol: ?findStructureFeatureTypeAt@WorldGenerator@@UEAA?AW4StructureFeatureType@@AEBVBlockPos@@@Z + virtual ::StructureFeatureType findStructureFeatureTypeAt(class BlockPos const& pos); + + // symbol: ?isStructureFeatureTypeAt@WorldGenerator@@UEBA_NAEBVBlockPos@@W4StructureFeatureType@@@Z + virtual bool isStructureFeatureTypeAt(class BlockPos const& pos, ::StructureFeatureType type) const; // symbol: // ?findNearestStructureFeature@WorldGenerator@@UEAA_NW4StructureFeatureType@@AEBVBlockPos@@AEAV3@_NV?$optional@VHashedString@@@std@@@Z - MCVAPI bool + virtual bool findNearestStructureFeature(::StructureFeatureType, class BlockPos const&, class BlockPos&, bool, std::optional); - // symbol: ?findStructureFeatureTypeAt@WorldGenerator@@UEAA?AW4StructureFeatureType@@AEBVBlockPos@@@Z - MCVAPI ::StructureFeatureType findStructureFeatureTypeAt(class BlockPos const& pos); - // symbol: ?garbageCollectBlueprints@WorldGenerator@@UEAAXV?$buffer_span@VChunkPos@@@@@Z - MCVAPI void garbageCollectBlueprints(class buffer_span activeChunks); - + virtual void garbageCollectBlueprints(class buffer_span activeChunks); + + // vIndex: 38 + virtual void + prepareHeights(class BlockVolume& box, class ChunkPos const& chunkPos, bool factorInBeardsAndShavers) = 0; + + // vIndex: 39 + virtual void prepareAndComputeHeights( + class BlockVolume& box, + class ChunkPos const& chunkPos, + std::vector& ZXheights, + bool factorInBeardsAndShavers, + int skipTopN + ) = 0; + + // vIndex: 40 + virtual class BiomeArea getBiomeArea(class BoundingBox const& area, uint scale) const = 0; + + // vIndex: 41 + virtual class BiomeSource const& getBiomeSource() const = 0; + + // vIndex: 42 + virtual struct WorldGenerator::BlockVolumeDimensions getBlockVolumeDimensions() const = 0; + + // vIndex: 43 + virtual class BlockPos findSpawnPosition() const = 0; + + // vIndex: 44, symbol: ?addHardcodedSpawnAreas@WorldGenerator@@UEAAXAEAVLevelChunk@@@Z + virtual void addHardcodedSpawnAreas(class LevelChunk& lc); + + // vIndex: 45, symbol: ?debugRender@WorldGenerator@@UEAAXXZ + virtual void debugRender(); + + // vIndex: 46 + virtual void decorateWorldGenLoadChunk( + class Biome& biome, + class LevelChunk& lc, + class BlockVolumeTarget& target, + class Random& random, + class ChunkPos const& pos + ) const = 0; + + // vIndex: 47 + virtual void decorateWorldGenPostProcess( + class Biome& biome, + class LevelChunk& lc, + class BlockSource& source, + class Random& random + ) const = 0; + + // IPreliminarySurfaceProvider vtable overloaded functions // symbol: ?getPreliminarySurfaceLevel@WorldGenerator@@UEBA?AV?$optional@F@std@@V?$DividedPos2d@$03@@@Z - MCVAPI std::optional getPreliminarySurfaceLevel(class DividedPos2d<4> worldPos) const; - - // symbol: ?init@WorldGenerator@@UEAAXXZ - MCVAPI void init(); - - // symbol: ?isStructureFeatureTypeAt@WorldGenerator@@UEBA_NAEBVBlockPos@@W4StructureFeatureType@@@Z - MCVAPI bool isStructureFeatureTypeAt(class BlockPos const& pos, ::StructureFeatureType type) const; + virtual std::optional getPreliminarySurfaceLevel(class DividedPos2d<4> worldPos) const; + // ChunkSource vtable overloaded function // symbol: ?postProcessMobsAt@WorldGenerator@@UEAAXAEAVBlockSource@@HHAEAVRandom@@@Z - MCVAPI void + virtual void postProcessMobsAt(class BlockSource& blockSource, int chunkWestBlock, int chunkNorthBlock, class Random& random); - // symbol: ??1WorldGenerator@@UEAA@XZ - MCVAPI ~WorldGenerator(); - // symbol: ??0WorldGenerator@@QEAA@AEAVDimension@@@Z MCAPI explicit WorldGenerator(class Dimension& dimension); diff --git a/src/mc/world/level/levelgen/flat/FlatWorldGenerator.h b/src/mc/world/level/levelgen/flat/FlatWorldGenerator.h index 19ae3ab588..4946cb5693 100644 --- a/src/mc/world/level/levelgen/flat/FlatWorldGenerator.h +++ b/src/mc/world/level/levelgen/flat/FlatWorldGenerator.h @@ -3,6 +3,9 @@ #include "mc/_HeaderOutputPredefine.h" #include "mc/world/level/biome/source/FixedBiomeSource.h" #include "mc/world/level/block/BlockVolume.h" +#include "mc/world/level/chunk/LevelChunk.h" +#include "mc/world/level/levelgen/v1/ChunkLocalNoiseCache.h" +#include "mc/world/level/levelgen/v1/WorldGenCache.h" // auto generated inclusion list #include "mc/deps/core/utility/buffer_span.h" @@ -78,7 +81,22 @@ class FlatWorldGenerator : public ::WorldGenerator { virtual bool postProcess(class ChunkViewSource&); // vIndex: 11, symbol: ?loadChunk@FlatWorldGenerator@@UEAAXAEAVLevelChunk@@_N@Z - virtual void loadChunk(class LevelChunk&, bool); + virtual void loadChunk(class LevelChunk& levelChunk, bool unk) { + auto chunkPos = levelChunk.getPosition(); + auto blockPos = BlockPos(chunkPos, 0); + DividedPos2d<4> dividedPos2D; + dividedPos2D.x = (blockPos.x>>31) - ((blockPos.x>>31) - blockPos.x)/4; + dividedPos2D.z = (blockPos.z>>31) - ((blockPos.z>>31) - blockPos.z)/4; + SurfaceLevelCache surfaceLevelCache(dividedPos2D, mUnk, 4); + WorldGenerator::prepareStructureFeatureBlueprints(*mDimension, chunkPos, getBiomeSource(), surfaceLevelCache); + levelChunk.setBlockVolume(mPrototype, 0); + levelChunk.recomputeHeightMap(0); + mBiomeSource = std::make_unique(); + ChunkLocalNoiseCache chunkLocalNoiseCache; + mBiomeSource->fillBiomes(levelChunk, chunkLocalNoiseCache); + levelChunk.setSaved(); + levelChunk.changeState(ChunkState::Generating, ChunkState::Generated); + }; // symbol: ??0FlatWorldGenerator@@QEAA@AEAVDimension@@IAEBVValue@Json@@@Z MCAPI FlatWorldGenerator(class Dimension& dimension, uint, class Json::Value const& generationOptionsJSON); diff --git a/src/mc/world/level/levelgen/v1/OverworldGenerator.h b/src/mc/world/level/levelgen/v1/OverworldGenerator.h index bb13cbc975..5828c982e4 100644 --- a/src/mc/world/level/levelgen/v1/OverworldGenerator.h +++ b/src/mc/world/level/levelgen/v1/OverworldGenerator.h @@ -42,20 +42,26 @@ class OverworldGenerator : public ::WorldGenerator { public: // NOLINTBEGIN // vIndex: 9, symbol: ?postProcess@OverworldGenerator@@UEAA_NAEAVChunkViewSource@@@Z - virtual bool postProcess(class ChunkViewSource&); + virtual bool postProcess(class ChunkViewSource& neighborhood); // vIndex: 11, symbol: ?loadChunk@OverworldGenerator@@UEAAXAEAVLevelChunk@@_N@Z - virtual void loadChunk(class LevelChunk&, bool); + virtual void loadChunk(class LevelChunk& lc, bool forceImmediateReplacementDataLoad); // vIndex: 37, symbol: ?prepareHeights@OverworldGenerator@@UEAAXAEAVBlockVolume@@AEBVChunkPos@@_N@Z - virtual void prepareHeights(class BlockVolume&, class ChunkPos const&, bool); + virtual void prepareHeights(class BlockVolume& box, class ChunkPos const& chunkPos, bool factorInBeardsAndShavers); // vIndex: 38, symbol: // ?prepareAndComputeHeights@OverworldGenerator@@UEAAXAEAVBlockVolume@@AEBVChunkPos@@AEAV?$vector@FV?$allocator@F@std@@@std@@_NH@Z - virtual void prepareAndComputeHeights(class BlockVolume&, class ChunkPos const&, std::vector&, bool, int); + virtual void prepareAndComputeHeights( + class BlockVolume& box, + class ChunkPos const& chunkPos, + std::vector& ZXheights, + bool factorInBeardsAndShavers, + int skipTopN + ); // vIndex: 39, symbol: ?getBiomeArea@OverworldGenerator@@UEBA?AVBiomeArea@@AEBVBoundingBox@@I@Z - virtual class BiomeArea getBiomeArea(class BoundingBox const&, uint) const; + virtual class BiomeArea getBiomeArea(class BoundingBox const& area, uint scale) const; // vIndex: 41, symbol: ?getBlockVolumeDimensions@OverworldGenerator@@UEBA?AUBlockVolumeDimensions@WorldGenerator@@XZ virtual struct WorldGenerator::BlockVolumeDimensions getBlockVolumeDimensions() const; @@ -72,7 +78,7 @@ class OverworldGenerator : public ::WorldGenerator { // vIndex: 47 virtual class Util::MultidimensionalArray - generateDensityCellsForChunk(class ChunkPos const&) const = 0; + generateDensityCellsForChunk(class ChunkPos const& chunkPos) const = 0; // vIndex: 48 virtual int getLevelGenHeight() const = 0; @@ -91,7 +97,7 @@ class OverworldGenerator : public ::WorldGenerator { ) const; // vIndex: 51, symbol: ?createNoiseCache@OverworldGenerator@@MEBA?AVChunkLocalNoiseCache@@VChunkPos@@@Z - virtual class ChunkLocalNoiseCache createNoiseCache(class ChunkPos) const; + virtual class ChunkLocalNoiseCache createNoiseCache(class ChunkPos chunkPos) const; // vIndex: 52, symbol: ?createWorldGenCache@OverworldGenerator@@MEBA?AVWorldGenCache@@VChunkPos@@@Z virtual class WorldGenCache createWorldGenCache(class ChunkPos) const; @@ -104,14 +110,14 @@ class OverworldGenerator : public ::WorldGenerator { // vIndex: 55 virtual void _prepareHeights( - class BlockVolume&, - class ChunkPos const&, - class WorldGenCache const&, - class Aquifer*, - std::function&&, - bool, - std::vector*, - int + class BlockVolume& box, + class ChunkPos const& chunkPos, + class WorldGenCache const& worldGenCache, + class Aquifer* aquiferPtr, + std::function&& tickUpdateFn, + bool factorInBeardsAndShavers, + std::vector* ZXheights, + int skipTopN ) = 0; // symbol: ??1OverworldGenerator@@UEAA@XZ