From 2da6b88e9b14858c11d215a54080aec3561df959 Mon Sep 17 00:00:00 2001 From: glowredman <35727266+glowredman@users.noreply.github.com> Date: Sun, 14 May 2023 00:03:07 +0200 Subject: [PATCH 1/2] Only register recipes if NH Core is loaded --- .../java/de/katzenpapst/amunra/AmunRa.java | 15 ++- .../amunra/crafting/RecipeHelper.java | 121 ++++++++++++------ 2 files changed, 95 insertions(+), 41 deletions(-) diff --git a/src/main/java/de/katzenpapst/amunra/AmunRa.java b/src/main/java/de/katzenpapst/amunra/AmunRa.java index b1ccea98..98b45793 100755 --- a/src/main/java/de/katzenpapst/amunra/AmunRa.java +++ b/src/main/java/de/katzenpapst/amunra/AmunRa.java @@ -19,6 +19,7 @@ import org.apache.logging.log4j.Logger; import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; @@ -104,7 +105,11 @@ @Mod( modid = AmunRa.MODID, version = AmunRa.VERSION, - dependencies = "required-after:GalacticraftCore@[3.0.61-GTNH,);required-after:GalacticraftMars", + dependencies = "required-after:GalacticraftCore@[3.0.61-GTNH,);" + + "required-after:GalacticraftMars;" + + "after:dreamcraft;" + + "after:IronChest;" + + "after:AdvancedSolarPanel", name = AmunRa.MODNAME) public class AmunRa { @@ -156,6 +161,10 @@ public class AmunRa { protected ArrayList possibleMothershipTextures = new ArrayList<>(); protected ArrayList possibleAsteroidTextures = new ArrayList<>(); + + public static boolean isNHCoreLoaded; + public static boolean isIronChestsLoaded; + public static boolean isASPLoaded; @SidedProxy( clientSide = "de.katzenpapst.amunra.proxy.ClientProxy", @@ -166,6 +175,10 @@ public class AmunRa { @EventHandler public void preInit(final FMLPreInitializationEvent event) { + isNHCoreLoaded = Loader.isModLoaded("dreamcraft"); + isIronChestsLoaded = Loader.isModLoaded("IronChest"); + isASPLoaded = Loader.isModLoaded("AdvancedSolarPanel"); + final Configuration configFile = new Configuration(event.getSuggestedConfigurationFile()); config.processConfig(configFile); diff --git a/src/main/java/de/katzenpapst/amunra/crafting/RecipeHelper.java b/src/main/java/de/katzenpapst/amunra/crafting/RecipeHelper.java index 44044356..1bff8804 100755 --- a/src/main/java/de/katzenpapst/amunra/crafting/RecipeHelper.java +++ b/src/main/java/de/katzenpapst/amunra/crafting/RecipeHelper.java @@ -52,6 +52,12 @@ public class RecipeHelper { public RecipeHelper() {} public static void initRecipes() { + + initNasaWorkbenchCrafting(); + + if(!AmunRa.isNHCoreLoaded) { + return; + } // ItemStack enderWaferStack = ARItems.baseItem.getItemStack("waferEnder", 1); final ItemStack freqModuleStack = new ItemStack(GCItems.basicItem, 1, 19); @@ -765,8 +771,6 @@ public static void initRecipes() { addSlabAndStairsCrafting(ARBlocks.blockMethanePlanks, ARBlocks.slabMethanePlanks, ARBlocks.stairsMethanePlanks); addSlabAndStairsCrafting(ARBlocks.blockObsidianBrick, ARBlocks.slabObsidianBrick, ARBlocks.stairsObsidianBrick); addSlabAndStairsCrafting(ARBlocks.blockPodPlanks, ARBlocks.slabPodPlanks, ARBlocks.stairsPodPlanks); - - initNasaWorkbenchCrafting(); } public static void verifyNasaWorkbenchCrafting() { @@ -912,36 +916,72 @@ private static void initNasaWorkbenchCrafting() { final ItemStack shuttleLeg = ARItems.shuttleLegs.getItemStack(1); // Schematic final HashMap input = new HashMap<>(); - // top row, single slot - input.put(1, ARItems.noseCone.getItemStack(1)); - // body - input.put(2, lightPlate); - input.put(3, lightPlate); - input.put(4, lightPlate); - // next 3 - input.put(5, lightPlate); - input.put(6, new ItemStack(Blocks.glass_pane, 1, 0)); - input.put(7, lightPlate); - - input.put(8, lightPlate); - input.put(9, lightPlate); - input.put(10, lightPlate); - - // second to last row, the fins start here - input.put(11, new ItemStack(GCItems.partFins)); - - // for now, potentially change this - input.put(12, lightPlate); - input.put(13, lightPlate); - input.put(14, lightPlate); - - input.put(15, new ItemStack(GCItems.partFins)); - - // last row - input.put(16, shuttleLeg); - // engine? - input.put(17, new ItemStack(GCItems.rocketEngine)); - input.put(18, shuttleLeg); + + if(AmunRa.isNHCoreLoaded && AmunRa.isASPLoaded) { + final ItemStack fins = GameRegistry.findItemStack("dreamcraft", "item.HeavyDutyRocketFinsTier4", 1); + + // top row, single slot + input.put(1, ARItems.noseCone.getItemStack(1)); + // body + input.put(2, lightPlate); + input.put(3, lightPlate); + input.put(4, lightPlate); + // next 3 + input.put(5, lightPlate); + input.put(6, new ItemStack(GameRegistry.findItem("AdvancedSolarPanel", "asp_crafting_items"), 1, 5)); + input.put(7, lightPlate); + + input.put(8, lightPlate); + input.put(9, lightPlate); + input.put(10, lightPlate); + + // second to last row, the fins start here + input.put(11, fins); + + // for now, potentially change this + input.put(12, lightPlate); + input.put(13, lightPlate); + input.put(14, lightPlate); + + input.put(15, fins); + + // last row + input.put(16, shuttleLeg); + // engine? + input.put(17, GameRegistry.findItemStack("dreamcraft", "item.HeavyDutyRocketEngineTier4", 1)); + input.put(18, shuttleLeg); + } else { + // top row, single slot + input.put(1, ARItems.noseCone.getItemStack(1)); + // body + input.put(2, lightPlate); + input.put(3, lightPlate); + input.put(4, lightPlate); + // next 3 + input.put(5, lightPlate); + input.put(6, new ItemStack(Blocks.glass_pane, 1, 0)); + input.put(7, lightPlate); + + input.put(8, lightPlate); + input.put(9, lightPlate); + input.put(10, lightPlate); + + // second to last row, the fins start here + input.put(11, new ItemStack(GCItems.partFins)); + + // for now, potentially change this + input.put(12, lightPlate); + input.put(13, lightPlate); + input.put(14, lightPlate); + + input.put(15, new ItemStack(GCItems.partFins)); + + // last row + input.put(16, shuttleLeg); + // engine? + input.put(17, new ItemStack(GCItems.rocketEngine)); + input.put(18, shuttleLeg); + } // chests input.put(19, null); @@ -988,9 +1028,6 @@ private static void addSlabAndStairsCrafting(final BlockMetaPair block, final Bl /** * Helper function to add all reloading recipes for all rayguns and batteries... - * - * @param guns - * @param batteries */ /* * private static void initRaygunReloadingRecipes(ItemStack[] guns, ItemStack[] batteries) { for(ItemStack gun: @@ -1001,8 +1038,6 @@ private static void addSlabAndStairsCrafting(final BlockMetaPair block, final Bl /** * adds a crafting recipe for a gun and reloading recipes * - * @param gun - * @param batteries * @param recipe the very last argument must be the battery */ private static void addRaygunRecipe(final ItemStack gun, final ItemStack[] batteries, final Object... recipe) { @@ -1038,8 +1073,6 @@ private static void addRaygunRecipe(final ItemStack gun, final ItemStack[] batte * @param input the input hashmap * @param chestAlu itemstack of the "chest" * @param chestSlot1 the 3 slot positions for the 3 "chests" - * @param chestSlot2 - * @param chestSlot3 */ public static void addRocketRecipeWithChestPermutations(final Item rocket, final HashMap input) { @@ -1047,8 +1080,16 @@ public static void addRocketRecipeWithChestPermutations(final Item rocket, final int chestSlot2 = 20; final int chestSlot3 = 21; - final ItemStack chest = new ItemStack(Blocks.chest); + ItemStack chest; final ItemStack tank = ARItems.shuttleTank.getItemStack(1); + + if(AmunRa.isIronChestsLoaded) { + // Copper Chest + chest = GameRegistry.findItemStack("IronChest", "BlockIronChest", 1); + Items.apple.setDamage(chest, 3); + } else { + chest = new ItemStack(Blocks.chest); + } /* * ItemStack numChests0 = new ItemStack(rocket, 1, 0); ItemStack numChests1 = new ItemStack(rocket, 1, 1); From 31b70737195dfb73410572631d36c6029042da03 Mon Sep 17 00:00:00 2001 From: GitHub GTNH Actions <> Date: Sat, 13 May 2023 22:08:11 +0000 Subject: [PATCH 2/2] spotlessApply --- src/main/java/de/katzenpapst/amunra/AmunRa.java | 7 +++---- .../amunra/crafting/RecipeHelper.java | 16 ++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/katzenpapst/amunra/AmunRa.java b/src/main/java/de/katzenpapst/amunra/AmunRa.java index 98b45793..7507fa94 100755 --- a/src/main/java/de/katzenpapst/amunra/AmunRa.java +++ b/src/main/java/de/katzenpapst/amunra/AmunRa.java @@ -105,8 +105,7 @@ @Mod( modid = AmunRa.MODID, version = AmunRa.VERSION, - dependencies = "required-after:GalacticraftCore@[3.0.61-GTNH,);" - + "required-after:GalacticraftMars;" + dependencies = "required-after:GalacticraftCore@[3.0.61-GTNH,);" + "required-after:GalacticraftMars;" + "after:dreamcraft;" + "after:IronChest;" + "after:AdvancedSolarPanel", @@ -161,7 +160,7 @@ public class AmunRa { protected ArrayList possibleMothershipTextures = new ArrayList<>(); protected ArrayList possibleAsteroidTextures = new ArrayList<>(); - + public static boolean isNHCoreLoaded; public static boolean isIronChestsLoaded; public static boolean isASPLoaded; @@ -178,7 +177,7 @@ public void preInit(final FMLPreInitializationEvent event) { isNHCoreLoaded = Loader.isModLoaded("dreamcraft"); isIronChestsLoaded = Loader.isModLoaded("IronChest"); isASPLoaded = Loader.isModLoaded("AdvancedSolarPanel"); - + final Configuration configFile = new Configuration(event.getSuggestedConfigurationFile()); config.processConfig(configFile); diff --git a/src/main/java/de/katzenpapst/amunra/crafting/RecipeHelper.java b/src/main/java/de/katzenpapst/amunra/crafting/RecipeHelper.java index 1bff8804..c4d18ce1 100755 --- a/src/main/java/de/katzenpapst/amunra/crafting/RecipeHelper.java +++ b/src/main/java/de/katzenpapst/amunra/crafting/RecipeHelper.java @@ -52,10 +52,10 @@ public class RecipeHelper { public RecipeHelper() {} public static void initRecipes() { - + initNasaWorkbenchCrafting(); - - if(!AmunRa.isNHCoreLoaded) { + + if (!AmunRa.isNHCoreLoaded) { return; } @@ -917,9 +917,9 @@ private static void initNasaWorkbenchCrafting() { // Schematic final HashMap input = new HashMap<>(); - if(AmunRa.isNHCoreLoaded && AmunRa.isASPLoaded) { + if (AmunRa.isNHCoreLoaded && AmunRa.isASPLoaded) { final ItemStack fins = GameRegistry.findItemStack("dreamcraft", "item.HeavyDutyRocketFinsTier4", 1); - + // top row, single slot input.put(1, ARItems.noseCone.getItemStack(1)); // body @@ -1038,7 +1038,7 @@ private static void addSlabAndStairsCrafting(final BlockMetaPair block, final Bl /** * adds a crafting recipe for a gun and reloading recipes * - * @param recipe the very last argument must be the battery + * @param recipe the very last argument must be the battery */ private static void addRaygunRecipe(final ItemStack gun, final ItemStack[] batteries, final Object... recipe) { // TODO find a way to display what is actually being crafted @@ -1082,8 +1082,8 @@ public static void addRocketRecipeWithChestPermutations(final Item rocket, ItemStack chest; final ItemStack tank = ARItems.shuttleTank.getItemStack(1); - - if(AmunRa.isIronChestsLoaded) { + + if (AmunRa.isIronChestsLoaded) { // Copper Chest chest = GameRegistry.findItemStack("IronChest", "BlockIronChest", 1); Items.apple.setDamage(chest, 3);