Search in sources :

Example 1 with EntitySpectralArrow

use of net.minecraft.entity.projectile.EntitySpectralArrow in project Cavern2 by kegare.

the class EntityCavenicSkeleton method getArrow.

@Override
protected EntityArrow getArrow(float dist) {
    ItemStack heldOff = getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
    if (heldOff.getItem() == Items.SPECTRAL_ARROW) {
        EntitySpectralArrow arrow = new EntitySpectralArrow(this.world, this);
        arrow.setEnchantmentEffectsFromEntity(this, dist);
        return arrow;
    } else {
        EntityArrow arrow = new EntityCavenicArrow(world, this);
        arrow.setEnchantmentEffectsFromEntity(this, dist);
        if (heldOff.getItem() == Items.TIPPED_ARROW && arrow instanceof EntityTippedArrow) {
            ((EntityTippedArrow) arrow).setPotionEffect(heldOff);
        }
        return arrow;
    }
}
Also used : EntityArrow(net.minecraft.entity.projectile.EntityArrow) EntityTippedArrow(net.minecraft.entity.projectile.EntityTippedArrow) EntitySpectralArrow(net.minecraft.entity.projectile.EntitySpectralArrow) ItemStack(net.minecraft.item.ItemStack)

Aggregations

EntityArrow (net.minecraft.entity.projectile.EntityArrow)1 EntitySpectralArrow (net.minecraft.entity.projectile.EntitySpectralArrow)1 EntityTippedArrow (net.minecraft.entity.projectile.EntityTippedArrow)1 ItemStack (net.minecraft.item.ItemStack)1