Added integration for non-vanilla dimensions.

Fixed some config basics.
This commit is contained in:
Robert Sosnitzka
2016-07-26 16:31:03 +02:00
parent f8984bec16
commit e8976365a2
4 changed files with 60 additions and 19 deletions

View File

@@ -38,7 +38,7 @@ public class Fluids {
public static BasicTinkerFluid nitroniteFluid = new BasicTinkerFluid("nitronite", 0xFFdfe553, true, 680, 10, 2185);
public static BasicTinkerFluid proxideumFluid = new BasicTinkerFluid("proxideum", 0xFF2f7177, true, 700, 9, 3859);
public static BasicTinkerFluid noctunyxFluid = new BasicTinkerFluid("noctunyx", 0xFF5f5081, true, 712, 8, 3983);
public static BasicTinkerFluid imperomiteFluid = new BasicTinkerFluid("imperomite", 0xFFff6642, true, 510, 10, 2353);
public static BasicTinkerFluid imperomiteFluid = new BasicTinkerFluid("imperomite", 0xFF5cc96b, true, 510, 10, 2353);
public static BasicTinkerFluid cryptogenFluid = new BasicTinkerFluid("cryptogen", 0xFF9f8a4a, true, 560, 10, 3243);
public static BasicTinkerFluid fractoryteFluid = new BasicTinkerFluid("fractoryte", 0xFF983f11, true, 670, 8, 3805);
public static BasicTinkerFluid seismodiumFluid = new BasicTinkerFluid("seismodium", 0xFF46131D, true, 831, 10, 1837);

View File

@@ -14,9 +14,12 @@ import java.util.List;
public class TAIGAConfiguration {
public static final String CATEGORY_NAME_GENERAL = "category_general";
public static final String CATEGORY_NAME_ORE = "category_ore";
public static int oreResistenceFactor;
public static final String CATEGORY_NAME_ORE_GEN = "category_ore_gen";
public static final String CATEGORY_NAME_ORE_VAL = "category_ore_val";
public static double oreResistenceFactor;
public static boolean slagIronGen;
public static boolean slagGoldGen;
public static boolean ironGen;
private static Configuration config = null;
public static void preInit() {
@@ -51,38 +54,55 @@ public class TAIGAConfiguration {
config.load();
}
final int RESMUT_MIN_VALUE = 0;
final int RESMUT_MAX_VALUE = 9999;
final int RESMUT_DEFAULT_VALUE = 1;
Property resMultiplier = config.get(CATEGORY_NAME_ORE, "res_multiplier", RESMUT_DEFAULT_VALUE,
final double RESMUT_MIN_VALUE = 0;
final double RESMUT_MAX_VALUE = 9999;
final double RESMUT_DEFAULT_VALUE = 1.0;
Property resMultiplier = config.get(CATEGORY_NAME_ORE_GEN, "Percentage resource multiplier", RESMUT_DEFAULT_VALUE,
"Resistance multiplier", RESMUT_MIN_VALUE, RESMUT_MAX_VALUE);
resMultiplier.setLanguageKey("gui.taiga_configuration.res_multiplier");
final boolean IRONGEN_DEFAULT_VALUE = true;
final boolean SLAGIRONGEN_DEFAULT_VALUE = true;
final boolean SLAGGOLDGEN_DEFAULT_VALUE = true;
Property ironSwitch = config.get(CATEGORY_NAME_GENERAL, "switch_iron", IRONGEN_DEFAULT_VALUE);
Property slagIronSwitch = config.get(CATEGORY_NAME_GENERAL, "switch_slagiron", SLAGIRONGEN_DEFAULT_VALUE);
Property slagGoldSwitch = config.get(CATEGORY_NAME_GENERAL, "switch_slaggold", SLAGGOLDGEN_DEFAULT_VALUE);
ironSwitch.setComment("Switch extra iron on/off");
slagGoldSwitch.setComment("Switch slaggold on/off");
slagIronSwitch.setComment("Switch slagiron on/off");
ironSwitch.setLanguageKey("gui.taiga_configuration.gen_iron");
slagIronSwitch.setLanguageKey("gui.taiga_configuration.gen_slagiron");
slagGoldSwitch.setLanguageKey("gui.taiga_configuration.gen_slaggold");
List<String> propOrderGeneral = new ArrayList<String>();
propOrderGeneral.add(ironSwitch.getName());
propOrderGeneral.add(slagIronSwitch.getName());
propOrderGeneral.add(slagGoldSwitch.getName());
config.setCategoryPropertyOrder(CATEGORY_NAME_GENERAL, propOrderGeneral);
List<String> propOrderOre = new ArrayList<String>();
propOrderOre.add(resMultiplier.getName());
config.setCategoryPropertyOrder(CATEGORY_NAME_ORE, propOrderOre);
config.setCategoryPropertyOrder(CATEGORY_NAME_ORE_GEN, propOrderOre);
if (readFieldsFromConfig) {
oreResistenceFactor = resMultiplier.getInt(RESMUT_DEFAULT_VALUE);
oreResistenceFactor = resMultiplier.getDouble(RESMUT_DEFAULT_VALUE);
if (oreResistenceFactor > RESMUT_MAX_VALUE || oreResistenceFactor < RESMUT_MIN_VALUE) {
oreResistenceFactor = RESMUT_DEFAULT_VALUE;
}
ironGen = ironSwitch.getBoolean(IRONGEN_DEFAULT_VALUE);
slagIronGen = slagIronSwitch.getBoolean(SLAGIRONGEN_DEFAULT_VALUE);
slagGoldGen = slagGoldSwitch.getBoolean(SLAGGOLDGEN_DEFAULT_VALUE);
}
resMultiplier.set(oreResistenceFactor);
ironSwitch.set(ironGen);
slagIronSwitch.set(slagIronGen);
slagGoldSwitch.set(slagGoldGen);
if (config.hasChanged()) {
config.save();
@@ -93,7 +113,7 @@ public class TAIGAConfiguration {
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
if (TAIGA.MODID.equals(event.getModID()) && !event.isWorldRunning()) {
if (event.getConfigID().equals(CATEGORY_NAME_GENERAL) || event.getConfigID().equals(CATEGORY_NAME_ORE)) {
if (event.getConfigID().equals(CATEGORY_NAME_GENERAL) || event.getConfigID().equals(CATEGORY_NAME_ORE_GEN) || event.getConfigID().equals(CATEGORY_NAME_ORE_VAL)) {
syncFromGUI();
}
}

View File

@@ -36,14 +36,16 @@ public class TAIGAGuiFactory implements IModGuiFactory {
}
public static class TAIGAConfigGui extends GuiConfig {
public TAIGAConfigGui(GuiScreen parentScreen) {
super(parentScreen, getConfigElements(), TAIGA.MODID, false, false, I18n.format("gui.taiga_configuration.mainTitle"));
}
private static List<IConfigElement> getConfigElements() {
List<IConfigElement> list = new ArrayList<IConfigElement>();
list.add(new DummyConfigElement.DummyCategoryElement("mainCfg", "gui.taiga_configuration.ctgy.general", CategoryEntryGeneral.class));
list.add(new DummyConfigElement.DummyCategoryElement("oreCfg", "gui.taiga_configuration.ctgy.ore", CategoryEntryOre.class));
list.add(new DummyConfigElement.DummyCategoryElement("Main Configuration", "gui.taiga_configuration.ctgy.general", CategoryEntryGeneral.class));
list.add(new DummyConfigElement.DummyCategoryElement("Ore Generation", "gui.taiga_configuration.ctgy.oregen", CategoryEntryOreGen.class));
list.add(new DummyConfigElement.DummyCategoryElement("Ore Values", "gui.taiga_configuration.ctgy.oreval", CategoryEntryOreVal.class));
return list;
}
@@ -63,19 +65,35 @@ public class TAIGAGuiFactory implements IModGuiFactory {
}
}
public static class CategoryEntryOre extends GuiConfigEntries.CategoryEntry {
public CategoryEntryOre(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) {
public static class CategoryEntryOreGen extends GuiConfigEntries.CategoryEntry {
public CategoryEntryOreGen(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) {
super(owningScreen, owningEntryList, prop);
}
@Override
protected GuiScreen buildChildScreen() {
Configuration configuration = TAIGAConfiguration.getConfig();
ConfigElement cat_general = new ConfigElement(configuration.getCategory(TAIGAConfiguration.CATEGORY_NAME_ORE));
ConfigElement cat_general = new ConfigElement(configuration.getCategory(TAIGAConfiguration.CATEGORY_NAME_ORE_GEN));
List<IConfigElement> propertiesOnThisScreen = cat_general.getChildElements();
String windowTitle = configuration.toString();
return new GuiConfig(this.owningScreen, propertiesOnThisScreen, this.owningScreen.modID, TAIGAConfiguration.CATEGORY_NAME_ORE, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, windowTitle);
return new GuiConfig(this.owningScreen, propertiesOnThisScreen, this.owningScreen.modID, TAIGAConfiguration.CATEGORY_NAME_ORE_GEN, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, windowTitle);
}
}
public static class CategoryEntryOreVal extends GuiConfigEntries.CategoryEntry {
public CategoryEntryOreVal(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) {
super(owningScreen, owningEntryList, prop);
}
@Override
protected GuiScreen buildChildScreen() {
Configuration configuration = TAIGAConfiguration.getConfig();
ConfigElement cat_general = new ConfigElement(configuration.getCategory(TAIGAConfiguration.CATEGORY_NAME_ORE_VAL));
List<IConfigElement> propertiesOnThisScreen = cat_general.getChildElements();
String windowTitle = configuration.toString();
return new GuiConfig(this.owningScreen, propertiesOnThisScreen, this.owningScreen.modID, TAIGAConfiguration.CATEGORY_NAME_ORE_VAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, windowTitle);
}
}
}

View File

@@ -15,10 +15,10 @@ import static com.sosnitzka.taiga.Blocks.*;
public class ZWorldGen implements IWorldGenerator {
private void nether(Random random, int x, int z, World world) {
Generator.generateNetherOre(titaniteOre.getDefaultState(), random, x, z, world, 30, 1, 64, 2, 12);
Generator.generateNetherOre(titaniteOre.getDefaultState(), random, x, z, world, 35, 1, 64, 2, 12);
Generator.generateNetherOre(tiberiumOre.getDefaultState(), random, x, z, world, 30, 1, 128, 7, 15);
Generator.generateNetherOre(palladiumOre.getDefaultState(), random, x, z, world, 30, 32, 64, 2, 7);
Generator.generateNetherOre(prometheumOre.getDefaultState(), random, x, z, world, 30, 64, 128, 2, 6);
Generator.generateNetherOre(palladiumOre.getDefaultState(), random, x, z, world, 35, 32, 64, 2, 6);
Generator.generateNetherOre(prometheumOre.getDefaultState(), random, x, z, world, 35, 64, 128, 2, 6);
}
private void world(Random random, int x, int z, World world) {
@@ -63,6 +63,9 @@ public class ZWorldGen implements IWorldGenerator {
case 1:
end(random, x, z, world);
break;
default:
world(random, x, z, world);
break;
}
}
}