mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-18 19:39:12 +00:00
Transition old IMC plugins to new compat loader.
These old ones need to be removed still and all TContent refs need updated in these when refactor occurs.
This commit is contained in:
1 parent
3b3b439cfb
commit
35367bb1fd
5 files changed
+215
-31
No files matched your search
@@ -3,16 +3,17 @@ package tconstruct.plugins;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.plugins.appeng.AppEng;
|
||||
import tconstruct.plugins.buildcraft.BuildcraftTransport;
|
||||
import tconstruct.plugins.fmp.ForgeMultiPart;
|
||||
import tconstruct.plugins.minefactoryreloaded.MineFactoryReloaded;
|
||||
import tconstruct.plugins.mystcraft.Mystcraft;
|
||||
import tconstruct.plugins.nei.NotEnoughItems;
|
||||
import tconstruct.plugins.thaumcraft.Thaumcraft;
|
||||
import tconstruct.plugins.waila.Waila;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class PluginController
|
||||
{
|
||||
@@ -23,7 +24,7 @@ public class PluginController
|
||||
|
||||
private static PluginController instance;
|
||||
private Configuration conf = null;
|
||||
private Map<ICompatPlugin, Boolean> plugins = new HashMap<ICompatPlugin, Boolean>();
|
||||
private List<ICompatPlugin> plugins = new LinkedList<ICompatPlugin>();
|
||||
private Phase currPhase = Phase.PRELAUNCH;
|
||||
|
||||
private PluginController() {
|
||||
@@ -48,21 +49,14 @@ public class PluginController
|
||||
*/
|
||||
public void registerPlugin(ICompatPlugin plugin)
|
||||
{
|
||||
if (Loader.isModLoaded(plugin.getModId()))
|
||||
conf.load();
|
||||
boolean shouldLoad = conf.get("Plugins", plugin.getModId(), true).getBoolean(true);
|
||||
conf.save();
|
||||
|
||||
if (shouldLoad && Loader.isModLoaded(plugin.getModId()))
|
||||
{
|
||||
TConstruct.logger.info("[PluginController] Attempting registration of compat plugin for " + plugin.getModId());
|
||||
plugins.put(plugin, true);
|
||||
|
||||
conf.load();
|
||||
boolean shouldLoad = conf.get("Plugins", plugin.getModId(), true).getBoolean(true);
|
||||
plugins.put(plugin, shouldLoad);
|
||||
conf.save();
|
||||
|
||||
if (!shouldLoad)
|
||||
{
|
||||
TConstruct.logger.info("[PluginController] Aborting registration of compat plugin for " + plugin.getModId() + "; disabled in configuration.");
|
||||
return;
|
||||
}
|
||||
TConstruct.logger.info("[PluginController] Registering compat plugin for " + plugin.getModId());
|
||||
plugins.add(plugin);
|
||||
|
||||
switch (currPhase) // Play catch-up if plugin is registered late
|
||||
{
|
||||
@@ -88,36 +82,31 @@ public class PluginController
|
||||
public void preInit()
|
||||
{
|
||||
currPhase = Phase.PREINIT;
|
||||
for (Map.Entry<ICompatPlugin, Boolean> entry : plugins.entrySet()){
|
||||
if (entry.getValue())
|
||||
entry.getKey().preInit();
|
||||
}
|
||||
for (ICompatPlugin pl : plugins) pl.preInit();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
currPhase = Phase.INIT;
|
||||
for (Map.Entry<ICompatPlugin, Boolean> entry : plugins.entrySet()){
|
||||
if (entry.getValue())
|
||||
entry.getKey().init();
|
||||
}
|
||||
for (ICompatPlugin pl : plugins) pl.init();
|
||||
}
|
||||
|
||||
public void postInit()
|
||||
{
|
||||
currPhase = Phase.POSTINIT;
|
||||
for (Map.Entry<ICompatPlugin, Boolean> entry : plugins.entrySet()){
|
||||
if (entry.getValue())
|
||||
entry.getKey().postInit();
|
||||
}
|
||||
for (ICompatPlugin pl : plugins) pl.postInit();
|
||||
currPhase = Phase.DONE;
|
||||
}
|
||||
|
||||
public void registerBuiltins()
|
||||
{
|
||||
registerPlugin(new AppEng());
|
||||
registerPlugin(new BuildcraftTransport());
|
||||
registerPlugin(new ForgeMultiPart());
|
||||
registerPlugin(new MineFactoryReloaded());
|
||||
registerPlugin(new Mystcraft());
|
||||
registerPlugin(new NotEnoughItems());
|
||||
registerPlugin(new Thaumcraft());
|
||||
registerPlugin(new Waila());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package tconstruct.plugins.appeng;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.plugins.ICompatPlugin;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class AppEng implements ICompatPlugin {
|
||||
|
||||
private static List<String> spatialIOLogics = Arrays.asList("AdaptiveSmelteryLogic", "AqueductLogic", "CastingBasinLogic", "CastingChannelLogic", "CastingTableLogic",
|
||||
"CraftingStationLogic", "DryingRackLogic", "EssenceExtractorLogic", "FaucetLogic", "FrypanLogic", "GolemPedestalLogic", "LavaTankLogic", "PartBuilderLogic",
|
||||
"PatternChestLogic", "SmelteryDrainLogic", "SmelteryLogic", "StencilTableLogic", "TankAirLogic", "TileEntityLandmine", "ToolForgeLogic", "ToolStationLogic",
|
||||
"TowerFurnaceLogic", "MultiServantLogic");
|
||||
|
||||
@Override
|
||||
public String getModId() {
|
||||
return "AppliedEnergistics";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
TConstruct.logger.info("[AppEng] Registering for Spatial IO.");
|
||||
for (String s : spatialIOLogics)
|
||||
{
|
||||
FMLInterModComms.sendMessage("AppliedEnergistics", "movabletile", "tconstruct.blocks.logic." + s);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package tconstruct.plugins.buildcraft;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.plugins.ICompatPlugin;
|
||||
|
||||
public class BuildcraftTransport implements ICompatPlugin {
|
||||
|
||||
@Override
|
||||
public String getModId() {
|
||||
return "BuildCraft|Transport";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
TConstruct.logger.info("[BC|Transport] Registering facades.");
|
||||
// Smeltery Blocks
|
||||
addFacade(TContent.smeltery.blockID, 2);
|
||||
for (int sc = 4; sc < 11; sc++)
|
||||
{
|
||||
addFacade(TContent.smeltery.blockID, sc);
|
||||
}
|
||||
// Multi Brick + Fancy
|
||||
for (int sc = 0; sc < 13; sc++)
|
||||
{
|
||||
addFacade(TContent.multiBrick.blockID, sc);
|
||||
}
|
||||
for (int sc = 0; sc < 16; sc++)
|
||||
{
|
||||
addFacade(TContent.multiBrickFancy.blockID, sc);
|
||||
}
|
||||
// Special Soil
|
||||
for (int sc = 0; sc < 6; sc++)
|
||||
{
|
||||
addFacade(TContent.craftedSoil.blockID, sc);
|
||||
}
|
||||
// Metal Storage
|
||||
for (int sc = 0; sc < 11; sc++)
|
||||
{
|
||||
addFacade(TContent.metalBlock.blockID, sc);
|
||||
}
|
||||
// Speed Block
|
||||
for (int sc = 0; sc < 7; sc++)
|
||||
{
|
||||
addFacade(TContent.speedBlock.blockID, sc);
|
||||
}
|
||||
// Hambone
|
||||
addFacade(TContent.meatBlock.blockID, 4);
|
||||
addFacade(TContent.meatBlock.blockID, 8);
|
||||
|
||||
// Slime Gel
|
||||
addFacade(TContent.slimeGel.blockID, 0);
|
||||
addFacade(TContent.slimeGel.blockID, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
|
||||
}
|
||||
|
||||
private void addFacade (int blockId, int meta)
|
||||
{
|
||||
FMLInterModComms.sendMessage("BuildCraft|Transport", "add-facade", String.format("%d@%d", blockId, meta));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package tconstruct.plugins.mystcraft;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.plugins.ICompatPlugin;
|
||||
|
||||
public class Mystcraft implements ICompatPlugin {
|
||||
|
||||
private static String[] fluids = new String[] { "invar.molten", "electrum.molten", "bronze.molten", "aluminumbrass.molten", "manyullyn.molten", "alumite.molten", "cobalt.molten",
|
||||
"moltenArdite", "ender", "steel.molten", "platinum.molten" };
|
||||
|
||||
@Override
|
||||
public String getModId() {
|
||||
return "Mystcraft";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
TConstruct.logger.info("[Mystcraft] Blacklisting Mystcraft fluid symbols.");
|
||||
for (String nm : fluids) sendFluidBlacklist(nm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
|
||||
}
|
||||
|
||||
private void sendFluidBlacklist (String FluidName)
|
||||
{
|
||||
NBTTagCompound NBTMsg = new NBTTagCompound();
|
||||
NBTMsg.setCompoundTag("fluidsymbol", new NBTTagCompound());
|
||||
NBTMsg.getCompoundTag("fluidsymbol").setFloat("rarity", 0.0F);
|
||||
NBTMsg.getCompoundTag("fluidsymbol").setFloat("grammarweight", 0.0F);
|
||||
NBTMsg.getCompoundTag("fluidsymbol").setFloat("instabilityPerBlock", 10000F);// renders creative symbol useless
|
||||
NBTMsg.getCompoundTag("fluidsymbol").setString("fluidname", FluidName);
|
||||
FMLInterModComms.sendMessage("Mystcraft", "fluidsymbol", NBTMsg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package tconstruct.plugins.thaumcraft;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.plugins.ICompatPlugin;
|
||||
|
||||
public class Thaumcraft implements ICompatPlugin {
|
||||
|
||||
@Override
|
||||
public String getModId() {
|
||||
return "Thaumcraft";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
TConstruct.logger.info("[Thaumcraft] Registering harvestables.");
|
||||
FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(TContent.oreBerry, 1, 12));
|
||||
FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(TContent.oreBerry, 1, 13));
|
||||
FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(TContent.oreBerry, 1, 14));
|
||||
FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(TContent.oreBerry, 1, 15));
|
||||
FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(TContent.oreBerrySecond, 1, 12));
|
||||
FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(TContent.oreBerrySecond, 1, 13));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user