Massive rework of configs, items and blocks.
I redone where the items/blocsks are stored and how the configs are handled to clean up it and give space. You can change the config line to AWWayofTime if you want to keep the compatibility with old configs. Now you reference the blocks from the ModBlocks and Items from the ModItems.
This commit is contained in:
parent
8601e9faff
commit
e3644f2d2b
304 changed files with 3941 additions and 5108 deletions
|
@ -1,15 +1,14 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class CrucibleRecipe
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CrucibleRecipe {
|
||||
public ItemStack recipeOutput;
|
||||
public Object catalyst;
|
||||
public AspectList aspects;
|
||||
|
@ -34,10 +33,10 @@ public class CrucibleRecipe
|
|||
!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst, cat, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size() > 0)
|
||||
} else if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>) catalyst).size() > 0)
|
||||
{
|
||||
if (!ThaumcraftApiHelper.containsMatch(true, ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[] {}), cat)) return false;
|
||||
if (!ThaumcraftApiHelper.containsMatch(true, ((ArrayList<ItemStack>) catalyst).toArray(new ItemStack[]{}), cat))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itags == null)
|
||||
|
@ -45,7 +44,7 @@ public class CrucibleRecipe
|
|||
return false;
|
||||
}
|
||||
|
||||
for (Aspect tag: aspects.getAspects())
|
||||
for (Aspect tag : aspects.getAspects())
|
||||
{
|
||||
if (itags.getAmount(tag) < aspects.getAmount(tag))
|
||||
{
|
||||
|
@ -61,7 +60,7 @@ public class CrucibleRecipe
|
|||
AspectList temptags = new AspectList();
|
||||
temptags.aspects.putAll(itags.aspects);
|
||||
|
||||
for (Aspect tag: aspects.getAspects())
|
||||
for (Aspect tag : aspects.getAspects())
|
||||
{
|
||||
temptags.remove(tag, aspects.getAmount(tag));
|
||||
// if (!temptags.remove(tag, aspects.getAmount(tag))) return null;
|
||||
|
|
|
@ -6,10 +6,10 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public interface IArcaneRecipe
|
||||
{
|
||||
public interface IArcaneRecipe {
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
boolean matches(IInventory var1, World world, EntityPlayer player);
|
||||
|
@ -25,6 +25,8 @@ public interface IArcaneRecipe
|
|||
int getRecipeSize();
|
||||
|
||||
ItemStack getRecipeOutput();
|
||||
|
||||
AspectList getAspects();
|
||||
|
||||
String getResearch();
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -13,8 +9,11 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class InfusionEnchantmentRecipe
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class InfusionEnchantmentRecipe {
|
||||
public AspectList aspects;
|
||||
public String research;
|
||||
public ItemStack[] components;
|
||||
|
@ -35,6 +34,7 @@ public class InfusionEnchantmentRecipe
|
|||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player)
|
||||
|
@ -54,7 +54,7 @@ public class InfusionEnchantmentRecipe
|
|||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
int j1 = ((Integer)iterator.next()).intValue();
|
||||
int j1 = ((Integer) iterator.next()).intValue();
|
||||
Enchantment ench = Enchantment.enchantmentsList[j1];
|
||||
|
||||
if (j1 == enchantment.effectId &&
|
||||
|
@ -65,7 +65,7 @@ public class InfusionEnchantmentRecipe
|
|||
|
||||
if (enchantment.effectId != ench.effectId &&
|
||||
(!enchantment.canApplyTogether(ench) ||
|
||||
!ench.canApplyTogether(enchantment)))
|
||||
!ench.canApplyTogether(enchantment)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -74,12 +74,12 @@ public class InfusionEnchantmentRecipe
|
|||
ItemStack i2 = null;
|
||||
ArrayList<ItemStack> ii = new ArrayList<ItemStack>();
|
||||
|
||||
for (ItemStack is: input)
|
||||
for (ItemStack is : input)
|
||||
{
|
||||
ii.add(is.copy());
|
||||
}
|
||||
|
||||
for (ItemStack comp: components)
|
||||
for (ItemStack comp : components)
|
||||
{
|
||||
boolean b = false;
|
||||
|
||||
|
@ -136,13 +136,12 @@ public class InfusionEnchantmentRecipe
|
|||
|
||||
if (od != -1)
|
||||
{
|
||||
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[] {});
|
||||
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
|
||||
|
||||
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[] {stack1}, ores))
|
||||
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
t1 = ItemStack.areItemStackTagsEqual(stack0, stack1);
|
||||
}
|
||||
|
@ -173,7 +172,7 @@ public class InfusionEnchantmentRecipe
|
|||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
int j1 = ((Integer)iterator.next()).intValue();
|
||||
int j1 = ((Integer) iterator.next()).intValue();
|
||||
i += EnchantmentHelper.getEnchantmentLevel(j1, recipeInput);
|
||||
}
|
||||
|
||||
|
@ -193,7 +192,7 @@ public class InfusionEnchantmentRecipe
|
|||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
int j1 = ((Integer)iterator.next()).intValue();
|
||||
int j1 = ((Integer) iterator.next()).intValue();
|
||||
|
||||
if (j1 != enchantment.effectId)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -9,8 +7,9 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class InfusionRecipe
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class InfusionRecipe {
|
||||
public AspectList aspects;
|
||||
public String research;
|
||||
public ItemStack[] components;
|
||||
|
@ -31,6 +30,7 @@ public class InfusionRecipe
|
|||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player)
|
||||
|
@ -54,12 +54,12 @@ public class InfusionRecipe
|
|||
|
||||
ArrayList<ItemStack> ii = new ArrayList<ItemStack>();
|
||||
|
||||
for (ItemStack is: input)
|
||||
for (ItemStack is : input)
|
||||
{
|
||||
ii.add(is.copy());
|
||||
}
|
||||
|
||||
for (ItemStack comp: components)
|
||||
for (ItemStack comp : components)
|
||||
{
|
||||
boolean b = false;
|
||||
|
||||
|
@ -116,13 +116,12 @@ public class InfusionRecipe
|
|||
|
||||
if (od != -1)
|
||||
{
|
||||
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[] {});
|
||||
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
|
||||
|
||||
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[] {stack1}, ores))
|
||||
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
t1 = ItemStack.areItemStackTagsEqual(stack0, stack1);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -14,28 +10,32 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class ShapedArcaneRecipe implements IArcaneRecipe
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ShapedArcaneRecipe implements IArcaneRecipe {
|
||||
//Added in for future ease of change, but hard coded for now.
|
||||
private static final int MAX_CRAFT_GRID_WIDTH = 3;
|
||||
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
|
||||
|
||||
public ItemStack output = null;
|
||||
public Object[] input = null;
|
||||
public Object[] input = null;
|
||||
public AspectList aspects = null;
|
||||
public String research;
|
||||
public int width = 0;
|
||||
public int height = 0;
|
||||
private boolean mirrored = true;
|
||||
|
||||
public ShapedArcaneRecipe(String research, Block result, AspectList aspects, Object... recipe)
|
||||
public ShapedArcaneRecipe(String research, Block result, AspectList aspects, Object... recipe)
|
||||
{
|
||||
this(research, new ItemStack(result), aspects, recipe);
|
||||
}
|
||||
public ShapedArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe)
|
||||
|
||||
public ShapedArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe)
|
||||
{
|
||||
this(research, new ItemStack(result), aspects, recipe);
|
||||
}
|
||||
|
||||
public ShapedArcaneRecipe(String research, ItemStack result, AspectList aspects, Object... recipe)
|
||||
{
|
||||
output = result.copy();
|
||||
|
@ -46,13 +46,12 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
|
|||
|
||||
if (recipe[idx] instanceof Boolean)
|
||||
{
|
||||
mirrored = (Boolean)recipe[idx];
|
||||
mirrored = (Boolean) recipe[idx];
|
||||
|
||||
if (recipe[idx + 1] instanceof Object[])
|
||||
{
|
||||
recipe = (Object[])recipe[idx + 1];
|
||||
}
|
||||
else
|
||||
recipe = (Object[]) recipe[idx + 1];
|
||||
} else
|
||||
{
|
||||
idx = 1;
|
||||
}
|
||||
|
@ -60,7 +59,7 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
|
|||
|
||||
if (recipe[idx] instanceof String[])
|
||||
{
|
||||
String[] parts = ((String[])recipe[idx++]);
|
||||
String[] parts = ((String[]) recipe[idx++]);
|
||||
|
||||
for (String s : parts)
|
||||
{
|
||||
|
@ -69,12 +68,11 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
|
|||
}
|
||||
|
||||
height = parts.length;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
while (recipe[idx] instanceof String)
|
||||
{
|
||||
String s = (String)recipe[idx++];
|
||||
String s = (String) recipe[idx++];
|
||||
shape += s;
|
||||
width = s.length();
|
||||
height++;
|
||||
|
@ -85,7 +83,7 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
|
|||
{
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
|
||||
for (Object tmp : recipe)
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
|
@ -94,34 +92,30 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
|
|||
throw new RuntimeException(ret);
|
||||
}
|
||||
|
||||
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
|
||||
HashMap<Character,Object> itemMap = new HashMap<Character,Object>();
|
||||
|
||||
for (; idx < recipe.length; idx += 2)
|
||||
{
|
||||
Character chr = (Character)recipe[idx];
|
||||
Character chr = (Character) recipe[idx];
|
||||
Object in = recipe[idx + 1];
|
||||
|
||||
if (in instanceof ItemStack)
|
||||
{
|
||||
itemMap.put(chr, ((ItemStack)in).copy());
|
||||
}
|
||||
else if (in instanceof Item)
|
||||
itemMap.put(chr, ((ItemStack) in).copy());
|
||||
} else if (in instanceof Item)
|
||||
{
|
||||
itemMap.put(chr, new ItemStack((Item)in));
|
||||
}
|
||||
else if (in instanceof Block)
|
||||
itemMap.put(chr, new ItemStack((Item) in));
|
||||
} else if (in instanceof Block)
|
||||
{
|
||||
itemMap.put(chr, new ItemStack((Block)in, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
else if (in instanceof String)
|
||||
itemMap.put(chr, new ItemStack((Block) in, 1, OreDictionary.WILDCARD_VALUE));
|
||||
} else if (in instanceof String)
|
||||
{
|
||||
itemMap.put(chr, OreDictionary.getOres((String)in));
|
||||
}
|
||||
else
|
||||
itemMap.put(chr, OreDictionary.getOres((String) in));
|
||||
} else
|
||||
{
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
|
||||
for (Object tmp : recipe)
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
|
@ -200,8 +194,7 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
|
|||
if (mirror)
|
||||
{
|
||||
target = input[width - subX - 1 + subY * width];
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
target = input[subX + subY * width];
|
||||
}
|
||||
|
@ -211,16 +204,15 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
|
|||
|
||||
if (target instanceof ItemStack)
|
||||
{
|
||||
if (!checkItemEquals((ItemStack)target, slot))
|
||||
if (!checkItemEquals((ItemStack) target, slot))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (target instanceof ArrayList)
|
||||
} else if (target instanceof ArrayList)
|
||||
{
|
||||
boolean matched = false;
|
||||
|
||||
for (ItemStack item : (ArrayList<ItemStack>)target)
|
||||
for (ItemStack item : (ArrayList<ItemStack>) target)
|
||||
{
|
||||
matched = matched || checkItemEquals(item, slot);
|
||||
}
|
||||
|
@ -229,8 +221,7 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
|
|||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (target == null && slot != null)
|
||||
} else if (target == null && slot != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -261,6 +252,7 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
|
|||
/**
|
||||
* Returns the input for this recipe, any mod accessing this value should never
|
||||
* manipulate the values in this array as it will effect the recipe itself.
|
||||
*
|
||||
* @return The recipes input vales.
|
||||
*/
|
||||
public Object[] getInput()
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
@ -13,8 +10,10 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class ShapelessArcaneRecipe implements IArcaneRecipe
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class ShapelessArcaneRecipe implements IArcaneRecipe {
|
||||
private ItemStack output = null;
|
||||
private ArrayList input = new ArrayList();
|
||||
|
||||
|
@ -25,7 +24,8 @@ public class ShapelessArcaneRecipe implements IArcaneRecipe
|
|||
{
|
||||
this(research, new ItemStack(result), aspects, recipe);
|
||||
}
|
||||
public ShapelessArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe)
|
||||
|
||||
public ShapelessArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe)
|
||||
{
|
||||
this(research, new ItemStack(result), aspects, recipe);
|
||||
}
|
||||
|
@ -40,25 +40,21 @@ public class ShapelessArcaneRecipe implements IArcaneRecipe
|
|||
{
|
||||
if (in instanceof ItemStack)
|
||||
{
|
||||
input.add(((ItemStack)in).copy());
|
||||
}
|
||||
else if (in instanceof Item)
|
||||
input.add(((ItemStack) in).copy());
|
||||
} else if (in instanceof Item)
|
||||
{
|
||||
input.add(new ItemStack((Item)in));
|
||||
}
|
||||
else if (in instanceof Block)
|
||||
input.add(new ItemStack((Item) in));
|
||||
} else if (in instanceof Block)
|
||||
{
|
||||
input.add(new ItemStack((Block)in));
|
||||
}
|
||||
else if (in instanceof String)
|
||||
input.add(new ItemStack((Block) in));
|
||||
} else if (in instanceof String)
|
||||
{
|
||||
input.add(OreDictionary.getOres((String)in));
|
||||
}
|
||||
else
|
||||
input.add(OreDictionary.getOres((String) in));
|
||||
} else
|
||||
{
|
||||
String ret = "Invalid shapeless ore recipe: ";
|
||||
|
||||
for (Object tmp : recipe)
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
|
@ -113,11 +109,10 @@ public class ShapelessArcaneRecipe implements IArcaneRecipe
|
|||
|
||||
if (next instanceof ItemStack)
|
||||
{
|
||||
match = checkItemEquals((ItemStack)next, slot);
|
||||
}
|
||||
else if (next instanceof ArrayList)
|
||||
match = checkItemEquals((ItemStack) next, slot);
|
||||
} else if (next instanceof ArrayList)
|
||||
{
|
||||
for (ItemStack item : (ArrayList<ItemStack>)next)
|
||||
for (ItemStack item : (ArrayList<ItemStack>) next)
|
||||
{
|
||||
match = match || checkItemEquals(item, slot);
|
||||
}
|
||||
|
@ -151,6 +146,7 @@ public class ShapelessArcaneRecipe implements IArcaneRecipe
|
|||
/**
|
||||
* Returns the input for this recipe, any mod accessing this value should never
|
||||
* manipulate the values in this array as it will effect the recipe itself.
|
||||
*
|
||||
* @return The recipes input vales.
|
||||
*/
|
||||
public ArrayList getInput()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue