| 1 | package net.minecraft.data.worldgen;
|
| 2 |
|
| 3 | import com.google.common.collect.ImmutableList;
|
| 4 | import com.mojang.datafixers.util.Pair;
|
| 5 | import net.minecraft.core.Holder;
|
| 6 | import net.minecraft.core.HolderGetter;
|
| 7 | import net.minecraft.core.registries.Registries;
|
| 8 | import net.minecraft.data.worldgen.placement.VillagePlacements;
|
| 9 | import net.minecraft.resources.ResourceKey;
|
| 10 | import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
| 11 | import net.minecraft.world.level.levelgen.structure.pools.StructurePoolElement;
|
| 12 | import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
|
| 13 | import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList;
|
| 14 |
|
| 15 | public class SnowyVillagePools {
|
| 16 | public static final ResourceKey<StructureTemplatePool> START = Pools.createKey("village/snowy/town_centers");
|
| 17 | private static final ResourceKey<StructureTemplatePool> TERMINATORS_KEY = Pools.createKey("village/snowy/terminators");
|
| 18 |
|
| 19 | public static void bootstrap(final BootstrapContext<StructureTemplatePool> context) {
|
| 20 | HolderGetter<PlacedFeature> placedFeatures = context.lookup(Registries.PLACED_FEATURE);
|
| 21 | Holder<PlacedFeature> spruceVillage = placedFeatures.getOrThrow(VillagePlacements.SPRUCE_VILLAGE);
|
| 22 | Holder<PlacedFeature> pileSnowVillage = placedFeatures.getOrThrow(VillagePlacements.PILE_SNOW_VILLAGE);
|
| 23 | Holder<PlacedFeature> pileIceVillage = placedFeatures.getOrThrow(VillagePlacements.PILE_ICE_VILLAGE);
|
| 24 | HolderGetter<StructureProcessorList> processorLists = context.lookup(Registries.PROCESSOR_LIST);
|
| 25 | Holder<StructureProcessorList> streetSnowyOrTaiga = processorLists.getOrThrow(ProcessorLists.STREET_SNOWY_OR_TAIGA);
|
| 26 | Holder<StructureProcessorList> farmSnowy = processorLists.getOrThrow(ProcessorLists.FARM_SNOWY);
|
| 27 | Holder<StructureProcessorList> zombieSnowy = processorLists.getOrThrow(ProcessorLists.ZOMBIE_SNOWY);
|
| 28 | HolderGetter<StructureTemplatePool> pools = context.lookup(Registries.TEMPLATE_POOL);
|
| 29 | Holder<StructureTemplatePool> empty = pools.getOrThrow(Pools.EMPTY);
|
| 30 | Holder<StructureTemplatePool> terminators = pools.getOrThrow(TERMINATORS_KEY);
|
| 31 | context.register(
|
| 32 | START,
|
| 33 | new StructureTemplatePool(
|
| 34 | empty,
|
| 35 | ImmutableList.of(
|
| 36 | Pair.of(StructurePoolElement.legacy("village/snowy/town_centers/snowy_meeting_point_1"), 100),
|
| 37 | Pair.of(StructurePoolElement.legacy("village/snowy/town_centers/snowy_meeting_point_2"), 50),
|
| 38 | Pair.of(StructurePoolElement.legacy("village/snowy/town_centers/snowy_meeting_point_3"), 150),
|
| 39 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/town_centers/snowy_meeting_point_1"), 2),
|
| 40 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/town_centers/snowy_meeting_point_2"), 1),
|
| 41 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/town_centers/snowy_meeting_point_3"), 3)
|
| 42 | ),
|
| 43 | StructureTemplatePool.Projection.RIGID
|
| 44 | )
|
| 45 | );
|
| 46 | Pools.register(
|
| 47 | context,
|
| 48 | "village/snowy/streets",
|
| 49 | new StructureTemplatePool(
|
| 50 | terminators,
|
| 51 | ImmutableList.of(
|
| 52 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/corner_01", streetSnowyOrTaiga), 2),
|
| 53 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/corner_02", streetSnowyOrTaiga), 2),
|
| 54 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/corner_03", streetSnowyOrTaiga), 2),
|
| 55 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/square_01", streetSnowyOrTaiga), 2),
|
| 56 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/straight_01", streetSnowyOrTaiga), 4),
|
| 57 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/straight_02", streetSnowyOrTaiga), 4),
|
| 58 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/straight_03", streetSnowyOrTaiga), 4),
|
| 59 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/straight_04", streetSnowyOrTaiga), 7),
|
| 60 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/straight_06", streetSnowyOrTaiga), 4),
|
| 61 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/straight_08", streetSnowyOrTaiga), 4),
|
| 62 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/crossroad_02", streetSnowyOrTaiga), 1),
|
| 63 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/crossroad_03", streetSnowyOrTaiga), 2),
|
| 64 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/crossroad_04", streetSnowyOrTaiga), 2),
|
| 65 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/crossroad_05", streetSnowyOrTaiga), 2),
|
| 66 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/crossroad_06", streetSnowyOrTaiga), 2),
|
| 67 | Pair.of(StructurePoolElement.legacy("village/snowy/streets/turn_01", streetSnowyOrTaiga), 3)
|
| 68 | ),
|
| 69 | StructureTemplatePool.Projection.TERRAIN_MATCHING
|
| 70 | )
|
| 71 | );
|
| 72 | Pools.register(
|
| 73 | context,
|
| 74 | "village/snowy/zombie/streets",
|
| 75 | new StructureTemplatePool(
|
| 76 | terminators,
|
| 77 | ImmutableList.of(
|
| 78 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/corner_01", streetSnowyOrTaiga), 2),
|
| 79 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/corner_02", streetSnowyOrTaiga), 2),
|
| 80 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/corner_03", streetSnowyOrTaiga), 2),
|
| 81 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/square_01", streetSnowyOrTaiga), 2),
|
| 82 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/straight_01", streetSnowyOrTaiga), 4),
|
| 83 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/straight_02", streetSnowyOrTaiga), 4),
|
| 84 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/straight_03", streetSnowyOrTaiga), 4),
|
| 85 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/straight_04", streetSnowyOrTaiga), 7),
|
| 86 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/straight_06", streetSnowyOrTaiga), 4),
|
| 87 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/straight_08", streetSnowyOrTaiga), 4),
|
| 88 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/crossroad_02", streetSnowyOrTaiga), 1),
|
| 89 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/crossroad_03", streetSnowyOrTaiga), 2),
|
| 90 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/crossroad_04", streetSnowyOrTaiga), 2),
|
| 91 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/crossroad_05", streetSnowyOrTaiga), 2),
|
| 92 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/crossroad_06", streetSnowyOrTaiga), 2),
|
| 93 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/streets/turn_01", streetSnowyOrTaiga), 3)
|
| 94 | ),
|
| 95 | StructureTemplatePool.Projection.TERRAIN_MATCHING
|
| 96 | )
|
| 97 | );
|
| 98 | Pools.register(
|
| 99 | context,
|
| 100 | "village/snowy/houses",
|
| 101 | new StructureTemplatePool(
|
| 102 | terminators,
|
| 103 | ImmutableList.of(
|
| 104 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_small_house_1"), 2),
|
| 105 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_small_house_2"), 2),
|
| 106 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_small_house_3"), 2),
|
| 107 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_small_house_4"), 3),
|
| 108 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_small_house_5"), 2),
|
| 109 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_small_house_6"), 2),
|
| 110 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_small_house_7"), 2),
|
| 111 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_small_house_8"), 2),
|
| 112 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_medium_house_1"), 2),
|
| 113 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_medium_house_2"), 2),
|
| 114 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_medium_house_3"), 2),
|
| 115 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_butchers_shop_1"), 2),
|
| 116 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_butchers_shop_2"), 2),
|
| 117 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_tool_smith_1"), 2),
|
| 118 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_fletcher_house_1"), 2),
|
| 119 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_shepherds_house_1"), 3),
|
| 120 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_armorer_house_1"), 1),
|
| 121 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_armorer_house_2"), 1),
|
| 122 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_fisher_cottage"), 2),
|
| 123 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_tannery_1"), 2),
|
| 124 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_cartographer_house_1"), 2),
|
| 125 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_library_1"), 2),
|
| 126 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_masons_house_1"), 2),
|
| 127 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_masons_house_2"), 2),
|
| 128 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_weapon_smith_1"), 2),
|
| 129 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_temple_1"), 2),
|
| 130 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_farm_1", farmSnowy), 3),
|
| 131 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_farm_2", farmSnowy), 3),
|
| 132 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_animal_pen_1"), 2),
|
| 133 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_animal_pen_2"), 2),
|
| 134 | Pair.of(StructurePoolElement.empty(), 6)
|
| 135 | ),
|
| 136 | StructureTemplatePool.Projection.RIGID
|
| 137 | )
|
| 138 | );
|
| 139 | Pools.register(
|
| 140 | context,
|
| 141 | "village/snowy/zombie/houses",
|
| 142 | new StructureTemplatePool(
|
| 143 | terminators,
|
| 144 | ImmutableList.of(
|
| 145 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/houses/snowy_small_house_1", zombieSnowy), 2),
|
| 146 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/houses/snowy_small_house_2", zombieSnowy), 2),
|
| 147 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/houses/snowy_small_house_3", zombieSnowy), 2),
|
| 148 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/houses/snowy_small_house_4", zombieSnowy), 2),
|
| 149 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/houses/snowy_small_house_5", zombieSnowy), 2),
|
| 150 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/houses/snowy_small_house_6", zombieSnowy), 2),
|
| 151 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/houses/snowy_small_house_7", zombieSnowy), 2),
|
| 152 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/houses/snowy_small_house_8", zombieSnowy), 2),
|
| 153 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/houses/snowy_medium_house_1", zombieSnowy), 2),
|
| 154 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/houses/snowy_medium_house_2", zombieSnowy), 2),
|
| 155 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/houses/snowy_medium_house_3", zombieSnowy), 1),
|
| 156 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_butchers_shop_1", zombieSnowy), 2),
|
| 157 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_butchers_shop_2", zombieSnowy), 2),
|
| 158 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_tool_smith_1", zombieSnowy), 2),
|
| 159 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_fletcher_house_1", zombieSnowy), 2),
|
| 160 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_shepherds_house_1", zombieSnowy), 2),
|
| 161 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_armorer_house_1", zombieSnowy), 1),
|
| 162 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_armorer_house_2", zombieSnowy), 1),
|
| 163 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_fisher_cottage", zombieSnowy), 2),
|
| 164 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_tannery_1", zombieSnowy), 2),
|
| 165 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_cartographer_house_1", zombieSnowy), 2),
|
| 166 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_library_1", zombieSnowy), 2),
|
| 167 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_masons_house_1", zombieSnowy), 2),
|
| 168 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_masons_house_2", zombieSnowy), 2),
|
| 169 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_weapon_smith_1", zombieSnowy), 2),
|
| 170 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_temple_1", zombieSnowy), 2),
|
| 171 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_farm_1", zombieSnowy), 3),
|
| 172 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_farm_2", zombieSnowy), 3),
|
| 173 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_animal_pen_1", zombieSnowy), 2),
|
| 174 | Pair.of(StructurePoolElement.legacy("village/snowy/houses/snowy_animal_pen_2", zombieSnowy), 2),
|
| 175 | Pair.of(StructurePoolElement.empty(), 6)
|
| 176 | ),
|
| 177 | StructureTemplatePool.Projection.RIGID
|
| 178 | )
|
| 179 | );
|
| 180 | context.register(
|
| 181 | TERMINATORS_KEY,
|
| 182 | new StructureTemplatePool(
|
| 183 | empty,
|
| 184 | ImmutableList.of(
|
| 185 | Pair.of(StructurePoolElement.legacy("village/plains/terminators/terminator_01", streetSnowyOrTaiga), 1),
|
| 186 | Pair.of(StructurePoolElement.legacy("village/plains/terminators/terminator_02", streetSnowyOrTaiga), 1),
|
| 187 | Pair.of(StructurePoolElement.legacy("village/plains/terminators/terminator_03", streetSnowyOrTaiga), 1),
|
| 188 | Pair.of(StructurePoolElement.legacy("village/plains/terminators/terminator_04", streetSnowyOrTaiga), 1)
|
| 189 | ),
|
| 190 | StructureTemplatePool.Projection.TERRAIN_MATCHING
|
| 191 | )
|
| 192 | );
|
| 193 | Pools.register(
|
| 194 | context,
|
| 195 | "village/snowy/trees",
|
| 196 | new StructureTemplatePool(empty, ImmutableList.of(Pair.of(StructurePoolElement.feature(spruceVillage), 1)), StructureTemplatePool.Projection.RIGID)
|
| 197 | );
|
| 198 | Pools.register(
|
| 199 | context,
|
| 200 | "village/snowy/decor",
|
| 201 | new StructureTemplatePool(
|
| 202 | empty,
|
| 203 | ImmutableList.of(
|
| 204 | Pair.of(StructurePoolElement.legacy("village/snowy/snowy_lamp_post_01"), 4),
|
| 205 | Pair.of(StructurePoolElement.legacy("village/snowy/snowy_lamp_post_02"), 4),
|
| 206 | Pair.of(StructurePoolElement.legacy("village/snowy/snowy_lamp_post_03"), 1),
|
| 207 | Pair.of(StructurePoolElement.feature(spruceVillage), 4),
|
| 208 | Pair.of(StructurePoolElement.feature(pileSnowVillage), 4),
|
| 209 | Pair.of(StructurePoolElement.feature(pileIceVillage), 1),
|
| 210 | Pair.of(StructurePoolElement.empty(), 9)
|
| 211 | ),
|
| 212 | StructureTemplatePool.Projection.RIGID
|
| 213 | )
|
| 214 | );
|
| 215 | Pools.register(
|
| 216 | context,
|
| 217 | "village/snowy/zombie/decor",
|
| 218 | new StructureTemplatePool(
|
| 219 | empty,
|
| 220 | ImmutableList.of(
|
| 221 | Pair.of(StructurePoolElement.legacy("village/snowy/snowy_lamp_post_01", zombieSnowy), 1),
|
| 222 | Pair.of(StructurePoolElement.legacy("village/snowy/snowy_lamp_post_02", zombieSnowy), 1),
|
| 223 | Pair.of(StructurePoolElement.legacy("village/snowy/snowy_lamp_post_03", zombieSnowy), 1),
|
| 224 | Pair.of(StructurePoolElement.feature(spruceVillage), 4),
|
| 225 | Pair.of(StructurePoolElement.feature(pileSnowVillage), 4),
|
| 226 | Pair.of(StructurePoolElement.feature(pileIceVillage), 4),
|
| 227 | Pair.of(StructurePoolElement.empty(), 7)
|
| 228 | ),
|
| 229 | StructureTemplatePool.Projection.RIGID
|
| 230 | )
|
| 231 | );
|
| 232 | Pools.register(
|
| 233 | context,
|
| 234 | "village/snowy/villagers",
|
| 235 | new StructureTemplatePool(
|
| 236 | empty,
|
| 237 | ImmutableList.of(
|
| 238 | Pair.of(StructurePoolElement.legacy("village/snowy/villagers/nitwit"), 1),
|
| 239 | Pair.of(StructurePoolElement.legacy("village/snowy/villagers/baby"), 1),
|
| 240 | Pair.of(StructurePoolElement.legacy("village/snowy/villagers/unemployed"), 10)
|
| 241 | ),
|
| 242 | StructureTemplatePool.Projection.RIGID
|
| 243 | )
|
| 244 | );
|
| 245 | Pools.register(
|
| 246 | context,
|
| 247 | "village/snowy/zombie/villagers",
|
| 248 | new StructureTemplatePool(
|
| 249 | empty,
|
| 250 | ImmutableList.of(
|
| 251 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/villagers/nitwit"), 1),
|
| 252 | Pair.of(StructurePoolElement.legacy("village/snowy/zombie/villagers/unemployed"), 10)
|
| 253 | ),
|
| 254 | StructureTemplatePool.Projection.RIGID
|
| 255 | )
|
| 256 | );
|
| 257 | }
|
| 258 | }
|
| 259 |
|