allow to configure XP juice ID, take value from OpenBlocks' config if possible

This commit is contained in:
Matthias Mann committed 2015-01-05 00:14:10 +01:00
1 parent da6daab14c
commit eee6e98c52
2 files changed
+22 -4

No files matched your search

+20 -4
View File
@@ -465,10 +465,9 @@ public class EnderIO {
FMLInterModComms.sendMessage("Railcraft", "boiler-fuel-liquid", Fluids.FIRE_WATER_NAME + "@"
+ (Config.fireWaterPowerPerCycleRF / 10 * Config.fireWaterPowerTotalBurnTime));
fluidXpJuice = FluidRegistry.getFluid("xpjuice");
if(!Loader.isModLoaded("OpenBlocks")) {
Log.info("XP Juice registered by Ender IO.");
fluidXpJuice = new Fluid("xpjuice").setLuminosity(10).setDensity(800).setViscosity(1500).setUnlocalizedName("eio.xpjuice");
fluidXpJuice = new Fluid(Config.xpJuiceName).setLuminosity(10).setDensity(800).setViscosity(1500).setUnlocalizedName("eio.xpjuice");
FluidRegistry.registerFluid(fluidXpJuice);
itemBucketXpJuice = ItemBucketEio.create(fluidXpJuice);
} else {
@@ -600,9 +599,9 @@ public class EnderIO {
PaintSourceValidator.instance.loadConfig();
if(fluidXpJuice == null) { //should have been registered by open blocks
fluidXpJuice = FluidRegistry.getFluid("xpjuice");
fluidXpJuice = FluidRegistry.getFluid(getXPJuiceName());
if(fluidXpJuice == null) {
Log.error("Liquid XP registration left to open blocks but could not be found.");
Log.error("Liquid XP Juice registration left to open blocks but could not be found.");
}
}
@@ -627,6 +626,23 @@ public class EnderIO {
addModIntegration();
}
private static String getXPJuiceName() {
String openBlocksXPJuiceName = null;
try {
Field getField = Class.forName("openblocks.Config").getField("xpFluidId");
openBlocksXPJuiceName = (String) getField.get(null);
}catch(Exception e) {
}
if(openBlocksXPJuiceName != null && !Config.xpJuiceName.equals(openBlocksXPJuiceName)) {
Log.info("Overwriting XP Juice name with '" + openBlocksXPJuiceName + "' taken from OpenBlocks' config");
return openBlocksXPJuiceName;
}
return Config.xpJuiceName;
}
private void addModIntegration() {
if(Loader.isModLoaded("TConstruct")) {
@@ -411,6 +411,7 @@ public final class Config {
public static boolean enderRailTeleportPlayers = false;
public static int xpObeliskMaxXpLevel = Integer.MAX_VALUE;
public static String xpJuiceName = "xpjuice";
public static boolean clearGlassSameTexture = false;
public static boolean clearGlassConnectToFusedQuartz = false;
@@ -1117,6 +1118,7 @@ public final class Config {
"When set to true a list of all registered mobs will be dumped to config/enderio/mobTypes.txt The names are in the format required by EIOs mob blacklists.");
xpObeliskMaxXpLevel = config.get(sectionMisc.name, "xpObeliskMaxXpLevel", xpObeliskMaxXpLevel, "Maximum level of XP the xp obelisk can contain.").getInt();
xpJuiceName = config.getString("xpJuiceName", sectionMisc.name, xpJuiceName, "Id of liquid XP fluid (WARNING: only for users who know what they are doing - changing this id can break worlds) - this should match the with OpenBlocks when installed");
clearGlassSameTexture = config.getBoolean("clearGlassSameTexture", sectionMisc.name, clearGlassSameTexture, "If true, quite clear glass will use the fused quartz border texture for the block instead of the white border.");
clearGlassConnectToFusedQuartz = config.getBoolean("clearGlassConnectToFusedQuartz", sectionMisc.name, clearGlassConnectToFusedQuartz, "If true, quite clear glass will connect textures with fused quartz.");