Merge pull request #391 from Glitchfinder/master

Fixing Data Value issues caused by the patch to deprecated ItemStack use.
This commit is contained in:
Glitchfinder
2012-12-29 13:02:07 -08:00
8 changed files with 29 additions and 55 deletions

View File

@ -52,8 +52,7 @@ public class Excavation {
int xp;
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
item.setData(new MaterialData(block.getTypeId(), block.getData()));
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
xp = ModChecks.getCustomBlock(block).getXpGain();

View File

@ -241,8 +241,7 @@ public class Herbalism {
break;
default:
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
item.setData(new MaterialData(block.getTypeId(), block.getData()));
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
customPlant = true;

View File

@ -97,8 +97,7 @@ public class Mining {
default:
if (ModChecks.isCustomMiningBlock(block)) {
ItemStack dropItem = new ItemStack(block.getTypeId(), 1, (short) 0);
dropItem.setData(new MaterialData(block.getTypeId(), block.getData()));
ItemStack dropItem = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
Misc.dropItem(location, dropItem);
}
@ -121,8 +120,7 @@ public class Mining {
switch (type) {
case COAL_ORE:
if (configInstance.getCoalDoubleDropsEnabled()) {
item = new ItemStack(Material.COAL, 1, (short) 0);
item.setData(new MaterialData(Material.COAL, CoalType.COAL.getData()));
item = (new MaterialData(Material.COAL, CoalType.COAL.getData())).toItemStack(1);
Misc.dropItem(location, item);
}
@ -172,8 +170,7 @@ public class Mining {
case LAPIS_ORE:
if (configInstance.getLapisDoubleDropsEnabled()) {
item = new ItemStack(Material.INK_SACK, 1, (short) 0);
item.setData(new MaterialData(Material.INK_SACK, (byte) 0x4));
item = (new MaterialData(Material.INK_SACK, (byte) 0x4)).toItemStack(1);
Misc.dropItems(location, item, 4);
Misc.randomDropItems(location, item, 50, 4);

View File

@ -98,18 +98,14 @@ public class WoodCutting {
//Prepare ItemStacks
ItemStack item = null;
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);
ItemStack oak = (new MaterialData(Material.LOG, TreeSpecies.GENERIC.getData())).toItemStack(1);
ItemStack spruce = (new MaterialData(Material.LOG, TreeSpecies.REDWOOD.getData())).toItemStack(1);
ItemStack birch = (new MaterialData(Material.LOG, TreeSpecies.BIRCH.getData())).toItemStack(1);
ItemStack jungle = (new MaterialData(Material.LOG, TreeSpecies.JUNGLE.getData())).toItemStack(1);
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()) {
if (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLogBlock(x)) {
if (ModChecks.isCustomLogBlock(x)) {
CustomBlock block = ModChecks.getCustomBlock(x);
item = block.getItemDrop();
@ -209,8 +205,8 @@ public class WoodCutting {
else if (x.getType() == Material.LEAVES) {
final int SAPLING_DROP_CHANCE = 10;
item = new ItemStack(Material.SAPLING, 1, (short) 0);
item.setData(new MaterialData(Material.SAPLING, (byte) (x.getData() & 3))); //Drop the right type of sapling
//Drop the right type of sapling
item = (new MaterialData(Material.SAPLING, (byte) (x.getData() & 3))).toItemStack(1);
Misc.randomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
@ -380,8 +376,7 @@ public class WoodCutting {
}
}
else {
item = new ItemStack(mat, 1, (short) 0);
item.setData(new MaterialData(mat, type));
item = (new MaterialData(mat, type)).toItemStack(1);
location = block.getLocation();