Even more Mining optimizations.

This commit is contained in:
Grant 2012-02-01 03:28:47 -05:00
parent 64e6ea86fd
commit 5b3c176192

View File

@ -89,55 +89,69 @@ public class Mining
return; return;
} }
//GLOWSTONE switch (id){
if(id == 89) //GLOWSTONE
{ 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);
}
//REDSTONE
else if(id == 73 || id == 74)
{
mat = Material.getMaterial(331);
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); m.mcDropItem(loc, item);
} break;
} //REDSTONE
//LAPIS case 73:
else if(id == 21) mat = Material.getMaterial(331);
{ item = new ItemStack(mat, 1, (byte)0, damage);
mat = Material.getMaterial(351); m.mcDropItem(loc, item);
item = new ItemStack(mat, 1, (byte)0,(byte)0x4); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); if(Math.random() * 10 > 5)
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
} break;
//DIAMOND case 74:
else if(id == 56) mat = Material.getMaterial(331);
{ item = new ItemStack(mat, 1, (byte)0, damage);
mat = Material.getMaterial(264); m.mcDropItem(loc, item);
item = new ItemStack(mat, 1, (byte)0, damage); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
} m.mcDropItem(loc, item);
//STONE if(Math.random() * 10 > 5)
else if(id == 1) m.mcDropItem(loc, item);
{ break;
mat = Material.getMaterial(4); //LAPIS
item = new ItemStack(mat, 1, (byte)0, damage); case 21:
m.mcDropItem(loc, item); mat = Material.getMaterial(351);
} item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
//COAL m.mcDropItem(loc, item);
else if(id == 16) m.mcDropItem(loc, item);
{ m.mcDropItem(loc, item);
mat = Material.getMaterial(263); m.mcDropItem(loc, item);
item = new ItemStack(mat, 1, (byte)0, damage); if(Math.random() * 10 > 5)
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);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
break;
//DIAMOND
case 56:
mat = Material.getMaterial(264);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item);
break;
//STONE
case 1:
mat = Material.getMaterial(4);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item);
break;
//COAL
case 16:
mat = Material.getMaterial(263);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item);
break;
} }
} }
@ -229,11 +243,8 @@ public class Mining
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if(LoadProperties.toolsLoseDurabilityFromAbilities) if(LoadProperties.toolsLoseDurabilityFromAbilities)
{ {
if(player.getItemInHand().getEnchantments().containsKey(Enchantment.DURABILITY)) if(!player.getItemInHand().getEnchantments().containsKey(Enchantment.DURABILITY))
{ m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
}
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
} }
//Pre-processing //Pre-processing
@ -244,32 +255,34 @@ public class Mining
byte damage = 0; byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage); ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
if(id == 1 || id == 24) //STONE
if(id == 1)
{ {
if(id == 1) if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5)
{ {
mat = Material.COBBLESTONE; xp += LoadProperties.mstone;
if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5) blockProcCheck(block, player);
{ blockProcCheck(block, player);
xp += LoadProperties.mstone;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
} else
{
mat = Material.SANDSTONE;
if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5)
{
xp += LoadProperties.msandstone;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
} }
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);
} }
//SANDSTONE
else if(id == 24)
{
if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5)
{
xp += LoadProperties.msandstone;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//NETHERRACK //NETHERRACK
else if(id == 87) else if(id == 87)
{ {
@ -278,8 +291,6 @@ public class Mining
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
mat = Material.getMaterial(87);
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);
@ -320,7 +331,6 @@ public class Mining
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
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);
@ -328,15 +338,11 @@ public class Mining
//OBSIDIAN //OBSIDIAN
else if(id == 49 && m.getTier(player) >= 4) else if(id == 49 && m.getTier(player) >= 4)
{ {
if(LoadProperties.toolsLoseDurabilityFromAbilities)
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){ if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
xp += LoadProperties.mobsidian; xp += LoadProperties.mobsidian;
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
mat = Material.getMaterial(49);
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);
@ -363,7 +369,6 @@ public class Mining
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
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);
@ -382,14 +387,13 @@ public class Mining
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); 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);
}
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
} }
//LAPUS //LAPIS
else if(id == 21 && m.getTier(player) >= 3){ else if(id == 21 && m.getTier(player) >= 3){
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){ if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
xp += LoadProperties.mlapis; xp += LoadProperties.mlapis;
@ -402,14 +406,22 @@ public class Mining
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); 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);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
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);
} }
if(block.getData() != (byte) 5) if(block.getData() != (byte) 5)
PP.addXP(SkillType.MINING, xp, player); PP.addXP(SkillType.MINING, xp, player);
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation()); SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
Skills.XpCheckSkill(SkillType.MINING, player); Skills.XpCheckSkill(SkillType.MINING, player);
} }
} }