This commit is contained in:
Shadows_of_Fire 2019-02-06 15:01:33 -05:00
parent 81a988811b
commit 7fe79f09be
2 changed files with 59 additions and 51 deletions

View file

@ -57,7 +57,9 @@ public enum ConfigBoolValues{
MOST_BLAND_PERSON_EVER("No Colored Item Names", ConfigCategories.OTHER, false, "If you want to be really boring and lame, you can turn on this setting to disable colored names on Actually Additions items. Because why would you want things to look pretty anyways, right?"), MOST_BLAND_PERSON_EVER("No Colored Item Names", ConfigCategories.OTHER, false, "If you want to be really boring and lame, you can turn on this setting to disable colored names on Actually Additions items. Because why would you want things to look pretty anyways, right?"),
COLOR_LENS_USES_OREDICT("Color Lens Oredict", ConfigCategories.OTHER, false, "If true, the Lens of Color will attempt to pull from the oredict instead of only using vanilla dyes."), COLOR_LENS_USES_OREDICT("Color Lens Oredict", ConfigCategories.OTHER, false, "If true, the Lens of Color will attempt to pull from the oredict instead of only using vanilla dyes."),
SOLID_XP_ALWAYS_ORBS("Solid XP Orbs", ConfigCategories.OTHER, false, "If true, Solidified Experience will always spawn orbs, even for regular players."); SOLID_XP_ALWAYS_ORBS("Solid XP Orbs", ConfigCategories.OTHER, false, "If true, Solidified Experience will always spawn orbs, even for regular players."),
ORE_GEN_DIM_WHITELIST("Ore Gen Whitelist", ConfigCategories.WORLD_GEN, false, "If true, the ore gen dimension blacklist will be treated as a whitelist.");
public final String name; public final String name;

View file

@ -10,6 +10,11 @@
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen;
import java.util.ArrayList;
import java.util.Random;
import org.apache.commons.lang3.ArrayUtils;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.BlockMisc; import de.ellpeck.actuallyadditions.mod.blocks.BlockMisc;
import de.ellpeck.actuallyadditions.mod.blocks.BlockWildPlant; import de.ellpeck.actuallyadditions.mod.blocks.BlockWildPlant;
@ -43,10 +48,6 @@ import net.minecraftforge.fml.common.IWorldGenerator;
import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import org.apache.commons.lang3.ArrayUtils;
import java.util.ArrayList;
import java.util.Random;
public class OreGen implements IWorldGenerator { public class OreGen implements IWorldGenerator {
@ -65,12 +66,17 @@ public class OreGen implements IWorldGenerator{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
int dimension = world.provider.getDimension(); int dimension = world.provider.getDimension();
if (dimension != -1 && dimension != 1) { if (dimension != -1 && dimension != 1) {
if(world.getWorldType() != WorldType.FLAT && !ArrayUtils.contains(ConfigIntListValues.ORE_GEN_DIMENSION_BLACKLIST.getValue(), world.provider.getDimension())){ if (world.getWorldType() != WorldType.FLAT && canGen(world.provider.getDimension())) {
this.generateDefault(world, random, chunkX, chunkZ); this.generateDefault(world, random, chunkX, chunkZ);
} }
} }
} }
private boolean canGen(int dimension) {
boolean inList = ArrayUtils.contains(ConfigIntListValues.ORE_GEN_DIMENSION_BLACKLIST.getValue(), dimension);
return (inList && ConfigBoolValues.ORE_GEN_DIM_WHITELIST.isEnabled()) || (!inList && !ConfigBoolValues.ORE_GEN_DIM_WHITELIST.isEnabled());
}
private void generateDefault(World world, Random random, int x, int z) { private void generateDefault(World world, Random random, int x, int z) {
if (ConfigBoolValues.GENERATE_QUARTZ.isEnabled()) { if (ConfigBoolValues.GENERATE_QUARTZ.isEnabled()) {
this.addOreSpawn(InitBlocks.blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.ORE_QUARTZ), Blocks.STONE, world, random, x * 16, z * 16, MathHelper.getInt(random, 5, 8), 10, QUARTZ_MIN, QUARTZ_MAX); this.addOreSpawn(InitBlocks.blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.ORE_QUARTZ), Blocks.STONE, world, random, x * 16, z * 16, MathHelper.getInt(random, 5, 8), 10, QUARTZ_MIN, QUARTZ_MAX);