@@ -26,23 +26,51 @@ namespace custom_structure {
2626
2727void CustomJigsawStructureBlockRules::initialize (JigsawStructureRegistry& registry) {
2828 auto & jigsawBlockRulesRegistry = registry.mJigsawBlockRulesRegistry ;
29- // auto& DefaultBlockState =
30- // BlockTypeRegistry::getDefaultBlockState(VanillaBlockTypeIds::PolishedBlackstoneBricks(), 1);
31- auto & resultBlock = BlockTypeRegistry::getDefaultBlockState (VanillaBlockTypeIds::RedstoneBlock (), 1 );
32- auto & block = BlockTypeRegistry::getDefaultBlockState (VanillaBlockTypeIds::Blackstone (), 1 );
3329
34- std::unique_ptr<IStructurePoolBlockPredicate> sourceBlock =
35- std::make_unique<StructurePoolBlockPredicateBlockMatchRandom>(block, 0.3 );
30+ // input_predicate block
31+ auto & stoneBricks = BlockTypeRegistry::getDefaultBlockState (VanillaBlockTypeIds::StoneBricks ());
32+
33+ // output_state blocks
34+ auto & mossyStoneBricks = BlockTypeRegistry::getDefaultBlockState (VanillaBlockTypeIds::MossyStoneBricks ());
35+ auto & crackedStoneBricks = BlockTypeRegistry::getDefaultBlockState (VanillaBlockTypeIds::CrackedStoneBricks ());
36+ auto & cobblestone = BlockTypeRegistry::getDefaultBlockState (VanillaBlockTypeIds::Cobblestone ());
37+
38+ // input_predicate
39+ std::unique_ptr<IStructurePoolBlockPredicate> sourceBlock_pro1 =
40+ std::make_unique<StructurePoolBlockPredicateBlockMatchRandom>(stoneBricks, 0.2 );
41+ std::unique_ptr<IStructurePoolBlockPredicate> sourceBlock_pro2 =
42+ std::make_unique<StructurePoolBlockPredicateBlockMatchRandom>(stoneBricks, 0.1 );
43+
3644 std::unique_ptr<IStructurePoolBlockPredicate> targetBlock =
3745 std::make_unique<StructurePoolBlockPredicateAlwaysTrue>();
3846
39- auto blockRule =
40- std::make_unique<StructurePoolBlockRule>(std::move (sourceBlock), std::move (targetBlock), &resultBlock);
47+ auto blockRule_1 =
48+ std::make_unique<StructurePoolBlockRule>(std::move (sourceBlock_pro1), std::move (targetBlock), &mossyStoneBricks);
49+ auto blockRule_2 =
50+ std::make_unique<StructurePoolBlockRule>(std::move (sourceBlock_pro1), std::move (targetBlock), &crackedStoneBricks);
51+ auto blockRule_3 =
52+ std::make_unique<StructurePoolBlockRule>(std::move (sourceBlock_pro2), std::move (targetBlock), &cobblestone);
53+
54+
4155 auto ruleList = std::make_unique<std::vector<std::unique_ptr<StructurePoolBlockRule>>>();
4256
43- ruleList->push_back (std::move (blockRule));
57+ ruleList->emplace_back (std::move (blockRule_1));
58+ ruleList->emplace_back (std::move (blockRule_2));
59+ ruleList->emplace_back (std::move (blockRule_3));
60+
61+ jigsawBlockRulesRegistry->registerBlockRules (" mike:stone_brick_replacement_jig" , std::move (ruleList));
62+
63+ // br::worldgen::processors::BlockRules::Test block_test;
64+ // block_test.mData = br::worldgen::processors::BlockRules::RandomBlockMatch(stoneBricks.mLegacyBlock.get(), 0.2);
65+
66+ // auto blockRule_1 = br::worldgen::processors::RuleSet::from(block_test, mossyStoneBricks);
67+ // auto blockRule_2 = br::worldgen::processors::RuleSet::from(block_test, crackedStoneBricks);
68+ // auto blockRule_3 = br::worldgen::processors::RuleSet::from(block_test, cobblestone);
69+
70+ // auto ruleList = br::worldgen::StructureProcessor::Rule({blockRule_1, blockRule_2, blockRule_3});
71+ // auto prot = br::worldgen::StructureProcessor::Protected(VanillaBlockTypeIds::RedstoneBlock());
72+ // jigsawBlockRulesRegistry->record("mike:stone_brick_replacement", {ruleList, prot});
4473
45- jigsawBlockRulesRegistry->registerBlockRules (" custom:custom_structure_block_rule" , std::move (ruleList));
4674}
4775
4876void CustomJigsawStructureElements::initialize (
@@ -52,45 +80,124 @@ void CustomJigsawStructureElements::initialize(
5280) {
5381 auto & jigsawBlockRulesRegistry = jigsawRegistry.mJigsawBlockRulesRegistry ;
5482 auto & jigsawStructureElementRegistry = jigsawRegistry.mJigsawElementRegistry ;
55- auto ruleList = jigsawBlockRulesRegistry->lookupByName (" custom:custom_structure_block_rule " );
83+ auto ruleList = jigsawBlockRulesRegistry->lookupByName (" mike:stone_brick_replacement " );
5684
5785 // 每一个结构nbt文件都得这样注册进来,多个nbt结构文件的可以使用同一个Block Rule
86+ // mike:5x5int
5887 jigsawStructureElementRegistry->registerStructureElement (
59- " mike:21room " ,
88+ " mike:5x5intb " ,
6089 std::make_unique<StructurePoolElement>(
6190 manager,
62- " custom/21room" ,
91+ " custom/beds5x5int" ,
92+ ruleList,
93+ nullptr ,
94+ nullptr ,
95+ Projection::TerrainMatching,
96+ PostProcessSettings::All
97+ )
98+ );
99+ jigsawStructureElementRegistry->registerStructureElement (
100+ " mike:5x5intc" ,
101+ std::make_unique<StructurePoolElement>(
102+ manager,
103+ " custom/chestcarpet5x5int" ,
104+ ruleList,
105+ nullptr ,
106+ nullptr ,
107+ Projection::TerrainMatching,
108+ PostProcessSettings::All
109+ )
110+ );
111+ jigsawStructureElementRegistry->registerStructureElement (
112+ " mike:5x5intk" ,
113+ std::make_unique<StructurePoolElement>(
114+ manager,
115+ " custom/kitchen5x5int" ,
63116 ruleList,
64117 nullptr ,
65118 nullptr ,
66- Projection::Rigid ,
67- PostProcessSettings::None
119+ Projection::TerrainMatching ,
120+ PostProcessSettings::All
68121 )
69122 );
70123
124+ // mike:ew7x4
71125 jigsawStructureElementRegistry->registerStructureElement (
72- " mike:ew7x4 " ,
126+ " mike:ew7x4h " ,
73127 std::make_unique<StructurePoolElement>(
74128 manager,
75129 " custom/ewhall" ,
76130 ruleList,
77131 nullptr ,
78132 nullptr ,
79- Projection::Rigid,
80- PostProcessSettings::None
133+ Projection::TerrainMatching,
134+ PostProcessSettings::All
135+ )
136+ );
137+ jigsawStructureElementRegistry->registerStructureElement (
138+ " mike:ew7x4r" ,
139+ std::make_unique<StructurePoolElement>(
140+ manager,
141+ " custom/21room" ,
142+ ruleList,
143+ nullptr ,
144+ nullptr ,
145+ Projection::TerrainMatching,
146+ PostProcessSettings::All
81147 )
82148 );
83149
150+ // mike:ns7x4
84151 jigsawStructureElementRegistry->registerStructureElement (
85- " mike:ns7x4 " ,
152+ " mike:ns7x4h " ,
86153 std::make_unique<StructurePoolElement>(
87154 manager,
88155 " custom/nshall" ,
89156 ruleList,
90157 nullptr ,
91158 nullptr ,
92- Projection::Rigid,
93- PostProcessSettings::None
159+ Projection::TerrainMatching,
160+ PostProcessSettings::All
161+ )
162+ );
163+ jigsawStructureElementRegistry->registerStructureElement (
164+ " mike:ns7x4r" ,
165+ std::make_unique<StructurePoolElement>(
166+ manager,
167+ " custom/21room" ,
168+ ruleList,
169+ nullptr ,
170+ nullptr ,
171+ Projection::TerrainMatching,
172+ PostProcessSettings::All
173+ )
174+ );
175+
176+ // mike:ewcap
177+ jigsawStructureElementRegistry->registerStructureElement (
178+ " mike:ewcap" ,
179+ std::make_unique<StructurePoolElement>(
180+ manager,
181+ " custom/ewcap" ,
182+ ruleList,
183+ nullptr ,
184+ nullptr ,
185+ Projection::TerrainMatching,
186+ PostProcessSettings::All
187+ )
188+ );
189+
190+ // mike:nacap
191+ jigsawStructureElementRegistry->registerStructureElement (
192+ " mike:nscap" ,
193+ std::make_unique<StructurePoolElement>(
194+ manager,
195+ " custom/nscap" ,
196+ ruleList,
197+ nullptr ,
198+ nullptr ,
199+ Projection::TerrainMatching,
200+ PostProcessSettings::All
94201 )
95202 );
96203}
@@ -104,19 +211,31 @@ void CustomJigsawStructure::initialize(
104211 CustomJigsawStructureElements::initialize (manager, featureRegistry, registry);
105212 auto & jigsawStructureElementRegistry = registry.mJigsawElementRegistry ;
106213
107- std::vector<std::pair<StructurePoolElement const *, int >> templates_room{
108- {jigsawStructureElementRegistry->lookupByName (" mike:21room" ), 1 }
214+ std::vector<std::pair<StructurePoolElement const *, int >> templates_5x5{
215+ {jigsawStructureElementRegistry->lookupByName (" mike:5x5intb" ), 4 },
216+ {jigsawStructureElementRegistry->lookupByName (" mike:5x5intc" ), 1 },
217+ {jigsawStructureElementRegistry->lookupByName (" mike:5x5intk" ), 1 }
109218 };
110219 std::vector<std::pair<StructurePoolElement const *, int >> templates_ew{
111- {jigsawStructureElementRegistry->lookupByName (" mike:ew7x4" ), 1 }
220+ {jigsawStructureElementRegistry->lookupByName (" mike:ew7x4h" ), 4 },
221+ {jigsawStructureElementRegistry->lookupByName (" mike:ew7x4r" ), 1 }
112222 };
113223 std::vector<std::pair<StructurePoolElement const *, int >> templates_ns{
114- {jigsawStructureElementRegistry->lookupByName (" mike:ns7x4" ), 1 }
224+ {jigsawStructureElementRegistry->lookupByName (" mike:ns7x4h" ), 4 },
225+ {jigsawStructureElementRegistry->lookupByName (" mike:ns7x4r" ), 1 }
226+ };
227+ std::vector<std::pair<StructurePoolElement const *, int >> templates_ewcap{
228+ {jigsawStructureElementRegistry->lookupByName (" mike:ewcap" ), 4 }
229+ };
230+ std::vector<std::pair<StructurePoolElement const *, int >> templates_nscap{
231+ {jigsawStructureElementRegistry->lookupByName (" mike:nscap" ), 4 }
115232 };
116233
117- registry.registerPool (std::make_unique<StructureTemplatePool>(" mike:21room" , " empty" , templates_room));
118- registry.registerPool (std::make_unique<StructureTemplatePool>(" mike:ew7x4" , " empty" , templates_ew));
119- registry.registerPool (std::make_unique<StructureTemplatePool>(" mike:ns7x4" , " empty" , templates_ns));
234+ registry.registerPool (std::make_unique<StructureTemplatePool>(" mike:5x5int" , " empty" , templates_5x5));
235+ registry.registerPool (std::make_unique<StructureTemplatePool>(" mike:ew7x4" , " mike:ewcap" , templates_ew));
236+ registry.registerPool (std::make_unique<StructureTemplatePool>(" mike:ns7x4" , " mike:nscap" , templates_ns));
237+ registry.registerPool (std::make_unique<StructureTemplatePool>(" mike:ewcap" , " empty" , templates_ewcap));
238+ registry.registerPool (std::make_unique<StructureTemplatePool>(" mike:nscap" , " empty" , templates_nscap));
120239}
121240
122241} // namespace custom_structure
0 commit comments