mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 20:52:26 +00:00
Reorganize folders for modules
This commit is contained in:
1 parent
2c14f315de
commit
e2f0558b6f
370 files changed
+4274
-4788
No files matched your search
@@ -0,0 +1,147 @@
|
||||
package tconstruct.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
|
||||
public class CraftingRecipeHelper
|
||||
{
|
||||
public static void removeShapedRecipes (List<ItemStack> removelist)
|
||||
{
|
||||
for (ItemStack stack : removelist)
|
||||
removeShapedRecipe(stack);
|
||||
}
|
||||
|
||||
public static void removeAnyRecipe (ItemStack resultItem)
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (int i = 0; i < recipes.size(); i++)
|
||||
{
|
||||
IRecipe tmpRecipe = recipes.get(i);
|
||||
ItemStack recipeResult = tmpRecipe.getRecipeOutput();
|
||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
|
||||
{
|
||||
recipes.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeShapedRecipe (ItemStack resultItem)
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (int i = 0; i < recipes.size(); i++)
|
||||
{
|
||||
IRecipe tmpRecipe = recipes.get(i);
|
||||
if (tmpRecipe instanceof ShapedRecipes)
|
||||
{
|
||||
ShapedRecipes recipe = (ShapedRecipes) tmpRecipe;
|
||||
ItemStack recipeResult = recipe.getRecipeOutput();
|
||||
|
||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
|
||||
{
|
||||
recipes.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeShapelessRecipe (ItemStack resultItem)
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (int i = 0; i < recipes.size(); i++)
|
||||
{
|
||||
IRecipe tmpRecipe = recipes.get(i);
|
||||
if (tmpRecipe instanceof ShapelessRecipes)
|
||||
{
|
||||
ShapelessRecipes recipe = (ShapelessRecipes) tmpRecipe;
|
||||
ItemStack recipeResult = recipe.getRecipeOutput();
|
||||
|
||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
|
||||
{
|
||||
recipes.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void addShapedRecipeFirst (List recipeList, ItemStack itemstack, Object... objArray)
|
||||
{
|
||||
String var3 = "";
|
||||
int var4 = 0;
|
||||
int var5 = 0;
|
||||
int var6 = 0;
|
||||
|
||||
if (objArray[var4] instanceof String[])
|
||||
{
|
||||
String[] var7 = ((String[]) objArray[var4++]);
|
||||
|
||||
for (int var8 = 0; var8 < var7.length; ++var8)
|
||||
{
|
||||
String var9 = var7[var8];
|
||||
++var6;
|
||||
var5 = var9.length();
|
||||
var3 = var3 + var9;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (objArray[var4] instanceof String)
|
||||
{
|
||||
String var11 = (String) objArray[var4++];
|
||||
++var6;
|
||||
var5 = var11.length();
|
||||
var3 = var3 + var11;
|
||||
}
|
||||
}
|
||||
|
||||
HashMap var12;
|
||||
|
||||
for (var12 = new HashMap(); var4 < objArray.length; var4 += 2)
|
||||
{
|
||||
Character var13 = (Character) objArray[var4];
|
||||
ItemStack var14 = null;
|
||||
|
||||
if (objArray[var4 + 1] instanceof Item)
|
||||
{
|
||||
var14 = new ItemStack((Item) objArray[var4 + 1]);
|
||||
}
|
||||
else if (objArray[var4 + 1] instanceof Block)
|
||||
{
|
||||
var14 = new ItemStack((Block) objArray[var4 + 1], 1, Short.MAX_VALUE);
|
||||
}
|
||||
else if (objArray[var4 + 1] instanceof ItemStack)
|
||||
{
|
||||
var14 = (ItemStack) objArray[var4 + 1];
|
||||
}
|
||||
|
||||
var12.put(var13, var14);
|
||||
}
|
||||
|
||||
ItemStack[] var15 = new ItemStack[var5 * var6];
|
||||
|
||||
for (int var16 = 0; var16 < var5 * var6; ++var16)
|
||||
{
|
||||
char var10 = var3.charAt(var16);
|
||||
|
||||
if (var12.containsKey(Character.valueOf(var10)))
|
||||
{
|
||||
var15[var16] = ((ItemStack) var12.get(Character.valueOf(var10))).copy();
|
||||
}
|
||||
else
|
||||
{
|
||||
var15[var16] = null;
|
||||
}
|
||||
}
|
||||
|
||||
ShapedRecipes var17 = new ShapedRecipes(var5, var6, var15, itemstack);
|
||||
recipeList.add(0, var17);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user