3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 07:10:10 +01:00
Paper/nms-patches/ShapelessRecipes.patch

58 Zeilen
2.1 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ShapelessRecipes.java
+++ b/net/minecraft/server/ShapelessRecipes.java
@@ -5,6 +5,13 @@
2017-05-19 13:00:13 +02:00
import com.google.gson.JsonParseException;
2018-07-15 02:00:00 +02:00
import it.unimi.dsi.fastutil.ints.IntList;
2016-11-17 02:41:03 +01:00
import java.util.Iterator;
+// CraftBukkit start
+import java.util.ArrayList;
+import java.util.List;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+// CraftBukkit end
2017-05-14 04:00:00 +02:00
2017-05-30 13:25:59 +02:00
public class ShapelessRecipes implements IRecipe {
@@ -20,6 +27,26 @@
2017-05-14 04:00:00 +02:00
this.ingredients = nonnulllist;
}
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start
+ @SuppressWarnings("unchecked")
+ public org.bukkit.inventory.ShapelessRecipe toBukkitRecipe() {
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
+ CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
2018-08-26 04:00:00 +02:00
+ recipe.setGroup(this.group);
+
2017-05-14 04:00:00 +02:00
+ for (RecipeItemStack list : this.ingredients) {
2018-07-15 02:00:00 +02:00
+ list.buildChoices();
+
+ List<org.bukkit.Material> choices = new ArrayList<>(list.choices.length);
+ for (ItemStack i : list.choices) {
+ choices.add(CraftMagicNumbers.getMaterial(i.getItem()));
+ }
+ recipe.addIngredient(new org.bukkit.inventory.RecipeChoice.MaterialChoice(choices));
+ }
+ return recipe;
+ }
+ // CraftBukkit end
2015-02-26 23:41:06 +01:00
+
2018-07-15 02:00:00 +02:00
public MinecraftKey getKey() {
2018-08-26 04:00:00 +02:00
return this.key;
2018-07-15 02:00:00 +02:00
}
@@ -127,11 +154,11 @@
2018-07-15 02:00:00 +02:00
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);
}
2016-11-17 02:41:03 +01:00
}