Force adding ItemStack to Scrapbox List
This commit is contained in:
parent
a1335f118a
commit
b503feed8a
2 changed files with 18 additions and 2 deletions
|
@ -4,23 +4,26 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import techreborn.Core;
|
||||||
|
|
||||||
public class ScrapboxList
|
public class ScrapboxList
|
||||||
{
|
{
|
||||||
|
|
||||||
public static List<ItemStack> stacks = new ArrayList<ItemStack>();
|
public static List<ItemStack> stacks = new ArrayList<>();
|
||||||
|
|
||||||
public static void addItemStackToList(ItemStack stack)
|
public static void addItemStackToList(ItemStack stack)
|
||||||
{
|
{
|
||||||
if (!hasItems(stack))
|
if (!hasItems(stack))
|
||||||
|
{
|
||||||
stacks.add(stack);
|
stacks.add(stack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean hasItems(ItemStack stack)
|
private static boolean hasItems(ItemStack stack)
|
||||||
{
|
{
|
||||||
for (ItemStack s : stacks)
|
for (ItemStack s : stacks)
|
||||||
{
|
{
|
||||||
if (stack.getItem().getItemStackDisplayName(stack).equals(s.getItem().getItemStackDisplayName(stack)))
|
if (stack.getDisplayName().equals(s.getDisplayName()))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package techreborn.init;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
import java.security.InvalidParameterException;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
@ -51,6 +52,7 @@ import techreborn.items.ItemParts;
|
||||||
import techreborn.items.ItemPlates;
|
import techreborn.items.ItemPlates;
|
||||||
import techreborn.parts.ItemStandaloneCables;
|
import techreborn.parts.ItemStandaloneCables;
|
||||||
import techreborn.utils.RecipeUtils;
|
import techreborn.utils.RecipeUtils;
|
||||||
|
import techreborn.utils.StackWIPHandler;
|
||||||
|
|
||||||
public class ModRecipes
|
public class ModRecipes
|
||||||
{
|
{
|
||||||
|
@ -106,6 +108,12 @@ public class ModRecipes
|
||||||
ScrapboxList.addItemStackToList(new ItemStack(i));
|
ScrapboxList.addItemStackToList(new ItemStack(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < StackWIPHandler.devHeads.size(); i++)
|
||||||
|
ScrapboxList.stacks.add(StackWIPHandler.devHeads.get(i));
|
||||||
|
|
||||||
|
registerDyable(Blocks.stained_hardened_clay);
|
||||||
|
registerDyable(Blocks.wool);
|
||||||
|
|
||||||
for (int i = 0; i < ScrapboxList.stacks.size(); i++)
|
for (int i = 0; i < ScrapboxList.stacks.size(); i++)
|
||||||
{
|
{
|
||||||
RecipeHandler.addRecipe(new ScrapboxRecipe(ScrapboxList.stacks.get(i)));
|
RecipeHandler.addRecipe(new ScrapboxRecipe(ScrapboxList.stacks.get(i)));
|
||||||
|
@ -127,6 +135,11 @@ public class ModRecipes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void registerDyable(Block block) {
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
ScrapboxList.stacks.add(new ItemStack(block, 1, i));
|
||||||
|
}
|
||||||
|
|
||||||
static void addWireRecipes()
|
static void addWireRecipes()
|
||||||
{
|
{
|
||||||
CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("copper", 6), "XXX", "CCC", "XXX", 'C',
|
CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("copper", 6), "XXX", "CCC", "XXX", 'C',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue