Fixed an NPE with Buildcraft (and likely other things)
This commit is contained in:
parent
fda6e74f63
commit
d7d3c1656b
1 changed files with 11 additions and 6 deletions
|
@ -173,14 +173,19 @@ public class AchievementEventHandler
|
||||||
public void onBlockPlaced(BlockEvent.PlaceEvent event)
|
public void onBlockPlaced(BlockEvent.PlaceEvent event)
|
||||||
{
|
{
|
||||||
ItemStack stack = event.itemInHand;
|
ItemStack stack = event.itemInHand;
|
||||||
Item item = stack.getItem();
|
|
||||||
Block block = Block.getBlockFromItem(item);
|
|
||||||
IBlockState state = block != null ? block.getStateFromMeta(stack.getItemDamage()) : null;
|
|
||||||
|
|
||||||
//Yggdrasil
|
//Blocks can be placed by things other than players
|
||||||
if (state == BlockBOPSapling.paging.getVariantState(BOPTrees.SACRED_OAK))
|
if (stack != null)
|
||||||
{
|
{
|
||||||
event.player.triggerAchievement(BOPAchievements.grow_sacred_oak);
|
Item item = stack.getItem();
|
||||||
|
Block block = Block.getBlockFromItem(item);
|
||||||
|
IBlockState state = block != null ? block.getStateFromMeta(stack.getItemDamage()) : null;
|
||||||
|
|
||||||
|
//Yggdrasil
|
||||||
|
if (state == BlockBOPSapling.paging.getVariantState(BOPTrees.SACRED_OAK))
|
||||||
|
{
|
||||||
|
event.player.triggerAchievement(BOPAchievements.grow_sacred_oak);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue