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