Updated to rename revision 02
This commit is contained in:
@@ -8,27 +8,27 @@ import org.bukkit.inventory.ShapedRecipe;
|
||||
|
||||
public class ShapedRecipes implements CraftingRecipe {
|
||||
|
||||
private int b;
|
||||
private int c;
|
||||
private ItemStack[] d;
|
||||
private ItemStack e;
|
||||
private int width;
|
||||
private int height;
|
||||
private ItemStack[] items;
|
||||
private ItemStack result;
|
||||
public final int a;
|
||||
|
||||
public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) {
|
||||
this.a = itemstack.id;
|
||||
this.b = i;
|
||||
this.c = j;
|
||||
this.d = aitemstack;
|
||||
this.e = itemstack;
|
||||
this.width = i;
|
||||
this.height = j;
|
||||
this.items = aitemstack;
|
||||
this.result = itemstack;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public ShapedRecipe toBukkitRecipe() {
|
||||
CraftItemStack result = new CraftItemStack(this.e);
|
||||
CraftItemStack result = new CraftItemStack(this.result);
|
||||
CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
|
||||
switch (this.b) {
|
||||
switch (this.width) {
|
||||
case 1:
|
||||
switch (this.c) {
|
||||
switch (this.height) {
|
||||
case 1:
|
||||
recipe.shape("a");
|
||||
break;
|
||||
@@ -41,7 +41,7 @@ public class ShapedRecipes implements CraftingRecipe {
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (this.c) {
|
||||
switch (this.height) {
|
||||
case 1:
|
||||
recipe.shape("a","b");
|
||||
break;
|
||||
@@ -54,7 +54,7 @@ public class ShapedRecipes implements CraftingRecipe {
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (this.c) {
|
||||
switch (this.height) {
|
||||
case 1:
|
||||
recipe.shape("a","b","c");
|
||||
break;
|
||||
@@ -68,7 +68,7 @@ public class ShapedRecipes implements CraftingRecipe {
|
||||
break;
|
||||
}
|
||||
char c = 'a';
|
||||
for (ItemStack stack : this.d) {
|
||||
for (ItemStack stack : this.items) {
|
||||
if (stack != null) {
|
||||
recipe.setIngredient(c, org.bukkit.Material.getMaterial(stack.id), stack.getData());
|
||||
}
|
||||
@@ -79,12 +79,12 @@ public class ShapedRecipes implements CraftingRecipe {
|
||||
// CraftBukkit end
|
||||
|
||||
public ItemStack b() {
|
||||
return this.e;
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public boolean a(InventoryCrafting inventorycrafting) {
|
||||
for (int i = 0; i <= 3 - this.b; ++i) {
|
||||
for (int j = 0; j <= 3 - this.c; ++j) {
|
||||
for (int i = 0; i <= 3 - this.width; ++i) {
|
||||
for (int j = 0; j <= 3 - this.height; ++j) {
|
||||
if (this.a(inventorycrafting, i, j, true)) {
|
||||
return true;
|
||||
}
|
||||
@@ -105,11 +105,11 @@ public class ShapedRecipes implements CraftingRecipe {
|
||||
int j1 = l - j;
|
||||
ItemStack itemstack = null;
|
||||
|
||||
if (i1 >= 0 && j1 >= 0 && i1 < this.b && j1 < this.c) {
|
||||
if (i1 >= 0 && j1 >= 0 && i1 < this.width && j1 < this.height) {
|
||||
if (flag) {
|
||||
itemstack = this.d[this.b - i1 - 1 + j1 * this.b];
|
||||
itemstack = this.items[this.width - i1 - 1 + j1 * this.width];
|
||||
} else {
|
||||
itemstack = this.d[i1 + j1 * this.b];
|
||||
itemstack = this.items[i1 + j1 * this.width];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,10 +135,10 @@ public class ShapedRecipes implements CraftingRecipe {
|
||||
}
|
||||
|
||||
public ItemStack b(InventoryCrafting inventorycrafting) {
|
||||
return new ItemStack(this.e.id, this.e.count, this.e.getData(), this.e.getEnchantments()); // CraftBukkit - copy enchantments
|
||||
return new ItemStack(this.result.id, this.result.count, this.result.getData(), this.result.getEnchantments()); // CraftBukkit - copy enchantments
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.b * this.c;
|
||||
return this.width * this.height;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user