summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r--src/main/java/net/minecraft/server/CraftingManager.java13
-rw-r--r--src/main/java/net/minecraft/server/CraftingRecipe.java4
-rw-r--r--src/main/java/net/minecraft/server/FurnaceRecipes.java4
-rw-r--r--src/main/java/net/minecraft/server/ShapedRecipes.java62
-rw-r--r--src/main/java/net/minecraft/server/ShapelessRecipes.java20
5 files changed, 98 insertions, 5 deletions
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
index 45923c13..c785425b 100644
--- a/src/main/java/net/minecraft/server/CraftingManager.java
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
@@ -8,13 +8,13 @@ import java.util.List;
public class CraftingManager {
private static final CraftingManager a = new CraftingManager();
- private List b = new ArrayList();
+ public List b = new ArrayList(); // CraftBukkit - private -> public
public static final CraftingManager getInstance() {
return a;
}
- private CraftingManager() {
+ public CraftingManager() { // CraftBukkit - private -> public
(new RecipesTools()).a(this);
(new RecipesWeapons()).a(this);
(new RecipeIngots()).a(this);
@@ -91,10 +91,17 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Item.BED, 1), new Object[] { "###", "XXX", Character.valueOf('#'), Block.WOOL, Character.valueOf('X'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.ENCHANTMENT_TABLE, 1), new Object[] { " B ", "D#D", "###", Character.valueOf('#'), Block.OBSIDIAN, Character.valueOf('B'), Item.BOOK, Character.valueOf('D'), Item.DIAMOND});
this.registerShapelessRecipe(new ItemStack(Item.EYE_OF_ENDER, 1), new Object[] { Item.ENDER_PEARL, Item.BLAZE_POWDER});
- Collections.sort(this.b, new RecipeSorter(this));
+ //Collections.sort(this.b, new RecipeSorter(this)); // CraftBukkit - removed; see below
+ this.sort(); // CraftBukkit - moved sort to a separate method
System.out.println(this.b.size() + " recipes");
}
+ // CraftBukkit start
+ public void sort() {
+ Collections.sort(this.b, new RecipeSorter(this));
+ }
+ // CraftBukkit end
+
public void registerShapedRecipe(ItemStack itemstack, Object... aobject) { // CraftBukkit - default -> public
String s = "";
int i = 0;
diff --git a/src/main/java/net/minecraft/server/CraftingRecipe.java b/src/main/java/net/minecraft/server/CraftingRecipe.java
index dee3749c..28c2526d 100644
--- a/src/main/java/net/minecraft/server/CraftingRecipe.java
+++ b/src/main/java/net/minecraft/server/CraftingRecipe.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import org.bukkit.inventory.Recipe; // CraftBukkit
+
public interface CraftingRecipe {
boolean a(InventoryCrafting inventorycrafting);
@@ -9,4 +11,6 @@ public interface CraftingRecipe {
int a();
ItemStack b();
+
+ Recipe toBukkitRecipe(); // CraftBukkit
}
diff --git a/src/main/java/net/minecraft/server/FurnaceRecipes.java b/src/main/java/net/minecraft/server/FurnaceRecipes.java
index 8d4bd61b..e0c4f1e3 100644
--- a/src/main/java/net/minecraft/server/FurnaceRecipes.java
+++ b/src/main/java/net/minecraft/server/FurnaceRecipes.java
@@ -6,13 +6,13 @@ import java.util.Map;
public class FurnaceRecipes {
private static final FurnaceRecipes a = new FurnaceRecipes();
- private Map b = new HashMap();
+ public Map b = new HashMap(); // CraftBukkit - private -> public
public static final FurnaceRecipes getInstance() {
return a;
}
- private FurnaceRecipes() {
+ public FurnaceRecipes() { // CraftBukkit - private -> public
this.registerRecipe(Block.IRON_ORE.id, new ItemStack(Item.IRON_INGOT));
this.registerRecipe(Block.GOLD_ORE.id, new ItemStack(Item.GOLD_INGOT));
this.registerRecipe(Block.DIAMOND_ORE.id, new ItemStack(Item.DIAMOND));
diff --git a/src/main/java/net/minecraft/server/ShapedRecipes.java b/src/main/java/net/minecraft/server/ShapedRecipes.java
index 6fde0c73..eccfd47e 100644
--- a/src/main/java/net/minecraft/server/ShapedRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapedRecipes.java
@@ -1,5 +1,11 @@
package net.minecraft.server;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
+import org.bukkit.inventory.ShapedRecipe;
+// CraftBukkit end
+
public class ShapedRecipes implements CraftingRecipe {
private int b;
@@ -16,6 +22,62 @@ public class ShapedRecipes implements CraftingRecipe {
this.e = itemstack;
}
+ // CraftBukkit start
+ public ShapedRecipe toBukkitRecipe() {
+ CraftItemStack result = new CraftItemStack(this.e);
+ CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
+ switch (this.b) {
+ case 1:
+ switch (this.c) {
+ case 1:
+ recipe.shape("a");
+ break;
+ case 2:
+ recipe.shape("ab");
+ break;
+ case 3:
+ recipe.shape("abc");
+ break;
+ }
+ break;
+ case 2:
+ switch (this.c) {
+ 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.c) {
+ 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.d) {
+ if (stack != null) {
+ recipe.setIngredient(c, org.bukkit.Material.getMaterial(stack.id), stack.getData());
+ }
+ c++;
+ }
+ return recipe;
+ }
+ // CraftBukkit end
+
public ItemStack b() {
return this.e;
}
diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java
index d38896a4..bea33ccf 100644
--- a/src/main/java/net/minecraft/server/ShapelessRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java
@@ -4,6 +4,12 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
+import org.bukkit.inventory.ShapelessRecipe;
+// CraftBukkit end
+
public class ShapelessRecipes implements CraftingRecipe {
private final ItemStack a;
@@ -14,6 +20,20 @@ public class ShapelessRecipes implements CraftingRecipe {
this.b = list;
}
+ // CraftBukkit start
+ @SuppressWarnings("unchecked")
+ public ShapelessRecipe toBukkitRecipe() {
+ CraftItemStack result = new CraftItemStack(this.a);
+ CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
+ for (ItemStack stack : (List<ItemStack>) this.b) {
+ if (stack != null) {
+ recipe.addIngredient(org.bukkit.Material.getMaterial(stack.id), stack.getData());
+ }
+ }
+ return recipe;
+ }
+ // CraftBukkit end
+
public ItemStack b() {
return this.a;
}