From 62255d9ace9a126857e990a20ef415676d89a37c Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 10 Mar 2017 23:17:50 +0100 Subject: [PATCH] fix pickup achievements --- .../ellpeck/actuallyadditions/mod/event/CommonEvents.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java index e5fe9820f..f959b14f0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java @@ -29,6 +29,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingDropsEvent; +import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent; @@ -43,7 +44,7 @@ public class CommonEvents{ } public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){ - if(gotten != null){ + if(gotten != null && player != null){ for(TheAchievements ach : TheAchievements.values()){ if(ach.type == type){ if(ItemUtil.contains(ach.itemsToBeGotten, gotten, true)){ @@ -103,8 +104,8 @@ public class CommonEvents{ } @SubscribeEvent - public void onPickupEvent(PlayerEvent.ItemPickupEvent event){ - checkAchievements(event.pickedUp.getEntityItem(), event.player, InitAchievements.Type.PICK_UP); + public void onPickupEvent(EntityItemPickupEvent event){ + checkAchievements(event.getItem().getEntityItem(), event.getEntityPlayer(), InitAchievements.Type.PICK_UP); } @SubscribeEvent