Search in sources :

Example 1 with SmallFireballEntity

use of net.minecraft.entity.projectile.SmallFireballEntity in project ChocolateQuestRepoured by TeamChocoQuest.

the class EntityAIFireball method start.

@Override
public void start() {
    super.start();
    this.cooldown = 140;
    this.entity.getMainHandItem().shrink(1);
    Vector3d v = this.entity.getTarget().position().subtract(this.entity.position());
    DamagingProjectileEntity fireball = this.entity.getRandom().nextDouble() > 0.7 ? new FireballEntity(this.entity.level, this.entity, v.x, v.y, v.z) : new SmallFireballEntity(this.entity.level, this.entity, v.x, v.y, v.z);
    this.entity.level.addFreshEntity(fireball);
}
Also used : Vector3d(net.minecraft.util.math.vector.Vector3d) DamagingProjectileEntity(net.minecraft.entity.projectile.DamagingProjectileEntity) SmallFireballEntity(net.minecraft.entity.projectile.SmallFireballEntity) SmallFireballEntity(net.minecraft.entity.projectile.SmallFireballEntity) FireballEntity(net.minecraft.entity.projectile.FireballEntity)

Example 2 with SmallFireballEntity

use of net.minecraft.entity.projectile.SmallFireballEntity in project bewitchment by MoriyaShiine.

the class DemonEntity method tick.

@Override
public void tick() {
    super.tick();
    if (!world.isClient) {
        tradeResetTimer++;
        if (tradeResetTimer >= 168000) {
            tradeResetTimer = 0;
            offers.clear();
        }
        LivingEntity target = getTarget();
        if (target != null) {
            lookAtEntity(target, 360, 360);
            if ((age + getId()) % 40 == 0) {
                SmallFireballEntity fireball = new SmallFireballEntity(world, this, target.getX() - getX(), target.getBodyY(0.5) - getBodyY(0.5), target.getZ() - getZ());
                fireball.updatePosition(fireball.getX(), getBodyY(0.5), fireball.getZ());
                world.playSound(null, getBlockPos(), BWSoundEvents.ENTITY_GENERIC_SHOOT, getSoundCategory(), getSoundVolume(), getSoundPitch());
                world.spawnEntity(fireball);
                swingHand(Hand.MAIN_HAND);
            }
        }
    }
}
Also used : SmallFireballEntity(net.minecraft.entity.projectile.SmallFireballEntity)

Example 3 with SmallFireballEntity

use of net.minecraft.entity.projectile.SmallFireballEntity in project Arclight by IzzelAliz.

the class SmallFireballEntityMixin method onImpact.

/**
 * @author IzzelAliz
 * @reason
 */
@Overwrite
protected void onImpact(RayTraceResult result) {
    if (ArclightVersion.atLeast(ArclightVersion.v1_15)) {
        super.onImpact(result);
    }
    if (!this.world.isRemote) {
        if (result.getType() == RayTraceResult.Type.ENTITY) {
            Entity entity = ((EntityRayTraceResult) result).getEntity();
            if (!entity.isImmuneToFire()) {
                int i = entity.getFireTimer();
                if (isIncendiary) {
                    EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), ((EntityBridge) entity).bridge$getBukkitEntity(), 5);
                    Bukkit.getPluginManager().callEvent(event);
                    if (!event.isCancelled()) {
                        ((EntityBridge) entity).bridge$setOnFire(event.getDuration(), false);
                    }
                }
                boolean flag = entity.attackEntityFrom(DamageSource.causeFireballDamage((SmallFireballEntity) (Object) this, this.shootingEntity), 5.0F);
                if (flag) {
                    this.applyEnchantments(this.shootingEntity, entity);
                } else {
                    entity.setFireTimer(i);
                }
            }
        } else if (isIncendiary && this.shootingEntity == null || !(this.shootingEntity instanceof MobEntity) || ForgeEventFactory.getMobGriefingEvent(this.world, this.shootingEntity)) {
            BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult) result;
            BlockPos blockpos = blockraytraceresult.getPos().offset(blockraytraceresult.getFace());
            if (this.world.isAirBlock(blockpos) && !CraftEventFactory.callBlockIgniteEvent(this.world, blockpos, (SmallFireballEntity) (Object) this).isCancelled()) {
                this.world.setBlockState(blockpos, Blocks.FIRE.getDefaultState());
            }
        }
        this.remove();
    }
}
Also used : Entity(net.minecraft.entity.Entity) LivingEntity(net.minecraft.entity.LivingEntity) SmallFireballEntity(net.minecraft.entity.projectile.SmallFireballEntity) MobEntity(net.minecraft.entity.MobEntity) EntityRayTraceResult(net.minecraft.util.math.EntityRayTraceResult) SmallFireballEntity(net.minecraft.entity.projectile.SmallFireballEntity) BlockPos(net.minecraft.util.math.BlockPos) BlockRayTraceResult(net.minecraft.util.math.BlockRayTraceResult) EntityBridge(io.izzel.arclight.common.bridge.entity.EntityBridge) EntityCombustByEntityEvent(org.bukkit.event.entity.EntityCombustByEntityEvent) MobEntity(net.minecraft.entity.MobEntity) Overwrite(org.spongepowered.asm.mixin.Overwrite)

Aggregations

SmallFireballEntity (net.minecraft.entity.projectile.SmallFireballEntity)3 EntityBridge (io.izzel.arclight.common.bridge.entity.EntityBridge)1 Entity (net.minecraft.entity.Entity)1 LivingEntity (net.minecraft.entity.LivingEntity)1 MobEntity (net.minecraft.entity.MobEntity)1 DamagingProjectileEntity (net.minecraft.entity.projectile.DamagingProjectileEntity)1 FireballEntity (net.minecraft.entity.projectile.FireballEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 BlockRayTraceResult (net.minecraft.util.math.BlockRayTraceResult)1 EntityRayTraceResult (net.minecraft.util.math.EntityRayTraceResult)1 Vector3d (net.minecraft.util.math.vector.Vector3d)1 EntityCombustByEntityEvent (org.bukkit.event.entity.EntityCombustByEntityEvent)1 Overwrite (org.spongepowered.asm.mixin.Overwrite)1