From 9af66a8e6950481e6dab1a8b0503c2440d1d7091 Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Tue, 25 Dec 2012 01:01:10 -0500 Subject: [PATCH] Fixed ItemStack deprecation issues. --- Changelog.txt | 1 + .../gmail/nossr50/config/TreasuresConfig.java | 4 +- .../config/mods/CustomBlocksConfig.java | 14 ++-- .../nossr50/skills/gathering/Excavation.java | 6 +- .../nossr50/skills/gathering/Fishing.java | 64 +++++++------------ .../nossr50/skills/gathering/Herbalism.java | 6 +- .../nossr50/skills/gathering/Mining.java | 14 +++- .../nossr50/skills/gathering/WoodCutting.java | 21 ++++-- .../com/gmail/nossr50/util/BlockChecks.java | 31 +++++++-- .../com/gmail/nossr50/util/ModChecks.java | 26 ++++++-- 10 files changed, 120 insertions(+), 67 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 9f514e46f..f88d1fd9a 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -12,6 +12,7 @@ Version 1.3.13-dev = Fixed issue with missing default cases from several switch/case statements = Fixed issue with Mining using actual skill level rather than max skill level = Fixed some issues with static access + = Fixed ItemStack deprecation issues ! GJ stopped being a lazy slacker and got stuff done - Removed dead code relating to null profiles - Removed unused imports diff --git a/src/main/java/com/gmail/nossr50/config/TreasuresConfig.java b/src/main/java/com/gmail/nossr50/config/TreasuresConfig.java index f4f5adf13..a00398017 100644 --- a/src/main/java/com/gmail/nossr50/config/TreasuresConfig.java +++ b/src/main/java/com/gmail/nossr50/config/TreasuresConfig.java @@ -11,6 +11,7 @@ import java.util.Set; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.inventory.ItemStack; +import org.bukkit.material.MaterialData; import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; import com.gmail.nossr50.datatypes.treasure.FishingTreasure; @@ -125,7 +126,8 @@ public class TreasuresConfig extends ConfigLoader{ * Drops From & Max Level */ - ItemStack item = new ItemStack(id, amount, (short) 0, (byte) data); + ItemStack item = new ItemStack(id, amount, (short) 0); + item.setData(new MaterialData(id, (byte) data)); if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) { if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) { diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomBlocksConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomBlocksConfig.java index d58db8684..91c8535b6 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomBlocksConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomBlocksConfig.java @@ -7,6 +7,7 @@ import java.util.Set; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.inventory.ItemStack; +import org.bukkit.material.MaterialData; import com.gmail.nossr50.config.ConfigLoader; import com.gmail.nossr50.datatypes.mods.CustomBlock; @@ -78,7 +79,9 @@ public class CustomBlocksConfig extends ConfigLoader { } if (skillType.equals("Ability_Blocks")) { - blockItem = new ItemStack(id, 1, (short) 0, data); + blockItem = new ItemStack(id, 1, (short) 0); + blockItem.setData(new MaterialData(id, data)); + blockList.add(blockItem); continue; } @@ -89,14 +92,17 @@ public class CustomBlocksConfig extends ConfigLoader { } if (dropItem) { - itemDrop = new ItemStack(dropID, 1, (short) 0, dropData); + itemDrop = new ItemStack(dropID, 1, (short) 0); + itemDrop.setData(new MaterialData(dropID, dropData)); } else { - itemDrop = new ItemStack(id, 1, (short) 0, data); + itemDrop = new ItemStack(id, 1, (short) 0); + itemDrop.setData(new MaterialData(id, data)); } block = new CustomBlock(minimumDropAmount, maxiumDropAmount, itemDrop, tier, xp, data, id); - blockItem = new ItemStack(id, 1, (short) 0, data); + blockItem = new ItemStack(id, 1, (short) 0); + blockItem.setData(new MaterialData(id, data)); if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) { customOres.add(blockItem); diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java b/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java index 8f5c5823d..a4635191e 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java @@ -9,6 +9,7 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.material.MaterialData; import org.getspout.spoutapi.sound.SoundEffect; import com.gmail.nossr50.mcMMO; @@ -51,7 +52,10 @@ public class Excavation { int xp; - if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) { xp = ModChecks.getCustomBlock(block).getXpGain(); } else { diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java index 9b8f7aeaf..7f49ee586 100755 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java @@ -17,6 +17,7 @@ import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.material.MaterialData; import org.bukkit.material.Wool; import com.gmail.nossr50.config.AdvancedConfig; @@ -284,8 +285,7 @@ public class Fishing { case CREEPER: if (DROP_NUMBER > 97) { - Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, - 1, (short) 4)); + Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4)); } else { Misc.dropItem(location, new ItemStack(Material.SULPHUR)); } @@ -321,17 +321,14 @@ public class Fishing { if (DROP_NUMBER > 95) { Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); } else if (DROP_NUMBER > 90) { - Misc.dropItem(location, new ItemStack( - Material.MUSHROOM_SOUP)); + Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP)); } else if (DROP_NUMBER > 60) { Misc.dropItem(location, new ItemStack(Material.LEATHER)); } else if (DROP_NUMBER > 30) { Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); } else { - Misc.dropItem(location, - new ItemStack(Material.RED_MUSHROOM)); - Misc.randomDropItems(location, new ItemStack( - Material.RED_MUSHROOM), 50, 2); + Misc.dropItem(location, new ItemStack(Material.RED_MUSHROOM)); + Misc.randomDropItems(location, new ItemStack(Material.RED_MUSHROOM), 50, 2); } break; @@ -341,8 +338,7 @@ public class Fishing { case PIG_ZOMBIE: if (DROP_NUMBER > 50) { - Misc.dropItem(location, - new ItemStack(Material.ROTTEN_FLESH)); + Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); } else { Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET)); } @@ -366,25 +362,21 @@ public class Fishing { case SKELETON: if (((Skeleton) le).getSkeletonType() == SkeletonType.WITHER) { if (DROP_NUMBER > 97) { - Misc.dropItem(location, new ItemStack( - Material.SKULL_ITEM, 1, (short) 1)); + Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1)); } else if (DROP_NUMBER > 50) { Misc.dropItem(location, new ItemStack(Material.BONE)); } else { Misc.dropItem(location, new ItemStack(Material.COAL)); - Misc.randomDropItems(location, new ItemStack( - Material.COAL), 50, 2); + Misc.randomDropItems(location, new ItemStack(Material.COAL), 50, 2); } } else { if (DROP_NUMBER > 97) { - Misc.dropItem(location, new ItemStack( - Material.SKULL_ITEM)); + Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM)); } else if (DROP_NUMBER > 50) { Misc.dropItem(location, new ItemStack(Material.BONE)); } else { Misc.dropItem(location, new ItemStack(Material.ARROW)); - Misc.randomDropItems(location, new ItemStack( - Material.ARROW), 50, 2); + Misc.randomDropItems(location, new ItemStack(Material.ARROW), 50, 2); } } break; @@ -398,8 +390,7 @@ public class Fishing { Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); } else { Misc.dropItem(location, new ItemStack(Material.SNOW_BALL)); - Misc.randomDropItems(location, new ItemStack( - Material.SNOW_BALL), 50, 4); + Misc.randomDropItems(location, new ItemStack(Material.SNOW_BALL), 50, 4); } break; @@ -412,38 +403,33 @@ public class Fishing { break; case SQUID: - Misc.dropItem(location, 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)); + + Misc.dropItem(location, item); break; case WITCH: final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1; if (DROP_NUMBER > 95) { if (DROP_NUMBER_2 > 66) { - Misc.dropItem(location, new ItemStack(Material.POTION, - 1, (short) 8197)); + Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197)); } else if (DROP_NUMBER_2 > 33) { - Misc.dropItem(location, new ItemStack(Material.POTION, - 1, (short) 8195)); + Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195)); } else { - Misc.dropItem(location, new ItemStack(Material.POTION, - 1, (short) 8194)); + Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194)); } } else { if (DROP_NUMBER_2 > 88) { - Misc.dropItem(location, new ItemStack( - Material.GLASS_BOTTLE)); + Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE)); } else if (DROP_NUMBER_2 > 75) { - Misc.dropItem(location, new ItemStack( - Material.GLOWSTONE_DUST)); + Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST)); } else if (DROP_NUMBER_2 > 63) { Misc.dropItem(location, new ItemStack(Material.SULPHUR)); } else if (DROP_NUMBER_2 > 50) { - Misc.dropItem(location, - new ItemStack(Material.REDSTONE)); + Misc.dropItem(location, new ItemStack(Material.REDSTONE)); } else if (DROP_NUMBER_2 > 38) { - Misc.dropItem(location, new ItemStack( - Material.SPIDER_EYE)); + Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); } else if (DROP_NUMBER_2 > 25) { Misc.dropItem(location, new ItemStack(Material.STICK)); } else if (DROP_NUMBER_2 > 13) { @@ -456,11 +442,9 @@ public class Fishing { case ZOMBIE: if (DROP_NUMBER > 97) { - Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, - 1, (short) 2)); + Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2)); } else { - Misc.dropItem(location, - new ItemStack(Material.ROTTEN_FLESH)); + Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); } break; diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java index d1225b603..3bcaee8f5 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java @@ -10,6 +10,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; +import org.bukkit.material.MaterialData; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.Config; @@ -240,7 +241,10 @@ public class Herbalism { break; default: - if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) { customPlant = true; xp = ModChecks.getCustomBlock(block).getXpGain(); } diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java b/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java index 4740bfad1..2fe813fdb 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java @@ -9,6 +9,7 @@ import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.material.MaterialData; import org.getspout.spoutapi.sound.SoundEffect; import com.gmail.nossr50.mcMMO; @@ -96,7 +97,10 @@ public class Mining { default: if (ModChecks.isCustomMiningBlock(block)) { - Misc.dropItem(location, new ItemStack(block.getTypeId(), 1, (short) 0, block.getData())); + ItemStack dropItem = new ItemStack(block.getTypeId(), 1, (short) 0); + dropItem.setData(new MaterialData(block.getTypeId(), block.getData())); + + Misc.dropItem(location, dropItem); } break; } @@ -117,7 +121,9 @@ public class Mining { switch (type) { case COAL_ORE: if (configInstance.getCoalDoubleDropsEnabled()) { - item = new ItemStack(Material.COAL, 1, (short) 0, CoalType.COAL.getData()); + item = new ItemStack(Material.COAL, 1, (short) 0); + item.setData(new MaterialData(Material.COAL, CoalType.COAL.getData())); + Misc.dropItem(location, item); } break; @@ -166,7 +172,9 @@ public class Mining { case LAPIS_ORE: if (configInstance.getLapisDoubleDropsEnabled()) { - item = new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x4); + item = new ItemStack(Material.INK_SACK, 1, (short) 0); + item.setData(new MaterialData(Material.INK_SACK, (byte) 0x4)); + Misc.dropItems(location, item, 4); Misc.randomDropItems(location, item, 50, 4); } diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java index 36beee741..c2c0a4a98 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java @@ -10,6 +10,7 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.material.MaterialData; import org.bukkit.material.Tree; import org.getspout.spoutapi.sound.SoundEffect; @@ -97,11 +98,15 @@ public class WoodCutting { //Prepare ItemStacks ItemStack item = null; - ItemStack oak = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.GENERIC.getData()); - ItemStack spruce = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.REDWOOD.getData()); - ItemStack birch = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.BIRCH.getData()); - ItemStack jungle = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.JUNGLE.getData()); + ItemStack oak = new ItemStack(Material.LOG, 1, (short) 0); + ItemStack spruce = new ItemStack(Material.LOG, 1, (short) 0); + ItemStack birch = new ItemStack(Material.LOG, 1, (short) 0); + ItemStack jungle = new ItemStack(Material.LOG, 1, (short) 0); + oak.setData(new MaterialData(Material.LOG, TreeSpecies.GENERIC.getData())); + spruce.setData(new MaterialData(Material.LOG, TreeSpecies.REDWOOD.getData())); + birch.setData(new MaterialData(Material.LOG, TreeSpecies.BIRCH.getData())); + jungle.setData(new MaterialData(Material.LOG, TreeSpecies.JUNGLE.getData())); for (Block x : toBeFelled) { if (Misc.blockBreakSimulate(x, player, true)) { if (Config.getInstance().getBlockModsEnabled()) { @@ -204,7 +209,9 @@ public class WoodCutting { else if (x.getType() == Material.LEAVES) { final int SAPLING_DROP_CHANCE = 10; - item = new ItemStack(Material.SAPLING, 1, (short) 0, (byte) (x.getData() & 3)); //Drop the right type of sapling + item = new ItemStack(Material.SAPLING, 1, (short) 0); + item.setData(new MaterialData(Material.SAPLING, (byte) (x.getData() & 3))); //Drop the right type of sapling + Misc.randomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE); //Remove the block @@ -373,7 +380,9 @@ public class WoodCutting { } } else { - item = new ItemStack(mat, 1, (short) 0, type); + item = new ItemStack(mat, 1, (short) 0); + item.setData(new MaterialData(mat, type)); + location = block.getLocation(); TreeSpecies species = TreeSpecies.getByData(type); diff --git a/src/main/java/com/gmail/nossr50/util/BlockChecks.java b/src/main/java/com/gmail/nossr50/util/BlockChecks.java index f109378fa..f5307f94c 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockChecks.java +++ b/src/main/java/com/gmail/nossr50/util/BlockChecks.java @@ -4,6 +4,7 @@ import org.bukkit.CropState; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.inventory.ItemStack; +import org.bukkit.material.MaterialData; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.mods.CustomBlocksConfig; @@ -59,7 +60,10 @@ public class BlockChecks { return true; default: - if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(item)) { return true; } else { @@ -75,7 +79,10 @@ public class BlockChecks { * @return true if the block should allow ability activation, false otherwise */ public static boolean abilityBlockCheck(Block block) { - if (customBlocksEnabled && CustomBlocksConfig.getInstance().customAbilityBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (customBlocksEnabled && CustomBlocksConfig.getInstance().customAbilityBlocks.contains(item)) { return false; } @@ -197,7 +204,10 @@ public class BlockChecks { } default: - if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) { return true; } else { @@ -232,7 +242,10 @@ public class BlockChecks { return true; default: - if (customBlocksEnabled && CustomBlocksConfig.getInstance().customMiningBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (customBlocksEnabled && CustomBlocksConfig.getInstance().customMiningBlocks.contains(item)) { return true; } else { @@ -259,7 +272,10 @@ public class BlockChecks { return true; default: - if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) { return true; } else { @@ -282,7 +298,10 @@ public class BlockChecks { return true; default: - if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(item)) { return true; } else { diff --git a/src/main/java/com/gmail/nossr50/util/ModChecks.java b/src/main/java/com/gmail/nossr50/util/ModChecks.java index b15e7520a..f69a77d65 100644 --- a/src/main/java/com/gmail/nossr50/util/ModChecks.java +++ b/src/main/java/com/gmail/nossr50/util/ModChecks.java @@ -2,6 +2,7 @@ package com.gmail.nossr50.util; import org.bukkit.block.Block; import org.bukkit.inventory.ItemStack; +import org.bukkit.material.MaterialData; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.mods.CustomArmorConfig; @@ -48,7 +49,10 @@ public class ModChecks { * @return the block if it exists, null otherwise */ public static CustomBlock getCustomBlock(Block block) { - if (!blocksInstance.customItems.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (!blocksInstance.customItems.contains(item)) { return null; } @@ -68,7 +72,10 @@ public class ModChecks { * @return true if the block is custom, false otherwise */ public static boolean isCustomMiningBlock(Block block) { - if (customBlocksEnabled && blocksInstance.customMiningBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (customBlocksEnabled && blocksInstance.customMiningBlocks.contains(item)) { return true; } else { @@ -83,7 +90,10 @@ public class ModChecks { * @return true if the block represents leaves, false otherwise */ public static boolean isCustomLeafBlock(Block block) { - if (blocksInstance.customLeaves.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (blocksInstance.customLeaves.contains(item)) { return true; } else { @@ -98,7 +108,10 @@ public class ModChecks { * @return true if the block represents a log, false otherwise */ public static boolean isCustomLogBlock(Block block) { - if (blocksInstance.customLogs.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (blocksInstance.customLogs.contains(item)) { return true; } else { @@ -113,7 +126,10 @@ public class ModChecks { * @return true if the block represents an ore, false otherwise */ public static boolean isCustomOreBlock(Block block) { - if (blocksInstance.customOres.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { + ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0); + item.setData(new MaterialData(block.getTypeId(), block.getData())); + + if (blocksInstance.customOres.contains(item)) { return true; } else {