Search in sources :

Example 1 with HarvestEntityEvent

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<>());
}
Also used : Humanoid(org.spongepowered.api.entity.living.Humanoid) HarvestEntityEvent(org.spongepowered.api.event.entity.HarvestEntityEvent)

Aggregations

Humanoid (org.spongepowered.api.entity.living.Humanoid)1 HarvestEntityEvent (org.spongepowered.api.event.entity.HarvestEntityEvent)1