Skip to content

Commit

Permalink
Fix: Fix the issue with IFeature vtable and the issue with StackResul…
Browse files Browse the repository at this point in the history
…tStorageFeature::tryUnwrap.
  • Loading branch information
Lovelylavender4 committed Jan 18, 2024
1 parent 85f5f2a commit 3175162
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/mc/world/level/levelgen/feature/IFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@ class IFeature {

public:
// NOLINTBEGIN
// vIndex: 0
virtual ~IFeature() = default;

// vIndex: 1
// virtual std::optional<class BlockPos>
// place(class IBlockWorldGenAPI&, class BlockPos const&, class Random&, class RenderParams&) const = 0;
virtual std::optional<class BlockPos>
place(class IBlockWorldGenAPI&, class BlockPos const&, class Random&, class RenderParams&) const = 0;

// vIndex: 2, symbol:
// ?isValidPlacement@IFeature@@UEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
// virtual bool isValidPlacement(std::string const&);
virtual bool isValidPlacement(std::string const&);

// symbol: ?setBlockSafe@IFeature@@QEBA_NAEAVIBlockWorldGenAPI@@AEBVBlockPos@@AEBVBlock@@H@Z
MCAPI bool
setBlockSafe(class IBlockWorldGenAPI& target, class BlockPos const& pos, class Block const& block, int updateFlags)
const;

// NOLINTEND
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class StackResultStorageFeature {
template <class T = IFeature>
[[nodiscard]] optional_ref<T> tryUnwrap() const {
if (_hasValue()) {
return *(T*)(&_getStackRef());
return reinterpret_cast<T*>(&_getStackRef());
}
return nullptr;
}
Expand Down

0 comments on commit 3175162

Please sign in to comment.