More Mining optimizations

This commit is contained in:
Grant 2012-02-01 02:00:53 -05:00
parent 388fd364ac
commit 5404fc8703
3 changed files with 15 additions and 14 deletions

View File

@ -76,9 +76,11 @@ public class mcBlockListener implements Listener
if(m.shouldBeWatched(block)) if(m.shouldBeWatched(block))
{ {
int id = block.getTypeId(); int id = block.getTypeId();
if (id == 17 || id == 39 || id == 40 || id == 91 || id == 86 || id == 73 || id == 74) {
//Only needed for blocks that use their block data (wood, pumpkins, etc.)
if (id == 17 || id == 81 || id == 83 || id == 86 || id == 91)
plugin.misc.blockWatchList.add(block); plugin.misc.blockWatchList.add(block);
} else { else {
//block.setData((byte) 5); //Change the byte //block.setData((byte) 5); //Change the byte
//The following is a method to get around a breakage in 1.1-R2 and onward //The following is a method to get around a breakage in 1.1-R2 and onward
//it should be removed as soon as functionality to change a block //it should be removed as soon as functionality to change a block

View File

@ -92,7 +92,10 @@ public class m
return shouldBeWatched(id); return shouldBeWatched(id);
} }
public static boolean shouldBeWatched(int id) { public static boolean shouldBeWatched(int id) {
return id == 103 || id == 82 || id == 16 || id == 73 || id == 49 || id == 81 || id == 83 || id == 86 || id == 91 || id == 1 || id == 17 || id == 42 || id == 87 || id == 89 || id == 2 || id == 3 || id == 12 || id == 13 || id == 21 || id == 15 || id == 14 || id == 56 || id == 38 || id == 37 || id == 39 || id == 40 || id == 24; return id == 2 || id == 3 || id == 12 || id == 13 || id == 82 || //Excavation
id == 1 || id == 14 || id == 15 || id == 16 || id == 21 || id == 24 || id == 49 || id == 56 || id == 73 || id == 74 || id == 87 || id == 89 || //Mining
id == 17 || id == 37 || id == 38 || id == 39 || id == 40 || id == 81 || id == 83 || id == 86 || id == 91 || id == 103 || id == 106 || id == 111 || //Woodcutting & Herbalism
id == 42; //Anvil
} }
public static int getPowerLevel(Player player) public static int getPowerLevel(Player player)

View File

@ -79,10 +79,10 @@ public class Mining
public static void blockProcSimulate(Block block) public static void blockProcSimulate(Block block)
{ {
Location loc = block.getLocation(); Location loc = block.getLocation();
Material mat = Material.getMaterial(block.getTypeId()); int id = block.getTypeId();
Material mat = Material.getMaterial(id);
byte damage = 0; byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage); ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
int id = block.getTypeId();
if(id != 89 && id != 73 && id != 74 && id != 56 && id != 21 && id != 1 && id != 16) { if(id != 89 && id != 73 && id != 74 && id != 56 && id != 21 && id != 1 && id != 16) {
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
@ -108,7 +108,7 @@ public class Mining
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
} }
} }
//LAPUS //LAPIS
else if(id == 21) else if(id == 21)
{ {
mat = Material.getMaterial(351); mat = Material.getMaterial(351);
@ -220,11 +220,8 @@ public class Mining
*/ */
public static Boolean canBeSuperBroken(Block block) public static Boolean canBeSuperBroken(Block block)
{ {
int t = block.getTypeId(); int id = block.getTypeId();
if(t == 49 || t == 87 || t == 89 || t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15 || t == 112) return id == 1 || id == 14 || id == 15 || id == 16 || id == 21 || id == 24 || id == 49 || id == 56 || id == 73 || id == 74 || id == 87 || id == 89;
return true;
else
return false;
} }
public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin) public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin)
@ -241,12 +238,11 @@ public class Mining
//Pre-processing //Pre-processing
Location loc = block.getLocation(); Location loc = block.getLocation();
Material mat = Material.getMaterial(block.getTypeId()); int id = block.getTypeId();
Material mat = Material.getMaterial(id);
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);
int id = block.getTypeId();
if(id == 1 || id == 24) if(id == 1 || id == 24)
{ {