Skip to content

Commit

Permalink
Add debug option for superflat ore gen
Browse files Browse the repository at this point in the history
@krossgg rejoice
  • Loading branch information
JuiceyBeans committed Oct 16, 2024
1 parent e7293c2 commit 337c686
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -2236,6 +2236,7 @@
"config.gtceu.option.disableManualCompression": "uoıssǝɹdɯoƆןɐnuɐWǝןqɐsıp",
"config.gtceu.option.doBedrockOres": "sǝɹOʞɔoɹpǝᗺop",
"config.gtceu.option.doProcessingArray": "ʎɐɹɹⱯbuıssǝɔoɹԀop",
"config.gtceu.option.doSuperflatOres": "sǝɹOʇɐןɟɹǝdnSop",
"config.gtceu.option.doTerrainExplosion": "uoısoןdxƎuıɐɹɹǝ⟘op",
"config.gtceu.option.doesExplosionDamagesTerrain": "uıɐɹɹǝ⟘sǝbɐɯɐᗡuoısoןdxƎsǝop",
"config.gtceu.option.dumpAssets": "sʇǝssⱯdɯnp",
Expand Down
1 change: 1 addition & 0 deletions src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -2236,6 +2236,7 @@
"config.gtceu.option.disableManualCompression": "disableManualCompression",
"config.gtceu.option.doBedrockOres": "doBedrockOres",
"config.gtceu.option.doProcessingArray": "doProcessingArray",
"config.gtceu.option.doSuperflatOres": "doSuperflatOres",
"config.gtceu.option.doTerrainExplosion": "doTerrainExplosion",
"config.gtceu.option.doesExplosionDamagesTerrain": "doesExplosionDamagesTerrain",
"config.gtceu.option.dumpAssets": "dumpAssets",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.gregtechceu.gtceu.api.data.worldgen.ores;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.config.ConfigHolder;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
Expand All @@ -10,6 +12,7 @@
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.levelgen.FlatLevelSource;
import net.minecraft.world.level.levelgen.XoroshiroRandomSource;
import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest;

Expand Down Expand Up @@ -43,6 +46,8 @@ public class OrePlacer {
* once all of its chunks have been generated.
*/
public void placeOres(WorldGenLevel level, ChunkGenerator chunkGenerator, ChunkAccess chunk) {
if (!ConfigHolder.INSTANCE.dev.doSuperflatOres && chunkGenerator instanceof FlatLevelSource) return;

var random = new XoroshiroRandomSource(level.getSeed() ^ chunk.getPos().toLong());
var generatedVeins = oreGenCache.consumeChunkVeins(level, chunkGenerator, chunk);
var generatedIndicators = oreGenCache.consumeChunkIndicators(level, chunkGenerator, chunk);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,9 @@ public static class DeveloperConfigs {
"Default: false (no placement printout in debug.log)" })
public boolean debugWorldgen = false;
@Configurable
@Configurable.Comment({ "Generate ores in superflat worlds?", "Default: false" })
public boolean doSuperflatOres = false;
@Configurable
@Configurable.Comment({ "Dump all registered GT recipes?", "Default: false" })
public boolean dumpRecipes = false;
@Configurable
Expand Down

0 comments on commit 337c686

Please sign in to comment.