mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-27 01:08:34 +01:00
fix pickup achievements
This commit is contained in:
parent
4944c11889
commit
62255d9ace
1 changed files with 4 additions and 3 deletions
|
@ -29,6 +29,7 @@ import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
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){
|
public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){
|
||||||
if(gotten != null){
|
if(gotten != null && player != null){
|
||||||
for(TheAchievements ach : TheAchievements.values()){
|
for(TheAchievements ach : TheAchievements.values()){
|
||||||
if(ach.type == type){
|
if(ach.type == type){
|
||||||
if(ItemUtil.contains(ach.itemsToBeGotten, gotten, true)){
|
if(ItemUtil.contains(ach.itemsToBeGotten, gotten, true)){
|
||||||
|
@ -103,8 +104,8 @@ public class CommonEvents{
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPickupEvent(PlayerEvent.ItemPickupEvent event){
|
public void onPickupEvent(EntityItemPickupEvent event){
|
||||||
checkAchievements(event.pickedUp.getEntityItem(), event.player, InitAchievements.Type.PICK_UP);
|
checkAchievements(event.getItem().getEntityItem(), event.getEntityPlayer(), InitAchievements.Type.PICK_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
Loading…
Reference in a new issue