SPIGOT-4283: Allow setting recipe groups

This commit is contained in:
md_5
2018-08-17 20:40:54 +10:00
parent 06112946da
commit bfb9131494
6 changed files with 17 additions and 10 deletions

View File

@@ -11,7 +11,7 @@
public class FurnaceRecipe implements IRecipe {
@@ -56,6 +60,16 @@
@@ -56,6 +60,19 @@
return this.key;
}
@@ -22,13 +22,16 @@
+ list.buildChoices();
+ net.minecraft.server.ItemStack stack = list.choices[0];
+
+ return new CraftFurnaceRecipe(CraftNamespacedKey.fromMinecraft(this.key), result, CraftItemStack.asCraftMirror(stack), this.experience, this.cookingTime);
+ CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(CraftNamespacedKey.fromMinecraft(this.key), result, CraftItemStack.asCraftMirror(stack), this.experience, this.cookingTime);
+ recipe.setGroup(this.group);
+
+ return recipe;
+ }
+
public static class a implements RecipeSerializer<FurnaceRecipe> {
public a() {}
@@ -106,11 +120,11 @@
@@ -106,11 +123,11 @@
return "smelting";
}

View File

@@ -11,7 +11,7 @@
public class ShapedRecipes implements IRecipe {
@@ -32,6 +36,64 @@
@@ -32,6 +36,66 @@
this.result = itemstack;
}
@@ -19,6 +19,8 @@
+ public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
+ CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
+ recipe.setGroup(this.f);
+
+ switch (this.height) {
+ case 1:
+ switch (this.width) {
@@ -76,7 +78,7 @@
public MinecraftKey getKey() {
return this.e;
}
@@ -302,11 +364,11 @@
@@ -302,11 +366,11 @@
packetdataserializer.a(shapedrecipes.result);
}

View File

@@ -11,7 +11,7 @@
public class ShapelessRecipes implements IRecipe {
@@ -20,6 +24,20 @@
@@ -20,6 +24,22 @@
this.ingredients = nonnulllist;
}
@@ -20,6 +20,8 @@
+ public org.bukkit.inventory.ShapelessRecipe toBukkitRecipe() {
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
+ CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
+ recipe.setGroup(this.b);
+
+ for (RecipeItemStack list : this.ingredients) {
+ list.buildChoices();
+ net.minecraft.server.ItemStack stack = list.choices[0];
@@ -32,7 +34,7 @@
public MinecraftKey getKey() {
return this.a;
}
@@ -127,11 +145,11 @@
@@ -127,11 +147,11 @@
packetdataserializer.a(shapelessrecipes.result);
}