Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Nov 27, 2024
1 parent 0828d24 commit 638125b
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"biomes": "#trailiertales:has_structure/snowy_ruins",
"cluster_pieces": {
"max_inclusive": 6,
"min_inclusive": 1
"min_inclusive": 2
},
"cluster_probability": 1.0,
"heightmap": "OCEAN_FLOOR_WG",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public void onSave() throws Exception {
public void onSync(TTWorldgenConfig syncInstance) {
var config = this.config();
GENERATE_GENERIC_RUINS = config.ruins.generic;
GENERATE_SNOWY_RUINS = config.ruins.snowy;
GENERATE_JUNGLE_RUINS = config.ruins.jungle;
GENERATE_SAVANNA_RUINS = config.ruins.savanna;
GENERATE_DESERT_RUINS = config.ruins.desert;
Expand All @@ -40,6 +41,7 @@ public void onSync(TTWorldgenConfig syncInstance) {
);

public static volatile boolean GENERATE_GENERIC_RUINS = true;
public static volatile boolean GENERATE_SNOWY_RUINS = true;
public static volatile boolean GENERATE_JUNGLE_RUINS = true;
public static volatile boolean GENERATE_SAVANNA_RUINS = true;
public static volatile boolean GENERATE_DESERT_RUINS = true;
Expand All @@ -59,6 +61,9 @@ public static class Ruins {
@EntrySyncData("generic")
public boolean generic = true;

@EntrySyncData("snowy")
public boolean snowy = true;

@EntrySyncData("jungle")
public boolean jungle = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ public static void setupEntries(@NotNull ConfigCategory category, @NotNull Confi
"generic",
configInstance
);
var snowyRuins = FrozenClothConfig.syncedEntry(
entryBuilder.startBooleanToggle(TTConstants.text("snowy_ruins"), modifiedRuins.snowy)
.setDefaultValue(defaultConfig.ruins.snowy)
.setSaveConsumer(newValue -> ruins.snowy = newValue)
.setTooltip(TTConstants.tooltip("snowy_ruins"))
.build(),
ruins.getClass(),
"snowy",
configInstance
);
var jungleRuins = FrozenClothConfig.syncedEntry(
entryBuilder.startBooleanToggle(TTConstants.text("jungle_ruins"), modifiedRuins.jungle)
.setDefaultValue(defaultConfig.ruins.jungle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ private static void fillInPieceOffsets() {
return Util.getRandom(SNOWY_MOSTLY_BURIED_PIECES, random);
}
if (random.nextFloat() <= 0.05F) {
return Util.getRandom(SNOWY_FIVE_FROM_TOP_PIECES, random);
return random.nextBoolean() ? Util.getRandom(SNOWY_FIVE_FROM_TOP_PIECES, random) : Util.getRandom(SNOWY_FOUR_FROM_TOP_PIECES, random);
}
return random.nextBoolean() ? Util.getRandom(SNOWY_SURFACE_PIECES, random) : Util.getRandom(SNOWY_BURIED_PIECES, random);
}
Expand Down Expand Up @@ -411,6 +411,9 @@ private static void addClusterRuins(
}

private static ResourceLocation getPieceForType(RuinsStructure.Type type, RandomSource random) {
if (type == RuinsStructure.Type.SNOWY) {
return getRandomSnowyRuin(random);
}
if (type == RuinsStructure.Type.SAVANNA) {
return getRandomSavannaRuin(random);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public int getHeight(
@Override
public @NotNull Optional<GenerationStub> findGenerationPoint(Structure.GenerationContext context) {
if (this.biomeType == Type.GENERIC && !TTWorldgenConfig.GENERATE_GENERIC_RUINS) return Optional.empty();
if (this.biomeType == Type.SNOWY && !TTWorldgenConfig.GENERATE_SNOWY_RUINS) return Optional.empty();
if (this.biomeType == Type.JUNGLE && !TTWorldgenConfig.GENERATE_JUNGLE_RUINS) return Optional.empty();
if (this.biomeType == Type.SAVANNA && !TTWorldgenConfig.GENERATE_SAVANNA_RUINS) return Optional.empty();
if (this.biomeType == Type.DESERT && !TTWorldgenConfig.GENERATE_DESERT_RUINS) return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void bootstrap(@NotNull BootstrapContext<Structure> context) {
),
RuinsStructure.Type.SNOWY,
1F,
UniformInt.of(1, 6),
UniformInt.of(2, 6),
Heightmap.Types.OCEAN_FLOOR_WG
)
);
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/trailiertales/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@
"tooltip.trailiertales.ruins": "Contains options for Ruins structures.",
"option.trailiertales.generic_ruins": "Ruins",
"tooltip.trailiertales.generic_ruins": "Whether Ruins should generate in Plains and Forest biomes.",
"option.trailiertales.snowy_ruins": "Snowy Ruins",
"tooltip.trailiertales.snowy_ruins": "Whether Snowy Ruins should generate biomes.",
"option.trailiertales.jungle_ruins": "Jungle Ruins",
"tooltip.trailiertales.jungle_ruins": "Whether Jungle Ruins should generate.",
"option.trailiertales.savanna_ruins": "Savanna Ruins",
Expand Down

0 comments on commit 638125b

Please sign in to comment.