Created
December 22, 2011 22:12
-
-
Save macalinao/1512078 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Stores the ItemStack at the given index. Notifies all attached | |
* InventoryViewers of the change. | |
* | |
* @param index The index where to put the ItemStack | |
* @param item The ItemStack to set | |
*/ | |
@Override | |
public void setItem(int index, SpoutItemStack item) { | |
super.setItem(index, item); | |
if (index != RESULT_SLOT) { | |
ItemStack[] items = new ItemStack[4]; | |
for (int i = 0; i < 4; ++i) { | |
items[i] = getItem(i); | |
} | |
Recipe recipe = ((SpoutServer) Bukkit.getServer()).getCraftingManager().getCraftingRecipe(items); | |
if (recipe == null) { | |
setItem(RESULT_SLOT, null); | |
} else { | |
setItem(RESULT_SLOT, recipe.getResult()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment