use of org.spongepowered.api.event.entity.HarvestEntityEvent in project LanternServer by LanternPowered.
the class LanternLiving method handleDeath.
protected void handleDeath(CauseStack causeStack) {
final int exp = collectExperience(causeStack);
// Humanoids get their own sub-interface for the event
final HarvestEntityEvent harvestEvent;
if (this instanceof Humanoid) {
harvestEvent = SpongeEventFactory.createHarvestEntityEventTargetHumanoid(causeStack.getCurrentCause(), exp, exp, (Humanoid) this);
} else {
harvestEvent = SpongeEventFactory.createHarvestEntityEventTargetLiving(causeStack.getCurrentCause(), exp, exp, this);
}
Sponge.getEventManager().post(harvestEvent);
// Finalize the harvest event
finalizeHarvestEvent(causeStack, harvestEvent, new ArrayList<>());
}
Aggregations