Skip to content

Commit

Permalink
Support all "chestWood" ore dictionary items for rockets with invento…
Browse files Browse the repository at this point in the history
…ry space. Fixes #3891.
  • Loading branch information
micdoodle8 committed Apr 17, 2020
1 parent f3533a2 commit 2db9183
Show file tree
Hide file tree
Showing 7 changed files with 273 additions and 202 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import micdoodle8.mods.galacticraft.api.recipe.INasaWorkbenchRecipe;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraftforge.oredict.OreDictionary;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -31,11 +33,14 @@ public static List<INasaWorkbenchRecipe> getRecipesList()
public static int countChests(INasaWorkbenchRecipe recipe)
{
int count = 0;
ItemStack chest = new ItemStack(Blocks.CHEST);
for (Entry<Integer, ItemStack> e : recipe.getRecipeInput().entrySet())
NonNullList<ItemStack> woodChests = OreDictionary.getOres("chestWood");
for (ItemStack woodChest : woodChests)
{
if (ItemStack.areItemsEqual(chest, e.getValue()))
count++;
for (Entry<Integer, ItemStack> e : recipe.getRecipeInput().entrySet())
{
if (ItemStack.areItemsEqual(woodChest, e.getValue()))
count++;
}
}
return count;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;

public class ContainerSchematicTier1Rocket extends Container
{
Expand Down Expand Up @@ -164,25 +165,37 @@ else if (var2.getItem() == GCItems.rocketEngine)
return ItemStack.EMPTY;
}
}
else if (var2.getItem() == Item.getItemFromBlock(Blocks.CHEST))
else
{
if (!this.mergeOneItem(var4, 15, 18, false))
boolean foundChest = false;
for (ItemStack woodChest : OreDictionary.getOres("chestWood"))
{
return ItemStack.EMPTY;
if (var2.getItem() == woodChest.getItem())
{
foundChest = true;
break;
}
}
}
else if (par1 >= 18 && par1 < 45)
{
if (!this.mergeItemStack(var4, 45, 54, false))
if (foundChest)
{
return ItemStack.EMPTY;
if (!this.mergeOneItem(var4, 15, 18, false))
{
return ItemStack.EMPTY;
}
}
}
else if (par1 >= 45 && par1 < 54)
{
if (!this.mergeItemStack(var4, 18, 45, false))
else if (par1 >= 18 && par1 < 45)
{
return ItemStack.EMPTY;
if (!this.mergeItemStack(var4, 45, 54, false))
{
return ItemStack.EMPTY;
}
}
else if (par1 >= 45 && par1 < 54)
{
if (!this.mergeItemStack(var4, 18, 45, false))
{
return ItemStack.EMPTY;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
Expand Down Expand Up @@ -126,47 +127,55 @@ public static void addUniversalRecipes()
input.put(17, ItemStack.EMPTY);
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 0), input);

HashMap<Integer, ItemStack> input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, new ItemStack(Blocks.CHEST));
input2.put(16, ItemStack.EMPTY);
input2.put(17, ItemStack.EMPTY);
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2);

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, ItemStack.EMPTY);
input2.put(16, new ItemStack(Blocks.CHEST));
input2.put(17, ItemStack.EMPTY);
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2);

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, ItemStack.EMPTY);
input2.put(16, ItemStack.EMPTY);
input2.put(17, new ItemStack(Blocks.CHEST));
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2);

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, new ItemStack(Blocks.CHEST));
input2.put(16, new ItemStack(Blocks.CHEST));
input2.put(17, ItemStack.EMPTY);
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 2), input2);
NonNullList<ItemStack> woodChests = OreDictionary.getOres("chestWood");
HashMap<Integer, ItemStack> input2;

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, new ItemStack(Blocks.CHEST));
input2.put(16, ItemStack.EMPTY);
input2.put(17, new ItemStack(Blocks.CHEST));
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 2), input2);
for (ItemStack woodChest : woodChests)
{
input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, woodChest);
input2.put(16, ItemStack.EMPTY);
input2.put(17, ItemStack.EMPTY);
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2);

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, ItemStack.EMPTY);
input2.put(16, woodChest);
input2.put(17, ItemStack.EMPTY);
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2);

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, ItemStack.EMPTY);
input2.put(16, ItemStack.EMPTY);
input2.put(17, woodChest);
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2);

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, woodChest);
input2.put(16, woodChest);
input2.put(17, ItemStack.EMPTY);
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 2), input2);

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, woodChest);
input2.put(16, ItemStack.EMPTY);
input2.put(17, woodChest);
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 2), input2);

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, ItemStack.EMPTY);
input2.put(16, woodChest);
input2.put(17, woodChest);
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 2), input2);

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, woodChest);
input2.put(16, woodChest);
input2.put(17, woodChest);
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 3), input2);
}

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, ItemStack.EMPTY);
input2.put(16, new ItemStack(Blocks.CHEST));
input2.put(17, new ItemStack(Blocks.CHEST));
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 2), input2);

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(15, new ItemStack(Blocks.CHEST));
input2.put(16, new ItemStack(Blocks.CHEST));
input2.put(17, new ItemStack(Blocks.CHEST));
RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 3), input2);

//

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;

