Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
BlockArchetypeDispatcherImpl.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/world/level/block/registry/BlockTypeRegistry.h"
5
6// clang-format off
7class BlockType;
8class BushBlock;
10class Material;
11class PumpkinBlock;
12class HashedString;
13namespace SharedTypes::v1_26_20::BlockDefinition { struct BlockArchetype; }
14namespace SharedTypes::v1_26_20::BlockDefinition { struct BushArchetype; }
15namespace SharedTypes::v1_26_20::BlockDefinition { struct FlowerBedArchetype; }
16namespace SharedTypes::v1_26_20::BlockDefinition { struct PumpkinArchetype; }
17// clang-format on
18
19namespace BlockArchetypeDispatcherImpl {
20
22using BlockFactory = ::std::function<::BlockType*(
23 ::SharedTypes::v1_26_20::BlockDefinition::BlockArchetype const& archetypeData,
24 ::std::string const& blockName,
25 int blockID,
26 ::Material const& material
27)>;
28
30[[nodiscard]] LLNDAPI ::std::unordered_map<::std::string_view, BlockFactory> const& getBlockFactories();
31
35template <class TArchetype>
36::BlockType* registerArchetypeBlock(
37 ::SharedTypes::v1_26_20::BlockDefinition::BlockArchetype const& archetypeData,
38 ::std::string const& blockName,
39 int blockID,
40 ::Material const& material
41);
42
43template <>
44LLNDAPI ::BlockType* registerArchetypeBlock<::SharedTypes::v1_26_20::BlockDefinition::BushArchetype>(
45 ::SharedTypes::v1_26_20::BlockDefinition::BlockArchetype const& archetypeData,
46 ::std::string const& blockName,
47 int blockID,
48 ::Material const& material
49);
50
51template <>
52LLNDAPI ::BlockType* registerArchetypeBlock<::SharedTypes::v1_26_20::BlockDefinition::FlowerBedArchetype>(
53 ::SharedTypes::v1_26_20::BlockDefinition::BlockArchetype const& archetypeData,
54 ::std::string const& blockName,
55 int blockID,
56 ::Material const& material
57);
58
59template <>
60LLNDAPI ::BlockType* registerArchetypeBlock<::SharedTypes::v1_26_20::BlockDefinition::PumpkinArchetype>(
61 ::SharedTypes::v1_26_20::BlockDefinition::BlockArchetype const& archetypeData,
62 ::std::string const& blockName,
63 int blockID,
64 ::Material const& material
65);
66
67} // namespace BlockArchetypeDispatcherImpl
Definition BlockType.h:79
Definition BushBlock.h:17
Definition FlowerBedBlock.h:24
Definition HashedString.h:5
Definition Material.h:8
Definition PumpkinBlock.h:22