001 package net.minecraftforge.event.entity.player; 002 003 import java.util.ArrayList; 004 005 import net.minecraft.src.*; 006 import net.minecraftforge.event.Cancelable; 007 import net.minecraftforge.event.entity.living.LivingDropsEvent; 008 009 /** 010 * Child class of LivingDropEvent that is fired specifically when a 011 * player dies. Canceling the event will prevent ALL drops from entering the 012 * world. 013 */ 014 @Cancelable 015 public class PlayerDropsEvent extends LivingDropsEvent 016 { 017 public final EntityPlayer entityPlayer; 018 019 /** 020 * Creates a new event containing all the items that will drop into the 021 * world when a player dies. 022 * @param entity The dying player. 023 * @param source The source of the damage which is killing the player. 024 * @param drops List of all drops entering the world. 025 */ 026 public PlayerDropsEvent(EntityPlayer entity, DamageSource source, ArrayList<EntityItem> drops, boolean recentlyHit) 027 { 028 super(entity, source, drops, 029 (source.getEntity() instanceof EntityPlayer) ? 030 EnchantmentHelper.getLootingModifier(((EntityPlayer)source.getEntity()).inventory) : 0, 031 recentlyHit, 0); 032 033 this.entityPlayer = entity; 034 } 035 }