Made Super Breaker & Silk Touch work together properly.

This commit is contained in:
gmcferrin 2012-02-02 00:56:56 -05:00
parent c95d2a9b84
commit ade31de797

View File

@ -89,12 +89,23 @@ public class Mining
return; return;
} }
//Drop natural block with Silk Touch
if(player.getItemInHand().getEnchantments().containsKey(Enchantment.SILK_TOUCH)){
m.mcDropItem(loc, item);
return;
}
switch (id){ switch (id){
//GLOWSTONE //GLOWSTONE
case 89: case 89:
mat = Material.getMaterial(348); mat = Material.getMaterial(348);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
break; break;
//REDSTONE //REDSTONE
case 73: case 73:
@ -270,6 +281,7 @@ public class Mining
int xp = 0; int xp = 0;
byte damage = 0; byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage); ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
boolean silkTouch = player.getItemInHand().getEnchantments().containsKey(Enchantment.SILK_TOUCH);
//STONE //STONE
if(id == 1) if(id == 1)
@ -280,8 +292,12 @@ public class Mining
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
if(!silkTouch)
{
mat = Material.getMaterial(4); mat = Material.getMaterial(4);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
}
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
@ -319,8 +335,19 @@ public class Mining
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
if(!silkTouch)
{
mat = Material.getMaterial(348); mat = Material.getMaterial(348);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
}
else
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
@ -333,8 +360,12 @@ public class Mining
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
if(!silkTouch)
{
mat = Material.getMaterial(263); mat = Material.getMaterial(263);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
}
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
@ -371,8 +402,12 @@ public class Mining
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
if(!silkTouch)
{
mat = Material.getMaterial(264); mat = Material.getMaterial(264);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
}
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
@ -398,6 +433,9 @@ public class Mining
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
if(!silkTouch)
{
mat = Material.getMaterial(331); mat = Material.getMaterial(331);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
@ -406,6 +444,10 @@ public class Mining
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
if(Math.random() * 10 > 5) if(Math.random() * 10 > 5)
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
}
else
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
} }
@ -416,6 +458,9 @@ public class Mining
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
if(!silkTouch)
{
mat = Material.getMaterial(351); mat = Material.getMaterial(351);
item = new ItemStack(mat, 1, (byte)0,(byte)0x4); item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
@ -430,6 +475,9 @@ public class Mining
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
if(Math.random() * 10 > 5) if(Math.random() * 10 > 5)
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
}
else
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
} }