Added LivingExperienceDropsEvent to change the amount of experience an entity drops

This commit is contained in:
Lumien committed 2015-04-14 11:58:00 +02:00
1 parent 5ac654dc1c
commit 81ab4cbc5f
3 files changed
+67

No files matched your search

@@ -0,0 +1,47 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
/**
* Event for when an entity drops experience on its death, can be used to change
* the amount of experience points dropped or completely prevent dropping of experience
* by canceling the event.
*/
@Cancelable
public class LivingExperienceDropEvent extends LivingEvent
{
final EntityPlayer attackingPlayer;
final int originalExperiencePoints;
int droppedExperiencePoints;
public LivingExperienceDropEvent(EntityLivingBase entity, EntityPlayer attackingPlayer, int originalExperience)
{
super(entity);
this.attackingPlayer = attackingPlayer;
this.originalExperiencePoints = this.droppedExperiencePoints = originalExperience;
}
public int getDroppedExperience()
{
return droppedExperiencePoints;
}
public void setDroppedExperience(int droppedExperience)
{
this.droppedExperiencePoints = droppedExperience;
}
public EntityPlayer getAttackingPlayer()
{
return attackingPlayer;
}
public int getOriginalExperience()
{
return originalExperiencePoints;
}
}