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;
98 ::ll::TypedStorage<8, 96, ::BlockComponentStorage> mComponents;
99 ::ll::TypedStorage<8, 8, ::gsl::not_null<::BlockType*>> mBlockType;
100 ::ll::TypedStorage<4, 8, ::CachedComponentData> mCachedComponentData;
101 ::ll::TypedStorage<8, 96, ::BlockComponentDirectData> mDirectData;
102 ::ll::TypedStorage<8, 24, ::std::vector<::HashedString>> mTags;
103 ::ll::TypedStorage<8, 24, ::CompoundTag> mSerializationId;
104 ::ll::TypedStorage<8, 8, uint64> mSerializationIdHash;
105 ::ll::TypedStorage<4, 4, uint> mSerializationIdHashForNetwork;
106 ::ll::TypedStorage<4, 4, uint> mNetworkId;
107 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IClientBlockData>> mClientData;
108 ::ll::TypedStorage<2, 2, ushort const> mData;
109 ::ll::TypedStorage<1, 1, bool> mHasRuntimeId;
119 virtual ~Block() =
default;
125 MCAPI Block(ushort data, ::gsl::not_null<::BlockType*> oldBlock);
127 MCAPI Block(ushort data, ::gsl::not_null<::BlockType*> oldBlock,
::CompoundTag serId, uint
const& runId);
129 MCAPI
bool _isSolid()
const;
135 MCAPI
void _queueForTickBasedOnComponentConfiguration(
150 MCAPI ::std::string buildDescriptionId()
const;
152 MCAPI ::std::string buildDescriptionName()
const;
154 MCAPI
void buildSerializationId(uint latestUpdaterVersion);
156 MCAPI
bool canConnect(::Block
const& connectionBlock, uchar toOther)
const;
158 MCAPI
bool canProvideFullSupport(uchar face)
const;
160 MCFOLD
bool canProvideSupport(uchar face, ::BlockSupportType type)
const;
166 MCAPI ::HitResult clip(
171 ::ShapeType shapeType,
175 MCAPI uint computeRawSerializationIdHashForNetwork()
const;
177 MCAPI ::Block
const& copyState(::Block
const& fromBlock,
::BlockState const& state)
const;
179 MCAPI
void executeItemEvent(
181 ::std::string
const& eventName,
188 MCAPI
void finalizeBlockComponentStorage();
190 MCAPI ::BlockActorType getBlockEntityType()
const;
193 MCAPI ::std::optional<::ConnectionID> getConnectionID()
const;
196 MCAPI ::std::string getCraftingLabelText()
const;
199 MCAPI ::std::string getDescriptionId()
const;
203 MCAPI ::std::string getDisplayName()
const;
207 MCAPI
bool isCropBlock()
const;
211 MCAPI
bool isPreservingMediumWhenPlaced(::Block
const& medium)
const;
215 MCAPI ::Block
const& keepStates(::std::vector<::BlockState const*>
const& statesToKeep)
const;
221 MCAPI
void onActorEvent(
::BlockPos const& pos, ::std::string
const& eventName,
::Actor& sourceEntity)
const;
223 MCAPI
void onActorInternalEvent(
::BlockPos const& pos, ::std::string
const& eventName,
::Actor& sourceEntity)
const;
231 ::Block
const& previousBlock,
235 MCAPI
void onRedstoneUpdate(
243 MCAPI
void onStateChange(
246 ::Block
const& previousBlock,
262 MCAPI
bool shouldRandomTick()
const;
265 MCAPI
void spawnResources(
273 MCAPI ::std::string toDebugString()
const;
275 MCAPI
bool use(
::Player& player,
::BlockPos const& pos, uchar face, ::std::optional<::Vec3> hit)
const;
281 MCAPI static ::std::string
const& BLOCK_DESCRIPTION_PREFIX();
287 MCAPI
void* $ctor(ushort data, ::gsl::not_null<::BlockType*> oldBlock);
289 MCAPI
void* $ctor(ushort data, ::gsl::not_null<::BlockType*> oldBlock,
::CompoundTag serId, uint
const& runId);
295 MCAPI
static void** $vftable();
Definition BlockChangeContext.h:10
Definition ResourceDropsContext.h:16