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);
}
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);
}
}
}
}
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();
}
}
Aggregations