Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 04:50:05 +01:00
93 Zeilen
2.9 KiB
Diff
93 Zeilen
2.9 KiB
Diff
--- a/net/minecraft/server/ShapedRecipes.java
|
|
+++ b/net/minecraft/server/ShapedRecipes.java
|
|
@@ -13,6 +13,10 @@
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
+import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
|
|
+// CraftBukkit end
|
|
|
|
public class ShapedRecipes implements IRecipe {
|
|
|
|
@@ -32,6 +36,64 @@
|
|
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 (RecipeItemStack list : this.items) {
|
|
+ list.buildChoices();
|
|
+ if (list.choices.length > 0) {
|
|
+ net.minecraft.server.ItemStack stack = list.choices[0];
|
|
+ recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), (list.choices.length) > 1 ? 32767 : 0);
|
|
+ }
|
|
+ c++;
|
|
+ }
|
|
+ return recipe;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public MinecraftKey getKey() {
|
|
return this.e;
|
|
}
|
|
@@ -302,11 +364,11 @@
|
|
packetdataserializer.a(shapedrecipes.result);
|
|
}
|
|
|
|
- public IRecipe a(MinecraftKey minecraftkey, PacketDataSerializer packetdataserializer) {
|
|
+ public ShapedRecipes a(MinecraftKey minecraftkey, PacketDataSerializer packetdataserializer) { // CraftBukkit - decompile error
|
|
return this.b(minecraftkey, packetdataserializer);
|
|
}
|
|
|
|
- public IRecipe a(MinecraftKey minecraftkey, JsonObject jsonobject) {
|
|
+ public ShapedRecipes a(MinecraftKey minecraftkey, JsonObject jsonobject) { // CraftBukkit - decompile error
|
|
return this.b(minecraftkey, jsonobject);
|
|
}
|
|
}
|