Bugfixes and Modularization

Fixed several crashes due to ThermalExpansion splitting into Thermal
Foundation.
Also added config options to disable modinteraction with other mods.
This commit is contained in:
Arkandos committed 2014-08-11 14:09:15 +02:00
1 parent 2b0b729ad0
commit 580f1f4e12
15 files changed
+185 -65

No files matched your search

+5 -1
View File
@@ -1075,6 +1075,7 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
if (ThermalExpansionHelper.isActive())
{
LogHelper.info("Thermal Expansion bees active");
TE_BLIZZY.addSpecialty(Config.teDustBlizz, 9);
TE_GELID.addSpecialty(Config.teDustCryotheum, 9);
TE_DANTE.addSpecialty(Config.teDustSulfur, 9);
@@ -1137,8 +1138,9 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
{
LEAD.setInactive();
}
if (OreDictionary.getOres("ingotNaturalAluminum").size() <= 0)
if (OreDictionary.getOres("ingotNaturalAluminum").size() <= 0 && OreDictionary.getOres("ingotAluminum").size() <= 0 && OreDictionary.getOres("ingotAluminium").size() <= 0)
{
LogHelper.info("Aluminum bees inactive!");
ALUMINUM.setInactive();
}
if (OreDictionary.getOres("ingotArdite").size() <= 0)
@@ -1322,10 +1324,12 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
.setGenome(BeeGenomeManager.getTemplateAluminum());
if (OreDictionary.getOres("nuggetAluminum").size() > 0)
{
LogHelper.info("Aluminum bees active!");
ALUMINUM.addSpecialty(OreDictionary.getOres("nuggetAluminum").get(0), 20);
}
else
{
LogHelper.info("Aluminum bees inactive!");
ALUMINUM.setInactive();
}
ALUMINUM.register();
+37 -1
View File
@@ -60,6 +60,15 @@ public class Config
public int CapsuleStackSizeMax;
public boolean DoHiveRetrogen;
public boolean ForceHiveRegen;
public static boolean LogHiveSpawns;
public static boolean ArsMagicaActive;
public static boolean BloodMagicActive;
public static boolean EquivalentExchangeActive;
public static boolean ExtraBeesActive;
public static boolean RedstoneArsenalActive;
public static boolean ThaumcraftActive;
public static boolean ThermalExpansionActive;
public float MagnetBaseRange;
public float MagnetLevelMultiplier;
@@ -263,7 +272,7 @@ public class Config
hive.setHarvestLevel("scoop", 0, t.ordinal() );
}
FMLLog.info("Replacing stupid-block with 'Here, have some delicious textures' ItemBlock. This is 100%% normal.");
LogHelper.info("Replacing stupid-block with 'Here, have some delicious textures' ItemBlock. This is 100%% normal.");
/*Item.itemsList[hive.blockID] = null;
Item.itemsList[hive.blockID] = new ItemMultiTextureTile(hive.blockID - 256, hive, HiveType.getAllNames());*/
}
@@ -482,6 +491,33 @@ public class Config
p = configuration.get("general", "magnetMaximumLevel", 8);
p.comment = "Maximum level of the magnets.";
this.MagnetMaxLevel = p.getInt();
//Modules
p = configuration.get("modules", "ArsMagica", true);
this.ArsMagicaActive = p.getBoolean();
p = configuration.get("modules", "BloodMagic", true);
this.BloodMagicActive = p.getBoolean();
p = configuration.get("modules", "EquivalentExchange", true);
this.EquivalentExchangeActive = p.getBoolean();
p = configuration.get("modules", "ExtraBees", true);
this.ExtraBeesActive = p.getBoolean();
p = configuration.get("modules", "RedstoneArsenal", true);
this.RedstoneArsenalActive = p.getBoolean();
p = configuration.get("modules", "Thaumcraft", true);
this.ThaumcraftActive = p.getBoolean();
p = configuration.get("modules", "ThermalExpansion", true);
this.ThermalExpansionActive = p.getBoolean();
// Debug
p = configuration.get("debug", "logHiveSpawns", false);
p.comment = "Enable to see exact locations of MagicBees hive spawns.";
this.LogHiveSpawns = p.getBoolean();
}
}
+3 -24
View File
@@ -43,14 +43,7 @@ public class MagicBees
FMLCommonHandler.instance().bus().register(modConfig);
// Compatibility Helpers setup time.
ForestryHelper.preInit();
ExtraBeesHelper.preInit();
ThaumcraftHelper.preInit();
EquivalentExchangeHelper.preInit();
ArsMagicaHelper.preInit();
ThermalExpansionHelper.preInit();
RedstoneArsenalHelper.preInit();
BloodMagicHelper.preInit();
ModHelper.preInit();
this.modConfig.setupBlocks();
this.modConfig.setupItems();
@@ -64,14 +57,7 @@ public class MagicBees
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
ForestryHelper.init();
ExtraBeesHelper.init();
ThaumcraftHelper.init();
EquivalentExchangeHelper.init();
ArsMagicaHelper.init();
ThermalExpansionHelper.init();
RedstoneArsenalHelper.init();
BloodMagicHelper.init();
ModHelper.init();
worldHandler = new WorldGeneratorHandler();
GameRegistry.registerWorldGenerator(worldHandler, 0);
@@ -82,14 +68,7 @@ public class MagicBees
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
ForestryHelper.postInit();
ExtraBeesHelper.postInit();
ThaumcraftHelper.postInit();
EquivalentExchangeHelper.postInit();
ArsMagicaHelper.postInit();
ThermalExpansionHelper.postInit();
RedstoneArsenalHelper.postInit();
BloodMagicHelper.postInit();
ModHelper.postInit();
this.guiHandler = new GUIHandler();
NetworkRegistry.INSTANCE.registerGuiHandler(this, this.guiHandler);
@@ -25,7 +25,7 @@ public class VersionInfo
public static final String Logo = "/gfx/magicbees/logo.png";
public static final String Depends = "required-after:Forestry;after:Thaumcraft;after:ExtraBees;after:EE3;after:ArsMagica;after:TConstruct;after:Railcraft;after:ThermalExpansion";
public static final String Depends = "required-after:Forestry;after:Thaumcraft;after:ExtraBees;after:EE3;after:ArsMagica;after:TConstruct;after:Railcraft;after:ThermalFoundation;after:ThermalExpansion;after:AWWayofTime";
boolean criticalUpdate;
boolean newVersion;
@@ -48,7 +48,7 @@ public class ArsMagicaHelper
public static void preInit()
{
if (Loader.isModLoaded(Name))
if (Loader.isModLoaded(Name) && Config.ArsMagicaActive)
{
isArsMagicaPresent = true;
}
@@ -25,7 +25,7 @@ public class BloodMagicHelper {
public static void preInit()
{
if (Loader.isModLoaded(Name))
if (Loader.isModLoaded(Name) && Config.BloodMagicActive)
{
isBloodMagicActive = true;
}
@@ -17,7 +17,7 @@ public class EquivalentExchangeHelper
public static void preInit()
{
if (Loader.isModLoaded("EE3"))
if (Loader.isModLoaded("EE3") && Config.EquivalentExchangeActive)
{
isEquivalentExchangePresent = true;
}
@@ -1,5 +1,7 @@
package magicbees.main.utils.compat;
import cpw.mods.fml.common.Loader;
import magicbees.main.Config;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -102,7 +104,7 @@ public class ExtraBeesHelper
public static void preInit()
{
if (cpw.mods.fml.common.Loader.isModLoaded("ExtraBees"))
if (Loader.isModLoaded("ExtraBees") && Config.ExtraBeesActive)
{
isEBPresent = true;
}
@@ -0,0 +1,43 @@
package magicbees.main.utils.compat;
public class ModHelper
{
public static void preInit()
{
ForestryHelper.preInit();
ExtraBeesHelper.preInit();
ThaumcraftHelper.preInit();
EquivalentExchangeHelper.preInit();
ArsMagicaHelper.preInit();
ThermalFoundationHelper.preInit();
ThermalExpansionHelper.preInit();
RedstoneArsenalHelper.preInit();
BloodMagicHelper.preInit();
}
public static void init()
{
ForestryHelper.init();
ExtraBeesHelper.init();
ThaumcraftHelper.init();
EquivalentExchangeHelper.init();
ArsMagicaHelper.init();
ThermalFoundationHelper.init();
ThermalExpansionHelper.init();
RedstoneArsenalHelper.init();
BloodMagicHelper.init();
}
public static void postInit()
{
ForestryHelper.postInit();
ExtraBeesHelper.postInit();
ThaumcraftHelper.postInit();
EquivalentExchangeHelper.postInit();
ArsMagicaHelper.postInit();
ThermalFoundationHelper.postInit();
ThermalExpansionHelper.postInit();
RedstoneArsenalHelper.postInit();
BloodMagicHelper.postInit();
}
}
@@ -1,5 +1,6 @@
package magicbees.main.utils.compat;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import magicbees.main.Config;
import magicbees.main.utils.ItemInterface;
@@ -31,7 +32,7 @@ public class RedstoneArsenalHelper
public static void preInit()
{
if (cpw.mods.fml.common.Loader.isModLoaded(Name))
if (Loader.isModLoaded(Name) && Config.RedstoneArsenalActive)
{
isRedstoneArsenalPresent = true;
}
@@ -44,7 +45,10 @@ public class RedstoneArsenalHelper
public static void init()
{
//if (isActive()) { }
if (isActive())
{
}
}
public static void postInit()
@@ -1,5 +1,6 @@
package magicbees.main.utils.compat;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import magicbees.main.utils.ItemInterface;
import magicbees.main.utils.BlockInterface;
@@ -127,7 +128,7 @@ public class ThaumcraftHelper
public static void preInit()
{
if (cpw.mods.fml.common.Loader.isModLoaded(Name))
if (Loader.isModLoaded(Name) && Config.ThaumcraftActive)
{
isThaumcraftPresent = true;
}
@@ -1,5 +1,6 @@
package magicbees.main.utils.compat;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.registry.GameRegistry;
import magicbees.item.types.DropType;
@@ -55,7 +56,7 @@ public class ThermalExpansionHelper
public static void preInit()
{
if (cpw.mods.fml.common.Loader.isModLoaded(Name))
if (Loader.isModLoaded(Name) && Config.ThermalExpansionActive)
{
isThermalExpansionPresent = true;
}
@@ -143,26 +144,12 @@ public class ThermalExpansionHelper
private static void getBlocks()
{
Config.teEnderiumBlock = GameRegistry.findItemStack("ThermalExpansion", "blockEnderium", 1);
Config.teElectrumBlock = GameRegistry.findItemStack("ThermalExpansion", "blockElectrum", 1);
Config.teInvarBlock = GameRegistry.findItemStack("ThermalExpansion", "blockInvar", 1);
Config.teNickelBlock = GameRegistry.findItemStack("ThermalExpansion", "blockNickel", 1);
Config.tePlatinumBlock = GameRegistry.findItemStack("ThermalExpansion", "blockPlatinum", 1);
Config.teBronzeBlock = GameRegistry.findItemStack("ThermalExpansion", "blockBronze", 1);
}
private static void getItems()
{
Config.teEnderiumNugget = GameRegistry.findItemStack("ThermalExpansion", "nuggetEnderium", 1);
Config.teInvarNugget = GameRegistry.findItemStack("ThermalExpansion", "nuggetInvar", 1);
Config.teElectrumNugget = GameRegistry.findItemStack("ThermalExpansion", "nuggetElectrum", 1);
Config.teNickelNugget = GameRegistry.findItemStack("ThermalExpansion", "nuggetNickel", 1);
Config.tePlatinumNugget = GameRegistry.findItemStack("ThermalExpansion", "nuggetPlatinum", 1);
Config.teDustCryotheum = GameRegistry.findItemStack("ThermalExpansion", "dustCryotheum", 1);
Config.teDustBlizz = GameRegistry.findItemStack("ThermalExpansion", "dustBlizz", 1);
Config.teDustPyrotheum = GameRegistry.findItemStack("ThermalExpansion", "dustPyrotheum", 1);
Config.teDustSulfur = GameRegistry.findItemStack("ThermalExpansion", "dustSulfur", 1);
Config.teDustPlatinum = GameRegistry.findItemStack("ThermalExpansion", "dustPlatinum", 1);
}
}
@@ -0,0 +1,64 @@
package magicbees.main.utils.compat;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import magicbees.main.Config;
import magicbees.main.utils.LogHelper;
public class ThermalFoundationHelper {
public static final String Name = "ThermalFoundation";
private static boolean isThermalFoundationPresent = false;
public static boolean isActive(){return isThermalFoundationPresent; }
public static void preInit()
{
if(Loader.isModLoaded(Name) && Config.ThermalExpansionActive)
{
isThermalFoundationPresent = true;
}
}
public static void init()
{
if(isActive())
{
}
}
public static void postInit()
{
if(isActive())
{
getBlocks();
getItems();
}
}
public static void getBlocks()
{
Config.teEnderiumBlock = GameRegistry.findItemStack(Name, "blockEnderium", 1);
Config.teElectrumBlock = GameRegistry.findItemStack(Name, "blockElectrum", 1);
Config.teInvarBlock = GameRegistry.findItemStack(Name, "blockInvar", 1);
Config.teNickelBlock = GameRegistry.findItemStack(Name, "blockNickel", 1);
Config.tePlatinumBlock = GameRegistry.findItemStack(Name, "blockPlatinum", 1);
Config.teBronzeBlock = GameRegistry.findItemStack(Name, "blockBronze", 1);
}
public static void getItems()
{
Config.teEnderiumNugget = GameRegistry.findItemStack(Name, "nuggetEnderium", 1);
Config.teInvarNugget = GameRegistry.findItemStack(Name, "nuggetInvar", 1);
Config.teElectrumNugget = GameRegistry.findItemStack(Name, "nuggetElectrum", 1);
Config.teNickelNugget = GameRegistry.findItemStack(Name, "nuggetNickel", 1);
Config.tePlatinumNugget = GameRegistry.findItemStack(Name, "nuggetPlatinum", 1);
Config.teDustCryotheum = GameRegistry.findItemStack(Name, "dustCryotheum", 1);
Config.teDustBlizz = GameRegistry.findItemStack(Name, "dustBlizz", 1);
Config.teDustPyrotheum = GameRegistry.findItemStack(Name, "dustPyrotheum", 1);
Config.teDustSulfur = GameRegistry.findItemStack(Name, "dustSulfur", 1);
Config.teDustPlatinum = GameRegistry.findItemStack(Name, "dustPlatinum", 1);
}
}
@@ -1,9 +1,9 @@
package magicbees.world.feature;
import cpw.mods.fml.common.FMLLog;
import magicbees.block.types.HiveType;
import magicbees.main.Config;
import magicbees.main.MagicBees;
import magicbees.main.utils.LogHelper;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
@@ -18,7 +18,7 @@ public class FeatureHive
private static FeatureOreVein glowstoneGen;
private static FeatureOreVein endStoneGen;
private static boolean logSpawns = true;
private static boolean logSpawns = MagicBees.getConfig().LogHiveSpawns;
public static void initialize()
{
@@ -47,7 +47,7 @@ public class FeatureHive
b != null && b.isLeaves(world, coordX, coordY + 1, coordZ))
{
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.CURIOUS.ordinal(), 3);
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Curious", coordX, coordZ, coordY);
if (logSpawns) LogHelper.info("Spawning curious hive at: X " + coordX + ", Y: " + coordY + ", Z: " + coordZ);
doSpawn = true;
}
@@ -61,7 +61,7 @@ public class FeatureHive
boolean doSpawn = false;
if (world.isAirBlock(coordX, coordY + 1, coordZ) &&
world.isAirBlock(coordX, coordY, coordZ) &&
canBlockReplaceAt(world, coordX, coordY - 1, coordZ, Blocks.dirt))
canBlockReplaceAt(world, coordX, coordY - 1, coordZ, Blocks.grass))
{
doSpawn = true;
}
@@ -69,7 +69,7 @@ public class FeatureHive
if (doSpawn)
{
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.UNUSUAL.ordinal(), 3);
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Unusual", coordX, coordZ, coordY);
if (logSpawns) LogHelper.info("Spawning unusual hive at: X " + coordX + ", Y: " + coordY + ", Z: " + coordZ);
}
return doSpawn;
@@ -82,7 +82,7 @@ public class FeatureHive
if (world.rand.nextInt() < 40 && world.isAirBlock(coordX, coordY + 1, coordZ) &&
(world.isAirBlock(coordX, coordY, coordZ) || canBlockReplaceAt(world, coordX, coordY, coordZ,
Blocks.tallgrass)) &&
(canBlockReplaceAt(world, coordX, coordY - 1, coordZ, Blocks.dirt) ||
(canBlockReplaceAt(world, coordX, coordY - 1, coordZ, Blocks.grass) ||
canBlockReplaceAt(world, coordX, coordY - 1, coordZ, Blocks.sand)))
{
doSpawn = true;
@@ -91,7 +91,7 @@ public class FeatureHive
if (doSpawn)
{
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.RESONANT.ordinal(), 3);
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Resonant", coordX, coordZ, coordY);
if (logSpawns) LogHelper.info("Spawning resonant hive at: X " + coordX + ", Y: " + coordY + ", Z: " + coordZ);
}
return doSpawn;
@@ -115,7 +115,7 @@ public class FeatureHive
if (doSpawn)
{
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.DEEP.ordinal(), 3);
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Deep", coordX, coordZ, coordY);
if (logSpawns) LogHelper.info("Spawning deep hive at: X " + coordX + ", Y: " + coordY + ", Z: " + coordZ);
redstoneGen.generateVein(world, random, coordX + 1, coordY, coordZ, 2);
@@ -147,7 +147,7 @@ public class FeatureHive
if (doSpawn)
{
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.INFERNAL.ordinal(), 3);
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Infernal", coordX, coordZ, coordY);
if (logSpawns) LogHelper.info("Spawning infernal hive at: X " + coordX + ", Y: " + coordY + ", Z: " + coordZ);
netherQuartzGen.generateVein(world, random, coordX + 1, coordY, coordZ, 4);
netherQuartzGen.generateVein(world, random, coordX - 1, coordY, coordZ, 4);
@@ -171,7 +171,7 @@ public class FeatureHive
if (doSpawn)
{
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.INFERNAL.ordinal(), 3);
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Infernal", coordX, coordZ, coordY);
if (logSpawns) LogHelper.info("Spawning infernal hive at: X " + coordX + ", Y: " + coordY + ", Z: " + coordZ);
glowstoneGen.generateVein(world, random, coordX + 1, coordY, coordZ, world.rand.nextInt(4) + 1);
glowstoneGen.generateVein(world, random, coordX - 1, coordY, coordZ, world.rand.nextInt(4) + 1);
@@ -214,7 +214,7 @@ public class FeatureHive
if (doSpawn)
{
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.OBLIVION.ordinal(), 3);
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Oblivion", coordX, coordZ, coordY);
if (logSpawns) LogHelper.info("Spawning oblivion hive at: X " + coordX + ", Y: " + coordY + ", Z: " + coordZ);
int obsidianSpikeHeight = random.nextInt(8) + 2;
@@ -246,7 +246,7 @@ public class FeatureHive
if (doSpawn)
{
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.OBLIVION.ordinal(), 3);
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Oblivion", coordX, coordZ, coordY);
if (logSpawns) LogHelper.info("Spawning oblivion hive at: X " + coordX + ", Y: " + coordY + ", Z: " + coordZ);
endStoneGen.generateVein(world, random, coordX + 1, coordY, coordZ, world.rand.nextInt(6) + 1);
endStoneGen.generateVein(world, random, coordX - 1, coordY, coordZ, world.rand.nextInt(6) + 1);