diff options
author | toastedtruth <brammero@gmail.com> | 2013-12-01 23:18:16 +0000 |
---|---|---|
committer | Nate Mortensen <nate.richard.mortensen@gmail.com> | 2013-12-02 21:03:56 -0700 |
commit | 579b203347caee0cfc981ec885bc5a07d6188efc (patch) | |
tree | 313f8d08e7e18534fb08788afe90785036472109 /src | |
parent | 9969a86e839560f6fe4cfbfefa1c5d4f47df0a54 (diff) | |
download | craftbukkit-579b203347caee0cfc981ec885bc5a07d6188efc.tar craftbukkit-579b203347caee0cfc981ec885bc5a07d6188efc.tar.gz craftbukkit-579b203347caee0cfc981ec885bc5a07d6188efc.tar.lz craftbukkit-579b203347caee0cfc981ec885bc5a07d6188efc.tar.xz craftbukkit-579b203347caee0cfc981ec885bc5a07d6188efc.zip |
Added RecipeBookClone from nms for diff visibility
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/net/minecraft/server/RecipeBookClone.java | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/RecipeBookClone.java b/src/main/java/net/minecraft/server/RecipeBookClone.java new file mode 100644 index 00000000..473ed4e6 --- /dev/null +++ b/src/main/java/net/minecraft/server/RecipeBookClone.java @@ -0,0 +1,62 @@ +package net.minecraft.server; + +public class RecipeBookClone implements IRecipe { + + public boolean a(InventoryCrafting inventoryCrafting, World paramWorld) { + int i = 0; + ItemStack itemStack = null; + for (int j = 0; j < inventoryCrafting.getSize(); j++) { + ItemStack itemStack1 = inventoryCrafting.getItem(j); + if (itemStack1 != null) { + if (itemStack1.getItem() == Items.WRITTEN_BOOK) { + if (itemStack != null) { + return false; + } + itemStack = itemStack1; + } else if (itemStack1.getItem() == Items.BOOK_AND_QUILL) { + i++; + } else { + return false; + } + } + } + return (itemStack != null) && (i > 0); + } + + public ItemStack a(InventoryCrafting inventoryCrafting) { + int i = 0; + ItemStack itemStack = null; + for (int j = 0; j < inventoryCrafting.getSize(); j++) { + ItemStack itemStack2 = inventoryCrafting.getItem(j); + if (itemStack2 != null) { + if (itemStack2.getItem() == Items.WRITTEN_BOOK) { + if (itemStack != null) { + return null; + } + itemStack = itemStack2; + } else if (itemStack2.getItem() == Items.BOOK_AND_QUILL) { + i++; + } else { + return null; + } + } + } + if ((itemStack == null) || (i < 1)) { + return null; + } + ItemStack itemStack1 = new ItemStack(Items.WRITTEN_BOOK, i + 1); + itemStack1.setTag((NBTTagCompound) itemStack.getTag().clone()); + if (itemStack.hasName()) { + itemStack1.c(itemStack.getName()); + } + return itemStack1; + } + + public int a() { + return 9; + } + + public ItemStack b() { + return null; + } +} |