diff --git a/src/com/dark/CoreRegistry.java b/src/com/dark/CoreRegistry.java index cd2ae50d1..8b0e0d242 100644 --- a/src/com/dark/CoreRegistry.java +++ b/src/com/dark/CoreRegistry.java @@ -35,21 +35,45 @@ public class CoreRegistry public static Configuration masterBlockConfig = new Configuration(new File(Loader.instance().getConfigDir(), "objects/EnabledBlocks.cfg")); + /** Generates a block using reflection, and runs it threw config checks + * + * @param name - name to register the block with + * @param modID - mod id to register the block to + * @param blockClass - class to generate the instance from */ public static Block createNewBlock(String name, String modID, Class blockClass) { return CoreRegistry.createNewBlock(name, modID, blockClass, true); } + /** Generates a block using reflection, and runs it threw config checks + * + * @param name - name to register the block with + * @param modID - mod id to register the block to + * @param blockClass - class to generate the instance from + * @param canDisable - should we allow the player the option to disable the block */ public static Block createNewBlock(String name, String modID, Class blockClass, boolean canDisable) { return CoreRegistry.createNewBlock(name, modID, blockClass, null, canDisable); } + /** Generates a block using reflection, and runs it threw config checks + * + * @param name - name to register the block with + * @param modID - mod id to register the block to + * @param blockClass - class to generate the instance from + * @param itemClass - item block to register with the block */ public static Block createNewBlock(String name, String modID, Class blockClass, Class itemClass) { return createNewBlock(name, modID, blockClass, itemClass, true); } + /** Generates a block using reflection, and runs it threw config checks + * + * @param name - name to register the block with + * @param modID - mod id to register the block to + * @param blockClass - class to generate the instance from + * @param canDisable - should we allow the player the option to disable the block + * @param itemClass - item block to register with the block */ public static Block createNewBlock(String name, String modID, Class blockClass, Class itemClass, boolean canDisable) { Block block = null; @@ -66,7 +90,9 @@ public class CoreRegistry } catch (Exception e) { + System.out.println("\n\nWarning: Block [" + name + "] failed to be created\n"); e.printStackTrace(); + System.out.println("\n\n"); } if (block != null) { @@ -166,7 +192,6 @@ public class CoreRegistry Item item = null; if (clazz != null && (!canDisable || canDisable && masterBlockConfig.get("Enabled_List", "Enabled_" + name, true).getBoolean(true))) { - //TODO redesign to catch blockID conflict try { item = clazz.newInstance(); diff --git a/src/com/dark/DarkCore.java b/src/com/dark/DarkCore.java index 665716535..235538f18 100644 --- a/src/com/dark/DarkCore.java +++ b/src/com/dark/DarkCore.java @@ -58,7 +58,6 @@ public class DarkCore { if (!load) { - ExternalModHandler.init(); CoreRegistry.masterBlockConfig.load(); load = true; } diff --git a/src/com/dark/ExternalModHandler.java b/src/com/dark/ExternalModHandler.java deleted file mode 100644 index e3a2b9a9f..000000000 --- a/src/com/dark/ExternalModHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.dark; - -import net.minecraft.tileentity.TileEntity; -import cpw.mods.fml.common.Loader; - -/** Handles working with other mod without or without the need of the APIs. - * - * @author DarkGuardsman */ -public class ExternalModHandler -{ - private static boolean init = false; - - /** Calls this to load all external mod settings and handling */ - public static void init() - { - if (!init) - { - for (MOD_ID mod : MOD_ID.values()) - { - mod.loaded = Loader.isModLoaded(mod.modID); - } - } - } - - /** Checks to see if something can run powerless based on mods loaded - * - * @param optional - power system that the device can use - * @return true if free power is to be generated */ - public static boolean runPowerLess() - { - for (MOD_ID mod : MOD_ID.values()) - { - if (mod.validPowerSystem) - { - return false; - } - } - return true; - } - - /** Enum storing MOD_IDs and some general info on mods */ - public static enum MOD_ID - { - BUILCRAFT_MOD("BuildCraft|Core", false), - BUILCRAFT_ENERGY_MOD("BuildCraft|Energy", true), - BUILCRAFT_FACTORY_MOD("BuildCraft|Factory", false), - BUILCRAFT_SILICON_MOD("BuildCraft|Silicon", false), - BUILCRAFT_BUILDERS_MOD("BuildCraft|Builders", false), - BUILCRAFT_TRANSPORT_MOD("BuildCraft|Transport", false), - INDUSTRIALCRAFT_MOD("IC2", true), - MEKANISM_MOD("Mekanism", true); //TODO add mek sub mods - - public final String modID; - public String modNAME; - public boolean loaded; - public boolean validPowerSystem; - - private MOD_ID(String modID, boolean power) - { - this.modID = modID; - this.validPowerSystem = power; - } - } - -} diff --git a/src/com/dark/IndustryTabs.java b/src/com/dark/IndustryTabs.java index df2507726..c8eb3e95a 100644 --- a/src/com/dark/IndustryTabs.java +++ b/src/com/dark/IndustryTabs.java @@ -8,10 +8,11 @@ public class IndustryTabs extends CreativeTabs { public ItemStack itemStack = new ItemStack(Item.ingotIron, 1, 0); - private static IndustryTabs tabAutomation = new IndustryTabs("Automation"); - private static IndustryTabs tabIndustrial = new IndustryTabs("Industrial"); - private static IndustryTabs tabHydrualic = new IndustryTabs("Hydraulic"); - private static IndustryTabs tabMining = new IndustryTabs("Mining"); + private static IndustryTabs tabAutomation; + private static IndustryTabs tabIndustrial; + private static IndustryTabs tabHydrualic; + private static IndustryTabs tabMining; + private static IndustryTabs tabWar; public IndustryTabs(String label) { @@ -38,6 +39,15 @@ public class IndustryTabs extends CreativeTabs return tabAutomation; } + public static IndustryTabs tabWar() + { + if (tabWar == null) + { + tabWar = new IndustryTabs("War"); + } + return tabWar; + } + public static IndustryTabs tabIndustrial() { if (tabIndustrial == null) diff --git a/src/com/dark/access/AccessProfile.java b/src/com/dark/access/AccessProfile.java index 9189aea4d..6c14ce0b9 100644 --- a/src/com/dark/access/AccessProfile.java +++ b/src/com/dark/access/AccessProfile.java @@ -284,7 +284,7 @@ public class AccessProfile implements ISpecialAccess, IVirtualObject { if (this.saveFile == null) { - this.saveFile = new File(NBTFileHelper.getWorldSaveDirectory(MinecraftServer.getServer().getFolderName()), "CoreMachine/Access/" + this.getID() + ".dat"); + this.saveFile = new File(NBTFileHelper.getWorldSaveDirectory(MinecraftServer.getServer().getFolderName()), "Access/Profile/" + this.getID() + ".dat"); } return this.saveFile; } diff --git a/src/com/dark/access/IProfileContainer.java b/src/com/dark/access/IProfileContainer.java index 382d1a0c4..5a6fe693f 100644 --- a/src/com/dark/access/IProfileContainer.java +++ b/src/com/dark/access/IProfileContainer.java @@ -9,6 +9,9 @@ public interface IProfileContainer /** Return the active profile of the machine. When calling this avoid editing the profile */ public AccessProfile getAccessProfile(); + /** Sets the active profile used by the machine. Should only be called by set profile GUI */ + public void setAccessProfile(AccessProfile profile); + /** Strait up yes or no can this user access the tile. Any future checks should be done after the * user has accessed the machine */ public boolean canAccess(String username); diff --git a/src/com/dark/access/ISpecialAccess.java b/src/com/dark/access/ISpecialAccess.java index 3b99f91e7..9bedac91b 100644 --- a/src/com/dark/access/ISpecialAccess.java +++ b/src/com/dark/access/ISpecialAccess.java @@ -2,10 +2,10 @@ package com.dark.access; import java.util.List; -/** Used by any object that needs to restrict access to it by a set of users or groups. Make sure to - * always use the default groups(user,admin,owner) so that things work smoothly. +/** Deprecated in favor of using profile containers to reduce on methods in the entity class file * * @author DarkGuardsman */ +@Deprecated public interface ISpecialAccess { /** Gets the user access instance */