Search in sources :

Example 1 with ExperienceBottleEntity

use of net.minecraft.entity.item.ExperienceBottleEntity in project Arclight by IzzelAliz.

the class ExperienceBottleEntityMixin method onImpact.

/**
 * @author IzzelAliz
 * @reason
 */
@Overwrite
protected void onImpact(RayTraceResult result) {
    if (!this.world.isRemote) {
        int i = 3 + this.world.rand.nextInt(5) + this.world.rand.nextInt(5);
        ExpBottleEvent event = CraftEventFactory.callExpBottleEvent((ExperienceBottleEntity) (Object) this, i);
        i = event.getExperience();
        if (event.getShowEffect()) {
            this.world.playEvent(2002, new BlockPos((ExperienceBottleEntity) (Object) this), PotionUtils.getPotionColor(Potions.WATER));
        }
        while (i > 0) {
            int j = ExperienceOrbEntity.getXPSplit(i);
            i -= j;
            this.world.addEntity(new ExperienceOrbEntity(this.world, this.posX, this.posY, this.posZ, j));
        }
        this.remove();
    }
}
Also used : ExpBottleEvent(org.bukkit.event.entity.ExpBottleEvent) BlockPos(net.minecraft.util.math.BlockPos) ExperienceBottleEntity(net.minecraft.entity.item.ExperienceBottleEntity) ExperienceOrbEntity(net.minecraft.entity.item.ExperienceOrbEntity) Overwrite(org.spongepowered.asm.mixin.Overwrite)

Aggregations

ExperienceBottleEntity (net.minecraft.entity.item.ExperienceBottleEntity)1 ExperienceOrbEntity (net.minecraft.entity.item.ExperienceOrbEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 ExpBottleEvent (org.bukkit.event.entity.ExpBottleEvent)1 Overwrite (org.spongepowered.asm.mixin.Overwrite)1