Search in sources :

Example 6 with EntityLightningBolt

use of net.minecraft.entity.effect.EntityLightningBolt in project SecurityCraft by Geforce132.

the class WorldUtils method spawnLightning.

public static void spawnLightning(World world, double x, double y, double z) {
    EntityLightningBolt lightning = new EntityLightningBolt(world, x, y, z);
    world.addWeatherEffect(lightning);
    if (!world.isRemote) {
        mod_SecurityCraft.network.sendToAll(new PacketCSpawnLightning(x, y, z));
    }
}
Also used : PacketCSpawnLightning(net.geforcemods.securitycraft.network.packets.PacketCSpawnLightning) EntityLightningBolt(net.minecraft.entity.effect.EntityLightningBolt)

Example 7 with EntityLightningBolt

use of net.minecraft.entity.effect.EntityLightningBolt in project SecurityCraft by Geforce132.

the class BlockIronFence method onEntityIntersected.

@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity) {
    //so dropped items don't get destroyed
    if (entity instanceof EntityItem)
        return;
    else //owner check
    if (entity instanceof EntityPlayer) {
        if (((TileEntityOwnable) world.getTileEntity(pos)).getOwner().isOwner((EntityPlayer) entity))
            ;
        return;
    } else if (entity instanceof EntityCreeper) {
        EntityCreeper creeper = (EntityCreeper) entity;
        EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX(), pos.getY(), pos.getZ(), true);
        creeper.onStruckByLightning(lightning);
        creeper.extinguish();
        return;
    }
    //3 hearts per attack
    entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F);
}
Also used : EntityCreeper(net.minecraft.entity.monster.EntityCreeper) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityLightningBolt(net.minecraft.entity.effect.EntityLightningBolt) EntityItem(net.minecraft.entity.item.EntityItem) TileEntityOwnable(net.geforcemods.securitycraft.tileentity.TileEntityOwnable)

Example 8 with EntityLightningBolt

use of net.minecraft.entity.effect.EntityLightningBolt in project Minechem by iopleke.

the class AugmentLightning method spawnLightning.

public void spawnLightning(World world, double x, double y, double z, ItemStack stack, int level) {
    if (!world.isRemote) {
        level = getUsableLevel(stack, level);
        if (level >= 0) {
            consumeAugment(stack, level);
            world.addWeatherEffect(new EntityLightningBolt(world, x, y, z));
        }
    }
}
Also used : EntityLightningBolt(net.minecraft.entity.effect.EntityLightningBolt)

Example 9 with EntityLightningBolt

use of net.minecraft.entity.effect.EntityLightningBolt in project PneumaticCraft by MineMaarten.

the class BlockLightningPlant method executeFullGrownEffect.

@Override
public void executeFullGrownEffect(World world, int x, int y, int z, Random rand) {
    if (!world.isRemote) {
        int j = MathHelper.floor_double(x) + rand.nextInt(20) - 10;
        int k = MathHelper.floor_double(z) + rand.nextInt(20) - 10;
        int l = world.getPrecipitationHeight(j, k);
        if (world.canLightningStrikeAt(j, l, k)) {
            EntityLightningBolt lightning = new EntityLightningBolt(world, j, l, k);
            world.addWeatherEffect(lightning);
            world.setBlockMetadataWithNotify(x, y, z, 11, 3);
        }
    }
}
Also used : EntityLightningBolt(net.minecraft.entity.effect.EntityLightningBolt)

Example 10 with EntityLightningBolt

use of net.minecraft.entity.effect.EntityLightningBolt in project Pearcel-Mod by MiningMark48.

the class ItemGuardianFood method onFoodEaten.

@Override
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
    BlockPos pos = player.getPosition();
    int x = pos.getX();
    int y = pos.getY();
    int z = pos.getZ();
    Random rand = new Random();
    int num = rand.nextInt(5) + 10;
    int range = 25;
    List<EntityPlayer> players = world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(x - range, y - range, z - range, x + range, y + range, z + range));
    if (!world.isRemote) {
        EntityPearcelBoss pb = new EntityPearcelBoss(world);
        pb.setPosition(x, y + num, z);
        world.spawnEntity(new EntityLightningBolt(world, x, y, z, true));
        world.spawnEntity(pb);
        for (EntityPlayer e : players) {
            e.sendMessage(new TextComponentString(TextFormatting.GREEN + Translate.toLocal("chat.item.guardian_food.summoned")));
        }
    }
    world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, x + 0.5, y + num + 0.5, z + 0.5, 1.0D, 0.0D, 0.0D);
    for (EntityPlayer e : players) {
        e.playSound(ModSoundEvents.MOB_PEARCEL_BOSS_LAUGH, 5.0F, 1.0F);
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Random(java.util.Random) EntityPearcelBoss(com.miningmark48.pearcelmod.entity.EntityPearcelBoss) EntityPlayer(net.minecraft.entity.player.EntityPlayer) BlockPos(net.minecraft.util.math.BlockPos) EntityLightningBolt(net.minecraft.entity.effect.EntityLightningBolt) TextComponentString(net.minecraft.util.text.TextComponentString)

Aggregations

EntityLightningBolt (net.minecraft.entity.effect.EntityLightningBolt)18 EntityPlayer (net.minecraft.entity.player.EntityPlayer)9 EntityCreeper (net.minecraft.entity.monster.EntityCreeper)5 TileEntityOwnable (net.geforcemods.securitycraft.tileentity.TileEntityOwnable)4 EntityItem (net.minecraft.entity.item.EntityItem)4 BlockPos (net.minecraft.util.math.BlockPos)4 Random (java.util.Random)3 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3 TextComponentString (net.minecraft.util.text.TextComponentString)3 Entity (net.minecraft.entity.Entity)2 EntityHorse (net.minecraft.entity.passive.EntityHorse)2 TileEntity (net.minecraft.tileentity.TileEntity)2 AMVector3 (am2.api.math.AMVector3)1 EntityLightningGuardian (am2.bosses.EntityLightningGuardian)1 ParticleOrbitEntity (am2.particles.ParticleOrbitEntity)1 AffinityData (am2.playerextensions.AffinityData)1 IFluxReceiver (blusunrize.immersiveengineering.api.energy.immersiveflux.IFluxReceiver)1 EntityPearcelBoss (com.miningmark48.pearcelmod.entity.EntityPearcelBoss)1 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 ArrayList (java.util.ArrayList)1