44 using BlockStateValueType = std::variant<int, float, bool, std::string>;
45 using BlockStatesType = std::vector<std::pair<std::string, BlockStateValueType>>;
52 tryGetFromRegistry(
HashedString const& name, BlockStatesType
const& states);
55 LLNDAPI
bool isAir()
const;
56 [[nodiscard]]
inline bool hasProperty(BlockProperty type)
const {
57 return static_cast<uint64
>(type) &
static_cast<uint64
>(mBlockType->mProperties);
60 [[nodiscard]]
BlockType const& getBlockType()
const {
return *mBlockType; }
62 [[nodiscard]] std::string
const& getTypeName()
const {
return getBlockType().getTypeName(); }
64 [[nodiscard]]
unsigned short getBlockItemId()
const {
return getBlockType().mID->mValue; }
66 [[nodiscard]] ushort getData()
const {
return mData; }
68 [[nodiscard]]
Material const& getMaterial()
const {
return getBlockType().mMaterial; }
71 std::optional<T> getState(uint64
id)
const {
72 return mBlockType->getState<T>(id, mData);
76 std::optional<T> getState(
BlockState const& state)
const {
77 return mBlockType->getState<T>(state, mData);
82 return mBlockType->trySetState(
id, value, mData);
87 return mBlockType->trySetState(state, value, mData);
90 bool operator==(Block
const& other)
const {
return mSerializationIdHash == other.mSerializationIdHash; }
93 MCAPI T
const* tryGetComponent()
const;
97 mCachedComponentData->mEmissiveBrightness->mValue = mBlockType->getEmissiveBrightness(*this).mValue;
98 mCachedComponentData->mIsSolid = _isSolid();
108 ::ll::TypedStorage<8, 96, ::BlockComponentStorage> mComponents;
109 ::ll::TypedStorage<8, 8, ::gsl::not_null<::BlockType*>> mBlockType;
110 ::ll::TypedStorage<4, 8, ::CachedComponentData> mCachedComponentData;
111 ::ll::TypedStorage<8, 96, ::BlockComponentDirectData> mDirectData;
112 ::ll::TypedStorage<8, 24, ::std::vector<::HashedString>> mTags;
113 ::ll::TypedStorage<8, 24, ::CompoundTag> mSerializationId;
114 ::ll::TypedStorage<8, 8, uint64> mSerializationIdHash;
115 ::ll::TypedStorage<4, 4, uint> mSerializationIdHashForNetwork;
116 ::ll::TypedStorage<4, 4, uint> mNetworkId;
117 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IClientBlockData>> mClientData;
118 ::ll::TypedStorage<2, 2, ushort const> mData;
119 ::ll::TypedStorage<1, 1, bool> mHasRuntimeId;
129 virtual ~Block() =
default;
135 MCNAPI
Block(ushort data, ::gsl::not_null<::BlockType*> oldBlock);
137 MCNAPI
Block(ushort data, ::gsl::not_null<::BlockType*> oldBlock,
::CompoundTag serId, uint
const& runId);
139 MCAPI
bool _isSolid()
const;
162 MCAPI ::std::string buildDescriptionName()
const;
166 MCNAPI
bool canConnect(::Block
const& connectionBlock, uchar toOther)
const;
168 MCAPI
bool canProvideFullSupport(uchar face)
const;
170 MCAPI
bool canProvideSupport(uchar face, ::BlockSupportType type)
const;
176 MCAPI ::HitResult
clip(
181 ::ShapeType shapeType,
185 MCAPI uint computeRawSerializationIdHashForNetwork()
const;
187 MCAPI ::Block
const& copyState(::Block
const& fromBlock,
::BlockState const& state)
const;
191 ::std::string
const& eventName,
198 MCAPI
void finalizeBlockComponentStorage();
203 MCNAPI ::std::string getCraftingLabelText()
const;
206 MCAPI ::std::string getDescriptionId()
const;
210 MCAPI ::std::string getDisplayName()
const;
214 MCAPI
bool isCropBlock()
const;
222 MCAPI ::Block
const& keepStates(::std::vector<::BlockState const*>
const& statesToKeep)
const;
235 MCAPI
void onStateChange(
238 ::Block
const& previousBlock,
248 MCAPI
void spawnResources(
256 MCAPI ::std::string toDebugString()
const;
259 use(
::Player& player,
::BlockPos const& pos, uchar face, ::HandSlot handSlot, ::std::optional<::Vec3> hit)
const;
265 MCAPI static ::std::string
const& BLOCK_DESCRIPTION_PREFIX();
271 MCNAPI
void*
$ctor(ushort data, ::gsl::not_null<::BlockType*> oldBlock);
273 MCNAPI
void*
$ctor(ushort data, ::gsl::not_null<::BlockType*> oldBlock,
::CompoundTag serId, uint
const& runId);
Definition BlockChangeContext.h:11
Definition ResourceDropsContext.h:16