summaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorRobert Sosnitzka <robert.sosnitzka@gmail.com>2016-12-14 23:09:26 +0100
committerRobert Sosnitzka <robert.sosnitzka@gmail.com>2016-12-14 23:09:26 +0100
commit29576086f85851dcac2016c4013554df1a24538a (patch)
tree8d69b585b30545c55207b35816ec76c5a82ed960 /src/main/java/com
parente1048038547ec21ed29cb5c27618fe85991befd1 (diff)
Some generator changes
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/sosnitzka/taiga/TAIGAConfiguration.java232
-rw-r--r--src/main/java/com/sosnitzka/taiga/util/Generator.java71
-rw-r--r--src/main/java/com/sosnitzka/taiga/world/WorldGen.java38
3 files changed, 220 insertions, 121 deletions
diff --git a/src/main/java/com/sosnitzka/taiga/TAIGAConfiguration.java b/src/main/java/com/sosnitzka/taiga/TAIGAConfiguration.java
index 65d6abb..c8575ca 100644
--- a/src/main/java/com/sosnitzka/taiga/TAIGAConfiguration.java
+++ b/src/main/java/com/sosnitzka/taiga/TAIGAConfiguration.java
@@ -13,29 +13,28 @@ import java.util.ArrayList;
import java.util.List;
public class TAIGAConfiguration {
+
public static final String CATEGORY_NAME_GENERAL = "category_general";
public static final String CATEGORY_NAME_ORE_GEN = "category_ore_gen";
- public static double RESFAC_MIN_VALUE = 0;
- public static double RESFAC_MAX_VALUE = 9999;
-
- public static int IRON_VAL = 20;
- public static int TIBERIUM_VAL = 15;
- public static int PROMETHEUM_VAL = 25;
- public static int VALYRIUM_VAL = 10;
- public static int OSRAM_VAL = 1;
- public static int DURANITE_VAL = 1;
- public static int BASALT_VAL = 10;
- public static int EEZO_VAL = 3;
- public static int KARMESINE_VAL = 15;
- public static int VIBRANIUM_VAL = 10;
- public static int URU_VAL = 1;
- public static int AURORIUM_VAL = 10;
- public static int PALLADIUM_VAL = 10;
- public static int ABYSSUM_VAL = 4;
-
- public static boolean ironGen = false;
- public static boolean endGen = true;
+ public static boolean ironGen;
+ public static boolean endGen;
+
+ public static int IRON_VAL;
+ public static int TIBERIUM_VAL;
+ public static int PROMETHEUM_VAL;
+ public static int VALYRIUM_VAL;
+ public static int OSRAM_VAL;
+ public static int DURANITE_VAL;
+ public static int BASALT_VAL;
+ public static int EEZO_VAL;
+ public static int KARMESINE_VAL;
+ public static int VIBRANIUM_VAL;
+ public static int URU_VAL;
+ public static int AURORIUM_VAL;
+ public static int PALLADIUM_VAL;
+ public static int ABYSSUM_VAL;
+
private static Configuration config = null;
public static void preInit() {
@@ -70,17 +69,33 @@ public class TAIGAConfiguration {
config.load();
}
- /*
- * Declaration of general ore generation values: <br>
- * Activation of additional ores (iron/gold) <br>
- * Ore generation chance multiplier
- */
+ final int RESFAC_MIN_VALUE = 0;
+ final int RESFAC_MAX_VALUE = 100;
+
+ final int IRON_DEFAULT = 20;
+ final int TIBERIUM_DEFAULT = 15;
+ final int PROMETHEUM_DEFAULT = 25;
+ final int VALYRIUM_DEFAULT = 10;
+ final int OSRAM_DEFAULT = 1;
+ final int DURANITE_DEFAULT = 1;
+ final int BASALT_DEFAULT = 10;
+ final int EEZO_DEFAULT = 3;
+ final int KARMESINE_DEFAULT = 15;
+ final int VIBRANIUM_DEFAULT = 10;
+ final int URU_DEFAULT = 1;
+ final int AURORIUM_DEFAULT = 10;
+ final int PALLADIUM_DEFAULT = 10;
+ final int ABYSSUM_DEFAULT = 4;
+
+ final boolean FALSE = false;
+ final boolean TRUE = true;
- Property ironSwitch = config.get(CATEGORY_NAME_GENERAL, "Extra Iron Switch", ironGen);
+
+ Property ironSwitch = config.get(CATEGORY_NAME_GENERAL, "Extra Iron Switch", FALSE);
ironSwitch.setComment("Switch ore on/off");
ironSwitch.setLanguageKey("gui.taiga_configuration.gen_iron");
- Property endSwitch = config.get(CATEGORY_NAME_GENERAL, "Extra Endstone Switch", endGen);
+ Property endSwitch = config.get(CATEGORY_NAME_GENERAL, "Extra Endstone Switch", TRUE);
endSwitch.setComment("Switch extra End on/off");
endSwitch.setLanguageKey("gui.taiga_configuration.gen_end");
@@ -105,54 +120,133 @@ public class TAIGAConfiguration {
* Generation chance multiplier
*/
- Property ironValue = config.get(CATEGORY_NAME_ORE_GEN, "Iron", IRON_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- ironValue.setLanguageKey("gui.taiga_configuration.iron_multiplier");
- Property basaltValue = config.get(CATEGORY_NAME_ORE_GEN, "Basalt", BASALT_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- basaltValue.setLanguageKey("gui.taiga_configuration.basalt_multiplier");
- Property tiberiumValue = config.get(CATEGORY_NAME_ORE_GEN, "Tiberium", TIBERIUM_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- tiberiumValue.setLanguageKey("gui.taiga_configuration.tiberium_multiplier");
- Property auroriumValue = config.get(CATEGORY_NAME_ORE_GEN, "Aurorium", AURORIUM_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- auroriumValue.setLanguageKey("gui.taiga_configuration.aurorium_multiplier");
- Property prometheumValue = config.get(CATEGORY_NAME_ORE_GEN, "Prometheum", PROMETHEUM_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- prometheumValue.setLanguageKey("gui.taiga_configuration.prometheum_multiplier");
- Property duraniteValue = config.get(CATEGORY_NAME_ORE_GEN, "Duranite", DURANITE_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- duraniteValue.setLanguageKey("gui.taiga_configuration.duranite_multiplier");
- Property valyriumValue = config.get(CATEGORY_NAME_ORE_GEN, "Valyrium", VALYRIUM_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- valyriumValue.setLanguageKey("gui.taiga_configuration.valyrium_multiplier");
- Property vibraniumValue = config.get(CATEGORY_NAME_ORE_GEN, "Vibranium", VIBRANIUM_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- vibraniumValue.setLanguageKey("gui.taiga_configuration.vibranium_multiplier");
- Property karmesineValue = config.get(CATEGORY_NAME_ORE_GEN, "Karmesine", KARMESINE_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- karmesineValue.setLanguageKey("gui.taiga_configuration.karmesine_multiplier");
- Property palladiumValue = config.get(CATEGORY_NAME_ORE_GEN, "Palladium", PALLADIUM_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- palladiumValue.setLanguageKey("gui.taiga_configuration.palladium_multiplier");
- Property uruValue = config.get(CATEGORY_NAME_ORE_GEN, "Uru", URU_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- uruValue.setLanguageKey("gui.taiga_configuration.uru_multiplier");
- Property osramValue = config.get(CATEGORY_NAME_ORE_GEN, "Osram", OSRAM_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- osramValue.setLanguageKey("gui.taiga_configuration.osram_multiplier");
- Property abyssumValue = config.get(CATEGORY_NAME_ORE_GEN, "Abyssum", ABYSSUM_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- abyssumValue.setLanguageKey("gui.taiga_configuration.abyssum_multiplier");
- Property eezoValue = config.get(CATEGORY_NAME_ORE_GEN, "Eezo", EEZO_VAL, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
- eezoValue.setLanguageKey("gui.taiga_configuration.eezo_multiplier");
+
+ Property ironValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Iron", IRON_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ ironValueProp.setLanguageKey("gui.taiga_configuration.iron_multiplier");
+ Property basaltValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Basalt", BASALT_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ basaltValueProp.setLanguageKey("gui.taiga_configuration.basalt_multiplier");
+ Property tiberiumValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Tiberium", TIBERIUM_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ tiberiumValueProp.setLanguageKey("gui.taiga_configuration.tiberium_multiplier");
+ Property auroriumValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Aurorium", AURORIUM_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ auroriumValueProp.setLanguageKey("gui.taiga_configuration.aurorium_multiplier");
+ Property prometheumValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Prometheum", PROMETHEUM_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ prometheumValueProp.setLanguageKey("gui.taiga_configuration.prometheum_multiplier");
+ Property duraniteValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Duranite", DURANITE_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ duraniteValueProp.setLanguageKey("gui.taiga_configuration.duranite_multiplier");
+ Property valyriumValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Valyrium", VALYRIUM_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ valyriumValueProp.setLanguageKey("gui.taiga_configuration.valyrium_multiplier");
+ Property vibraniumValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Vibranium", VIBRANIUM_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ vibraniumValueProp.setLanguageKey("gui.taiga_configuration.vibranium_multiplier");
+ Property karmesineValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Karmesine", KARMESINE_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ karmesineValueProp.setLanguageKey("gui.taiga_configuration.karmesine_multiplier");
+ Property palladiumValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Palladium", PALLADIUM_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ palladiumValueProp.setLanguageKey("gui.taiga_configuration.palladium_multiplier");
+ Property uruValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Uru", URU_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ uruValueProp.setLanguageKey("gui.taiga_configuration.uru_multiplier");
+ Property osramValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Osram", OSRAM_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ osramValueProp.setLanguageKey("gui.taiga_configuration.osram_multiplier");
+ Property abyssumValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Abyssum", ABYSSUM_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ abyssumValueProp.setLanguageKey("gui.taiga_configuration.abyssum_multiplier");
+ Property eezoValueProp = config.get(CATEGORY_NAME_ORE_GEN, "Eezo", EEZO_DEFAULT, "value for generation", RESFAC_MIN_VALUE, RESFAC_MAX_VALUE);
+ eezoValueProp.setLanguageKey("gui.taiga_configuration.eezo_multiplier");
List<String> propOrderOreGen = new ArrayList<String>();
- propOrderOreGen.add(ironValue.getName());
- propOrderOreGen.add(basaltValue.getName());
- propOrderOreGen.add(tiberiumValue.getName());
- propOrderOreGen.add(auroriumValue.getName());
- propOrderOreGen.add(prometheumValue.getName());
- propOrderOreGen.add(duraniteValue.getName());
- propOrderOreGen.add(valyriumValue.getName());
- propOrderOreGen.add(vibraniumValue.getName());
- propOrderOreGen.add(karmesineValue.getName());
- propOrderOreGen.add(palladiumValue.getName());
- propOrderOreGen.add(uruValue.getName());
- propOrderOreGen.add(osramValue.getName());
- propOrderOreGen.add(abyssumValue.getName());
- propOrderOreGen.add(eezoValue.getName());
+ propOrderOreGen.add(ironValueProp.getName());
+ propOrderOreGen.add(basaltValueProp.getName());
+ propOrderOreGen.add(tiberiumValueProp.getName());
+ propOrderOreGen.add(auroriumValueProp.getName());
+ propOrderOreGen.add(prometheumValueProp.getName());
+ propOrderOreGen.add(duraniteValueProp.getName());
+ propOrderOreGen.add(valyriumValueProp.getName());
+ propOrderOreGen.add(vibraniumValueProp.getName());
+ propOrderOreGen.add(karmesineValueProp.getName());
+ propOrderOreGen.add(palladiumValueProp.getName());
+ propOrderOreGen.add(uruValueProp.getName());
+ propOrderOreGen.add(osramValueProp.getName());
+ propOrderOreGen.add(abyssumValueProp.getName());
+ propOrderOreGen.add(eezoValueProp.getName());
config.setCategoryPropertyOrder(CATEGORY_NAME_ORE_GEN, propOrderOreGen);
+ if (readFieldsFromConfig) {
+ ironGen = ironSwitch.getBoolean(FALSE);
+ endGen = endSwitch.getBoolean(TRUE);
+ IRON_VAL = ironValueProp.getInt(IRON_DEFAULT);
+ if (IRON_VAL > RESFAC_MAX_VALUE || IRON_VAL < RESFAC_MIN_VALUE) {
+ IRON_VAL = IRON_DEFAULT;
+ }
+ TIBERIUM_VAL = tiberiumValueProp.getInt(TIBERIUM_DEFAULT);
+ if (TIBERIUM_VAL > RESFAC_MAX_VALUE || TIBERIUM_VAL < RESFAC_MIN_VALUE) {
+ TIBERIUM_VAL = TIBERIUM_DEFAULT;
+ }
+ PROMETHEUM_VAL = prometheumValueProp.getInt(PROMETHEUM_DEFAULT);
+ if (PROMETHEUM_VAL > RESFAC_MAX_VALUE || PROMETHEUM_VAL < RESFAC_MIN_VALUE) {
+ PROMETHEUM_VAL = PROMETHEUM_DEFAULT;
+ }
+ VALYRIUM_VAL = valyriumValueProp.getInt(VALYRIUM_DEFAULT);
+ if (VALYRIUM_VAL > RESFAC_MAX_VALUE || VALYRIUM_VAL < RESFAC_MIN_VALUE) {
+ VALYRIUM_VAL = VALYRIUM_DEFAULT;
+ }
+ OSRAM_VAL = osramValueProp.getInt(OSRAM_DEFAULT);
+ if (OSRAM_VAL > RESFAC_MAX_VALUE || OSRAM_VAL < RESFAC_MIN_VALUE) {
+ OSRAM_VAL = OSRAM_DEFAULT;
+ }
+ DURANITE_VAL = duraniteValueProp.getInt(DURANITE_DEFAULT);
+ if (DURANITE_VAL > RESFAC_MAX_VALUE || DURANITE_VAL < RESFAC_MIN_VALUE) {
+ DURANITE_VAL = DURANITE_DEFAULT;
+ }
+ BASALT_VAL = basaltValueProp.getInt(BASALT_DEFAULT);
+ if (BASALT_VAL > RESFAC_MAX_VALUE || BASALT_VAL < RESFAC_MIN_VALUE) {
+ BASALT_VAL = BASALT_DEFAULT;
+ }
+ EEZO_VAL = eezoValueProp.getInt(EEZO_DEFAULT);
+ if (EEZO_VAL > RESFAC_MAX_VALUE || EEZO_VAL < RESFAC_MIN_VALUE) {
+ EEZO_VAL = EEZO_DEFAULT;
+ }
+ KARMESINE_VAL = karmesineValueProp.getInt(KARMESINE_DEFAULT);
+ if (KARMESINE_VAL > RESFAC_MAX_VALUE || KARMESINE_VAL < RESFAC_MIN_VALUE) {
+ KARMESINE_VAL = KARMESINE_DEFAULT;
+ }
+ VIBRANIUM_VAL = vibraniumValueProp.getInt(VIBRANIUM_DEFAULT);
+ if (VIBRANIUM_VAL > RESFAC_MAX_VALUE || VIBRANIUM_VAL < RESFAC_MIN_VALUE) {
+ VIBRANIUM_VAL = VIBRANIUM_DEFAULT;
+ }
+ URU_VAL = uruValueProp.getInt(URU_DEFAULT);
+ if (URU_VAL > RESFAC_MAX_VALUE || URU_VAL < RESFAC_MIN_VALUE) {
+ URU_VAL = URU_DEFAULT;
+ }
+ AURORIUM_VAL = auroriumValueProp.getInt(AURORIUM_DEFAULT);
+ if (AURORIUM_VAL > RESFAC_MAX_VALUE || AURORIUM_VAL < RESFAC_MIN_VALUE) {
+ AURORIUM_VAL = AURORIUM_DEFAULT;
+ }
+ PALLADIUM_VAL = palladiumValueProp.getInt(PALLADIUM_DEFAULT);
+ if (PALLADIUM_VAL > RESFAC_MAX_VALUE || PALLADIUM_VAL < RESFAC_MIN_VALUE) {
+ PALLADIUM_VAL = PALLADIUM_DEFAULT;
+ }
+ ABYSSUM_VAL = abyssumValueProp.getInt(ABYSSUM_DEFAULT);
+ if (ABYSSUM_VAL > RESFAC_MAX_VALUE || ABYSSUM_VAL < RESFAC_MIN_VALUE) {
+ ABYSSUM_VAL = ABYSSUM_DEFAULT;
+ }
+ }
+
+ ironSwitch.set(ironGen);
+ ironValueProp.set(IRON_VAL);
+ tiberiumValueProp.set(TIBERIUM_VAL);
+ prometheumValueProp.set(PROMETHEUM_VAL);
+ valyriumValueProp.set(VALYRIUM_VAL);
+ osramValueProp.set(OSRAM_VAL);
+ duraniteValueProp.set(DURANITE_VAL);
+ basaltValueProp.set(BASALT_VAL);
+ eezoValueProp.set(EEZO_VAL);
+ karmesineValueProp.set(KARMESINE_VAL);
+ vibraniumValueProp.set(VIBRANIUM_VAL);
+ uruValueProp.set(URU_VAL);
+ auroriumValueProp.set(AURORIUM_VAL);
+ palladiumValueProp.set(PALLADIUM_VAL);
+ abyssumValueProp.set(ABYSSUM_VAL);
+
+
if (config.hasChanged()) {
config.save();
}
diff --git a/src/main/java/com/sosnitzka/taiga/util/Generator.java b/src/main/java/com/sosnitzka/taiga/util/Generator.java
index 3e6a694..3b0a989 100644
--- a/src/main/java/com/sosnitzka/taiga/util/Generator.java
+++ b/src/main/java/com/sosnitzka/taiga/util/Generator.java
@@ -3,6 +3,7 @@ package com.sosnitzka.taiga.util;
import com.google.common.collect.Lists;
import com.sosnitzka.taiga.world.MeteorWorldSaveData;
import com.sosnitzka.taiga.world.WorldGenMinable;
+import net.minecraft.block.BlockStone;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
@@ -23,14 +24,18 @@ import static com.sosnitzka.taiga.util.Utils.nextInt;
public class Generator {
- public static void generateOre(boolean center, IBlockState state, IBlockState replace, Random random, int x, int z, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
- if (center) {
- generateOreDense(state, replace, random, x, z, world, chance, minY, maxY, minSize, maxSize, null);
- } else {
- generateOre(state, replace, null, null, random, x, z, world, chance, minY, maxY, minSize, maxSize, null);
- }
+ public static void generateOre(IBlockState state, IBlockState replace, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
+ if (replace == Blocks.IRON_ORE.getDefaultState()) System.out.println(" HIER ");
+ generateOre(state, replace, null, null, random, chunkX, chunkZ, world, chance, minY, maxY, minSize, maxSize, null);
+ }
+
+ public static void generateOre(IBlockState oldState, IBlockState newState, IProperty property, Comparable comparable, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize) {
+ generateOre(oldState, newState, property, comparable, random, chunkX, chunkZ, world, chance, minY, maxY, minSize, maxSize, null);
}
+ public static void generateOre(IBlockState state, IBlockState replace, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize, List<Biome> biome) {
+ generateOre(state, replace, null, null, random, chunkX, chunkZ, world, chance, minY, maxY, minSize, maxSize, null);
+ }
public static void generateOre(IBlockState state, IBlockState replace, IProperty property, Comparable comparable, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize, List<Biome> biome) {
int size = minSize + random.nextInt(maxSize - minSize);
@@ -48,11 +53,11 @@ public class Generator {
public static void generateOreDescending(List<IBlockState> replaceBlockList, IBlockState replacementBlock, Random random, int chunkX, int chunkZ, World world, int count, int minY, int maxY, int chance) {
if (random.nextFloat() < (float) (0.01 * chance))
- generateOreDescending(replaceBlockList, replacementBlock, random, chunkX, chunkZ, world, count, minY, maxY);
+ generateOreDescendingTopLayer(replaceBlockList, replacementBlock, random, chunkX, chunkZ, world, count, minY, maxY);
}
- public static void generateOreDescending(List<IBlockState> replaceBlockList, IBlockState replacementBlock, Random random, int chunkX, int chunkZ, World world, int count, int minY, int maxY) {
+ public static void generateOreDescendingTopLayer(List<IBlockState> replaceBlockList, IBlockState replacementBlock, Random random, int chunkX, int chunkZ, World world, int count, int minY, int maxY) {
for (int i = 0; i < count; i++) {
int posX = chunkX + random.nextInt(16);
int posZ = chunkZ + random.nextInt(16);
@@ -70,7 +75,28 @@ public class Generator {
}
}
- public static void generateOreBottom(IBlockState replacedBlock, IBlockState replacementBlock, Random random, int chunkX, int chunkZ, World world, int chance, int spread, int maxY) {
+ public static void generateOreDescending(IBlockState oldState, IBlockState newState, IProperty property, Comparable comparable, Random random, int chunkX, int chunkZ, World world, int count) {
+ for (int i = 0; i < count; i++) {
+ int posX = chunkX + random.nextInt(16);
+ int posZ = chunkZ + random.nextInt(16);
+ BlockPos cPos = new BlockPos(posX, random.nextInt(93) + 3, posZ);
+ IBlockState state = world.getBlockState(cPos);
+ if (oldState.getBlock().equals(state.getBlock()) && state.getBlock() instanceof BlockStone && comparable.equals(state.getValue(property))) {
+
+ world.setBlockState(cPos, newState);
+
+ continue;
+ }
+ while (!(state.getBlock() instanceof BlockStone) && !oldState.getBlock().equals(state.getBlock()) && !comparable.equals(state.getValue(property)) && cPos.getY() > 5) {
+ cPos = cPos.down();
+ }
+ if (state.getBlock() instanceof BlockStone && oldState.getBlock().equals(state.getBlock()) && comparable.equals(state.getValue(property))) {
+ world.setBlockState(cPos, newState);
+ }
+ }
+ }
+
+ public static void generateOreBottom(IBlockState oldState, IBlockState newState, Random random, int chunkX, int chunkZ, World world, int chance, int spread, int maxY) {
for (int i = 0; i < chance; i++) {
int posX = chunkX + random.nextInt(16);
int posY = 0;
@@ -80,8 +106,8 @@ public class Generator {
while (world.getBlockState(cPos).equals(Blocks.AIR.getDefaultState()) && cPos.getY() < maxY) {
cPos = cPos.up();
}
- if (world.getBlockState(cPos).equals(replacedBlock)) {
- world.setBlockState(cPos.up(random.nextInt(spread)), replacementBlock);
+ if (world.getBlockState(cPos).equals(oldState)) {
+ world.setBlockState(cPos.up(random.nextInt(spread)), newState);
}
}
}
@@ -188,27 +214,4 @@ public class Generator {
}
}
}
-
-
- public static void generateOreDense(IBlockState state, IBlockState replace, Random random, int chunkX, int chunkZ, World world, int chance, int minY, int maxY, int minSize, int maxSize, List<Biome> biome) {
- int size = minSize + random.nextInt(maxSize - minSize);
- int height = maxY - minY;
- BlockPos cPos;
- for (int i = 0; i < chance; i += 5) {
- for (int j = 0; j <= 2; j++) {
- cPos = new BlockPos(chunkX + random.nextInt(16), minY + height * j / 5 + random.nextInt(height * 3 / 5), chunkZ + random.nextInt(16));
- if (biome == null || biome.contains(world.getBiome(cPos))) {
- new WorldGenMinable(state, size, StateMatcher.forState(replace, null, null)).generate(world, random, cPos);
- }
- }
- for (int j = 0; j <= 1; j++) {
- int x = chunkX + random.nextInt(16);
- int y = chunkZ + random.nextInt(16);
- cPos = new BlockPos(x, minY + height * 4 / 9 + random.nextInt(height / 9), y);
- if (biome == null || biome.contains(world.getBiome(cPos))) {
- new WorldGenMinable(state, size, StateMatcher.forState(replace, null, null)).generate(world, random, cPos);
- }
- }
- }
- }
}
diff --git a/src/main/java/com/sosnitzka/taiga/world/WorldGen.java b/src/main/java/com/sosnitzka/taiga/world/WorldGen.java
index a3c821a..60d6aad 100644
--- a/src/main/java/com/sosnitzka/taiga/world/WorldGen.java
+++ b/src/main/java/com/sosnitzka/taiga/world/WorldGen.java
@@ -19,35 +19,37 @@ import static com.sosnitzka.taiga.TAIGAConfiguration.*;
@SuppressWarnings("unchecked")
public class WorldGen implements IWorldGenerator {
private void nether(Random random, int x, int z, World world) {
-
- Generator.generateOre(false, Blocks.NETHERRACK.getDefaultState(), tiberiumOre.getDefaultState(), random, x, z, world, TIBERIUM_VAL, 0, 128, 10, 35);
- Generator.generateOre(true, Blocks.NETHERRACK.getDefaultState(), prometheumOre.getDefaultState(), random, x, z, world, PROMETHEUM_VAL, 0, 128, 2, 4);
- Generator.generateOre(true, Blocks.NETHERRACK.getDefaultState(), valyriumOre.getDefaultState(), random, x, z, world, VALYRIUM_VAL, 0, 32, 2, 4);
+ System.out.println("TIBERIUM_VAL: " + TIBERIUM_VAL);
+ System.out.println("PROMETHEUM_VAL: " + PROMETHEUM_VAL);
+ System.out.println("VALYRIUM_VAL: " + VALYRIUM_VAL);
+ System.out.println("OSRAM_VAL: " + OSRAM_VAL);
+ Generator.generateOre(Blocks.NETHERRACK.getDefaultState(), tiberiumOre.getDefaultState(), random, x, z, world, TIBERIUM_VAL, 0, 128, 10, 35);
+ Generator.generateOre(Blocks.NETHERRACK.getDefaultState(), prometheumOre.getDefaultState(), random, x, z, world, PROMETHEUM_VAL, 0, 128, 2, 4);
+ Generator.generateOre(Blocks.NETHERRACK.getDefaultState(), valyriumOre.getDefaultState(), random, x, z, world, VALYRIUM_VAL, 0, 32, 2, 4);
Generator.generateOreDescending(newArrayList(Blocks.LAVA.getDefaultState(), Blocks.FLOWING_LAVA.getDefaultState()), osramOre.getDefaultState(), random, x, z, world, OSRAM_VAL, 0, 64, 15);
}
private void world(Random random, int x, int z, World world) {
- // Optional
- if (ironGen)
- Generator.generateOre(false, Blocks.STONE.getDefaultState(), Blocks.IRON_ORE.getDefaultState(), random, x, z, world, IRON_VAL, 0, 128, 1, 8);
- System.out.println("IRON GEN: " + ironGen);
- System.out.println("Duranite ore Numer: " + DURANITE_VAL);
- Generator.generateMeteor(duraniteOre.getDefaultState(), blockMeteorite.getDefaultState(), random, x, z, world, DURANITE_VAL, 4, 16, 112);
- Generator.generateOreDescending(newArrayList(Blocks.LAVA.getDefaultState(), Blocks.FLOWING_LAVA.getDefaultState()), basaltBlock.getDefaultState(), random, x, z, world, BASALT_VAL, 0, 64);
- Generator.generateOreDescending(newArrayList(Blocks.BEDROCK.getDefaultState()), eezoOre.getDefaultState(), random, x, z, world, EEZO_VAL, 0, 10);
- Generator.generateOre(karmesineOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.DIORITE, random, x, z, world, KARMESINE_VAL, 0, 96, 3, 4, null);
- Generator.generateOre(karmesineOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.ANDESITE, random, x, z, world, KARMESINE_VAL, 0, 96, 3, 4, null);
- Generator.generateOre(karmesineOre.getDefaultState(), Blocks.STONE.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.GRANITE, random, x, z, world, KARMESINE_VAL, 0, 96, 3, 4, null);
- Generator.generateOreDense(vibraniumOre.getDefaultState(), Blocks.STONE.getDefaultState(), random, x, z, world, VIBRANIUM_VAL, 0, 64, 2, 12, newArrayList(Biomes.DESERT_HILLS, Biomes.EXTREME_HILLS, Biomes.EXTREME_HILLS_EDGE, Biomes.EXTREME_HILLS_WITH_TREES, Biomes.DESERT));
+ Generator.generateMeteor(duraniteOre.getDefaultState(), blockMeteorite.getDefaultState(), random, x, z, world, DURANITE_VAL, 6, 16, 112);
+ Generator.generateOreDescendingTopLayer(newArrayList(Blocks.LAVA.getDefaultState(), Blocks.FLOWING_LAVA.getDefaultState()), basaltBlock.getDefaultState(), random, x, z, world, BASALT_VAL, 0, 64);
+ Generator.generateOreDescendingTopLayer(newArrayList(Blocks.BEDROCK.getDefaultState()), eezoOre.getDefaultState(), random, x, z, world, EEZO_VAL, 0, 10);
+
+ Generator.generateOreDescending(Blocks.STONE.getDefaultState(), karmesineOre.getDefaultState(), BlockStone.VARIANT, BlockStone.EnumType.DIORITE, random, x, z, world, KARMESINE_VAL);
+
+ Generator.generateOre(vibraniumOre.getDefaultState(), Blocks.STONE.getDefaultState(), random, x, z, world, VIBRANIUM_VAL, 0, 64, 2, 12, newArrayList(Biomes.DESERT_HILLS, Biomes.EXTREME_HILLS, Biomes.EXTREME_HILLS_EDGE, Biomes.EXTREME_HILLS_WITH_TREES, Biomes.DESERT));
+ Generator.generateOre(vibraniumOre.getDefaultState(), Blocks.STONE.getDefaultState(), random, x, z, world, 1, 0, 128, 1, 3, null);
+ if (ironGen) {
+ Generator.generateOre(Blocks.STONE.getDefaultState(), Blocks.IRON_ORE.getDefaultState(), random, x, z, world, IRON_VAL + 2000, 0, 32, 2, 8);
+ }
}
private void end(Random random, int x, int z, World world) {
Generator.generateCube(true, uruOre.getDefaultState(), blockObsidiorite.getDefaultState(), random, x, z, world, URU_VAL, 2, 0, 96, 3);
if (endGen)
Generator.generateOre(Blocks.END_STONE.getDefaultState(), Blocks.AIR.getDefaultState(), null, null, random, x, z, world, 1, 3, 64, 3, 8, null);
- Generator.generateOre(false, Blocks.END_STONE.getDefaultState(), auroriumOre.getDefaultState(), random, x, z, world, AURORIUM_VAL, 32, 48, 2, 4);
- Generator.generateOre(true, Blocks.END_STONE.getDefaultState(), palladiumOre.getDefaultState(), random, x, z, world, PALLADIUM_VAL, 48, 64, 2, 4);
+ Generator.generateOre(Blocks.END_STONE.getDefaultState(), auroriumOre.getDefaultState(), random, x, z, world, AURORIUM_VAL, 32, 48, 2, 4);
+ Generator.generateOre(Blocks.END_STONE.getDefaultState(), palladiumOre.getDefaultState(), random, x, z, world, PALLADIUM_VAL, 48, 64, 2, 4);
Generator.generateOreBottom(Blocks.END_STONE.getDefaultState(), abyssumOre.getDefaultState(), random, x, z, world, ABYSSUM_VAL, 4, 64);
}