Skip to content

Commit

Permalink
Merge pull request #13 from GTNewHorizons/nhify
Browse files Browse the repository at this point in the history
Only register recipes if NH Core is loaded
  • Loading branch information
Dream-Master authored May 14, 2023
2 parents f2e3bdb + 0491d34 commit f8ab123
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 42 deletions.
14 changes: 13 additions & 1 deletion src/main/java/de/katzenpapst/amunra/AmunRa.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -104,7 +105,10 @@
@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 {

Expand Down Expand Up @@ -157,6 +161,10 @@ public class AmunRa {
protected ArrayList<ResourceLocation> possibleMothershipTextures = new ArrayList<>();
protected ArrayList<ResourceLocation> possibleAsteroidTextures = new ArrayList<>();

public static boolean isNHCoreLoaded;
public static boolean isIronChestsLoaded;
public static boolean isASPLoaded;

@SidedProxy(
clientSide = "de.katzenpapst.amunra.proxy.ClientProxy",
serverSide = "de.katzenpapst.amunra.proxy.ServerProxy")
Expand All @@ -166,6 +174,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);
Expand Down
123 changes: 82 additions & 41 deletions src/main/java/de/katzenpapst/amunra/crafting/RecipeHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ 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);
final ItemStack enderWaferStack = ARItems.waferEnder.getItemStack(1);
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -912,36 +916,72 @@ private static void initNasaWorkbenchCrafting() {
final ItemStack shuttleLeg = ARItems.shuttleLegs.getItemStack(1);
// Schematic
final HashMap<Integer, ItemStack> 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);
Expand Down Expand Up @@ -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:
Expand All @@ -1001,9 +1038,7 @@ 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
* @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
Expand Down Expand Up @@ -1038,18 +1073,24 @@ 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<Integer, ItemStack> input) {
final int chestSlot1 = 19;
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);
* ItemStack numChests2 = new ItemStack(rocket, 1, 2); ItemStack numChests3 = new ItemStack(rocket, 1, 3);
Expand Down

0 comments on commit f8ab123

Please sign in to comment.