3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00
Paper/nms-patches/ShapelessRecipes.patch
2018-08-26 12:00:00 +10:00

51 Zeilen
1.9 KiB
Diff

--- a/net/minecraft/server/ShapelessRecipes.java
+++ b/net/minecraft/server/ShapelessRecipes.java
@@ -5,6 +5,10 @@
import com.google.gson.JsonParseException;
import it.unimi.dsi.fastutil.ints.IntList;
import java.util.Iterator;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
+// CraftBukkit end
public class ShapelessRecipes implements IRecipe {
@@ -20,6 +24,22 @@
this.ingredients = nonnulllist;
}
+ // CraftBukkit start
+ @SuppressWarnings("unchecked")
+ public org.bukkit.inventory.ShapelessRecipe toBukkitRecipe() {
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
+ CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
+ recipe.setGroup(this.group);
+
+ for (RecipeItemStack list : this.ingredients) {
+ list.buildChoices();
+ net.minecraft.server.ItemStack stack = list.choices[0];
+ recipe.addIngredient(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), (list.choices.length) > 1 ? 32767 : 0);
+ }
+ return recipe;
+ }
+ // CraftBukkit end
+
public MinecraftKey getKey() {
return this.key;
}
@@ -127,11 +147,11 @@
packetdataserializer.a(shapelessrecipes.result);
}
- public IRecipe a(MinecraftKey minecraftkey, PacketDataSerializer packetdataserializer) {
+ public ShapelessRecipes a(MinecraftKey minecraftkey, PacketDataSerializer packetdataserializer) { // CraftBukkit - decompile error
return this.b(minecraftkey, packetdataserializer);
}
- public IRecipe a(MinecraftKey minecraftkey, JsonObject jsonobject) {
+ public ShapelessRecipes a(MinecraftKey minecraftkey, JsonObject jsonobject) { // CraftBukkit - decompile error
return this.b(minecraftkey, jsonobject);
}
}