mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-27 23:45:48 +00:00
Merge branch 'master' of github.com:SlimeKnights/TinkersConstruct
This commit is contained in:
commit
6671cd9a3f
10 files changed
+277
-57
No files matched your search
@@ -78,7 +78,7 @@ public class TConstruct
|
||||
public void preInit (FMLPreInitializationEvent event)
|
||||
{
|
||||
|
||||
PHConstruct.initProps(event.getModConfigurationDirectory());
|
||||
PHConstruct.initProps(event.getSuggestedConfigurationFile());
|
||||
TConstructRegistry.materialTab = new TabTools("TConstructMaterials");
|
||||
TConstructRegistry.toolTab = new TabTools("TConstructTools");
|
||||
TConstructRegistry.blockTab = new TabTools("TConstructBlocks");
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package tconstruct.plugins;
|
||||
|
||||
/**
|
||||
* Interface for TiC compat plugins.
|
||||
*
|
||||
* Do not include mod API usage directly in this file except for IMC! This must be constructable even
|
||||
* when the target mod isn't available due to Java not allowing static abstracts.
|
||||
*/
|
||||
public interface ICompatPlugin {
|
||||
|
||||
// Mod ID the plugin handles
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
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.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class PluginController
|
||||
{
|
||||
@@ -18,10 +23,15 @@ public class PluginController
|
||||
}
|
||||
|
||||
private static PluginController instance;
|
||||
private List<ICompatPlugin> plugins = new ArrayList<ICompatPlugin>();
|
||||
private Configuration conf = null;
|
||||
private List<ICompatPlugin> plugins = new LinkedList<ICompatPlugin>();
|
||||
private Phase currPhase = Phase.PRELAUNCH;
|
||||
|
||||
private PluginController() {}
|
||||
private PluginController() {
|
||||
String path = Loader.instance().getConfigDir().toString() + File.separator + "TDynstruct.cfg";
|
||||
TConstruct.logger.info("[PluginController] Using config path: " + path);
|
||||
conf = new Configuration(new File(path));
|
||||
}
|
||||
|
||||
public static PluginController getController()
|
||||
{
|
||||
@@ -29,58 +39,82 @@ public class PluginController
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a plugin with the controller.
|
||||
*
|
||||
* Warning: Make sure your plugin class imports no APIs directly! Any API interaction should be done by handlers called in pre/init/post so
|
||||
* merely creating an instance to check the mod ID isn't a hazard to the controller.
|
||||
*
|
||||
* @param plugin Plugin to register
|
||||
*/
|
||||
public void registerPlugin(ICompatPlugin plugin)
|
||||
{
|
||||
if (Loader.isModLoaded(plugin.getModId()))
|
||||
{
|
||||
TConstruct.logger.info("Registering compat plugin for " + plugin.getModId());
|
||||
plugins.add(plugin);
|
||||
conf.load();
|
||||
boolean shouldLoad = conf.get("Plugins", plugin.getModId(), true).getBoolean(true);
|
||||
conf.save();
|
||||
|
||||
switch (currPhase) // Play catch-up if plugin is registered late
|
||||
{
|
||||
case DONE:
|
||||
case POSTINIT:
|
||||
plugin.preInit();
|
||||
plugin.init();
|
||||
plugin.postInit();
|
||||
break;
|
||||
case INIT:
|
||||
plugin.preInit();
|
||||
plugin.init();
|
||||
break;
|
||||
case PREINIT:
|
||||
plugin.preInit();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (shouldLoad)
|
||||
loadPlugin(plugin);
|
||||
}
|
||||
|
||||
// This does the actual plugin loading if mod is present; needed to allow force-enabling.
|
||||
private void loadPlugin(ICompatPlugin plugin)
|
||||
{
|
||||
if (!Loader.isModLoaded(plugin.getModId())) return;
|
||||
|
||||
TConstruct.logger.info("[PluginController] Registering compat plugin for " + plugin.getModId());
|
||||
plugins.add(plugin);
|
||||
|
||||
switch (currPhase) // Play catch-up if plugin is registered late
|
||||
{
|
||||
case DONE:
|
||||
case POSTINIT:
|
||||
plugin.preInit();
|
||||
plugin.init();
|
||||
plugin.postInit();
|
||||
break;
|
||||
case INIT:
|
||||
plugin.preInit();
|
||||
plugin.init();
|
||||
break;
|
||||
case PREINIT:
|
||||
plugin.preInit();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void preInit()
|
||||
{
|
||||
currPhase = Phase.PREINIT;
|
||||
for (ICompatPlugin plugin : plugins) plugin.preInit();
|
||||
for (ICompatPlugin pl : plugins) pl.preInit();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
currPhase = Phase.INIT;
|
||||
for (ICompatPlugin plugin : plugins) plugin.init();
|
||||
for (ICompatPlugin pl : plugins) pl.init();
|
||||
}
|
||||
|
||||
public void postInit()
|
||||
{
|
||||
currPhase = Phase.POSTINIT;
|
||||
for (ICompatPlugin plugin : plugins) plugin.postInit();
|
||||
for (ICompatPlugin pl : plugins) pl.postInit();
|
||||
currPhase = Phase.DONE;
|
||||
}
|
||||
|
||||
public void registerBuiltins()
|
||||
{
|
||||
// Mystcraft is pushed in through the backdoor so it can't be disabled.
|
||||
loadPlugin(new Mystcraft());
|
||||
|
||||
registerPlugin(new AppEng());
|
||||
registerPlugin(new BuildcraftTransport());
|
||||
registerPlugin(new ForgeMultiPart());
|
||||
registerPlugin(new MineFactoryReloaded());
|
||||
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() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,12 +28,6 @@ public class EnvironmentChecks
|
||||
if (Loader.isModLoaded("gregtech_addon"))
|
||||
{
|
||||
TConstruct.logger.severe("[Environment Checks] Gelatinous iceberg dead ahead! Entering Greggy waters! Abandon hope all ye who enter here! (No, seriously, we don't support GT. Don't report any issues. Thanks.)");
|
||||
TConstruct.logger.severe("[Environment Checks] A NOTE TO THE USER: Gregtech has been known to crash the game with Metallurgy and for certain specific 'banished' players.");
|
||||
TConstruct.logger.severe("[Environment Checks] For this reason, the TCon dev team urge you to seek your tedium fix from someone else, as Greg disobeys");
|
||||
TConstruct.logger.severe("[Environment Checks] the basic tenets of good modders conduct. We log this message rather than sabotage. We'd hope he'd do the same.");
|
||||
TConstruct.logger.severe("[Environment Checks] In the meantime, we recommend not playing anything but IC2 alongside Gregtech. ~ Sunstrike");
|
||||
TConstruct.logger.severe("[Environment Checks] GT Appendum I: And now he's going after Forge Mod Loader too...");
|
||||
TConstruct.logger.severe("[Environment Checks] http://forum.industrial-craft.net/index.php?page=Thread&postID=138551#post138551 ~ SlimeKnights");
|
||||
modIds.add("gregtech_addon");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package tconstruct.util.config;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.Property;
|
||||
import tconstruct.TConstruct;
|
||||
@@ -11,29 +12,11 @@ import tconstruct.library.tools.AbilityHelper;
|
||||
public class PHConstruct
|
||||
{
|
||||
|
||||
public static void initProps (File location)
|
||||
public static void initProps (File confFile)
|
||||
{
|
||||
/* Here we will set up the config file for the mod
|
||||
* First: Create a folder inside the config folder
|
||||
* Second: Create the actual config file
|
||||
* Note: Configs are a pain, but absolutely necessary for every mod.
|
||||
*/
|
||||
File newFile = new File(location + "/TinkersWorkshop.txt");
|
||||
|
||||
/* Some basic debugging will go a long way */
|
||||
try
|
||||
{
|
||||
newFile.createNewFile();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
TConstruct.logger.severe("Could not create configuration file for TConstruct. Reason:");
|
||||
TConstruct.logger.severe(e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
/* [Forge] Configuration class, used as config method */
|
||||
Configuration config = new Configuration(newFile);
|
||||
cfglocation = location;
|
||||
Configuration config = new Configuration(confFile);
|
||||
/* Load the configuration file */
|
||||
config.load();
|
||||
|
||||
@@ -387,6 +370,7 @@ public class PHConstruct
|
||||
/* Save the configuration file */
|
||||
config.save();
|
||||
|
||||
String location = Loader.instance().getConfigDir().toString();
|
||||
File gt = new File(location + "/GregTech");
|
||||
if (gt.exists())
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user