From 311ab89f93558233a40079f7cb16605b141b5346 Mon Sep 17 00:00:00 2001 From: Johann Bernhardt Date: Sun, 12 Dec 2021 19:38:06 +0100 Subject: Move sources and resources --- .../core/handler/AchievementHandler.java | 421 +++++++++++++++++++++ .../java/gtPlusPlus/core/handler/BookHandler.java | 404 ++++++++++++++++++++ .../core/handler/BurnableFuelHandler.java | 35 ++ .../gtPlusPlus/core/handler/COMPAT_HANDLER.java | 320 ++++++++++++++++ .../core/handler/COMPAT_IntermodStaging.java | 91 +++++ .../gtPlusPlus/core/handler/CraftingManager.java | 17 + .../gtPlusPlus/core/handler/EnumHelperHandler.java | 21 + .../java/gtPlusPlus/core/handler/GuiHandler.java | 231 +++++++++++ .../gtPlusPlus/core/handler/OldCircuitHandler.java | 66 ++++ .../gtPlusPlus/core/handler/PacketHandler.java | 91 +++++ .../core/handler/Recipes/DecayableRecipe.java | 39 ++ .../handler/Recipes/LateRegistrationHandler.java | 28 ++ .../core/handler/Recipes/RegistrationHandler.java | 27 ++ .../handler/StopAnnoyingFuckingAchievements.java | 49 +++ .../core/handler/events/BlockEventHandler.java | 229 +++++++++++ .../core/handler/events/CustomMovementHandler.java | 163 ++++++++ .../handler/events/EnderDragonDeathHandler.java | 59 +++ .../core/handler/events/EntityDeathHandler.java | 124 ++++++ .../handler/events/GeneralTooltipEventHandler.java | 107 ++++++ .../core/handler/events/LoginEventHandler.java | 128 +++++++ .../core/handler/events/MissingMappingsEvent.java | 56 +++ .../events/PickaxeBlockBreakEventHandler.java | 80 ++++ .../core/handler/events/PlayerTickHandler.java | 18 + .../core/handler/events/SneakManager.java | 131 +++++++ .../handler/events/UnbreakableBlockManager.java | 138 +++++++ .../events/ZombieBackupSpawnEventHandler.java | 55 +++ .../core/handler/render/CapeHandler.java | 122 ++++++ .../core/handler/render/FirepitModel.java | 121 ++++++ .../core/handler/render/FirepitRender.java | 55 +++ .../workbench/Workbench_CraftingHandler.java | 208 ++++++++++ .../handler/workbench/Workbench_RecipeSorter.java | 44 +++ 31 files changed, 3678 insertions(+) create mode 100644 src/main/java/gtPlusPlus/core/handler/AchievementHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/BookHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/BurnableFuelHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java create mode 100644 src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java create mode 100644 src/main/java/gtPlusPlus/core/handler/CraftingManager.java create mode 100644 src/main/java/gtPlusPlus/core/handler/EnumHelperHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/GuiHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/OldCircuitHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/PacketHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/Recipes/DecayableRecipe.java create mode 100644 src/main/java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/BlockEventHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/CustomMovementHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/EntityDeathHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/LoginEventHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/MissingMappingsEvent.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/PlayerTickHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/SneakManager.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java create mode 100644 src/main/java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/render/CapeHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/render/FirepitModel.java create mode 100644 src/main/java/gtPlusPlus/core/handler/render/FirepitRender.java create mode 100644 src/main/java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java create mode 100644 src/main/java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java (limited to 'src/main/java/gtPlusPlus/core/handler') diff --git a/src/main/java/gtPlusPlus/core/handler/AchievementHandler.java b/src/main/java/gtPlusPlus/core/handler/AchievementHandler.java new file mode 100644 index 0000000000..fa10f4def3 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/handler/AchievementHandler.java @@ -0,0 +1,421 @@ +package gtPlusPlus.core.handler; + +import java.util.concurrent.ConcurrentHashMap; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent.ItemSmeltedEvent; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.util.GT_Log; +import gregtech.common.items.GT_MetaGenerated_Tool_01; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.Achievement; +import net.minecraft.stats.StatBase; +import net.minecraftforge.common.AchievementPage; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.player.EntityItemPickupEvent; + +public class AchievementHandler { + + public ConcurrentHashMap achievementList = new ConcurrentHashMap(); + public ConcurrentHashMap issuedAchievements = new ConcurrentHashMap(); + + public int adjX = 5; + public int adjY = 9; + + private static final String aBaseAchievementName = "gtpp.start"; + + public AchievementHandler() { + + Logger.INFO("Initializing GT++ achievements"); + GT_Log.out.println("Initializing GT++ achievements"); + + //register first + this.registerAchievement(aBaseAchievementName, 0, 0, MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(MetaGeneratedGregtechTools.ANGLE_GRINDER, 1, Materials.Osmium, Materials.Osmium, null), "", true); + + //Useful Info + boolean cores = CORE.ConfigSwitches.requireControlCores; + if (cores || GregtechMeta_MultiBlockBase.DEBUG_DISABLE_CORES_TEMPORARILY) { + this.registerAchievement("hatch.control", -2, -2, GregtechItemList.Hatch_Control_Core.get(1), aBaseAchievementName, false); + } + this.registerAchievement("hatch.dynamo.buffered", 2, -2, GregtechItemList.Hatch_Buffer_Dynamo_IV.get(1), aBaseAchievementName, false); + //First multi anyone really needs + this.registerAchievement("multi.abs", -4, -2, GregtechItemList.Industrial_AlloyBlastSmelter.get(1), cores ? "hatch.control" : aBaseAchievementName, true); + + //Material Advancement + this.registerAchievement("dust.potin", 0, 2, ALLOY.POTIN.getDust(1), aBaseAchievementName, false); + this.registerAchievement("dust.eglin", 0, 4, ALLOY.EGLIN_STEEL.getDust(1), "dust.potin", false); + this.registerAchievement("dust.staballoy", 0, 6, ALLOY.STABALLOY.getDust(1), "dust.eglin", false); + this.registerAchievement("dust.quantum", 0, 8, ALLOY.QUANTUM.getDust(1), "dust.staballoy", true); + this.registerAchievement("dust.hypogen", 0, 10, ELEMENT.STANDALONE.HYPOGEN.getDust(1), "dust.quantum", true); + + + //Blocks + this.registerAchievement("block.fishtrap", -2, 2, ItemUtils.getSimpleStack(ModBlocks.blockFishTrap), "dust.potin", false); + this.registerAchievement("block.withercage", -2, 4, ItemUtils.getSimpleStack(ModBlocks.blockWitherGuard), "dust.eglin", false); + + + //Machines (-10/-8/-6) + this.registerAchievement("rtg", -16, -10, GregtechItemList.RTG.get(1), aBaseAchievementName, false); + this.registerAchievement("dehydrate", -15, -10, GregtechItemList.GT_Dehydrator_HV.get(1), aBaseAchievementName, false); + this.registerAchievement("semifluid", -14, -10, GregtechItemList.Generator_SemiFluid_HV.get(1), aBaseAchievementName, false); + this.registerAchievement("earlywasher", -13, -10, GregtechItemList.SimpleDustWasher_ULV.get(1), aBaseAchievementName, false); + this.registerAchievement("advancedsteam", -12, -10, GregtechItemList.Boiler_Advanced_MV.get(1), aBaseAchievementName, false); + if (PollutionUtils.isPollutionEnabled()) { + this.registerAchievement("pollutionremoval", -11, -10, GregtechItemList.Pollution_Cleaner_IV.get(1), aBaseAchievementName, false); + } + this.registerAchievement("hiampxform", -10, -10, GregtechItemList.Transformer_HA_HV_MV.get(1), aBaseAchievementName, false); + + + //Multis (-4/-2/0) + this.registerAchievement("multi.pss", -16, -7, GregtechItemList.PowerSubStation.get(1), "multi.abs", false); + this.registerAchievement("multi.cyclo", -15, -7, GregtechItemList.COMET_Cyclotron.get(1), "multi.abs", false); + this.registerAchievement("multi.sifter", -14, -7, GregtechItemList.Industrial_Sifter.get(1), "dust.eglin", false); + this.registerAchievement("multi.cokeoven", -13, -7, GregtechItemList.Industrial_CokeOven.get(1), "multi.abs", false); + this.registerAchievement("multi.boiler.thermal", -12, -7, GregtechItemList.GT4_Thermal_Boiler.get(1), "multi.abs", false); + this.registerAchievement("multi.zhuhai", -11, -7, GregtechItemList.Industrial_FishingPond.get(1), aBaseAchievementName, false); + //this.registerAchievement("rtg", -4, -4, GregtechItemList.RTG.get(1), aBaseAchievementName, false); + + //Casings + this.registerAchievement("casing.abs", 2, -10, GregtechItemList.Casing_Coil_BlastSmelter.get(1), aBaseAchievementName, false); + this.registerAchievement("casing.cyclotron.coil", 3, -10, GregtechItemList.Casing_Cyclotron_Coil.get(1), aBaseAchievementName, false); + this.registerAchievement("casing.multiuse", 4, -10, GregtechItemList.Casing_Multi_Use.get(1), aBaseAchievementName, false); + this.registerAchievement("casing.containment", 5, -10, GregtechItemList.Casing_Containment.get(1), aBaseAchievementName, false); + + + + + + + + + //Radioactive + this.registerAchievement("decay.neptunium238", 11, 8, ItemUtils.getSimpleStack(ModItems.dustNeptunium238), "multi.cyclo", false); + this.registerAchievement("decay.radium226", 12, 8, ItemUtils.getSimpleStack(ModItems.dustRadium226), "multi.cyclo", false); + this.registerAchievement("decay.molybdenum99", 13, 8, ItemUtils.getSimpleStack(ModItems.dustMolybdenum99), "multi.cyclo", false); + this.registerAchievement("decay.technetium99m", 14, 8, ItemUtils.getSimpleStack(ModItems.dustTechnetium99M), "multi.cyclo", false); + this.registerAchievement("decay.technetium99", 15, 8, ItemUtils.getSimpleStack(ModItems.dustTechnetium99), "multi.cyclo", false); + + + + + + + + + + + + + AchievementPage.registerAchievementPage( + new AchievementPage("GT++", (Achievement[]) ((Achievement[]) this.achievementList.values() + .toArray(new Achievement[this.achievementList.size()])))); + MinecraftForge.EVENT_BUS.register(this); + FMLCommonHandler.instance().bus().register(this); + + + } + + public Achievement registerAchievement(String textId, int x, int y, ItemStack icon, Achievement requirement, + boolean special) { + Achievement achievement = new Achievement(textId, textId, this.adjX + x, this.adjY + y, icon, requirement); + if (special) { + achievement.setSpecial(); + } + + achievement.registerStat(); + if (CORE.DEVENV) { + GT_Log.out.println("achievement." + textId + "="); + GT_Log.out.println("achievement." + textId + ".desc="); + } + + this.achievementList.put(textId, achievement); + return achievement; + } + + public Achievement registerAchievement(String textId, int x, int y, ItemStack icon, String requirement, + boolean special) { + Achievement achievement = new Achievement(textId, textId, this.adjX + x, this.adjY + y, icon, + this.getAchievement(requirement)); + if (special) { + achievement.setSpecial(); + } + + achievement.registerStat(); + if (CORE.DEVENV) { + GT_Log.out.println("achievement." + textId + "="); + GT_Log.out.println("achievement." + textId + ".desc="); + } + + this.achievementList.put(textId, achievement); + return achievement; + } + + public void issueAchievement(EntityPlayer entityplayer, String textId) { + if (entityplayer != null) { + entityplayer.triggerAchievement((StatBase) this.achievementList.get(textId)); + } + } + + public Achievement getAchievement(String textId) { + return this.achievementList.containsKey(textId) ? (Achievement) this.achievementList.get(textId) : null; + } + + + /** + * A generic handler that will give an achievement for an item. + * Useful to only write this once, then call it from all handlers. + * @param aStack - The Itemstack to check for achievements. + * @param aPlayer - The player to unlock for. + */ + private void handleAchivement(ItemStack aStack, EntityPlayer aPlayer) { + + if (aPlayer != null && aStack != null) { + /* + * Copy this to all events because I am lazy - Alk 2019 + */ + + //Safe name + String aUnlocalName = ItemUtils.getUnlocalizedItemName(aStack); + + + boolean isValid = false; + //Check if valid name // mod + String aModID = ItemUtils.getModId(aStack); + + if (aModID == null || aModID.length() <= 0 || aModID.isEmpty()) { + return; + } + + if (aModID != null && (ItemUtils.getModId(aStack).equals(CORE.MODID) || ItemUtils.getModId(aStack).equalsIgnoreCase("gregtech"))) { + isValid = true; + } + if (!isValid) { + return; + } + + //Should unlock base achievement from *ANY* GT++ item. (Too lazy to special case GT machineBlocks though) + if (ItemUtils.getModId(aStack).equals(CORE.MODID)) { + this.issueAchievement(aPlayer, aBaseAchievementName); + } + + if (aUnlocalName.contains("item.")) { + aUnlocalName = aUnlocalName.substring(5); + } + else if (aUnlocalName.contains("tile.")) { + aUnlocalName = aUnlocalName.substring(5); + } + + //Logger.INFO("Picked up "+aUnlocalName); + + + /** + * Misc Blocks + */ + + if (aUnlocalName.equals("blockFishTrap")) { + this.issueAchievement(aPlayer, "block.fishtrap"); + } + if (aUnlocalName.equals("blockBlackGate")) { + this.issueAchievement(aPlayer, "block.withercage"); + } + + + /** + * Decayables + */ + if (aUnlocalName.equals("dustNeptunium238")) { + this.issueAchievement(aPlayer, "decay.neptunium238"); + } + else if (aUnlocalName.equals("dustRadium226")) { + this.issueAchievement(aPlayer, "decay.radium226"); + } + else if (aUnlocalName.equals("dustMolybdenum99")) { + this.issueAchievement(aPlayer, "decay.molybdenum99"); + } + else if (aUnlocalName.equals("dustTechnetium99M")) { + this.issueAchievement(aPlayer, "decay.technetium99m"); + } + else if (aUnlocalName.equals("dustTechnetium99")) { + this.issueAchievement(aPlayer, "decay.technetium99"); + } + + /** + * Random Materials worthy of Achievements + */ + else if (aUnlocalName.equals("itemDustPotin")) { + this.issueAchievement(aPlayer, "dust.potin"); + } + else if (aUnlocalName.equals("itemDustEglinSteel")) { + this.issueAchievement(aPlayer, "dust.eglin"); + } + else if (aUnlocalName.equals("itemDustStaballoy")) { + this.issueAchievement(aPlayer, "dust.staballoy"); + } + else if (aUnlocalName.equals("itemDustQuantum")) { + this.issueAchievement(aPlayer, "dust.quantum"); + } + else if (aUnlocalName.equals("itemDustHypogen")) { + this.issueAchievement(aPlayer, "dust.hypogen"); + } + + + + /** + * Machines + */ + + else if (aUnlocalName.startsWith("gt.blockmachines.")) { + + //Readability + String aStartsWith = "gt.blockmachines."; + + /** + * Single Blocks + */ + + //RTG + if (aUnlocalName.startsWith(aStartsWith + "basicgenerator.rtg")) { + this.issueAchievement(aPlayer, "rtg"); + } + //Dehydrator + else if (aUnlocalName.startsWith(aStartsWith + "machine.dehydrator.tier.")) { + this.issueAchievement(aPlayer, "dehydrate"); + } + //SemiFluids + else if (aUnlocalName.startsWith(aStartsWith + "basicgenerator.semifluid.tier.")) { + this.issueAchievement(aPlayer, "semifluid"); + } + //Simple Washer + else if (aUnlocalName.startsWith(aStartsWith + "simplewasher.01.tier.")) { + this.issueAchievement(aPlayer, "earlywasher"); + } + //Advanced Boilers + else if (aUnlocalName.startsWith(aStartsWith + "electricboiler.")) { + this.issueAchievement(aPlayer, "advancedsteam"); + } + //Scrubers + else if (aUnlocalName.startsWith(aStartsWith + "pollutioncleaner.01.tier.")) { + this.issueAchievement(aPlayer, "pollutionremoval"); + } + //High-amp xformers + else if (aUnlocalName.startsWith(aStartsWith + "transformer.ha.tier.")) { + this.issueAchievement(aPlayer, "hiampxform"); + } + //Buffered Dynamos + else if (aUnlocalName.startsWith(aStartsWith + "hatch.dynamo.buffer.tier.")) { + this.issueAchievement(aPlayer, "hatch.dynamo.buffered"); + } + //Control Core Hatch + else if (aUnlocalName.startsWith(aStartsWith + "hatch.control.adv")) { + this.issueAchievement(aPlayer, "hatch.control"); + } + + + + /** + * Multis + */ + + //ABS + else if (aUnlocalName.equals(aStartsWith + "industrialsalloyamelter.controller.tier.single")) { + this.issueAchievement(aPlayer, "multi.abs"); + } + //PSS + else if (aUnlocalName.equals(aStartsWith + "substation.01.input.single")) { + this.issueAchievement(aPlayer, "multi.pss"); + } + //Cyclotron + else if (aUnlocalName.startsWith(aStartsWith + "cyclotron.tier.single")) { + this.issueAchievement(aPlayer, "multi.cyclo"); + } + //Sifter + else if (aUnlocalName.equals(aStartsWith + "industrialsifter.controller.tier.single")) { + this.issueAchievement(aPlayer, "multi.sifter"); + } + //Coke Oven + else if (aUnlocalName.equals(aStartsWith + "industrialcokeoven.controller.tier.single")) { + this.issueAchievement(aPlayer, "multi.cokeoven"); + } + //Thermal Boiler + else if (aUnlocalName.equals(aStartsWith + "gtplusplus.thermal.boiler")) { + this.issueAchievement(aPlayer, "multi.boiler.thermal"); + } + //Zhuhai + else if (aUnlocalName.equals(aStartsWith + "industrial.fishpond.controller.tier.single")) { + this.issueAchievement(aPlayer, "multi.zhuhai"); + } + + } + + /** + * Casings + */ + + else if (aUnlocalName.equals("gtplusplus.blockcasings.14")) { + this.issueAchievement(aPlayer, "casing.abs"); + } + + else if (aUnlocalName.equals("gtplusplus.blockcasings.2.9")) { + this.issueAchievement(aPlayer, "casing.cyclotron.coil"); + } + + else if (aUnlocalName.equals("gtplusplus.blockcasings.3.2")) { + this.issueAchievement(aPlayer, "casing.multiuse"); + } + else if (aUnlocalName.equals("gtplusplus.blockcasings.3.15")) { + this.issueAchievement(aPlayer, "casing.containment"); + } + } + } + + + + + /* + * Handle achievements for all vanilla types of obtianment. + */ + + + + @SubscribeEvent + public void onCrafting(ItemCraftedEvent event) { + EntityPlayer player = event.player; + ItemStack stack = event.crafting; + if (player != null && stack != null) { + handleAchivement(stack, player); + } + } + + @SubscribeEvent + public void onSmelting(ItemSmeltedEvent event) { + EntityPlayer player = event.player; + ItemStack stack = event.smelting; + if (player != null && stack != null) { + handleAchivement(stack, player); + } + } + + @SubscribeEvent + public void onItemPickup(EntityItemPickupEvent event) { + EntityPlayer player = event.entityPlayer; + ItemStack stack = event.item.getEntityItem(); + if (player != null && stack != null) { + handleAchivement(stack, player); + } + } +} \ No newline at end of file diff --git a/src/main/java/gtPlusPlus/core/handler/BookHandler.java b/src/main/java/gtPlusPlus/core/handler/BookHandler.java new file mode 100644 index 0000000000..d85de925bf --- /dev/null +++ b/src/main/java/gtPlusPlus/core/handler/BookHandler.java @@ -0,0 +1,404 @@ +package gtPlusPlus.core.handler; + +import java.util.HashMap; +import java.util.Map; + +import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.RecipeUtils; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +public class BookHandler { + + public static int mBookKeeperCount = 0; + + public static Map mBookMap = new HashMap(); + + public static BookTemplate book_ThermalBoiler; + public static BookTemplate book_MultiPowerStation; + public static BookTemplate book_ModularBauble; + public static BookTemplate book_MultiMachineManual; + public static BookTemplate book_NuclearManual; + public static BookTemplate book_MultiChemicalPlant; + + public static void run(){ + + Logger.INFO("Writing books."); + + //Thermal Boiler + book_ThermalBoiler = writeBookTemplate( + "Manual_Thermal_Boiler", "Thermal Boiler Manual", "GregoriusT", + new String[] { + "This Book explains how to set up and run your Thermal Boiler. We are not responsible for any Damage done by this Book itself nor its content.", + "First you need to craft the following things for a Thermal Boiler to Function: The Main Boiler Block, 20 Thermal Containment Casings, two Input Hatches, two Output Hatches, a bunch of different Tools and a Maintenance Hatch.", + "To begin the building, lay out the first 3x3 layer of Machine Casings on the ground (with a Hatch in the Middle), then place the Boiler Block facing outward in the middle of one of the 3m wide Sides.", + "Now grab 3 other Hatches and place them on the remaining three 3m wide Sides also facing outwards. And now the four corners of the Machine need also a Machine Casing. There should only be a Hole left in the middle of the Cube.", + "So, now place a 3x3 of Machine Casings ontop, at the 3rd Layer with the last Hatch in the middle facing outwards as well.", + "When accessing the Boiler Block, it should now stop telling you, that the structure is incomplete (bottom Line of that Screen). Now go with a bunch of different Tools (Metal Hammer, Rubber Hammer, Screwdriver, Wrench, Soldering Iron and Crowbar)", + "to the Maintenance Hatch and access it. After that you grab the 6 Tools and rightclick the Slot with each of them in your Hand in the Maintenance GUI. Note that you need Soldering Tin/Lead in your Inventory to use the Soldering Iron.", + "The Main Block should now tell you that you need to use the Rubber Hammer on it to (re)activate the Machine. The Rubber Hammer can enable and disable Machines. The Machine disables itself after something important broke.", + "If you want to use Lava with this Device, then you should add a Lava Filter to extract additional Resources from the Lava. If the Filter breaks, the Machine won't explode like a Turbine would. If you use molten Salt, then you won't need a Filter.", + "You will get Obsidian when processing Lava, however if a Filter is used, you will get sometimes an Ingot instead of a Block of Obsidian. When using molten Salt, you will get the Salt back.", + "So, now for the Maintenance. After a few Hours of running nonstop, your Boiler will get small Problems, which don't prevent it from running, these Problems just decrease Efficiency. Every Problem listed on the Screen does -10% Efficiency.", + "To fix these Problems, just go to the Maintenance Hatch and click with the problem corresponding Tool on the Slot to repair. If all six possible runtime Problems happen, the Machine will auto-shutdown no matter what. No Explosion, it's just stopping.", + "The Thermal Boiler will produce 800 Liters of Steam per tick for about 5 or 6 Liters of Water per tick at reaching 100% Efficiency. In case of Lava it consumes 1666 Liters every Second.", + "A Thermal Boiler is worth about 33 small Thermal Generators, and as the Boilers get much less Efficient, when not having enough Fuel, you should consider making a large Nether Pump for Lava, or a good Nuclear Reactor for molten Salt.", + "Input and Output Slots are fully optional, you can place multiple ones of them or even none on the Machine. A Machine without Input couldn't process any Recipes, while a Machine without Output just voids all outputted Items and Liquids.", + "It might be useful to use the Screwdriver on the Output Hatches to determine what is outputted where." }); + + + + //Test Novel + book_MultiPowerStation = writeBookTemplate( + "Manual_Multi_PowerStation", + "Power Storage & You [Version 0.64]", + "Alkalus", + new String[] { + //Page 1 + "So, when it comes to power storage you relaly have three seperate options:\n"+ + " \n"+ + "Battery Buffers,\n"+ + "Energy Buffers,\n"+ + "The Power Sub-Station\n", + //Page 2 + "Battery Buffer\n" + + " \n" + + "Is rather portable. Allowing you to throw set one up and insert batteries where ever you may need."+"\n"+ + "They output 1A for each battery stored inside, upto a maximum of 16A.", + //Page 3 + "Energy Buffer\n" + + " \n" + + "Is a more optimal choice for storage in your base. Once placed down, they cannot be moved without losing all stored power."+"\n"+ + "Energy Buffers can output 4A from the output side, however accept 16A as input.", + //Page 4 + "The Power Sub-Station"+ + " \n"+ + "Is used for storing Insane amounts of power later game."+"\n"+ + "Consumes 2% of the average voltage of all energy type hatches every tick."+"\n", + //Page 5 + "Allows Insertation/Removal of power from the rear face of the controller, swap with a screwdriver."+"\n"+ + "Variable Height Structure, between 4-16Y. Inserted Redox Cells dictate max energy tier of structure."+"\n", + //Page 6 + "Redox Cells cannot be placed into the Top or Bottom layer and only take up 3xhx3 internally."+"\n"+ + "Different Tier cells CANNOT be mixed together."+"\n", + //Page 7 + "All Hatches Must be HV at a Minimum, this minimum tier is in place to stop people abusing ULV/LV hatches to lower the avg/t."+"\n"+ + "Currently the GUI will NOT display anything at all until the structure forms, this is a known bug."+"\n", + //Page 8 + "Valid Hatches:\n"+ + "Energy Hatch,\n"+ + "Dynamo Hatch,\n"+ + "Charging Bus,\n"+ + "Discharging Bus,\n"+ + "Dynamo Buffer,\n"+ + "Multi-Amp Dynamo Hatch.\n\n\n"+ + "Structure MUST contain at least one energy input and one energy output hatch." + }); + + //Test Novel + book_ModularBauble = writeBookTemplate( + "Manual_Modular_Bauble", "How to: Modular Baubles", "Alkalus", + new String[] { + "Concept: This idea came from wanting flexibility. \n" + + "First step, Build a Modularity table to begin customisation of your Bauble. \n" + + " After this has been constructed, you can now combine the upgrades listed within this book to improve the baubles level/100.", + "Defence:\n" + + "Can be upgraded by combining metal plates with the bauble. \n" + + " | +1 | Aluminium \n" + + " | +2 | Stainless Steel \n" + + " | +3 | Tungsten \n" + + " | +4 | Tungsten Steel \n" + + " | +5 | Naquadah \n", + "There was once a sad and lonely oak tree. \n", + "There was once a sad and lonely oak tree. \n", + "There was once a sad and lonely oak tree. \n"}); + + //Test Novel + //20/21/22 + book_MultiMachineManual = writeBookTemplate( + "Manual_Multi_Machine", "Multi-Machine Manual", "Alkalus", + new String[] { + "This Multiblock, depending upon the mode used, can function as a variety of different machines. The idea behind this, was that most of these machines are rather niche compared to any others, as such, not used often.", + "To build, you need to construct a hollow 3x3x3 structure made from Multi-Use casings, With a minimum of 6. Any Casing position can be substituted out with an Input Hatch/Bus, an Output Hatch/Bus, Muffler, Maint. Hatch or Energy Injector Hatch.", + "The Mode can be set by using a Screwdriver on the controller block. Each mode allows the use of Numbered Circuits, to allow a different machine 'type' for each input bus.", + "[Metal Work] Mode A - Allows the multiblock to function as a Compressor, a Lathe or an Electro-Magnet. To allow a hatch to run in Compressor mode, insert a No. 20 circuit. For Lathe, use No. 21 and for Electro-Magnet use No. 22.", + "[Fluid Work] Mode B - Allows the multiblock to function as a Fermenter, a Fluid Extractor or an Extractor. To allow a hatch to run in Fermenter mode, insert a No. 20 circuit. For Fluid Extractor, use No. 21 and for Extractor use No. 22.", + "[Misc. Work] Mode C - Allows the multiblock to function as a Laser Engraver, an Autoclave or a Fluid Solidifier. To allow a hatch to run in Laser Engraver mode, insert a No. 20 circuit. For Autoclave, use No. 21 and for Solidifier use No. 22.", + }); + + book_NuclearManual = writeBookTemplate( + "Manual_NuclearStuff_1", "Nuclear Chemistry [FFPP]", "Alkalus", + new String[] { + //Page 1 + "Fission Fuel Processing Plant\n" + + "Size: 3x9x3 [LxHxW]\n" + + "Controller: Center, Bottom\n" + + "4x Input Hatch\n" + + "2x Output Hatch\n" + + "1x Output Bus\n" + + "1x ZPM+ Muffler\n" + + "1x Maintenance Hatch\n" + + "1x Energy Hatch\n", + //Page 2 + "[1] 7x Hastelloy-X or I/O\n" + + "[2] 5x Incoloy-DS Fluid Containment\n" + + "[3] 4x Zeron-100 Shielding\n" + + "[4] 17x Hastelloy-N Sealant Case" + + "\n" + + "Multiblock Construction\n" + + "Convention is [LxHxW]\n" + + "\n", + //Page 3 + "Layer 1/2:\n" + + "[1][1][1]\n" + + "[1][1][1]\n" + + "[1][1][1]\n" + + "\n" + + "Layer 3/5/6\n" + + "[ ][4][ ]\n" + + "[4][2][4]\n" + + "[ ][4][ ]\n" + + "\n", + //Page 4 + "Layer 4\n" + + "[ ][3][ ]\n" + + "[3][2][3]\n" + + "[ ][3][ ]\n" + + "\n" + + "Layer 7/8/9\n" + + "[ ][ ][ ]\n" + + "[ ][3][ ]\n" + + "[ ][ ][ ]\n" + , + //Page 5 + "Fission Fuel\n"+ + "Processing Plant"+ + "----------------------\n"+ + "This structure is used to produce the Molten Salts required to run a Liquid Fluorine Thorium Reactor [LFTR]." + + }); + + + book_MultiChemicalPlant = writeBookTemplate( + "book_Multi_ChemicalPlant", "Chemical Plant Manual", "Alkalus", + new String[] { + + // Intro + "This book will explain how the Chemical Plant is constructed, which blocks are valid to upgrade it and also how the upgrades work.", + + // Info + "Solid Casings = Plant tier" + "\n" + + "Machine Casings = Hatch tier" + "\n" + + "Higher tier coils More Speed" + "\n" + + "T1 50% , T2 100% , T3 150%, etc" + "\n", + + "Higher tier pipe casings boost parallel"+ "\n" + + "and reduce catalyst consumption" + "\n" + + "+2 parallel per tier, 20% extra chance of"+ "\n" + + "not damaging catalyst per tier" + "\n", + + + // Machine Casings + "Valid Solid Machine Casings:" + "\n" + + "0 - Strong Bronze" + "\n" + + "1 - Solid Steel" + "\n" + + "2 - Sturdy Aluminium" + "\n" + + "3 - Clean Stainless Steel" + "\n" + + "4 - Stable Titanium" + "\n" + + "5 - Robust Tungstensteel" + "\n" + + "6 - Vigorous Laurenium" + "\n" + + "7 - Rugged Botmium", + + // Machine Casings + "Valid Tiered Machine Casings:" + "\n" + "\n" + + "1 - " + GT_Values.VN[0] + "\n" + + "2 - " + GT_Values.VN[1] + "\n" + + "3 - " + GT_Values.VN[2] + "\n" + + "4 - " + GT_Values.VN[3] + "\n" + + "5 - " + GT_Values.VN[4] + "\n" + + "6 - " + GT_Values.VN[5] + "\n" + + "7 - " + GT_Values.VN[6] + "\n" + + "8 - " + GT_Values.VN[7] + "\n" + + "9 - " + GT_Values.VN[8] + "\n" + + "10 - " + GT_Values.VN[9], + + // Pipe Casings + "Valid Pipe Casings:" + "\n" + "\n" + + "1 - Bronze" + "\n" + + "2 - Steel" + "\n" + + "3 - Titanium" + "\n" + + "4 - Tungstensteel", + + //Coils + "Valid Coils:" + "\n" + "\n" + + "1 - Cupronickel" + "\n" + + "2 - Kanthal" + "\n" + + "3 - Nichrome" + "\n" + + "4 - Tungstensteel" + "\n" + + "5 - HSS-G" + "\n" + + "6 - Naquadah" + "\n" + + "7 - Naquadah Alloy", + + // Requirements + "Multiblock Requirements:" + "\n" + "\n" + + "27x Coils" + "\n" + + "18x Pipe Casings" + "\n" + + "57x Tiered Machine Casings" + "\n" + + "80+ Solid Casings" + "\n" + + "1x Catalyst Housing (Catalysts cannot go inside an Input Bus)", + + // Construction Guide + "Construction Guide Pt1:" + "\n" + "\n" + + "Controller is placed on a middle casing in the bottom layer" + "\n" + + "Hatches can only be placed on the bottom layer edges", + + "Construction Guide Pt2:" + "\n" + "\n" + + "7x7x7 Hollow frame of solid casings" + "\n" + + "5x1x5 layer of solid casings (fills in top layer)" + "\n" + + "5x1x5 layer of machine casings (fills in bottom layer)", + + "Construction Guide Pt3:" + "\n" + + "In the central 3x5x3:" + "\n" + + "3x1x3 layer of Coils, surrounded by ring of Machine Casings" + "\n" + + "3x1x3 layer of Pipe Casings" + "\n" + + "3x1x3 layer of Coils" + "\n" + + "3x1x3 layer of Pipe Casings" + "\n" + + "3x1x3 layer of Coils, surrounded by ring of Machine Casings", + + // Construction Guide Info + "Information:" + "\n" + "\n" + + "A = Air" + "\n" + + "X = Solid Casing" + "\n" + + "M = Machine Casing" + "\n" + + "P = Pipe Casing" + "\n" + + "C = Coil Casing", + + "Layer 1:" + "\n" + "\n" + + "XXXXXXX" + "\n" + + "XMMMMMX" + "\n" + + "XMMMMMX" + "\n" + + "XMMMMMX" + "\n" + + "XMMMMMX" + "\n" + + "XMMMMMX" + "\n" + + "XXXXXXX", + + "Layer 2:" + "\n" + "\n" + + "XAAAAAX" + "\n" + + "AMMMMMA" + "\n" + + "AMCCCMA" + "\n" + + "AMCCCMA" + "\n" + + "AMCCCMA" + "\n" + + "AMMMMMA" + "\n" + + "XAAAAAX", + + "Layer 3:" + "\n" + "\n" + + "XAAAAAX" + "\n" + + "AAAAAAA" + "\n" + + "AAPPPAA" + "\n" + + "AAPPPAA" + "\n" + + "AAPPPAA" + "\n" + + "AAAAAAA" + "\n" + + "XAAAAAX", + + "Layer 4:" + "\n" + "\n" + + "XAAAAAX" + "\n" + + "AAAAAAA" + "\n" + + "AACCCAA" + "\n" + + "AACCCAA" + "\n" + + "AACCCAA" + "\n" + + "AAAAAAA" + "\n" + + "XAAAAAX", + + "Layer 5:" + "\n" + "\n" + + "XAAAAAX" + "\n" + + "AAAAAAA" + "\n" + + "AAPPPAA" + "\n" + + "AAPPPAA" + "\n" + + "AAPPPAA" + "\n" + + "AAAAAAA" + "\n" + + "XAAAAAX", + + "Layer 6:" + "\n" + "\n" + + "XAAAAAX" + "\n" + + "AMMMMMA" + "\n" + + "AMCCCMA" + "\n" + + "AMCCCMA" + "\n" + + "AMCCCMA" + "\n" + + "AMMMMMA" + "\n" + + "XAAAAAX", + + "Layer 7:" + "\n" + "\n" + + "XXXXXXX" + "\n" + + "XXXXXXX" + "\n" + + "XXXXXXX" + "\n" + + "XXXXXXX" + "\n" + + "XXXXXXX" + "\n" + + "XXXXXXX" + "\n" + + "XXXXXXX", + }); + + } + + + + + public static ItemStack ItemBookWritten_ThermalBoiler; + public static ItemStack ItemBookWritten_NuclearManual; + public static ItemStack ItemBookWritten_ModularBaubles; + public static ItemStack ItemBookWritten_MultiPowerStorage; + public static ItemStack ItemBookWritten_MultiMachineManual; + public static ItemStack ItemBookWritten_MultiChemicalPlant; + + public static void runLater(){ + ItemBookWritten_ThermalBoiler = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, 0, 1); + ItemBookWritten_MultiPowerStorage = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, 1, 1); + ItemBookWritten_ModularBaubles = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, 2, 1); + ItemBookWritten_MultiMachineManual = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, 3, 1); + ItemBookWritten_NuclearManual = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, 4, 1); + ItemBookWritten_MultiChemicalPlant = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, 5, 1); + + //Multiblock Manuals + RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(Items.writable_book), ItemUtils.getSimpleStack(Items.lava_bucket)}, ItemBookWritten_ThermalBoiler); + RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(Items.writable_book), ItemUtils.getItemStackOfAmountFromOreDict(CI.craftingToolWrench, 1)}, ItemBookWritten_MultiMachineManual); + RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(Items.writable_book), ItemUtils.getItemStackOfAmountFromOreDict("wireGt01Tin", 1)}, ItemBookWritten_MultiPowerStorage); + RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(Items.writable_book), ItemUtils.getItemStackOfAmountFromOreDict("dustUranium", 1)}, ItemBookWritten_NuclearManual); + RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(Items.writable_book), ItemUtils.getItemStackOfAmountFromOreDict("wireGt01Copper", 1)}, ItemBookWritten_MultiChemicalPlant); + + for (int i=0;i temp : CORE.burnables) { + int aStackID = Item.getIdFromItem(aStack.getItem()); + int burnID = Item.getIdFromItem(temp.getValue().getItem()); + if (aStackID == burnID){ + int burn = temp.getKey(); + ItemStack fuel = temp.getValue(); + ItemStack testItem = ItemUtils.getSimpleStack(fuel, aStack.stackSize); + + if (aStack.isItemEqual(testItem)){ + return burn; + } + } + } + + //If it's not my fuel, return 0. + return 0; + } + +} diff --git a/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java new file mode 100644 index 0000000000..53d63499a6 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -0,0 +1,320 @@ +package gtPlusPlus.core.handler; + +import static gtPlusPlus.core.lib.LoadedMods.Gregtech; + +import java.util.LinkedList; +import java.util.Queue; +import java.util.Set; + +import cpw.mods.fml.common.event.FMLLoadCompleteEvent; +import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.api.interfaces.RunnableWithInfo; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.minecraft.ItemPackage; +import gtPlusPlus.core.common.compat.COMPAT_BigReactors; +import gtPlusPlus.core.common.compat.COMPAT_CompactWindmills; +import gtPlusPlus.core.common.compat.COMPAT_EnderIO; +import gtPlusPlus.core.common.compat.COMPAT_ExtraUtils; +import gtPlusPlus.core.common.compat.COMPAT_HarvestCraft; +import gtPlusPlus.core.common.compat.COMPAT_IC2; +import gtPlusPlus.core.common.compat.COMPAT_MorePlanets; +import gtPlusPlus.core.common.compat.COMPAT_OpenBlocks; +import gtPlusPlus.core.common.compat.COMPAT_PneumaticCraft; +import gtPlusPlus.core.common.compat.COMPAT_RFTools; +import gtPlusPlus.core.common.compat.COMPAT_Railcraft; +import gtPlusPlus.core.common.compat.COMPAT_SimplyJetpacks; +import gtPlusPlus.core.common.compat.COMPAT_Thaumcraft; +import gtPlusPlus.core.common.compat.COMPAT_Witchery; +import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; +import gtPlusPlus.core.handler.Recipes.RegistrationHandler; +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.recipe.RECIPES_Extruder; +import gtPlusPlus.core.recipe.RECIPES_GREGTECH; +import gtPlusPlus.core.recipe.RECIPES_LaserEngraver; +import gtPlusPlus.core.recipe.ShapedRecipeObject; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.RecipeUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaGarbageCollector; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_FluidCanning; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Recycling; +import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_GTNH; +import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_Nuclear; +import gtPlusPlus.xmod.gregtech.registration.gregtech.*; +import net.minecraft.item.ItemStack; + +public class COMPAT_HANDLER { + + public static Queue RemoveRecipeQueue = new LinkedList<>(); + public static Queue AddRecipeQueue = new LinkedList<>(); + public static Boolean areInitItemsLoaded = false; + + + public static void registerMyModsOreDictEntries(){ + + Logger.INFO("Registering Materials with OreDict."); + //In-house + + //tools + GT_OreDictUnificator.registerOre("craftingToolSandHammer", new ItemStack(ModItems.itemSandstoneHammer)); + + for(int i=1; i<=10; i++){ + GT_OreDictUnificator.registerOre("bufferCore_"+GT_Values.VN[i-1], new ItemStack(ItemUtils.getItemFromFQRN("miscutils:item.itemBufferCore"+i))); + } + } + + public static void registerGregtechMachines() { + if (Gregtech) { + + //Debug + GregtechItemList.Garbage_Collector_Debug_Machine.set( + new GregtechMetaGarbageCollector( + "garbagecollector.01.tier.single", + "JVM Garbage Collector", + "Useful for debugging or smoother performance on local servers").getStackForm(1L)); + + + //Free IDs + /* + --- + 859 + to + 868 + --- + 911 + to + 940 + */ + + new RECIPES_LaserEngraver(); + new RECIPES_Extruder(); + GregtechGeneratorsULV.run(); + GregtechEnergyBuffer.run(); + GregtechLFTR.run(); + GregtechSteamCondenser.run(); + GregtechSafeBlock.run(); + //GregtechSuperConductionPoint.run(); + GregtechIronBlastFurnace.run(); + GregtechIndustrialCentrifuge.run(); + GregtechIndustrialCokeOven.run(); + GregtechIndustrialPlatePress.run(); + GregtechRocketFuelGenerator.run(); + GregtechIndustrialElectrolyzer.run(); + GregtechIndustrialMacerator.run(); + GregtechIndustrialWiremill.run(); + GregtechIndustrialMassFabricator.run(); + GregtechIndustrialBlastSmelter.run(); + GregtechSolarGenerators.run(); + GregtechPowerSubStation.run(); + GregtechDehydrator.run(); + GregtechAdvancedBoilers.run(); + GregtechPollutionDevices.run(); + GregtechTieredFluidTanks.run(); + //GregtechIndustrialMultiTank.run(); + GregtechGeothermalThermalGenerator.run(); + Gregtech4Content.run(); + GregtechIndustrialFuelRefinery.run(); + GregtechTreeFarmerTE.run(); + GregtechIndustrialTreeFarm.run(); + GregtechIndustrialSifter.run(); + GregtechSimpleWasher.run(); + GregtechRTG.run(); + GregtechCyclotron.run(); + GregtechHiAmpTransformer.run(); + GregtechIndustrialThermalCentrifuge.run(); + GregtechIndustrialWashPlant.run(); + GregtechSemiFluidgenerators.run(); + GregtechAdvancedMixer.run(); + GregtechWirelessChargers.run(); + GregtechIndustrialGeneratorArray.run(); + GregtechIndustrialCuttingFactory.run(); + //GregtechMiniRaFusion.run(); + GregtechComponentAssembler.run(); + //GregtechTeslaTower.run(); + GregtechSuperChests.run(); + GregtechIndustrialFishPond.run(); + GregtechTieredChunkloaders.run(); + GregtechIndustrialExtruder.run(); + GregtechIndustrialMultiMachine.run(); + //GregtechBedrockPlatforms.run(); + GregtechBufferDynamos.run(); + GregtechAmazonWarehouse.run(); + GregtechFactoryGradeReplacementMultis.run(); + GregtechThaumcraftDevices.run(); + GregtechThreadedBuffers.run(); + GregtechIndustrialMixer.run(); + GregtechCustomHatches.run(); + //GregtechNaqReactor.run(); + GregtechIndustrialArcFurnace.run(); + //GregtechSolarTower.run(); + GregtechLargeTurbinesAndHeatExchanger.run(); + GregtechPowerBreakers.run(); + GregtechFluidReactor.run(); + GregtechAlgaeContent.run(); + GregtechIndustrialAlloySmelter.run(); + GregtechIsaMill.run(); + GregtechSteamMultis.run(); + //GregtechIndustrialElementDuplicator.run(); + + //New Horizons Content + NewHorizonsAccelerator.run(); + } + + } + + //InterMod + public static void intermodOreDictionarySupport(){ + + if (LoadedMods.Big_Reactors){ + COMPAT_BigReactors.OreDict(); + } + if (LoadedMods.EnderIO){ + COMPAT_EnderIO.OreDict(); + } + if (LoadedMods.MorePlanets){ + COMPAT_MorePlanets.OreDict(); + } + if (LoadedMods.OpenBlocks){ + COMPAT_OpenBlocks.OreDict(); + } + if (LoadedMods.Railcraft){ + COMPAT_Railcraft.OreDict(); + } + if (LoadedMods.Simply_Jetpacks){ + COMPAT_SimplyJetpacks.OreDict(); + } + if (LoadedMods.RFTools){ + COMPAT_RFTools.OreDict(); + } + if (LoadedMods.Thaumcraft){ + COMPAT_Thaumcraft.OreDict(); + } + if (LoadedMods.Extra_Utils){ + COMPAT_ExtraUtils.OreDict(); + } + if (LoadedMods.PneumaticCraft){ + COMPAT_PneumaticCraft.OreDict(); + } + if (LoadedMods.CompactWindmills){ + COMPAT_CompactWindmills.OreDict(); + } + if (LoadedMods.IndustrialCraft2){ + COMPAT_IC2.OreDict(); + } + if (LoadedMods.PamsHarvestcraft){ + COMPAT_HarvestCraft.OreDict(); + } + if (LoadedMods.Witchery) { + COMPAT_Witchery.OreDict(); + } + } + + public static void RemoveRecipesFromOtherMods(){ + //Removal of Recipes + for(final Object item : RemoveRecipeQueue){ + RecipeUtils.removeCraftingRecipe(item); + } + } + + public static void InitialiseHandlerThenAddRecipes(){ + RegistrationHandler.run(); + } + public static void InitialiseLateHandlerThenAddRecipes(){ + LateRegistrationHandler.run(); + } + + public static void startLoadingGregAPIBasedRecipes(){ + //Add hand-made recipes + RECIPES_GREGTECH.run(); + RecipeLoader_GTNH.generate(); + RecipeLoader_Nuclear.generate(); + //Add autogenerated Recipes from Item Components + for (Set> m : MaterialGenerator.mRecipeMapsToGenerate) { + for (RunnableWithInfo r : m) { + try { + r.run(); + Logger.INFO("[FIND] "+r.getInfoData().getLocalizedName()+" recipes generated."); + } + catch (Throwable t) { + t.printStackTrace(); + Logger.INFO("[ERROR] "+r.getInfoData().getLocalizedName()+" recipes failed to generated."); + } + } + } + RecipeGen_Recycling.executeGenerators(); + runQueuedMisc(); + + // Do Fluid Canning Last, because they're not executed on demand, but rather queued. + RecipeGen_FluidCanning.init(); + } + + + + public static void onLoadComplete(FMLLoadCompleteEvent event) { + runQueuedOnLoadComplete(event); + } + + public static final AutoMap> mRecipesToGenerate = new AutoMap>(); + public static final AutoMap> mGtRecipesToGenerate = new AutoMap>(); + + public static final AutoMap> mObjectsToRunInPostInit = new AutoMap>(); + public static final AutoMap mObjectsToRunInOnLoadComplete = new AutoMap(); + + public static void runQueuedRecipes() { + //Add autogenerated Recipes from Item Components + for (RunnableWithInfo m : mRecipesToGenerate) { + try { + m.run(); + } + catch (Throwable t) { + t.printStackTrace(); + Logger.INFO("[ERROR] "+m.getInfoData()+" recipe failed to generated."); + } + + } + for (RunnableWithInfo m : mGtRecipesToGenerate) { + try { + m.run(); + } + catch (Throwable t) { + t.printStackTrace(); + Logger.INFO("[ERROR] "+m.getInfoData()+" recipe failed to generated."); + } + + } + } + + public static void runQueuedMisc() { + for (RunnableWithInfo m : mObjectsToRunInPostInit) { + try { + m.run(); + } + catch (Throwable t) { + t.printStackTrace(); + Logger.INFO("[ERROR] "+m.getInfoData()); + } + + } + } + + /** + * Generally used to register GT recipe map changes after they've been populated. + */ + public static void runQueuedOnLoadComplete(FMLLoadCompleteEvent event) { + for (ItemPackage m : mObjectsToRunInOnLoadComplete) { + try { + m.onLoadComplete(event); + } + catch (Throwable t) { + t.printStackTrace(); + Logger.INFO("[ERROR] "+m.getInfoData()); + } + + } + } +} diff --git a/src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java new file mode 100644 index 0000000000..9a1b551d30 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java @@ -0,0 +1,91 @@ +package gtPlusPlus.core.handler; + +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLLoadCompleteEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import gtPlusPlus.xmod.bartcrops.HANDLER_CropsPlusPlus; +import gtPlusPlus.xmod.bop.HANDLER_BiomesOPlenty; +import gtPlusPlus.xmod.computronics.HANDLER_Computronics; +import gtPlusPlus.xmod.forestry.HANDLER_FR; +import gtPlusPlus.xmod.galacticraft.HANDLER_GalactiCraft; +import gtPlusPlus.xmod.gregtech.HANDLER_GT; +import gtPlusPlus.xmod.growthcraft.HANDLER_GC; +import gtPlusPlus.xmod.ic2.HANDLER_IC2; +import gtPlusPlus.xmod.ob.HANDLER_OpenBlocks; +import gtPlusPlus.xmod.railcraft.HANDLER_Railcraft; +import gtPlusPlus.xmod.reliquary.HANDLER_Reliquary; +import gtPlusPlus.xmod.sc2.HANDLER_SC2; +import gtPlusPlus.xmod.sol.HANDLER_SpiceOfLife; +import gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft; +import gtPlusPlus.xmod.thermalfoundation.HANDLER_TF; +import gtPlusPlus.xmod.tinkers.HANDLER_Tinkers; + +public class COMPAT_IntermodStaging { + + public static void preInit(FMLPreInitializationEvent preinit){ + HANDLER_GT.preInit(); + HANDLER_GC.preInit(); + HANDLER_TF.preInit(); + HANDLER_FR.preInit(); + HANDLER_IC2.preInit(); + HANDLER_Computronics.preInit(); + HANDLER_BiomesOPlenty.preInit(); + //HANDLER_Mekanism.preInit(); + HANDLER_Thaumcraft.preInit(); + HANDLER_Tinkers.preInit(); + HANDLER_SC2.preInit(); + HANDLER_GalactiCraft.preInit(); + HANDLER_CropsPlusPlus.preInit(preinit); + HANDLER_Railcraft.preInit(); + HANDLER_Reliquary.preInit(); + HANDLER_OpenBlocks.preInit(); + HANDLER_SpiceOfLife.preInit(); + } + + public static void init(FMLInitializationEvent init){ + HANDLER_GT.init(); + HANDLER_GC.init(); + HANDLER_TF.init(); + HANDLER_FR.Init(); + HANDLER_IC2.init(); + HANDLER_Computronics.init(); + HANDLER_BiomesOPlenty.init(); + //HANDLER_Mekanism.init(); + HANDLER_Thaumcraft.init(); + HANDLER_Tinkers.init(); + HANDLER_SC2.init(); + HANDLER_GalactiCraft.init(); + HANDLER_CropsPlusPlus.init(init); + HANDLER_Railcraft.init(); + HANDLER_Reliquary.init(); + HANDLER_OpenBlocks.init(); + HANDLER_SpiceOfLife.init(); + } + + public static void postInit(FMLPostInitializationEvent postinit){ + HANDLER_GT.postInit(); + HANDLER_GC.postInit(); + HANDLER_TF.postInit(); + HANDLER_FR.postInit(); + HANDLER_IC2.postInit(); + HANDLER_Computronics.postInit(); + HANDLER_BiomesOPlenty.postInit(); + //HANDLER_Mekanism.postInit(); + HANDLER_Thaumcraft.postInit(); + HANDLER_Tinkers.postInit(); + HANDLER_SC2.postInit(); + HANDLER_GalactiCraft.postInit(); + HANDLER_CropsPlusPlus.postInit(postinit); + HANDLER_Railcraft.postInit(); + HANDLER_Reliquary.postInit(); + HANDLER_OpenBlocks.postInit(); + HANDLER_SpiceOfLife.postInit(); + } + + public static void onLoadComplete(FMLLoadCompleteEvent event) { + HANDLER_GT.onLoadComplete(event); + } + + +} diff --git a/src/main/java/gtPlusPlus/core/handler/CraftingManager.java b/src/main/java/gtPlusPlus/core/handler/CraftingManager.java new file mode 100644 index 0000000000..6fb580cc32 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/handler/CraftingManager.java @@ -0,0 +1,17 @@ +package gtPlusPlus.core.handler; + +public class CraftingManager { + + public static void mainRegistry() { + addCraftingRecipies(); + addSmeltingRecipies(); + } + + public static void addCraftingRecipies() { + + } + + public static void addSmeltingRecipies() { + + } +} diff --git a/src/main/java/gtPlusPlus/core/handler/EnumHelperHandler.java b/src/main/java/gtPlusPlus/core/handler/EnumHelperHandler.java new file mode 100644 index 0000000000..d164efa3d7 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/handler/EnumHelperHandler.java @@ -0,0 +1,21 @@ +package gtPlusPlus.core.handler; + +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.xmod.gregtech.HANDLER_GT; +import gtPlusPlus.xmod.ic2.CustomInternalName; + +public class EnumHelperHandler { + + public static void init() { + + if (LoadedMods.IndustrialCraft2) { + CustomInternalName.init(); + } + + if (LoadedMods.Gregtech) { + HANDLER_GT.addNewOrePrefixes(); + } + + } + +} diff --git a/src/main/java/gtPlusPlus/core/handler/GuiHandler.java b/src/main/java/gtPlusPlus/core/handler/GuiHandler.java new file mode 100644 index 0000000000..0567d6c5dd --- /dev/null +++ b/src/main/java/gtPlusPlus/core/handler/GuiHandler.java @@ -0,0 +1,231 @@ +package gtPlusPlus.core.handler; + +import cpw.mods.fml.common.network.IGuiHandler; +import cpw.mods.fml.common.network.NetworkRegistry; +import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; +import gtPlusPlus.core.container.*; +import gtPlusPlus.core.container.box.LunchBoxContainer; +import gtPlusPlus.core.container.box.MagicBagContainer; +import gtPlusPlus.core.container.box.ToolBoxContainer; +import gtPlusPlus.core.gui.beta.Gui_ID_Registry; +import gtPlusPlus.core.gui.beta.MU_GuiId; +import gtPlusPlus.core.gui.item.GuiBaseBackpack; +import gtPlusPlus.core.gui.item.GuiBaseGrindle; +import gtPlusPlus.core.gui.item.box.LunchBoxGui; +import gtPlusPlus.core.gui.item.box.MagicBagGui; +import gtPlusPlus.core.gui.item.box.ToolBoxGui; +import gtPlusPlus.core.gui.machine.*; +import gtPlusPlus.core.interfaces.IGuiManager; +import gtPlusPlus.core.inventories.BaseInventoryBackpack; +import gtPlusPlus.core.inventories.BaseInventoryGrindle; +import gtPlusPlus.core.inventories.box.LunchBoxInventory; +import gtPlusPlus.core.inventories.box.MagicBagInventory; +import gtPlusPlus.core.inventories.box.ToolBoxInventory; +import gtPlusPlus.core.tileentities.base.TileEntityBase; +import gtPlusPlus.core.tileentities.general.*; +import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; +import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; +import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; +import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; + +public class GuiHandler implements IGuiHandler { + + public static final int GUI1 = 0; // Project Table + public static final int GUI2 = 1; // Helium Generator + public static final int GUI3 = 2; // BackpackHandler + public static final int GUI4 = 3; // Workbench + public static final int GUI5 = 4; // Workbench Adv + public static final int GUI6 = 5; // Fish trap + public static final int GUI7 = 6; // Trade table + public static final int GUI8 = 7; // Circuit Programmer + public static final int GUI9 = 8; // Grindle + public static final int GUI10 = 9; // Universal Toolbox + public static final int GUI11 = 10; // Auto Lunchbox + public static final int GUI12 = 11; // Bag for Magic Tools + public static final int GUI13 = 12; // Decayables Chest + public static final int GUI14 = 13; // Super Jukebox + public static final int GUI15 = 14; // Pest Killer + public static final int GUI16 = 15; // Round-Robinator + public static final int GUI17 = 16; // Egg Box + public static final int GUI18 = 17; // Volumetric Flask Setter + + public static void init() { + + Logger.INFO("Registering GUIs."); + NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler()); + // Register GuiHandler + // NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new + // GuiHandler()); + } + + @Override // ContainerModTileEntity + public Object getServerGuiElement(final int ID, final EntityPlayer player, final World world, final int x, + final int y, final int z) { + final TileEntity te = world.getTileEntity(x, y, z); + + if (te != null) { + if (ID == GUI1) { + return new Container_ProjectTable(player.inventory, (TileEntityProjectTable) te); + } else if (ID == GUI2) { + return new Container_ModularityTable(player.inventory, (TileEntityModularityTable) te); + } + } + + if (ID == GUI3) { + // Use the player's held item to create the inventory + return new Container_BackpackBase(player, player.inventory, + new BaseInventoryBackpack(player.getHeldItem())); + } + + if (te != null) { + if (ID == GUI4) { + return new Container_Workbench(player.inventory, (TileEntityWorkbench) te); + } else if (ID == GUI5) { + Logger.INFO("sad"); + return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te); + + } else if (ID == GUI6) { + return new Container_FishTrap(player.inventory, (TileEntityFishTrap) te); + } else if (ID == GUI7) { + return new Container_TradeTable(player.inventory, (TileEntityTradeTable) te); + } else if (ID == GUI8) { + return new Container_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te); + } else if (ID == GUI13) { + return new Container_DecayablesChest(player.inventory, (TileEntityDecayablesChest) te); + } else if (ID == GUI14) { + return new Container_SuperJukebox(player.inventory, (TileEntitySuperJukebox) te); + } else if (ID == GUI15) { + return new Container_PestKiller(player.inventory, (TileEntityPestKiller) te); + } else if (ID == GUI16) { + return new Container_RoundRobinator(player.inventory, (TileEntityRoundRobinator) te); + } else if (ID == GUI17) { + return new Container_EggBox(player.inventory, (TileEntityEggBox) te); + } else if (ID == GUI18) { + return new Container_VolumetricFlaskSetter(player.inventory, (TileEntityVolumetricFlaskSetter) te); + } + } + + if (ID == GUI9) { + return new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem())); + } + // Tool, lunch, magic + if (ID == GUI10) { + return new ToolBoxContainer(player, player.inventory, new ToolBoxInventory(player.getHeldItem())); + } + if (ID == GUI11) { + return new LunchBoxContainer(player, player.inventory, new LunchBoxInventory(player.getHeldItem())); + } + if (ID == GUI12) { + return new MagicBagContainer(player, player.inventory, new MagicBagInventory(player.getHeldItem())); + } + + return null; + } + + @Override // GuiModTileEntity + public Object getClientGuiElement(final int ID, final EntityPlayer player, final World world, final int x, + final int y, final int z) { + Logger.WARNING("getClientGuiElement Called by: " + player + ", in world: " + player.dimension + " at x:" + x + + ", y:" + y + ", z:" + z + "."); + final TileEntity te = world.getTileEntity(x, y, z); + if (te != null) { + if (ID == GUI1) { + return new GUI_ProjectTable(player.inventory, (TileEntityProjectTable) te); + } else if (ID == GUI2) { + return new GUI_ModularityTable(player.inventory, (TileEntityModularityTable) te); + } + } + + if (ID == GUI3) { + // We have to cast the new container as our custom class + // and pass in currently held item for the inventory + return new GuiBaseBackpack(new Container_BackpackBase(player, player.inventory, + new BaseInventoryBackpack(player.getHeldItem()))); + } + + if (te != null) { + if (ID == GUI4) { + return new GUI_Workbench(player.inventory, (TileEntityWorkbench) te); + } else if (ID == GUI5) { + Logger.INFO("sad"); + return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te); + } else if (ID == GUI6) { + return new GUI_FishTrap(player.inventory, (TileEntityFishTrap) te); + } else if (ID == GUI7) { + return new GUI_TradeTable(player.inventory, (TileEntityTradeTable) te, + ((TileEntityBase) te).getOwner()); + } else if (ID == GUI8) { + return new GUI_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te); + } else if (ID == GUI13) { + return new GUI_DecayablesChest(player.inventory, (TileEntityDecayablesChest) te); + } else if (ID == GUI14) { + return new GUI_SuperJukebox(player.inventory, (TileEntitySuperJukebox) te); + } else if (ID == GUI15) { + return new GUI_PestKiller(player.inventory, (TileEntityPestKiller) te); + } else if (ID == GUI16) { + return new GUI_RoundRobinator(player.inventory, (TileEntityRoundRobinator) te); + } else if (ID == GUI17) { + return new GUI_EggBox(player.inventory, (TileEntityEggBox) te); +