Some men want to watch the world burn (#897)

This commit is contained in:
Adubbz 2016-11-17 00:07:52 +11:00
parent 4956eb5071
commit 4f802ca60c

View file

@ -30,6 +30,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.AchievementList; import net.minecraft.stats.AchievementList;
import net.minecraft.util.JsonSerializableSet; import net.minecraft.util.JsonSerializableSet;
@ -55,7 +56,7 @@ public class AchievementEventHandler
Item item = stack.getItem(); Item item = stack.getItem();
Block block = Block.getBlockFromItem(item); Block block = Block.getBlockFromItem(item);
IBlockState state = block != null ? block.getStateFromMeta(stack.getMetadata()) : null; IBlockState state = block != null && item instanceof ItemBlock ? block.getStateFromMeta(((ItemBlock)item).getMetadata(stack.getMetadata())) : null;
EntityPlayer player = event.player; EntityPlayer player = event.player;
if (block != null && block instanceof BlockBOPLog) if (block != null && block instanceof BlockBOPLog)
@ -181,7 +182,7 @@ public class AchievementEventHandler
{ {
Item item = stack.getItem(); Item item = stack.getItem();
Block block = Block.getBlockFromItem(item); Block block = Block.getBlockFromItem(item);
IBlockState state = block != null ? block.getStateFromMeta(stack.getItemDamage()) : null; IBlockState state = block != null && item instanceof ItemBlock ? block.getStateFromMeta(((ItemBlock)item).getMetadata(stack.getMetadata())) : null;
try try
{ {