Skip to content

Commit

Permalink
Decrease Code for each Structure Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
JT122406 committed Mar 27, 2024
1 parent e2d508e commit e45dbab
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "minecraft:jigsaw",
"biomes": "#generations_structures:has_structure/fiery_shrine",
"max_distance_from_center": 40,
"max_distance_from_center": 80,
"project_start_to_heightmap": "WORLD_SURFACE_WG",
"size": 1,
"spawn_overrides": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "minecraft:jigsaw",
"biomes": "#generations_structures:has_structure/frozen_shrine",
"max_distance_from_center": 40,
"max_distance_from_center": 80,
"project_start_to_heightmap": "WORLD_SURFACE_WG",
"size": 1,
"spawn_overrides": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "minecraft:jigsaw",
"biomes": "#generations_structures:has_structure/lugia_shrine",
"max_distance_from_center": 40,
"max_distance_from_center": 80,
"project_start_to_heightmap": "WORLD_SURFACE_WG",
"size": 1,
"spawn_overrides": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "minecraft:jigsaw",
"biomes": "#generations_structures:has_structure/static_shrine",
"max_distance_from_center": 40,
"max_distance_from_center": 80,
"project_start_to_heightmap": "WORLD_SURFACE_WG",
"size": 1,
"spawn_overrides": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
{
"type": "minecraft:jigsaw",
"biomes": "#generations_structures:has_structure/spike",
"max_distance_from_center": 75,
"max_distance_from_center": 80,
"size": 1,
"spawn_overrides": {},
"start_height": {
"absolute": 10
"type": "minecraft:uniform",
"max_inclusive": {
"below_top": 100
},
"min_inclusive": {
"absolute": 5
}
},
"start_pool": "generations_structures:spike",
"step": "surface_structures",
"step": "underground_decoration",
"terrain_adaptation": "beard_thin",
"use_expansion_hack": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,9 @@ public static void bootstrap(BootstapContext<Structure> context) {
TerrainAdjustment.NONE
),
poolHolderGetter.getOrThrow(GenerationsTemplatePools.COMET),
Optional.empty(),
1,
UniformHeight.of(VerticalAnchor.absolute(250), VerticalAnchor.belowTop(150)),
false,
Optional.empty(),
80
false
));
registerStructure(context, GenerationsStructuresKeys.SCARLET_POKESHOP, createJigsaw(
new Structure.StructureSettings(
Expand All @@ -59,27 +56,23 @@ public static void bootstrap(BootstapContext<Structure> context) {
TerrainAdjustment.BEARD_THIN
),
poolHolderGetter.getOrThrow(GenerationsTemplatePools.SCARLET_POKESHOP),
Optional.empty(),
1,
ConstantHeight.of(VerticalAnchor.absolute(1)),
false,
Optional.of(Heightmap.Types.WORLD_SURFACE_WG),
80
Heightmap.Types.WORLD_SURFACE_WG
));
registerStructure(context, GenerationsStructuresKeys.SPIKE, createJigsaw(

registerStructure(context, GenerationsStructuresKeys.SPIKE,
createJigsaw(
new Structure.StructureSettings(
biomeHolderGetter.getOrThrow(GenerationsBiomeTags.HAS_SPIKE),
Map.of(),
GenerationStep.Decoration.SURFACE_STRUCTURES,
TerrainAdjustment.NONE
GenerationStep.Decoration.UNDERGROUND_DECORATION,
TerrainAdjustment.BEARD_THIN
),
poolHolderGetter.getOrThrow(GenerationsTemplatePools.SPIKE),
Optional.empty(),
1,
ConstantHeight.of(VerticalAnchor.absolute(10)),
false,
Optional.empty(),
75
UniformHeight.of(VerticalAnchor.absolute(5), VerticalAnchor.belowTop(100)),
false
));

registerStructure(context, GenerationsStructuresKeys.FROZEN_SHRINE, createJigsaw(
Expand All @@ -90,12 +83,9 @@ public static void bootstrap(BootstapContext<Structure> context) {
TerrainAdjustment.BEARD_THIN
),
poolHolderGetter.getOrThrow(GenerationsTemplatePools.FROZEN_SHRINE),
Optional.empty(),
1,
ConstantHeight.of(VerticalAnchor.absolute(1)),
false,
Optional.of(Heightmap.Types.WORLD_SURFACE_WG),
40
ConstantHeight.of(VerticalAnchor.absolute(1)),
Heightmap.Types.WORLD_SURFACE_WG
));

registerStructure(context, GenerationsStructuresKeys.FIERY_SHRINE, createJigsaw(
Expand All @@ -106,12 +96,9 @@ public static void bootstrap(BootstapContext<Structure> context) {
TerrainAdjustment.BEARD_THIN
),
poolHolderGetter.getOrThrow(GenerationsTemplatePools.FIERY_SHRINE),
Optional.empty(),
1,
ConstantHeight.of(VerticalAnchor.absolute(1)),
false,
Optional.of(Heightmap.Types.WORLD_SURFACE_WG),
40
ConstantHeight.of(VerticalAnchor.absolute(1)),
Heightmap.Types.WORLD_SURFACE_WG
));

registerStructure(context, GenerationsStructuresKeys.STATIC_SHRINE, createJigsaw(
Expand All @@ -122,12 +109,9 @@ public static void bootstrap(BootstapContext<Structure> context) {
TerrainAdjustment.BEARD_THIN
),
poolHolderGetter.getOrThrow(GenerationsTemplatePools.STATIC_SHRINE),
Optional.empty(),
1,
ConstantHeight.of(VerticalAnchor.absolute(1)),
false,
Optional.of(Heightmap.Types.WORLD_SURFACE_WG),
40
Heightmap.Types.WORLD_SURFACE_WG
));

registerStructure(context, GenerationsStructuresKeys.LUGIA_SHRINE, createJigsaw(
Expand All @@ -138,12 +122,9 @@ public static void bootstrap(BootstapContext<Structure> context) {
TerrainAdjustment.BEARD_THIN
),
poolHolderGetter.getOrThrow(GenerationsTemplatePools.LUGIA_SHRINE),
Optional.empty(),
1,
ConstantHeight.of(VerticalAnchor.absolute(1)),
false,
Optional.of(Heightmap.Types.WORLD_SURFACE_WG),
40
Heightmap.Types.WORLD_SURFACE_WG
));

registerStructure(context, GenerationsStructuresKeys.ISLANDS, createJigsaw(
Expand All @@ -154,12 +135,9 @@ public static void bootstrap(BootstapContext<Structure> context) {
TerrainAdjustment.NONE
),
poolHolderGetter.getOrThrow(GenerationsTemplatePools.ISLANDS),
Optional.empty(),
1,
UniformHeight.of(VerticalAnchor.absolute(150), VerticalAnchor.belowTop(100)),
false,
Optional.empty(),
80
false
));
}

Expand All @@ -174,6 +152,16 @@ private static JigsawStructure createJigsaw(Structure.StructureSettings settings
return new JigsawStructure(settings, startPool, startJigsawName, maxDepth, startHeight, useExpansionHack, projectStartToHeightmap, maxDistanceToCenter);
}

private static JigsawStructure createJigsaw(Structure.StructureSettings settings, Holder<StructureTemplatePool> startPool, int maxDepth,
HeightProvider startHeight, boolean useExpansionHack){
return new JigsawStructure(settings, startPool, maxDepth, startHeight, useExpansionHack);
}

private static JigsawStructure createJigsaw(Structure.StructureSettings settings, Holder<StructureTemplatePool> startPool, int maxDepth,
HeightProvider startHeight, Heightmap.Types projectStartToHeightmap){
return new JigsawStructure(settings, startPool, maxDepth, startHeight, false, projectStartToHeightmap);
}

private static JigsawStructure balloonJigsawStructure(Holder<StructureTemplatePool> poolHolderGetter, HolderSet<Biome> biomeHolderGetter){
return new JigsawStructure(new Structure.StructureSettings(biomeHolderGetter, Map.of(), GenerationStep.Decoration.SURFACE_STRUCTURES, TerrainAdjustment.NONE),
poolHolderGetter,
Expand Down

0 comments on commit e45dbab

Please sign in to comment.