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; break;
case SQUID: case SQUID:
ItemStack item = new ItemStack(Material.INK_SACK, 1); ItemStack item;
item.setData(new MaterialData(Material.INK_SACK, DyeColor.BLACK.getDyeData())); 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); Misc.dropItem(location, item);
break; break;

View File

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