mirror of
https://github.com/quizhizhe/LiteLoaderBDS-1.16.40.git
synced 2025-06-01 19:53:41 +00:00
Level::BlockPalettePtr
replace Level::BlockPalette
This commit is contained in:
parent
bcd2a1f717
commit
67688fe8e7
@ -4,13 +4,20 @@
|
||||
#include "../Global.h"
|
||||
|
||||
#define BEFORE_EXTRA
|
||||
|
||||
class BlockLegacy;
|
||||
#include <MC/Bedrock.hpp>
|
||||
#undef BEFORE_EXTRA
|
||||
|
||||
class BlockPalette {
|
||||
|
||||
#define AFTER_EXTRA
|
||||
|
||||
public:
|
||||
std::mutex mLegacyBlockStatesConversionWarningMutex;
|
||||
std::set<std::pair<int,int>> mLegacyBlockStatesConversionWarningSet;
|
||||
std::map<std::string,BlockLegacy const*> mNameLookup;
|
||||
std::map<CompoundTag,Block const*>mBlockFromSerId;
|
||||
std::vector<Block const*>mBlockFromRuntimeId;
|
||||
Level *mLevel;
|
||||
#undef AFTER_EXTRA
|
||||
#ifndef DISABLE_CONSTRUCTOR_PREVENTION_BLOCKPALETTE
|
||||
public:
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
//Helper
|
||||
LIAPI static BlockSource* getBlockSource(int dimid);
|
||||
LIAPI static BlockSource* getBlockSource(Actor* actor);
|
||||
//LIAPI static BlockPalette* getBlockPalette();
|
||||
LIAPI static BlockPalette* getBlockPalettePtr();
|
||||
//LIAPI static Dimension* getDimension(class AutomaticID<class Dimension, int> a0);
|
||||
LIAPI static Actor* getDamageSourceEntity(ActorDamageSource* ads);
|
||||
LIAPI static void broadcastText(const string& text, TextType type);
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include <MC/Level.hpp>
|
||||
|
||||
Block* Block::create(const string& name, unsigned short tileData) {
|
||||
BlockPalette& generator = Global<Level>->getBlockPalette();
|
||||
auto blk = generator.getBlockLegacy(name);
|
||||
BlockPalette* generator = Global<Level>->getBlockPalettePtr();
|
||||
auto blk = generator->getBlockLegacy(name);
|
||||
if (!blk)
|
||||
return nullptr;
|
||||
return (Block*)((BlockLegacy*)blk)->toBlock(tileData);
|
||||
|
@ -62,6 +62,10 @@ Block* Level::getBlock(const BlockPos& pos, BlockSource* blockSource) {
|
||||
return (Block*)&(blockSource->getBlock(pos));
|
||||
}
|
||||
|
||||
BlockPalette* Level::getBlockPalettePtr(){
|
||||
// MovingBlockActor::load Line69
|
||||
return dAccess<BlockPalette*>(Global<Level>,2000);
|
||||
};
|
||||
|
||||
// Return nullptr when failing to get block
|
||||
Block* Level::getBlockEx(const BlockPos& pos, int dimId) {
|
||||
|
@ -41,13 +41,13 @@
|
||||
|
||||
#include <MC/BlockPalette.hpp>
|
||||
bool StructureTemplate::toWorld(int dimID, BlockPos const& p1, Mirror mirror, Rotation rotation) {
|
||||
auto& palette = Global<Level>->getBlockPalette();
|
||||
auto palette = Global<Level>->getBlockPalettePtr();
|
||||
auto bs = Level::getBlockSource(dimID);
|
||||
auto setting = StructureSettings();
|
||||
setting.setMirror(mirror);
|
||||
setting.setStructureSize(getSize());
|
||||
setting.setRotation(rotation);
|
||||
placeInWorld(*bs, palette, p1, setting, nullptr, false);
|
||||
placeInWorld(*bs, *palette, p1, setting, nullptr, false);
|
||||
return true;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user