forked from xjboss/KCauldronX
93 lines
2.7 KiB
Diff
93 lines
2.7 KiB
Diff
|
--- ../src-base/minecraft/net/minecraft/item/crafting/ShapedRecipes.java
|
||
|
+++ ../src-work/minecraft/net/minecraft/item/crafting/ShapedRecipes.java
|
||
|
@@ -5,6 +5,11 @@
|
||
|
import net.minecraft.nbt.NBTTagCompound;
|
||
|
import net.minecraft.world.World;
|
||
|
|
||
|
+// CraftBukkit start
|
||
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||
|
+import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
|
||
|
+// CraftBukkit end
|
||
|
+
|
||
|
public class ShapedRecipes implements IRecipe
|
||
|
{
|
||
|
public final int recipeWidth;
|
||
|
@@ -22,6 +27,77 @@
|
||
|
this.recipeOutput = p_i1917_4_;
|
||
|
}
|
||
|
|
||
|
+ // CraftBukkit start
|
||
|
+ public org.bukkit.inventory.ShapedRecipe toBukkitRecipe()
|
||
|
+ {
|
||
|
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.recipeOutput);
|
||
|
+ CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
|
||
|
+
|
||
|
+ switch (this.recipeHeight)
|
||
|
+ {
|
||
|
+ case 1:
|
||
|
+ switch (this.recipeWidth)
|
||
|
+ {
|
||
|
+ case 1:
|
||
|
+ recipe.shape("a");
|
||
|
+ break;
|
||
|
+ case 2:
|
||
|
+ recipe.shape("ab");
|
||
|
+ break;
|
||
|
+ case 3:
|
||
|
+ recipe.shape("abc");
|
||
|
+ break;
|
||
|
+ }
|
||
|
+
|
||
|
+ break;
|
||
|
+ case 2:
|
||
|
+ switch (this.recipeWidth)
|
||
|
+ {
|
||
|
+ case 1:
|
||
|
+ recipe.shape("a", "b");
|
||
|
+ break;
|
||
|
+ case 2:
|
||
|
+ recipe.shape("ab", "cd");
|
||
|
+ break;
|
||
|
+ case 3:
|
||
|
+ recipe.shape("abc", "def");
|
||
|
+ break;
|
||
|
+ }
|
||
|
+
|
||
|
+ break;
|
||
|
+ case 3:
|
||
|
+ switch (this.recipeWidth)
|
||
|
+ {
|
||
|
+ case 1:
|
||
|
+ recipe.shape("a", "b", "c");
|
||
|
+ break;
|
||
|
+ case 2:
|
||
|
+ recipe.shape("ab", "cd", "ef");
|
||
|
+ break;
|
||
|
+ case 3:
|
||
|
+ recipe.shape("abc", "def", "ghi");
|
||
|
+ break;
|
||
|
+ }
|
||
|
+
|
||
|
+ break;
|
||
|
+ }
|
||
|
+
|
||
|
+ char c = 'a';
|
||
|
+
|
||
|
+ for (ItemStack stack : this.recipeItems)
|
||
|
+ {
|
||
|
+ if (stack != null)
|
||
|
+ {
|
||
|
+ recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getItemDamage());
|
||
|
+ }
|
||
|
+
|
||
|
+ c++;
|
||
|
+ }
|
||
|
+
|
||
|
+ return recipe;
|
||
|
+ }
|
||
|
+ // CraftBukkit end
|
||
|
+
|
||
|
public ItemStack getRecipeOutput()
|
||
|
{
|
||
|
return this.recipeOutput;
|