43 using BlockStateValueType = std::variant<int, float, bool, std::string>;
44 using BlockStatesType = std::vector<std::pair<std::string, BlockStateValueType>>;
51 tryGetFromRegistry(
HashedString const& name, BlockStatesType
const& states);
54 LLNDAPI
bool isAir()
const;
55 [[nodiscard]]
inline bool hasProperty(BlockProperty type)
const {
56 return static_cast<uint64
>(type) &
static_cast<uint64
>(mBlockType->mProperties);
59 [[nodiscard]]
BlockType const& getBlockType()
const {
return *mBlockType; }
61 [[nodiscard]] std::string
const& getTypeName()
const {
return getBlockType().getTypeName(); }
63 [[nodiscard]]
unsigned short getBlockItemId()
const {
return getBlockType().mID->mValue; }
65 [[nodiscard]] ushort getData()
const {
return mData; }
67 [[nodiscard]]
Material const& getMaterial()
const {
return getBlockType().mMaterial; }
70 std::optional<T> getState(uint64
id)
const {
71 return mBlockType->getState<T>(id, mData);
75 std::optional<T> getState(
BlockState const& state)
const {
76 return mBlockType->getState<T>(state, mData);
81 return mBlockType->trySetState(
id, value, mData);
86 return mBlockType->trySetState(state, value, mData);
89 bool operator==(Block
const& other)
const {
return mSerializationIdHash == other.mSerializationIdHash; }
92 MCAPI T
const* tryGetComponent()
const;
96 mCachedComponentData->mEmissiveBrightness->mValue = mBlockType->getEmissiveBrightness(*this).mValue;
97 mCachedComponentData->mIsSolid = _isSolid();
107 ::ll::TypedStorage<8, 96, ::BlockComponentStorage> mComponents;
108 ::ll::TypedStorage<8, 8, ::gsl::not_null<::BlockType*>> mBlockType;
109 ::ll::TypedStorage<4, 8, ::CachedComponentData> mCachedComponentData;
110 ::ll::TypedStorage<8, 96, ::BlockComponentDirectData> mDirectData;
111 ::ll::TypedStorage<8, 24, ::std::vector<::HashedString>> mTags;
112 ::ll::TypedStorage<8, 24, ::CompoundTag> mSerializationId;
113 ::ll::TypedStorage<8, 8, uint64> mSerializationIdHash;
114 ::ll::TypedStorage<4, 4, uint> mSerializationIdHashForNetwork;
115 ::ll::TypedStorage<4, 4, uint> mNetworkId;
116 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IClientBlockData>> mClientData;
117 ::ll::TypedStorage<2, 2, ushort const> mData;
118 ::ll::TypedStorage<1, 1, bool> mHasRuntimeId;
128 virtual ~Block() =
default;
134 MCAPI Block(ushort data, ::gsl::not_null<::BlockType*> oldBlock);
136 MCAPI Block(ushort data, ::gsl::not_null<::BlockType*> oldBlock,
::CompoundTag serId, uint
const& runId);
138 MCAPI
bool _isSolid()
const;
144 MCAPI
void _queueForTickBasedOnComponentConfiguration(
159 MCAPI ::std::string buildDescriptionId()
const;
161 MCAPI ::std::string buildDescriptionName()
const;
163 MCAPI
void buildSerializationId(uint latestUpdaterVersion);
165 MCAPI
bool canConnect(::Block
const& connectionBlock, uchar toOther)
const;
167 MCAPI
bool canProvideFullSupport(uchar face)
const;
169 MCAPI
bool canProvideSupport(uchar face, ::BlockSupportType type)
const;
175 MCAPI ::HitResult clip(
180 ::ShapeType shapeType,
184 MCAPI uint computeRawSerializationIdHashForNetwork()
const;
186 MCAPI ::Block
const& copyState(::Block
const& fromBlock,
::BlockState const& state)
const;
188 MCAPI
void executeItemEvent(
190 ::std::string
const& eventName,
196 MCAPI
void finalizeBlockComponentStorage();
198 MCAPI ::std::optional<::ConnectionID> getConnectionID()
const;
201 MCAPI ::std::string getCraftingLabelText()
const;
204 MCAPI ::std::string getDescriptionId()
const;
208 MCAPI ::std::string getDisplayName()
const;
212 MCAPI
bool isCropBlock()
const;
216 MCAPI
bool isPreservingMediumWhenPlaced(::Block
const& medium)
const;
220 MCAPI ::Block
const& keepStates(::std::vector<::BlockState const*>
const& statesToKeep)
const;
226 MCAPI
void onActorEvent(
::BlockPos const& pos, ::std::string
const& eventName,
::Actor& sourceEntity)
const;
228 MCAPI
void onActorInternalEvent(
::BlockPos const& pos, ::std::string
const& eventName,
::Actor& sourceEntity)
const;
238 MCAPI
void spawnResources(
246 MCAPI ::std::string toDebugString()
const;
249 use(
::Player& player,
::BlockPos const& pos, uchar face, ::HandSlot handSlot, ::std::optional<::Vec3> hit)
const;
255 MCAPI static ::std::string
const& BLOCK_DESCRIPTION_PREFIX();
261 MCAPI
void* $ctor(ushort data, ::gsl::not_null<::BlockType*> oldBlock);
263 MCAPI
void* $ctor(ushort data, ::gsl::not_null<::BlockType*> oldBlock,
::CompoundTag serId, uint
const& runId);
269 MCAPI
static void** $vftable();
Definition ResourceDropsContext.h:16