diff options
author | Celtic Minstrel <celtic.minstrel.ca@some.place> | 2011-07-14 20:54:07 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-02-20 16:39:33 -0500 |
commit | 84ecdb5439ef5633c44b1ea0581174bf581b4969 (patch) | |
tree | ff5216b243f97bea871f9875edb8973296097200 /src/main/java/net/minecraft/server/ShapelessRecipes.java | |
parent | 39048be4300b597a28ef153d705592cda638e691 (diff) | |
download | craftbukkit-84ecdb5439ef5633c44b1ea0581174bf581b4969.tar craftbukkit-84ecdb5439ef5633c44b1ea0581174bf581b4969.tar.gz craftbukkit-84ecdb5439ef5633c44b1ea0581174bf581b4969.tar.lz craftbukkit-84ecdb5439ef5633c44b1ea0581174bf581b4969.tar.xz craftbukkit-84ecdb5439ef5633c44b1ea0581174bf581b4969.zip |
Imported from mc-dev:
- ShapedRecipes
- ShapelessRecipes
- CraftingRecipe
- FurnaceRecipes
Diffstat (limited to 'src/main/java/net/minecraft/server/ShapelessRecipes.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ShapelessRecipes.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java new file mode 100644 index 00000000..d38896a4 --- /dev/null +++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java @@ -0,0 +1,59 @@ +package net.minecraft.server; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class ShapelessRecipes implements CraftingRecipe { + + private final ItemStack a; + private final List b; + + public ShapelessRecipes(ItemStack itemstack, List list) { + this.a = itemstack; + this.b = list; + } + + public ItemStack b() { + return this.a; + } + + public boolean a(InventoryCrafting inventorycrafting) { + ArrayList arraylist = new ArrayList(this.b); + + for (int i = 0; i < 3; ++i) { + for (int j = 0; j < 3; ++j) { + ItemStack itemstack = inventorycrafting.b(j, i); + + if (itemstack != null) { + boolean flag = false; + Iterator iterator = arraylist.iterator(); + + while (iterator.hasNext()) { + ItemStack itemstack1 = (ItemStack) iterator.next(); + + if (itemstack.id == itemstack1.id && (itemstack1.getData() == -1 || itemstack.getData() == itemstack1.getData())) { + flag = true; + arraylist.remove(itemstack1); + break; + } + } + + if (!flag) { + return false; + } + } + } + } + + return arraylist.isEmpty(); + } + + public ItemStack b(InventoryCrafting inventorycrafting) { + return this.a.cloneItemStack(); + } + + public int a() { + return this.b.size(); + } +} |