45 using BlockStateValueType = std::variant<int, float, bool, std::string>;
46 using BlockStatesType = std::vector<std::pair<std::string, BlockStateValueType>>;
53 tryGetFromRegistry(
HashedString const& name, BlockStatesType
const& states);
60 LLNDAPI
bool isAir()
const;
62 [[nodiscard]]
BlockType const& getBlockType()
const {
return *mBlockType; }
64 [[nodiscard]] std::string
const& getTypeName()
const {
return getBlockType().getTypeName(); }
66 [[nodiscard]]
unsigned short getBlockItemId()
const {
return getBlockType().mID->mValue; }
68 [[nodiscard]] ushort getData()
const {
return mData; }
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; }
95 ::ll::TypedStorage<8, 104, ::BlockComponentStorage> mComponents;
96 ::ll::TypedStorage<2, 2, ushort const> mData;
97 ::ll::TypedStorage<8, 8, ::gsl::not_null<::BlockType*>> mBlockType;
98 ::ll::TypedStorage<4, 8, ::CachedComponentData> mCachedComponentData;
99 ::ll::TypedStorage<8, 96, ::BlockComponentDirectData> mDirectData;
100 ::ll::TypedStorage<8, 24, ::std::vector<::HashedString>> mTags;
101 ::ll::TypedStorage<8, 24, ::CompoundTag> mSerializationId;
102 ::ll::TypedStorage<8, 8, uint64> mSerializationIdHash;
103 ::ll::TypedStorage<4, 4, uint> mSerializationIdHashForNetwork;
104 ::ll::TypedStorage<4, 4, uint> mNetworkId;
105 ::ll::TypedStorage<1, 1, bool> mHasRuntimeId;
106 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IClientBlockData>> mClientData;
116 virtual ~Block() =
default;
122 MCAPI Block(ushort data, ::gsl::not_null<::BlockType*> oldBlock);
124 MCAPI Block(ushort data, ::gsl::not_null<::BlockType*> oldBlock,
::CompoundTag serId, uint
const& runId);
134 MCAPI ::std::string buildDescriptionName()
const;
136 MCAPI
void buildSerializationId(uint latestUpdaterVersion);
138 MCAPI
bool canConnect(::Block
const& connectionBlock, uchar toOther)
const;
142 MCAPI ::HitResult clip(
147 ::ShapeType shapeType,
151 MCAPI uint computeRawSerializationIdHashForNetwork()
const;
153 MCAPI ::Block
const& connectionUpdate(
159 MCAPI ::Block
const& copyState(::Block
const& fromBlock,
::BlockState const& state)
const;
161 MCAPI ::Block
const& copyStates(::Block
const& fromBlock)
const;
163 MCAPI
void executeItemEvent(
165 ::std::string
const& eventName,
175 MCAPI
bool getCollisionShape(
182 MCAPI_C ::BlockType::HorizontalDirectionBits
185 MCAPI_C ::std::string getCraftingLabelText()
const;
187 MCAPI ::std::string getDescriptionId()
const;
189 MCAPI_C ::VoxelShapes::VoxelShape
const* getOcclusionFaceShape(uchar face)
const;
191 MCAPI_C ::AABB
const&
194 MCAPI_S ::Vec3 getRandomOffset(
::BlockPos const& pos)
const;
198 MCAPI ::Block
const& getStateFromLegacyData(ushort data)
const;
202 MCAPI
bool hasState(
::BlockState const& stateType)
const;
206 MCAPI_C
bool isCraftingBlock()
const;
208 MCAPI_C
bool isInteractiveBlock()
const;
212 MCAPI
bool isPreservingMediumWhenPlaced(::Block
const& medium)
const;
214 MCAPI
bool isSolidBlockingBlockAndNotSignalSource()
const;
241 MCAPI
bool shouldRandomTick()
const;
243 MCAPI ::std::string toDebugString()
const;
245 MCAPI
bool use(
::Player& player,
::BlockPos const& pos, uchar face, ::std::optional<::Vec3> hit)
const;
251 MCAPI static ::std::string
const& BLOCK_DESCRIPTION_PREFIX();
257 MCAPI
void* $ctor(ushort data, ::gsl::not_null<::BlockType*> oldBlock);
259 MCAPI
void* $ctor(ushort data, ::gsl::not_null<::BlockType*> oldBlock,
::CompoundTag serId, uint
const& runId);
265 MCAPI
static void** $vftable();