use of com.builtbroken.mc.core.content.debug.ItemInstaHole in project Engine by VoltzEngine-Project.
the class Engine method preInit.
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
//Init API values
VoltzEngineAPI.massRegistry = new MassRegistry();
//Init run time references
References.GLOBAL_CONFIG_FOLDER = event.getModConfigurationDirectory();
References.ROOT_FOLDER = References.GLOBAL_CONFIG_FOLDER.getParentFile();
References.BBM_CONFIG_FOLDER = new File(event.getModConfigurationDirectory(), "bbm");
//Load config files
config = new Configuration(new File(References.BBM_CONFIG_FOLDER, "ve/VoltzEngine.cfg"));
heatDataConfig = new Configuration(new File(event.getModConfigurationDirectory(), "bbm/ve/HeatMap.cfg"));
explosiveConfig = new Configuration(new File(event.getModConfigurationDirectory(), "bbm/ve/Explosives.cfg"));
manager = new ModManager().setPrefix(References.DOMAIN).setTab(CreativeTabs.tabAllSearch);
config.load();
heatDataConfig.load();
explosiveConfig.load();
ConfigScanner.instance().generateSets(event.getAsmData());
ConfigHandler.sync(getConfig(), References.DOMAIN);
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy);
MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(proxy);
MinecraftForge.EVENT_BUS.register(SaveManager.instance());
MinecraftForge.EVENT_BUS.register(new InteractionHandler());
MinecraftForge.EVENT_BUS.register(SelectionHandler.INSTANCE);
MinecraftForge.EVENT_BUS.register(RadarRegistry.INSTANCE);
FMLCommonHandler.instance().bus().register(RadarRegistry.INSTANCE);
MinecraftForge.EVENT_BUS.register(TileMapRegistry.INSTANCE);
FMLCommonHandler.instance().bus().register(TileMapRegistry.INSTANCE);
MinecraftForge.EVENT_BUS.register(RadioRegistry.INSTANCE);
FMLCommonHandler.instance().bus().register(RadioRegistry.INSTANCE);
FMLCommonHandler.instance().bus().register(new WorldActionQue());
FMLCommonHandler.instance().bus().register(TileTaskTickHandler.INSTANCE);
FMLCommonHandler.instance().bus().register(SelectionHandler.INSTANCE);
FMLCommonHandler.instance().bus().register(proxy);
//Load heat configs
enabledHeatMap = heatDataConfig.getBoolean("EnabledHeatMap", Configuration.CATEGORY_GENERAL, true, "Heat map handles interaction of heat based energy and the world. Disable only if it causes issues or you want to reduce world file size. If disabled it can prevent machines from working.");
//Load explosive configs
log_registering_explosives = explosiveConfig.getBoolean("EnableRegisterLogging", Configuration.CATEGORY_GENERAL, false, "Adds debug each time a mod registers an explosive handler. Should only be enabled to figure out which mod is overriding another mod's explosive");
MachineRecipeType.ITEM_SMELTER.setHandler(new MRSmelterHandler());
MachineRecipeType.ITEM_GRINDER.setHandler(new MRHandlerItemStack(MachineRecipeType.ITEM_GRINDER.INTERNAL_NAME));
MachineRecipeType.ITEM_CRUSHER.setHandler(new MRHandlerItemStack(MachineRecipeType.ITEM_CRUSHER.INTERNAL_NAME));
MachineRecipeType.ITEM_WASHER.setHandler(new MRHandlerItemStack(MachineRecipeType.ITEM_WASHER.INTERNAL_NAME));
MachineRecipeType.ITEM_SAWMILL.setHandler(new MRHandlerItemStack(MachineRecipeType.ITEM_SAWMILL.INTERNAL_NAME));
MachineRecipeType.FLUID_SMELTER.setHandler(new MRHandlerFluidStack(MachineRecipeType.FLUID_SMELTER.INTERNAL_NAME));
MachineRecipeType.FLUID_CAST.setHandler(new MRHandlerCast());
RecipeSorter.register(References.PREFIX + "sheetMetalTools", RecipeSheetMetal.class, SHAPED, "after:minecraft:shaped");
RecipeSorter.register(References.PREFIX + "Tools", RecipeTool.class, SHAPED, "after:minecraft:shaped");
RecipeSorter.register(References.PREFIX + "shapedLarge", RecipeShapedOreLarge.class, SHAPED, "after:minecraft:shaped");
//Internal systems
if (config.getBoolean("ASMTestingEnabled", "Internal", true, "Enables the testing of the internally used ASM code, used to ensure quality of the game. Only disable if you know the ASM is functional or there are issues with it running. Normally though if the ASM test fails then the ASM code itself was not injected. Which will result in several features of the mod not functioning correctly.")) {
//TODO check for Bukkit and disable
loader.applyModule(new ProxyASMTest());
}
loader.applyModule(getProxy());
loader.applyModule(packetHandler);
loader.applyModule(GroupProfileHandler.GLOBAL);
loader.applyModule(GlobalAccessSystem.instance);
//Recipes
loader.applyModule(SmeltingRecipeLoad.class);
loader.applyModule(CrusherRecipeLoad.class);
loader.applyModule(GrinderRecipeLoad.class);
loader.applyModule(FluidSmelterRecipeLoad.class);
loader.applyModule(CastRecipeLoader.class);
loader.applyModule(GearRecipeLoader.class);
loader.applyModule(RodRecipeLoader.class);
loader.applyModule(PlateRecipeLoader.class);
loader.applyModule(NuggetRecipeLoader.class);
loader.applyModule(WireRecipeLoader.class);
loader.applyModule(ScrewRecipeLoader.class);
loader.applyModule(JsonContentLoader.INSTANCE);
//Mod Support
config.setCategoryComment("Mod_Support", "If true the proxy class for the mod will be loaded enabling support, set to false if support is not required or breaks the game.");
//Uses reflection instead of API files
loader.applyModule(NEIProxy.class);
loader.applyModule(OCProxy.class, Mods.OC.isLoaded());
loader.applyModule(TinkerProxy.class, Mods.TINKERS.isLoaded());
loader.applyModule(AEProxy.class, Mods.AE.isLoaded());
loader.applyModule(ICProxy.class, Mods.IC2.isLoaded());
loader.applyModule(BCProxy.class, Mods.BC.isLoaded());
loader.applyModule(MekProxy.class, Mods.MEKANISM.isLoaded());
loader.applyModule(ProjectEProxy.class, Mods.PROJECT_E.isLoaded());
TriggerCauseRegistry.register("entity", new TriggerNBTBuilder("entity"));
TriggerCauseRegistry.register("impactEntity", new TriggerNBTBuilder("impactEntity"));
TriggerCauseRegistry.register("entityImpactBlock", new TriggerNBTBuilder("entityImpactBlock"));
TriggerCauseRegistry.register("entityImpactEntity", new TriggerNBTBuilder("entityImpactEntity"));
TriggerCauseRegistry.register("explosion", new TriggerNBTBuilder("explosion"));
TriggerCauseRegistry.register("fire", new TriggerNBTBuilder("fire"));
TriggerCauseRegistry.register("redstone", new TriggerNBTBuilder("redstone"));
//Load dev only content
if (runningAsDev) {
loader.applyModule(new DevWorldLoader());
}
//Check if RF api exists
boolean shouldLoadRFHandler = true;
for (String s : new String[] { "IEnergyConnection", "IEnergyContainerItem", "IEnergyHandler", "IEnergyProvider", "IEnergyReceiver", "IEnergyStorage" }) {
try {
Class clazz = Class.forName("cofh.api.energy." + s, false, this.getClass().getClassLoader());
if (clazz == null) {
shouldLoadRFHandler = false;
break;
}
} catch (ClassNotFoundException e) {
shouldLoadRFHandler = false;
logger().error("Not loading RF support as we couldn't detect " + "cofh.api.energy." + s + " class or interface.");
break;
} catch (Exception e) {
e.printStackTrace();
}
}
if (shouldLoadRFHandler) {
loader.applyModule(RFLoader.class);
loader.applyModule(TEProxy.class, Mods.TF_EXPANSION.isLoaded());
}
PotionUtility.resizePotionArray();
//Manually registered configs TODO setup threw sync system (once the system is tested)
CommandVE.disableCommands = getConfig().getBoolean("DisableServerCommands", "Commands", false, "Turns off all commands built into Voltz Engine");
CommandVE.disableButcherCommand = getConfig().getBoolean("DisableButcherCommands", "Commands", false, "Turns off butcher command");
CommandVE.disableClearCommand = getConfig().getBoolean("DisableClearCommands", "Commands", false, "Turns off clear command");
CommandVE.disableRemoveCommand = getConfig().getBoolean("DisableRemoverCommands", "Commands", false, "Turns off remove command");
//Map commands
enableExtendedMetaPacketSync = getConfig().getBoolean("EnableExtendedBlockMetaPacketSync", "Map_data", true, "While on extended meta values will be synced to the client. Can be disabled on both sides to save on bandwidth but will result in rendering issues if disabled.");
ToolMode.REGISTRY.add(new ToolModeGeneral());
ToolMode.REGISTRY.add(new ToolModeRotation());
/**
* Multiblock Handling
*/
if (getConfig().get("Content", "LoadInstantHole", runningAsDev, "This is a developer tool for checking if ores generated correctly. It creates a chunk sized hole in the ground replacing stone with air, and air with glass. Never enable or give this to normal users as it can be used for greifing.").getBoolean(runningAsDev)) {
instaHole = contentRegistry.newItem("ve.instanthole", new ItemInstaHole());
}
if (getConfig().get("Content", "LoadDevDataTool", runningAsDev, "This is a developer tool for checking data on blocks and tile").getBoolean(runningAsDev)) {
itemDevTool = contentRegistry.newItem("ve.devTool", new ItemDevData());
}
if (getConfig().get("Content", "LoadScrewDriver", true, "Basic tool for configuring, rotating, and picking up machines.").getBoolean(true)) {
itemWrench = getManager().newItem("ve.screwdriver", new ItemScrewdriver());
}
if (getConfig().get("Content", "LoadSelectionTool", true, "Admin tool for selecting areas on the ground for world manipulation or other tasks.").getBoolean(true)) {
itemSelectionTool = getManager().newItem("ve.selectiontool", new ItemSelectionWand());
}
if (Engine.runningAsDev) {
blockInfInventory = getManager().newBlock(TileInfInv.class);
}
ExplosiveRegistry.registerOrGetExplosive(References.DOMAIN, "TNT", new ExplosiveHandlerTNT());
final int tntValue = 8;
ExplosiveRegistry.registerExplosiveItem(new ItemStack(Blocks.tnt), ExplosiveRegistry.get("TNT"), tntValue);
ExplosiveRegistry.registerExplosiveItem(new ItemStack(Items.gunpowder), ExplosiveRegistry.get("TNT"), tntValue / 5.0);
//Creeper skull
ExplosiveRegistry.registerExplosiveItem(new ItemStack(Items.skull, 1, 4), ExplosiveRegistry.get("TNT"), tntValue / 10.0);
//Call loader
loader.preInit();
//Claim json content
JsonContentLoader.INSTANCE.claimContent(this);
//Ore dictionary registry
OreDictionary.registerOre(OreNames.WOOD_STICK, Items.stick);
OreDictionary.registerOre(OreNames.STRING, Items.string);
OreDictionary.registerOre(OreNames.FLINT, Items.flint);
Calendar calendar = Calendar.getInstance();
if (calendar.get(2) + 1 == 12 && calendar.get(5) >= 24 && calendar.get(5) <= 26) {
XMAS = true;
}
}
Aggregations