2012-10-25 05:53:23 +02:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2012-12-20 05:03:52 +01:00
|
|
|
public class RecipeMapClone extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
|
2012-10-25 05:53:23 +02:00
|
|
|
|
2013-03-25 05:22:32 +01:00
|
|
|
// CraftBukkit start - Delegate to new parent class
|
2012-12-20 05:03:52 +01:00
|
|
|
public RecipeMapClone() {
|
2012-10-25 05:53:23 +02:00
|
|
|
super(new ItemStack(Item.MAP, 0, -1), java.util.Arrays.asList(new ItemStack(Item.MAP_EMPTY, 0, 0)));
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
public boolean a(InventoryCrafting inventorycrafting, World world) {
|
|
|
|
int i = 0;
|
|
|
|
ItemStack itemstack = null;
|
|
|
|
|
|
|
|
for (int j = 0; j < inventorycrafting.getSize(); ++j) {
|
|
|
|
ItemStack itemstack1 = inventorycrafting.getItem(j);
|
|
|
|
|
|
|
|
if (itemstack1 != null) {
|
|
|
|
if (itemstack1.id == Item.MAP.id) {
|
|
|
|
if (itemstack != null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
itemstack = itemstack1;
|
|
|
|
} else {
|
|
|
|
if (itemstack1.id != Item.MAP_EMPTY.id) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return itemstack != null && i > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ItemStack a(InventoryCrafting inventorycrafting) {
|
|
|
|
int i = 0;
|
|
|
|
ItemStack itemstack = null;
|
|
|
|
|
|
|
|
for (int j = 0; j < inventorycrafting.getSize(); ++j) {
|
|
|
|
ItemStack itemstack1 = inventorycrafting.getItem(j);
|
|
|
|
|
|
|
|
if (itemstack1 != null) {
|
|
|
|
if (itemstack1.id == Item.MAP.id) {
|
|
|
|
if (itemstack != null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
itemstack = itemstack1;
|
|
|
|
} else {
|
|
|
|
if (itemstack1.id != Item.MAP_EMPTY.id) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (itemstack != null && i >= 1) {
|
2012-11-06 13:05:28 +01:00
|
|
|
ItemStack itemstack2 = new ItemStack(Item.MAP, i + 1, itemstack.getData());
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
if (itemstack.hasName()) {
|
|
|
|
itemstack2.c(itemstack.getName());
|
2012-11-06 13:05:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return itemstack2;
|
2012-10-25 05:53:23 +02:00
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public int a() {
|
|
|
|
return 9;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ItemStack b() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|