From 01c8701b68986ccfa83e902515716838d6829311 Mon Sep 17 00:00:00 2001 From: Onyx Date: Tue, 1 Dec 2015 20:55:30 +0000 Subject: - Fixed all of the bugs mentioned on github - Added new config options - Rabbits paw now increases the chance of spawning hearts, rather than itself spawning some - Hearts now have a much lower chance to spawn by default - You can no longer increase your health past 20 hearts (aka double the default health) - The guide now also shows the total number of pages on each tab - A new luck stat has been added to the Curse API - Cleaned up the code a bit (removed unused methods, imports etc) - The displayer's info now has a purple solid color background; the text also has a much closer shadow and now shrinks in height as well as in width when too big - I have modified the potion list to use Mithion's code, credits have been given --- .../darkknight/jewelrycraft/worldGen/Generation.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/worldGen/Generation.java') diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java b/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java index 11d053e..93310df 100644 --- a/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java @@ -1,5 +1,6 @@ package darkknight.jewelrycraft.worldGen; +import java.lang.reflect.Field; import java.util.Random; import cpw.mods.fml.common.IWorldGenerator; import darkknight.jewelrycraft.block.BlockList; @@ -43,12 +44,17 @@ public class Generation implements IWorldGenerator { if (!world.getWorldInfo().getTerrainType().equals(WorldType.FLAT)) { if (ConfigHandler.ORE_GEN) generateShadowOre(world, random, i, j); if (ConfigHandler.CRYSTAL_GEN) generateCrystals(world, random, i, j); - if (ConfigHandler.STRUCTURES[0]) generateStructureOverground(STRUCTURE_1, world, random, i, j, 6, false, true); - if (ConfigHandler.STRUCTURES[1]) generateStructureUnderground(STRUCTURE_2, world, random, i, j, 5, false, true); - if (ConfigHandler.STRUCTURES[2]) generateStructureUnderground(STRUCTURE_3, world, random, i, j, 7, false, true); - if (ConfigHandler.STRUCTURES[3]) generateStructureOverground(STRUCTURE_4, world, random, i, j, 10, false, true); - if (ConfigHandler.STRUCTURES[4]) generateStructureUnderground(STRUCTURE_5, world, random, i, j, 6, false, true); - if (ConfigHandler.STRUCTURES[5]) generateStructureOverground(STRUCTURE_6, world, random, i, j, 10, false, true); + try{ + for(Field f: this.getClass().getDeclaredFields()){ + Object obj = f.get(null); + if (obj instanceof WorldGenStructure && ConfigHandler.STRUCTURES[((WorldGenStructure)obj).structureNo() - 1]) + if(((WorldGenStructure)obj).isUnderground()) generateStructureUnderground((WorldGenStructure)obj, world, random, i, j, ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure)obj).structureNo()-1], false, true); + else generateStructureOverground((WorldGenStructure)obj, world, random, i, j, ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure)obj).structureNo()-1], false, true); + } + } + catch(IllegalAccessException e){ + throw new RuntimeException(e); + } } } } -- cgit v1.2.3