Merge pull request #383 from Glitchfinder/master

Fixing a few more NPEs.
This commit is contained in:
Glitchfinder 2012-12-28 21:11:58 -08:00
commit d35e56fd37
2 changed files with 29 additions and 17 deletions

View File

@ -308,7 +308,7 @@ public class Mining {
break; break;
default: default:
if (ModChecks.isCustomMiningBlock(block) && ModChecks.getCustomBlock(block) != null) { if (ModChecks.isCustomMiningBlock(block)) {
xp += ModChecks.getCustomBlock(block).getXpGain(); xp += ModChecks.getCustomBlock(block).getXpGain();
} }
break; break;

View File

@ -76,13 +76,16 @@ public class ModChecks {
item.setData(new MaterialData(block.getTypeId(), block.getData())); item.setData(new MaterialData(block.getTypeId(), block.getData()));
if (customBlocksEnabled && blocksInstance.customMiningBlocks.contains(item)) { if (customBlocksEnabled && blocksInstance.customMiningBlocks.contains(item)) {
for (CustomBlock b : blocksInstance.customBlocks) {
if ((b.getItemID() == block.getTypeId()) && (b.getDataValue() == block.getData())) {
return true; return true;
} }
else {
return false;
} }
} }
return false;
}
/** /**
* Check if a custom block is a leaf block. * Check if a custom block is a leaf block.
* *
@ -94,13 +97,16 @@ public class ModChecks {
item.setData(new MaterialData(block.getTypeId(), block.getData())); item.setData(new MaterialData(block.getTypeId(), block.getData()));
if (blocksInstance.customLeaves.contains(item)) { if (blocksInstance.customLeaves.contains(item)) {
for (CustomBlock b : blocksInstance.customBlocks) {
if ((b.getItemID() == block.getTypeId()) && (b.getDataValue() == block.getData())) {
return true; return true;
} }
else {
return false;
} }
} }
return false;
}
/** /**
* Check if a custom block is a log block. * Check if a custom block is a log block.
* *
@ -112,13 +118,16 @@ public class ModChecks {
item.setData(new MaterialData(block.getTypeId(), block.getData())); item.setData(new MaterialData(block.getTypeId(), block.getData()));
if (blocksInstance.customLogs.contains(item)) { if (blocksInstance.customLogs.contains(item)) {
for (CustomBlock b : blocksInstance.customBlocks) {
if ((b.getItemID() == block.getTypeId()) && (b.getDataValue() == block.getData())) {
return true; return true;
} }
else {
return false;
} }
} }
return false;
}
/** /**
* Check if a custom block is an ore block. * Check if a custom block is an ore block.
* *
@ -130,13 +139,16 @@ public class ModChecks {
item.setData(new MaterialData(block.getTypeId(), block.getData())); item.setData(new MaterialData(block.getTypeId(), block.getData()));
if (blocksInstance.customOres.contains(item)) { if (blocksInstance.customOres.contains(item)) {
for (CustomBlock b : blocksInstance.customBlocks) {
if ((b.getItemID() == block.getTypeId()) && (b.getDataValue() == block.getData())) {
return true; return true;
} }
else {
return false;
} }
} }
return false;
}
/** /**
* Checks to see if an item is a custom tool. * Checks to see if an item is a custom tool.
* *