From 1d19dab71d5f5d16524403e3b26045b4e4652624 Mon Sep 17 00:00:00 2001 From: GJ Date: Fri, 15 Feb 2013 12:16:31 -0500 Subject: [PATCH] Full change to DyeColor.COLOR.getDyeData() - *REQUIRES* CB 1.4.7 --- .../nossr50/skills/fishing/ShakeMob.java | 3 ++- .../nossr50/skills/herbalism/Herbalism.java | 24 +++---------------- .../skills/herbalism/HerbalismBlock.java | 3 ++- .../gmail/nossr50/skills/mining/Mining.java | 11 +-------- 4 files changed, 8 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/ShakeMob.java b/src/main/java/com/gmail/nossr50/skills/fishing/ShakeMob.java index e1da3a822..b7baef075 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/ShakeMob.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/ShakeMob.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; +import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -172,7 +173,7 @@ public final class ShakeMob { possibleDrops.put(new ItemStack(Material.SNOW_BALL, Misc.getRandom().nextInt(4) + 1), 97); break; case SQUID: - possibleDrops.put(new ItemStack(Material.INK_SACK), 100); // TODO: Add DyeColor.BLACK.getDyeData() to make it more explicit (available since 1.4.7-R0.1) + possibleDrops.put(new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()), 100); break; case WITCH: possibleDrops.put(new Potion(PotionType.INSTANT_HEAL).toItemStack(1), 1); diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java index a0a251081..032172e0e 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java @@ -236,15 +236,7 @@ public class Herbalism { hasSeeds = inventory.contains(Material.SEEDS); break; case COCOA: - try { - hasSeeds = inventory.containsAtLeast(new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()), 1); - } - catch(Exception e) { - hasSeeds = inventory.containsAtLeast(new ItemStack(Material.INK_SACK, 1, (short) 3), 1); - } - catch(NoSuchMethodError e) { - hasSeeds = inventory.containsAtLeast(new ItemStack(Material.INK_SACK, 1, (short) 3), 1); - } + hasSeeds = inventory.containsAtLeast(new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()), 1); break; case CARROT: hasSeeds = inventory.contains(Material.CARROT_ITEM); @@ -274,18 +266,8 @@ public class Herbalism { inventory.removeItem(new ItemStack(Material.SEEDS)); break; case COCOA: - try { - Misc.dropItems(location, new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()), 3); - inventory.removeItem(new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData())); - } - catch(Exception e) { - Misc.dropItems(location, new ItemStack(Material.INK_SACK, 1, (short) 3), 3); - inventory.removeItem(new ItemStack(Material.INK_SACK, 1, (short) 3)); - } - catch(NoSuchMethodError e) { - Misc.dropItems(location, new ItemStack(Material.INK_SACK, 1, (short) 3), 3); - inventory.removeItem(new ItemStack(Material.INK_SACK, 1, (short) 3)); - } + Misc.dropItems(location, new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()), 3); + inventory.removeItem(new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData())); break; case CARROT: Misc.dropItem(location, new ItemStack(Material.CARROT_ITEM)); diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismBlock.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismBlock.java index cd8ce8818..1836f7bea 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismBlock.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismBlock.java @@ -2,6 +2,7 @@ package com.gmail.nossr50.skills.herbalism; import java.util.Map; +import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -15,7 +16,7 @@ public enum HerbalismBlock { BROWN_MUSHROOM(Material.BROWN_MUSHROOM, Config.getInstance().getHerbalismXPMushrooms(), Config.getInstance().getBrownMushroomsDoubleDropsEnabled()), CACTUS(Material.CACTUS, Config.getInstance().getHerbalismXPCactus(), Config.getInstance().getCactiDoubleDropsEnabled()), CARROT(Material.CARROT, Material.CARROT_ITEM, Config.getInstance().getHerbalismXPCarrot(), Config.getInstance().getCarrotDoubleDropsEnabled()), - COCOA(Material.COCOA, new ItemStack(Material.INK_SACK, 1, (short) 3), Config.getInstance().getHerbalismXPCocoa(), Config.getInstance().getCocoaDoubleDropsEnabled()), //Change to DyeColor.BROWN once we remove backwards compatibility + COCOA(Material.COCOA, new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()), Config.getInstance().getHerbalismXPCocoa(), Config.getInstance().getCocoaDoubleDropsEnabled()), CROPS(Material.CROPS, Material.WHEAT, Config.getInstance().getHerbalismXPWheat(), Config.getInstance().getWheatDoubleDropsEnabled()), MELON_BLOCK(Material.MELON_BLOCK, Material.MELON, Config.getInstance().getHerbalismXPMelon(), Config.getInstance().getMelonsDoubleDropsEnabled()), NETHER_WARTS(Material.NETHER_WARTS, Material.NETHER_STALK, Config.getInstance().getHerbalismXPNetherWart(), Config.getInstance().getNetherWartsDoubleDropsEnabled()), diff --git a/src/main/java/com/gmail/nossr50/skills/mining/Mining.java b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java index 47991c0a8..f16679b11 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java @@ -244,16 +244,7 @@ public class Mining { case LAPIS_ORE: if (config.getLapisDoubleDropsEnabled()) { - try { - item = (new MaterialData(Material.INK_SACK, DyeColor.BLUE.getDyeData())).toItemStack(1); - } - catch(Exception e) { - item = (new MaterialData(Material.INK_SACK, (byte) 4)).toItemStack(1); - } - catch(NoSuchMethodError e) { - item = (new MaterialData(Material.INK_SACK, (byte) 4)).toItemStack(1); - } - + item = new ItemStack(Material.INK_SACK, 1, DyeColor.BLUE.getDyeData()); Misc.dropItems(location, item, 4); Misc.randomDropItems(location, item, 50, 4); }