Search in sources :

Example 16 with EntityLightningBolt

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

the class BlockReinforcedFenceGate method onEntityIntersected.

@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity) {
    if (BlockUtils.getBlockPropertyAsBoolean(world, pos, OPEN)) {
        return;
    }
    if (entity instanceof EntityItem)
        return;
    else if (entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        if (((TileEntityOwnable) world.getTileEntity(pos)).getOwner().isOwner(player))
            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);
        return;
    }
    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 17 with EntityLightningBolt

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

the class TileEntityProtecto method attackEntity.

@Override
public boolean attackEntity(Entity entity) {
    if (entity instanceof EntityLivingBase) {
        if ((entity instanceof EntityPlayer && (getOwner().isOwner((EntityPlayer) entity) || (hasModule(EnumCustomModules.WHITELIST) && ModuleUtils.getPlayersFromModule(worldObj, pos, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) entity).getName().toLowerCase())))) || entity instanceof EntityPigZombie || (entity instanceof EntityCreeper && ((EntityCreeper) entity).getPowered())) {
            return false;
        }
        EntityLightningBolt lightning = new EntityLightningBolt(worldObj, entity.posX, entity.posY, entity.posZ, true);
        worldObj.addWeatherEffect(lightning);
        BlockUtils.setBlockProperty(worldObj, pos, BlockProtecto.ACTIVATED, false);
        return true;
    }
    return false;
}
Also used : EntityCreeper(net.minecraft.entity.monster.EntityCreeper) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityLightningBolt(net.minecraft.entity.effect.EntityLightningBolt)

Example 18 with EntityLightningBolt

use of net.minecraft.entity.effect.EntityLightningBolt in project Realistic-Terrain-Generation by Team-RTG.

the class NecronomiconCreationRitual method completeRitualServer.

@Override
protected void completeRitualServer(World world, BlockPos pos, EntityPlayer player) {
    world.addWeatherEffect(new EntityLightningBolt(world, pos.getX(), pos.getY() + 1, pos.getZ(), false));
    TileEntity altar = world.getTileEntity(pos);
    NBTTagCompound compound = new NBTTagCompound();
    NBTTagCompound newItem = new NBTTagCompound();
    altar.writeToNBT(compound);
    NBTTagCompound nbtItem = compound.getCompoundTag("Item");
    if (ItemStack.loadItemStackFromNBT(nbtItem) == null || !ItemStack.loadItemStackFromNBT(nbtItem).isItemEqual(item)) {
        item.writeToNBT(newItem);
        compound.setTag("Item", newItem);
    }
    altar.readFromNBT(compound);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) EntityLightningBolt(net.minecraft.entity.effect.EntityLightningBolt)

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