Use new Bukkit DyeColor data.

This commit is contained in:
gmcferrin 2013-01-08 11:31:07 -05:00
parent 84994c2b2f
commit 85fb12a4ec
3 changed files with 9 additions and 6 deletions

View File

@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -404,7 +405,7 @@ public class Fishing {
case SQUID: case SQUID:
ItemStack item = new ItemStack(Material.INK_SACK, 1, (short) 0); ItemStack item = new ItemStack(Material.INK_SACK, 1, (short) 0);
item.setData(new MaterialData(Material.INK_SACK, (byte) 0x0)); item.setData(new MaterialData(Material.INK_SACK, DyeColor.BLACK.getDyeData()));
Misc.dropItem(location, item); Misc.dropItem(location, item);
break; break;

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.gathering;
import java.util.Random; import java.util.Random;
import org.bukkit.CropState; import org.bukkit.CropState;
import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -268,7 +269,7 @@ public class Herbalism {
} }
else { else {
if (mat == Material.COCOA) { if (mat == Material.COCOA) {
is = new ItemStack(Material.INK_SACK, 1, (short) 3); is = new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData());
} }
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);
@ -421,7 +422,7 @@ 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.
hasSeeds = inventory.contains(new ItemStack(Material.INK_SACK, 1, (short) 3), 1); hasSeeds = inventory.contains(new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()), 1);
break; break;
case CARROT: case CARROT:
hasSeeds = inventory.contains(Material.CARROT_ITEM); hasSeeds = inventory.contains(Material.CARROT_ITEM);
@ -455,8 +456,8 @@ public class Herbalism {
inventory.removeItem(new ItemStack(Material.SEEDS)); inventory.removeItem(new ItemStack(Material.SEEDS));
break; break;
case COCOA: case COCOA:
Misc.dropItem(location, new ItemStack(Material.INK_SACK, 3, (short) 3)); Misc.dropItem(location, new ItemStack(Material.INK_SACK, 3, DyeColor.BROWN.getDyeData()));
inventory.removeItem(new ItemStack(Material.INK_SACK, 1, (short) 3)); inventory.removeItem(new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()));
break; break;
case CARROT: case CARROT:
Misc.dropItem(location, new ItemStack(Material.CARROT_ITEM)); Misc.dropItem(location, new ItemStack(Material.CARROT_ITEM));

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.mining;
import java.util.Random; import java.util.Random;
import org.bukkit.CoalType; import org.bukkit.CoalType;
import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -331,7 +332,7 @@ public class Mining {
case LAPIS_ORE: case LAPIS_ORE:
if (config.getLapisDoubleDropsEnabled()) { if (config.getLapisDoubleDropsEnabled()) {
item = (new MaterialData(Material.INK_SACK, (byte) 0x4)).toItemStack(1); item = (new MaterialData(Material.INK_SACK, DyeColor.BLUE.getDyeData())).toItemStack(1);
Misc.dropItems(location, item, 4); Misc.dropItems(location, item, 4);
Misc.randomDropItems(location, item, 50, 4); Misc.randomDropItems(location, item, 50, 4);