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;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; 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); possibleDrops.put(new ItemStack(Material.SNOW_BALL, Misc.getRandom().nextInt(4) + 1), 97);
break; break;
case SQUID: 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; break;
case WITCH: case WITCH:
possibleDrops.put(new Potion(PotionType.INSTANT_HEAL).toItemStack(1), 1); possibleDrops.put(new Potion(PotionType.INSTANT_HEAL).toItemStack(1), 1);

View File

@ -236,15 +236,7 @@ public class Herbalism {
hasSeeds = inventory.contains(Material.SEEDS); hasSeeds = inventory.contains(Material.SEEDS);
break; break;
case COCOA: case COCOA:
try { hasSeeds = inventory.containsAtLeast(new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()), 1);
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);
}
break; break;
case CARROT: case CARROT:
hasSeeds = inventory.contains(Material.CARROT_ITEM); hasSeeds = inventory.contains(Material.CARROT_ITEM);
@ -274,18 +266,8 @@ public class Herbalism {
inventory.removeItem(new ItemStack(Material.SEEDS)); inventory.removeItem(new ItemStack(Material.SEEDS));
break; break;
case COCOA: case COCOA:
try { Misc.dropItems(location, new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()), 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()));
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));
}
break; break;
case CARROT: case CARROT:
Misc.dropItem(location, new ItemStack(Material.CARROT_ITEM)); 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 java.util.Map;
import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -15,7 +16,7 @@ public enum HerbalismBlock {
BROWN_MUSHROOM(Material.BROWN_MUSHROOM, Config.getInstance().getHerbalismXPMushrooms(), Config.getInstance().getBrownMushroomsDoubleDropsEnabled()), BROWN_MUSHROOM(Material.BROWN_MUSHROOM, Config.getInstance().getHerbalismXPMushrooms(), Config.getInstance().getBrownMushroomsDoubleDropsEnabled()),
CACTUS(Material.CACTUS, Config.getInstance().getHerbalismXPCactus(), Config.getInstance().getCactiDoubleDropsEnabled()), CACTUS(Material.CACTUS, Config.getInstance().getHerbalismXPCactus(), Config.getInstance().getCactiDoubleDropsEnabled()),
CARROT(Material.CARROT, Material.CARROT_ITEM, Config.getInstance().getHerbalismXPCarrot(), Config.getInstance().getCarrotDoubleDropsEnabled()), 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()), CROPS(Material.CROPS, Material.WHEAT, Config.getInstance().getHerbalismXPWheat(), Config.getInstance().getWheatDoubleDropsEnabled()),
MELON_BLOCK(Material.MELON_BLOCK, Material.MELON, Config.getInstance().getHerbalismXPMelon(), Config.getInstance().getMelonsDoubleDropsEnabled()), 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()), 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: case LAPIS_ORE:
if (config.getLapisDoubleDropsEnabled()) { if (config.getLapisDoubleDropsEnabled()) {
try { item = new ItemStack(Material.INK_SACK, 1, DyeColor.BLUE.getDyeData());
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);
}
Misc.dropItems(location, item, 4); Misc.dropItems(location, item, 4);
Misc.randomDropItems(location, item, 50, 4); Misc.randomDropItems(location, item, 50, 4);
} }