bump forge version, add in recipe remover(combined TCon + tcon tweaks), add coortuple utils from tcon work branch

This commit is contained in:
Progwml6 committed 2014-05-15 01:44:11 -04:00
1 parent 727db8b24c
commit ffe4704623
3 files changed
+193 -13

No files matched your search

+1 -1
View File
@@ -1,2 +1,2 @@
minecraft_version=1.7.2
forge_version=10.12.1.1060
forge_version=10.12.1.1072
+107
View File
@@ -0,0 +1,107 @@
package mantle.utils;
import java.util.List;
import java.util.Map;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.common.ChestGenHooks;
@SuppressWarnings("unchecked")
public class RecipeRemover
{
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 removeFurnaceRecipe (ItemStack resultItem)
{
Map<ItemStack, ItemStack> recipes = FurnaceRecipes.smelting().getSmeltingList();
recipes.remove(resultItem);
}
public static void removeFurnaceRecipe (Item i, int metadata)
{
removeFurnaceRecipe(new ItemStack(i, 1, metadata));
}
public static void removeFurnaceRecipe (Item i)
{
removeFurnaceRecipe(new ItemStack(i, 1, 32767));
}
//removes from all vanilla worldgen chests :D
public static void removeFromChests (ItemStack resultItem)
{
ChestGenHooks.getInfo(ChestGenHooks.BONUS_CHEST).removeItem(resultItem);
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).removeItem(resultItem);
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).removeItem(resultItem);
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).removeItem(resultItem);
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).removeItem(resultItem);
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).removeItem(resultItem);
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_DISPENSER).removeItem(resultItem);
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR).removeItem(resultItem);
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING).removeItem(resultItem);
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_LIBRARY).removeItem(resultItem);
}
}
+85 -12
View File
@@ -78,16 +78,89 @@ public class CoordTuple implements Comparable
return 0;
}
public int getDistanceFrom(CoordTuple tuple)
{
return getDistanceFrom(tuple.x, tuple.y, tuple.z);
}
public int getDistanceFrom (int x1, int y1, int z1)
{
int xPos = x - x1;
int yPos = y - y1;
int zPos = z - z1;
return xPos * xPos + yPos * yPos + zPos * zPos;
}
public static CoordTuple up (int x, int y, int z)
{
return new CoordTuple(x, y + 1, z);
}
public static CoordTuple down (int x, int y, int z)
{
return new CoordTuple(x, y - 1, z);
}
public static CoordTuple north (int x, int y, int z)
{
return new CoordTuple(x, y, z - 1);
}
public static CoordTuple south (int x, int y, int z)
{
return new CoordTuple(x, y, z + 1);
}
public static CoordTuple east (int x, int y, int z)
{
return new CoordTuple(x + 1, y, z);
}
public static CoordTuple west (int x, int y, int z)
{
return new CoordTuple(x - 1, y, z);
}
public static CoordTuple inFront (int x, int y, int z, int meta)
{
switch (meta)
{
case 0:
return down(x, y, z);
case 1:
return up(x, y, z);
case 2:
return north(x, y, z);
case 3:
return south(x, y, z);
case 4:
return west(x, y, z);
case 5:
return east(x, y, z);
default:
return new CoordTuple(x, y, z);
}
}
public static CoordTuple behind (int x, int y, int z, int meta)
{
switch (meta)
{
case 1:
return down(x, y, z);
case 0:
return up(x, y, z);
case 3:
return north(x, y, z);
case 2:
return south(x, y, z);
case 5:
return west(x, y, z);
case 4:
return east(x, y, z);
default:
return new CoordTuple(x, y, z);
}
}
public int getDistanceFrom (CoordTuple tuple)
{
return getDistanceFrom(tuple.x, tuple.y, tuple.z);
}
public int getDistanceFrom (int x1, int y1, int z1)
{
int xPos = x - x1;
int yPos = y - y1;
int zPos = z - z1;
return xPos * xPos + yPos * yPos + zPos * zPos;
}
}