Full change to DyeColor.COLOR.getDyeData() - *REQUIRES* CB 1.4.7

This commit is contained in:
GJ 2013-02-15 12:16:31 -05:00
parent 49fe98ac57
commit 1d19dab71d
4 changed files with 8 additions and 33 deletions

View File

@ -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);

View File

@ -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));

View File

@ -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()),

View File

@ -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);
}