mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 21:07:36 +01:00
77 lines
2.2 KiB
Diff
77 lines
2.2 KiB
Diff
--- /home/matt/mc-dev-private//net/minecraft/server/ShapedRecipes.java 2015-02-26 22:40:23.079608134 +0000
|
|
+++ src/main/java/net/minecraft/server/ShapedRecipes.java 2015-02-26 22:40:23.079608134 +0000
|
|
@@ -1,5 +1,10 @@
|
|
package net.minecraft.server;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
+import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
|
|
+// CraftBukkit end
|
|
+
|
|
public class ShapedRecipes implements IRecipe {
|
|
|
|
private final int width;
|
|
@@ -15,6 +20,62 @@
|
|
this.result = itemstack;
|
|
}
|
|
|
|
+ // CraftBukkit start
|
|
+ public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
|
|
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
|
+ CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
|
|
+ switch (this.height) {
|
|
+ case 1:
|
|
+ switch (this.width) {
|
|
+ case 1:
|
|
+ recipe.shape("a");
|
|
+ break;
|
|
+ case 2:
|
|
+ recipe.shape("ab");
|
|
+ break;
|
|
+ case 3:
|
|
+ recipe.shape("abc");
|
|
+ break;
|
|
+ }
|
|
+ break;
|
|
+ case 2:
|
|
+ switch (this.width) {
|
|
+ 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.width) {
|
|
+ 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.items) {
|
|
+ if (stack != null) {
|
|
+ recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getData());
|
|
+ }
|
|
+ c++;
|
|
+ }
|
|
+ return recipe;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public ItemStack b() {
|
|
return this.result;
|
|
}
|