2015-05-25 20:37:24 +10:00
|
|
|
--- a/net/minecraft/server/ShapedRecipes.java
|
|
|
|
+++ b/net/minecraft/server/ShapedRecipes.java
|
2019-01-02 15:56:21 +11:00
|
|
|
@@ -12,6 +12,15 @@
|
2017-05-14 12:00:00 +10:00
|
|
|
import java.util.Map;
|
2018-12-26 08:00:00 +11:00
|
|
|
import java.util.Set;
|
2017-05-14 12:00:00 +10:00
|
|
|
import java.util.Map.Entry;
|
2014-11-26 08:32:16 +11:00
|
|
|
+// CraftBukkit start
|
2018-09-01 11:04:48 +10:00
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
2014-11-26 08:32:16 +11:00
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
2019-01-02 15:56:21 +11:00
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
|
2014-11-26 08:32:16 +11:00
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
|
2018-09-01 11:04:48 +10:00
|
|
|
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
2019-01-02 15:56:21 +11:00
|
|
|
+import org.bukkit.inventory.RecipeChoice;
|
2014-11-26 08:32:16 +11:00
|
|
|
+// CraftBukkit end
|
|
|
|
|
2019-04-23 12:00:00 +10:00
|
|
|
public class ShapedRecipes implements RecipeCrafting {
|
2017-05-14 12:00:00 +10:00
|
|
|
|
2019-01-02 15:56:21 +11:00
|
|
|
@@ -31,6 +40,66 @@
|
2014-11-26 08:32:16 +11:00
|
|
|
this.result = itemstack;
|
|
|
|
}
|
2015-02-26 22:41:06 +00:00
|
|
|
|
2014-11-26 08:32:16 +11:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
|
|
|
|
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
|
|
|
+ CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
|
2018-08-26 12:00:00 +10:00
|
|
|
+ recipe.setGroup(this.group);
|
2018-08-17 20:40:54 +10:00
|
|
|
+
|
2014-11-26 08:32:16 +11:00
|
|
|
+ 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';
|
2017-05-14 12:00:00 +10:00
|
|
|
+ for (RecipeItemStack list : this.items) {
|
2019-01-02 15:56:21 +11:00
|
|
|
+ RecipeChoice choice = CraftRecipe.toBukkit(list);
|
|
|
|
+ if (choice != null) {
|
|
|
|
+ recipe.setIngredient(c, choice);
|
2014-11-26 08:32:16 +11:00
|
|
|
+ }
|
2019-01-02 15:56:21 +11:00
|
|
|
+
|
2014-11-26 08:32:16 +11:00
|
|
|
+ c++;
|
|
|
|
+ }
|
|
|
|
+ return recipe;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2015-02-26 22:41:06 +00:00
|
|
|
+
|
2019-04-23 12:00:00 +10:00
|
|
|
@Override
|
2018-07-15 10:00:00 +10:00
|
|
|
public MinecraftKey getKey() {
|
2018-08-26 12:00:00 +10:00
|
|
|
return this.key;
|