mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 12:46:12 +03:00
84 lines
2.5 KiB
Diff
84 lines
2.5 KiB
Diff
--- ../src-base/minecraft/net/minecraft/item/crafting/ShapedRecipes.java
|
|
+++ ../src-work/minecraft/net/minecraft/item/crafting/ShapedRecipes.java
|
|
@@ -1,10 +1,16 @@
|
|
package net.minecraft.item.crafting;
|
|
|
|
-import javax.annotation.Nullable;
|
|
import net.minecraft.inventory.InventoryCrafting;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.world.World;
|
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
+import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
|
|
|
|
+import javax.annotation.Nullable;
|
|
+
|
|
+//CraftBukkit start
|
|
+// CraftBukkit end
|
|
+
|
|
public class ShapedRecipes implements IRecipe
|
|
{
|
|
public final int recipeWidth;
|
|
@@ -20,7 +26,61 @@
|
|
this.recipeItems = p_i1917_3_;
|
|
this.recipeOutput = output;
|
|
}
|
|
-
|
|
+ // CraftBukkit start
|
|
+ public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
|
|
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.recipeOutput);
|
|
+ CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
|
|
+ switch (this.recipeHeight) {
|
|
+ case 1:
|
|
+ switch (this.recipeWidth) {
|
|
+ case 1:
|
|
+ recipe.shape("a");
|
|
+ break;
|
|
+ case 2:
|
|
+ recipe.shape("ab");
|
|
+ break;
|
|
+ case 3:
|
|
+ recipe.shape("abc");
|
|
+ break;
|
|
+ }
|
|
+ break;
|
|
+ case 2:
|
|
+ switch (this.recipeWidth) {
|
|
+ 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.recipeWidth) {
|
|
+ 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 (ItemStack stack : this.recipeItems) {
|
|
+ if (stack != null) {
|
|
+ recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getMetadata());
|
|
+ }
|
|
+ c++;
|
|
+ }
|
|
+ return recipe;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
@Nullable
|
|
public ItemStack getRecipeOutput()
|
|
{
|