40 using BlockStateValueType = std::variant<int, float, bool, std::string>;
41 using BlockStatesType = std::vector<std::pair<std::string, BlockStateValueType>>;
48 tryGetFromRegistry(
HashedString const& name, BlockStatesType
const& states);
55 LLNDAPI
bool isAir()
const;
57 [[nodiscard]]
BlockType const& getBlockType()
const {
return *mBlockType; }
59 [[nodiscard]] std::string
const& getTypeName()
const {
return getBlockType().getTypeName(); }
61 [[nodiscard]]
short getBlockItemId()
const {
return getBlockType().getBlockItemId(); }
63 [[nodiscard]] ushort getData()
const {
return mData; }
66 std::optional<T> getState(uint64
id)
const {
67 return mBlockType->getState<T>(id, mData);
71 std::optional<T> getState(
BlockState const& state)
const {
72 return mBlockType->getState<T>(state, mData);
77 return mBlockType->trySetState(
id, value, mData);
82 return mBlockType->trySetState(state, value, mData);
85 bool operator==(
Block const& other)
const {
return mSerializationIdHash == other.mSerializationIdHash; }
90 ::ll::TypedStorage<8, 104, ::BlockComponentStorage> mComponents;
91 ::ll::TypedStorage<2, 2, ushort const> mData;
92 ::ll::TypedStorage<8, 8, ::gsl::not_null<::BlockType*>> mBlockType;
93 ::ll::TypedStorage<4, 8, ::CachedComponentData> mCachedComponentData;
94 ::ll::TypedStorage<8, 112, ::BlockComponentDirectData> mDirectData;
95 ::ll::TypedStorage<8, 24, ::std::vector<::HashedString>> mTags;
96 ::ll::TypedStorage<8, 24, ::CompoundTag> mSerializationId;
97 ::ll::TypedStorage<8, 8, uint64> mSerializationIdHash;
98 ::ll::TypedStorage<4, 4, uint> mSerializationIdHashForNetwork;
99 ::ll::TypedStorage<4, 4, uint> mNetworkId;
100 ::ll::TypedStorage<1, 1, bool> mHasRuntimeId;
111 virtual ~Block() =
default;
117 MCAPI
Block(ushort data, ::gsl::not_null<::BlockType*> oldBlock);
119 MCAPI
Block(ushort data, ::gsl::not_null<::BlockType*> oldBlock,
::CompoundTag serId, uint
const& runId);
121 MCAPI
bool _isSolid()
const;
123 MCAPI
void _queueForTickBasedOnComponentConfiguration(
138 MCAPI ::std::string buildDescriptionName()
const;
140 MCAPI
void buildSerializationId(uint latestUpdaterVersion);
142 MCAPI
bool canProvideFullSupport(uchar face)
const;
148 MCAPI ::HitResult clip(
153 ::ShapeType shapeType,
157 MCAPI uint computeRawSerializationIdHashForNetwork()
const;
159 MCAPI ::Block
const& connectionUpdate(
167 MCAPI ::Block
const& copyStates(
::Block const& fromBlock)
const;
169 MCAPI
void executeItemEvent(
171 ::std::string
const& eventName,
179 MCAPI
bool getCollisionShape(
186 MCAPI ::std::string getDescriptionId()
const;
188 MCAPI ::Block
const& getStateFromLegacyData(ushort data)
const;
192 MCAPI
bool hasState(
::BlockState const& stateType)
const;
198 MCAPI
bool isPreservingMediumWhenPlaced(
::Block const& medium)
const;
200 MCAPI
bool isSolidBlockingBlockAndNotSignalSource()
const;
223 MCAPI
bool shouldRandomTick()
const;
225 MCAPI ::std::string toDebugString()
const;
227 MCAPI
bool use(
::Player& player,
::BlockPos const& pos, uchar face, ::std::optional<::Vec3> hit)
const;
233 MCAPI static ::std::string
const& BLOCK_DESCRIPTION_PREFIX();
239 MCAPI
void* $ctor(ushort data, ::gsl::not_null<::BlockType*> oldBlock);
241 MCAPI
void* $ctor(ushort data, ::gsl::not_null<::BlockType*> oldBlock,
::CompoundTag serId, uint
const& runId);
247 MCAPI
static void** $vftable();