Search in sources :

Example 1 with ExpBottleEvent

use of org.bukkit.event.entity.ExpBottleEvent in project Glowstone by GlowstoneMC.

the class GlowThrownExpBottle method spawnOrb.

private void spawnOrb() {
    int xp = ThreadLocalRandom.current().nextInt(9) + 3;
    ExpBottleEvent event = EventFactory.getInstance().callEvent(new ExpBottleEvent(this, xp));
    xp = event.getExperience();
    // TODO: Show effect
    ExperienceOrb orb = (ExperienceOrb) world.spawnEntity(location, EntityType.EXPERIENCE_ORB);
    orb.setExperience(xp);
    if (orb instanceof GlowExperienceOrb) {
        ((GlowExperienceOrb) orb).setFromBottle(true);
    }
    remove();
}
Also used : ExpBottleEvent(org.bukkit.event.entity.ExpBottleEvent) GlowExperienceOrb(net.glowstone.entity.objects.GlowExperienceOrb) GlowExperienceOrb(net.glowstone.entity.objects.GlowExperienceOrb) ExperienceOrb(org.bukkit.entity.ExperienceOrb)

Aggregations

GlowExperienceOrb (net.glowstone.entity.objects.GlowExperienceOrb)1 ExperienceOrb (org.bukkit.entity.ExperienceOrb)1 ExpBottleEvent (org.bukkit.event.entity.ExpBottleEvent)1