use of net.minecraft.entity.LightningEntity in project MobOrigins by UltrusBot.
the class TridentEntityMixin method onEntityHit$MobOrigins.
@Inject(method = "onEntityHit", at = @At("TAIL"))
public void onEntityHit$MobOrigins(EntityHitResult entityHitResult, CallbackInfo ci) {
Entity tridentThrower = this.getOwner();
if (this.world instanceof ServerWorld && MobOriginsPowers.SEAS_STORM.isActive(tridentThrower) && !this.world.isThundering() && EnchantmentHelper.hasChanneling(this.tridentStack)) {
Entity entity = entityHitResult.getEntity();
BlockPos blockPos = entity.getBlockPos();
if (this.world.isSkyVisible(blockPos)) {
LightningEntity lightningEntity = (LightningEntity) EntityType.LIGHTNING_BOLT.create(this.world);
lightningEntity.refreshPositionAfterTeleport(Vec3d.ofBottomCenter(blockPos));
lightningEntity.setChanneler(tridentThrower instanceof ServerPlayerEntity ? (ServerPlayerEntity) tridentThrower : null);
this.world.spawnEntity(lightningEntity);
}
}
}
use of net.minecraft.entity.LightningEntity in project MCDungeonsArtifacts by chronosacaria.
the class AOEHelper method summonLightningBoltOnEntity.
public static void summonLightningBoltOnEntity(Entity target) {
World world = target.getEntityWorld();
LightningEntity lightningEntity = EntityType.LIGHTNING_BOLT.create(world);
if (lightningEntity != null) {
lightningEntity.refreshPositionAfterTeleport(target.getX(), target.getY(), target.getZ());
lightningEntity.setCosmetic(true);
world.spawnEntity(lightningEntity);
}
}
use of net.minecraft.entity.LightningEntity in project bewitchment by MoriyaShiine.
the class ThunderboltFortune method finish.
@Override
public boolean finish(ServerWorld world, PlayerEntity target) {
LightningEntity entity = EntityType.LIGHTNING_BOLT.create(world);
if (entity != null) {
entity.updatePositionAndAngles(target.getX(), target.getY(), target.getZ(), world.random.nextFloat() * 360, 0);
world.spawnEntity(entity);
}
return super.finish(world, target);
}
use of net.minecraft.entity.LightningEntity in project Paradise-Lost by devs-immortal.
the class ElementalSword method postHit.
@Override
public boolean postHit(ItemStack stack, LivingEntity victim, LivingEntity attacker) {
if (this == AetherItems.FLAMING_SWORD) {
victim.setOnFireFor(30);
} else if (this == AetherItems.LIGHTNING_SWORD) {
LightningEntity lightning = new LightningEntity(EntityType.LIGHTNING_BOLT, attacker.world);
if (attacker instanceof ServerPlayerEntity)
lightning.setChanneler((ServerPlayerEntity) attacker);
} else if (this == AetherItems.HOLY_SWORD && victim.isUndead()) {
victim.damage(DamageSource.mob(attacker), 20);
stack.damage(10, attacker, null);
}
return super.postHit(stack, victim, attacker);
}
Aggregations