forked from TAIGA/TAIGA
fixed a potential NPE
This commit is contained in:
@@ -25,6 +25,7 @@ public class TraitFracture extends AbstractTrait {
|
|||||||
float b = 0.99F * calcBonus(tool);
|
float b = 0.99F * calcBonus(tool);
|
||||||
if (!world.isRemote && tool.canHarvestBlock(state) && f <= b) {
|
if (!world.isRemote && tool.canHarvestBlock(state) && f <= b) {
|
||||||
RayTraceResult mop = ((ToolCore) tool.getItem()).rayTrace(world, (EntityPlayer) player, false);
|
RayTraceResult mop = ((ToolCore) tool.getItem()).rayTrace(world, (EntityPlayer) player, false);
|
||||||
|
if (mop != null) {
|
||||||
for (int i = random.nextInt(9) + 1; i >= 0; i--) {
|
for (int i = random.nextInt(9) + 1; i >= 0; i--) {
|
||||||
switch (mop.sideHit) {
|
switch (mop.sideHit) {
|
||||||
case UP:
|
case UP:
|
||||||
@@ -62,6 +63,7 @@ public class TraitFracture extends AbstractTrait {
|
|||||||
if (random.nextBoolean()) ToolHelper.damageTool(tool, random.nextInt(5), player);
|
if (random.nextBoolean()) ToolHelper.damageTool(tool, random.nextInt(5), player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private float calcBonus(ItemStack tool) {
|
private float calcBonus(ItemStack tool) {
|
||||||
int durability = ToolHelper.getCurrentDurability(tool);
|
int durability = ToolHelper.getCurrentDurability(tool);
|
||||||
|
Reference in New Issue
Block a user