Merge pull request #458 from Glitchfinder/master

Adding a bit more in the way of Dye-related backwards compatibility.
This commit is contained in:
Glitchfinder 2013-01-08 15:29:57 -08:00
commit 32e0be481a
2 changed files with 28 additions and 7 deletions

View File

@ -404,8 +404,13 @@ public class Fishing {
break;
case SQUID:
ItemStack item = new ItemStack(Material.INK_SACK, 1);
item.setData(new MaterialData(Material.INK_SACK, DyeColor.BLACK.getDyeData()));
ItemStack item;
try {
item = (new MaterialData(Material.INK_SACK, DyeColor.BLACK.getDyeData())).toItemStack(1);
}
catch(Exception e) {
item = (new MaterialData(Material.INK_SACK, (byte) 0)).toItemStack(1);
}
Misc.dropItem(location, item);
break;

View File

@ -269,8 +269,13 @@ public class Herbalism {
}
else {
if (mat == Material.COCOA) {
try {
is = new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData());
}
catch (Exception e) {
is = new ItemStack(Material.INK_SACK, 1, (short) 3);
}
}
else if (mat == Material.CARROT) {
is = new ItemStack(Material.CARROT_ITEM, 1, (short) 0);
}
@ -422,7 +427,12 @@ public class Herbalism {
break;
case COCOA:
// Broken: Requires an update to bukkit to enable seaching for variable-sized ItemStacks.
try {
hasSeeds = inventory.contains(new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()), 1);
}
catch(Exception e) {
hasSeeds = inventory.contains(new ItemStack(Material.INK_SACK, 1, (short) 3), 1);
}
break;
case CARROT:
hasSeeds = inventory.contains(Material.CARROT_ITEM);
@ -456,8 +466,14 @@ public class Herbalism {
inventory.removeItem(new ItemStack(Material.SEEDS));
break;
case COCOA:
try {
Misc.dropItem(location, new ItemStack(Material.INK_SACK, 3, DyeColor.BROWN.getDyeData()));
inventory.removeItem(new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()));
}
catch(Exception e) {
Misc.dropItem(location, new ItemStack(Material.INK_SACK, 3, (short) 3));
inventory.removeItem(new ItemStack(Material.INK_SACK, 1, (short) 3));
}
break;
case CARROT:
Misc.dropItem(location, new ItemStack(Material.CARROT_ITEM));