public class ContainerSchematicTier3Rocket extends Container
{
Expand Down Expand Up @@ -153,7 +154,16 @@ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1)
}
else
{
if (var2.getItem() == Item.getItemFromBlock(Blocks.CHEST))
boolean foundChest = false;
for (ItemStack woodChest : OreDictionary.getOres("chestWood"))
{
if (var2.getItem() == woodChest.getItem())
{
foundChest = true;
break;
}
}
if (foundChest)
{
if (!this.mergeOneItemTestValid(var4, 19, 22, false))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.NonNullList;
import net.minecraftforge.oredict.OreDictionary;

import java.util.HashMap;

Expand Down Expand Up @@ -74,64 +75,73 @@ public static void addUniversalRecipes()
input.put(21, ItemStack.EMPTY);
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 0), input));

HashMap<Integer, ItemStack> input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, new ItemStack(Blocks.CHEST));
input2.put(20, ItemStack.EMPTY);
input2.put(21, ItemStack.EMPTY);
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), input2));
NonNullList<ItemStack> woodChests = OreDictionary.getOres("chestWood");
HashMap<Integer, ItemStack> input2;

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, ItemStack.EMPTY);
input2.put(20, new ItemStack(Blocks.CHEST));
input2.put(21, ItemStack.EMPTY);
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), input2));
for (ItemStack woodChest : woodChests)
{
input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, woodChest);
input2.put(20, ItemStack.EMPTY);
input2.put(21, ItemStack.EMPTY);
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), input2));

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, ItemStack.EMPTY);
input2.put(20, woodChest);
input2.put(21, ItemStack.EMPTY);
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), input2));

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, ItemStack.EMPTY);
input2.put(20, ItemStack.EMPTY);
input2.put(21, new ItemStack(Blocks.CHEST));
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), input2));
input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, ItemStack.EMPTY);
input2.put(20, ItemStack.EMPTY);
input2.put(21, woodChest);
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), input2));

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, new ItemStack(Blocks.CHEST));
input2.put(20, new ItemStack(Blocks.CHEST));
input2.put(21, ItemStack.EMPTY);
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), input2));
input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, woodChest);
input2.put(20, woodChest);
input2.put(21, ItemStack.EMPTY);
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), input2));

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, new ItemStack(Blocks.CHEST));
input2.put(20, ItemStack.EMPTY);
input2.put(21, new ItemStack(Blocks.CHEST));
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), input2));
input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, woodChest);
input2.put(20, ItemStack.EMPTY);
input2.put(21, woodChest);
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), input2));

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, ItemStack.EMPTY);
input2.put(20, new ItemStack(Blocks.CHEST));
input2.put(21, new ItemStack(Blocks.CHEST));
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), input2));
input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, ItemStack.EMPTY);
input2.put(20, woodChest);
input2.put(21, woodChest);
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), input2));

input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, new ItemStack(Blocks.CHEST));
input2.put(20, new ItemStack(Blocks.CHEST));
input2.put(21, new ItemStack(Blocks.CHEST));
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 3), input2));
input2 = new HashMap<Integer, ItemStack>(input);
input2.put(19, woodChest);
input2.put(20, woodChest);
input2.put(21, woodChest);
GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 3), input2));
}

input = new HashMap<Integer, ItemStack>();
input.put(1, new ItemStack(GCItems.heavyPlatingTier1));
input.put(3, new ItemStack(GCItems.heavyPlatingTier1));
input.put(5, new ItemStack(GCItems.heavyPlatingTier1));
input.put(11, new ItemStack(GCItems.heavyPlatingTier1));
input.put(2, new ItemStack(AsteroidsItems.orionDrive));
input.put(4, new ItemStack(AsteroidsItems.orionDrive));
input.put(9, new ItemStack(AsteroidsItems.orionDrive));
input.put(10, new ItemStack(AsteroidsItems.orionDrive));
input.put(12, new ItemStack(AsteroidsItems.orionDrive));
input.put(6, new ItemStack(GCItems.basicItem, 1, 14));
input.put(7, new ItemStack(Blocks.CHEST));
input.put(8, new ItemStack(Blocks.CHEST));
input.put(13, new ItemStack(AsteroidsItems.basicItem, 1, 8));
input.put(14, new ItemStack(GCItems.flagPole));
GalacticraftRegistry.addAstroMinerRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.astroMiner, 1, 0), input));
for (ItemStack woodChest : woodChests)
{
input = new HashMap<Integer, ItemStack>();
input.put(1, new ItemStack(GCItems.heavyPlatingTier1));
input.put(3, new ItemStack(GCItems.heavyPlatingTier1));
input.put(5, new ItemStack(GCItems.heavyPlatingTier1));
input.put(11, new ItemStack(GCItems.heavyPlatingTier1));
input.put(2, new ItemStack(AsteroidsItems.orionDrive));
input.put(4, new ItemStack(AsteroidsItems.orionDrive));
input.put(9, new ItemStack(AsteroidsItems.orionDrive));
input.put(10, new ItemStack(AsteroidsItems.orionDrive));
input.put(12, new ItemStack(AsteroidsItems.orionDrive));
input.put(6, new ItemStack(GCItems.basicItem, 1, 14));
input.put(7, woodChest);
input.put(8, woodChest);
input.put(13, new ItemStack(AsteroidsItems.basicItem, 1, 8));
input.put(14, new ItemStack(GCItems.flagPole));
GalacticraftRegistry.addAstroMinerRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.astroMiner, 1, 0), input));
}

//All this is for NEI's benefit
NonNullList<Ingredient> list1 = NonNullList.create();
Expand Down
Loading

0 comments on commit 2db9183

Please sign in to comment.