Search in sources :

Example 11 with EntityCreeper

use of net.minecraft.entity.monster.EntityCreeper in project SecurityCraft by Geforce132.

the class BlockReinforcedFenceGate method onEntityCollidedWithBlock.

public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
    if (world.getBlockMetadata(x, y, z) > 3)
        return;
    //so dropped items don't get destroyed
    if (entity instanceof EntityItem)
        return;
    else //owner check
    if (entity instanceof EntityPlayer) {
        if (((TileEntityOwnable) world.getTileEntity(x, y, z)).getOwner().isOwner((EntityPlayer) entity))
            return;
    } else if (entity instanceof EntityCreeper) {
        EntityCreeper creeper = (EntityCreeper) entity;
        EntityLightningBolt lightning = new EntityLightningBolt(world, x, y, z);
        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 12 with EntityCreeper

use of net.minecraft.entity.monster.EntityCreeper in project ArsMagica2 by Mithion.

the class Explosions method processCommand.

@Override
public void processCommand(ICommandSender icommandsender, String[] astring) {
    EntityPlayer player = getCommandSenderAsPlayer(icommandsender);
    if (player.getCommandSenderName().equals("Moridrex") || player.getCommandSenderName().equals("Mithion")) {
        if (player.worldObj.rand.nextInt(10) < 5 || !player.worldObj.canBlockSeeTheSky((int) player.posX, (int) player.posY, (int) player.posZ)) {
            Explosion explosion = player.worldObj.newExplosion(null, player.posX, player.posY, player.posZ, 10, true, true);
            player.attackEntityFrom(DamageSource.setExplosionSource(explosion), 5000);
        } else {
            if (!player.worldObj.isRemote) {
                for (int i = 0; i < 25; ++i) {
                    EntityCreeper creeper = new EntityCreeper(player.worldObj);
                    creeper.setPosition(player.posX + player.worldObj.rand.nextInt(4) - 2, player.posY + 20, player.posZ + player.worldObj.rand.nextInt(4) - 2);
                    player.worldObj.spawnEntityInWorld(creeper);
                }
            }
        }
    } else {
        player.addChatMessage(new ChatComponentText("You aren't Moridrex..."));
    }
}
Also used : Explosion(net.minecraft.world.Explosion) EntityCreeper(net.minecraft.entity.monster.EntityCreeper) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 13 with EntityCreeper

use of net.minecraft.entity.monster.EntityCreeper in project ImmersiveEngineering by BluSunrize.

the class ThermalFoundationHelper method init.

@Override
public void init() {
    ChemthrowerHandler.registerEffect("coal", new ChemthrowerEffect_Potion(null, 0, IEPotions.flammable, 100, 0));
    ChemthrowerHandler.registerFlammable("coal");
    ChemthrowerHandler.registerEffect("crude_oil", new ChemthrowerEffect_Potion(null, 0, new PotionEffect(IEPotions.flammable, 140, 0), new PotionEffect(MobEffects.BLINDNESS, 80, 1)));
    ChemthrowerHandler.registerFlammable("crude_oil");
    ChemthrowerHandler.registerEffect("refined_oil", new ChemthrowerEffect_Potion(null, 0, IEPotions.flammable, 100, 1));
    ChemthrowerHandler.registerFlammable("refined_oil");
    ChemthrowerHandler.registerEffect("resin", new ChemthrowerEffect_Potion(null, 0, IEPotions.sticky, 100, 1));
    ChemthrowerHandler.registerEffect("tree_oil", new ChemthrowerEffect_Potion(null, 0, IEPotions.flammable, 120, 0));
    ChemthrowerHandler.registerFlammable("tree_oil");
    ChemthrowerHandler.registerEffect("redstone", new ChemthrowerEffect_Potion(null, 0, IEPotions.conductive, 100, 1));
    ChemthrowerHandler.registerEffect("glowstone", new ChemthrowerEffect_Potion(null, 0, new PotionEffect(MobEffects.GLOWING, 120, 0), new PotionEffect(MobEffects.SPEED, 120, 0), new PotionEffect(MobEffects.JUMP_BOOST, 120, 0)));
    ChemthrowerHandler.registerEffect("ender", new ChemthrowerEffect_RandomTeleport(null, 0, 1));
    try {
        Class c_DamageHelper = Class.forName("cofh.lib.util.helpers.DamageHelper");
        DamageSource pyrotheum = (DamageSource) c_DamageHelper.getDeclaredField("pyrotheum").get(null);
        Field f_explodeCreepers = Class.forName("cofh.thermalfoundation.fluid.BlockFluidPyrotheum").getDeclaredField("effect");
        f_explodeCreepers.setAccessible(true);
        if ((boolean) f_explodeCreepers.get(null))
            ChemthrowerHandler.registerEffect("pyrotheum", new ChemthrowerEffect_Damage(pyrotheum, 3) {

                @Override
                public void applyToEntity(EntityLivingBase target, @Nullable EntityPlayer shooter, ItemStack thrower, Fluid fluid) {
                    super.applyToEntity(target, shooter, thrower, fluid);
                    if (target instanceof EntityCreeper) {
                        target.getEntityWorld().createExplosion(target, target.posX, target.posY, target.posZ, 6.0F, target.getEntityWorld().getGameRules().getBoolean("mobGriefing"));
                        target.setDead();
                    }
                }
            });
        else
            ChemthrowerHandler.registerEffect("pyrotheum", new ChemthrowerEffect_Damage(pyrotheum, 3));
        DamageSource cryotheum = (DamageSource) c_DamageHelper.getDeclaredField("cryotheum").get(null);
        ChemthrowerHandler.registerEffect("cryotheum", new ChemthrowerEffect_Potion(cryotheum, 2, MobEffects.SLOWNESS, 50, 3));
    } catch (Exception e) {
    }
    ChemthrowerHandler.registerEffect("aerotheum", new ChemthrowerEffect_Potion(null, 0, new PotionEffect(MobEffects.INVISIBILITY, 60, 0), new PotionEffect(MobEffects.WATER_BREATHING, 300, 0)));
    ChemthrowerHandler.registerEffect("petrotheum", new ChemthrowerEffect_Potion(null, 0, new PotionEffect(MobEffects.HASTE, 300, 2), new PotionEffect(MobEffects.NIGHT_VISION, 300, 0), new PotionEffect(MobEffects.RESISTANCE, 300, 1)) {

        @Override
        public void applyToBlock(World worldObj, RayTraceResult mop, @Nullable EntityPlayer shooter, ItemStack thrower, Fluid fluid) {
            IBlockState state = worldObj.getBlockState(mop.getBlockPos());
            if (state.getBlock() == Blocks.STONE || state.getBlock() == Blocks.COBBLESTONE || state.getBlock() == Blocks.STONEBRICK || state.getBlock() == Blocks.MOSSY_COBBLESTONE)
                worldObj.setBlockState(mop.getBlockPos(), Blocks.GRAVEL.getDefaultState());
        }
    });
    ChemthrowerHandler.registerEffect("mana", new ChemthrowerEffect_RandomTeleport(null, 0, .01f));
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) DamageSource(net.minecraft.util.DamageSource) ChemthrowerEffect_Damage(blusunrize.immersiveengineering.api.tool.ChemthrowerHandler.ChemthrowerEffect_Damage) PotionEffect(net.minecraft.potion.PotionEffect) Fluid(net.minecraftforge.fluids.Fluid) RayTraceResult(net.minecraft.util.math.RayTraceResult) World(net.minecraft.world.World) ChemthrowerEffect_Potion(blusunrize.immersiveengineering.api.tool.ChemthrowerHandler.ChemthrowerEffect_Potion) ChemthrowerEffect_RandomTeleport(blusunrize.immersiveengineering.api.tool.ChemthrowerHandler.ChemthrowerEffect_RandomTeleport) Field(java.lang.reflect.Field) EntityCreeper(net.minecraft.entity.monster.EntityCreeper) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) Nullable(javax.annotation.Nullable)

Example 14 with EntityCreeper

use of net.minecraft.entity.monster.EntityCreeper 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());
        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 15 with EntityCreeper

use of net.minecraft.entity.monster.EntityCreeper 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).getCommandSenderName().toLowerCase())))) || entity instanceof EntityPigZombie || (entity instanceof EntityCreeper && ((EntityCreeper) entity).getPowered()))
            return false;
        EntityLightningBolt lightning = new EntityLightningBolt(worldObj, entity.posX, entity.posY, entity.posZ);
        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)

Aggregations

EntityCreeper (net.minecraft.entity.monster.EntityCreeper)15 EntityPlayer (net.minecraft.entity.player.EntityPlayer)11 EntityLightningBolt (net.minecraft.entity.effect.EntityLightningBolt)7 EntityItem (net.minecraft.entity.item.EntityItem)6 TileEntityOwnable (net.geforcemods.securitycraft.tileentity.TileEntityOwnable)5 EntityLivingBase (net.minecraft.entity.EntityLivingBase)4 EntitySkeleton (net.minecraft.entity.monster.EntitySkeleton)3 ItemStack (net.minecraft.item.ItemStack)3 Block (net.minecraft.block.Block)2 EntityZombie (net.minecraft.entity.monster.EntityZombie)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 PotionEffect (net.minecraft.potion.PotionEffect)2 World (net.minecraft.world.World)2 ChemthrowerEffect_Damage (blusunrize.immersiveengineering.api.tool.ChemthrowerHandler.ChemthrowerEffect_Damage)1 ChemthrowerEffect_Potion (blusunrize.immersiveengineering.api.tool.ChemthrowerHandler.ChemthrowerEffect_Potion)1 ChemthrowerEffect_RandomTeleport (blusunrize.immersiveengineering.api.tool.ChemthrowerHandler.ChemthrowerEffect_RandomTeleport)1 Cube (com.builtbroken.mc.imp.transform.region.Cube)1 Pos (com.builtbroken.mc.imp.transform.vector.Pos)1 EntityExplosive (icbm.classic.content.entity.EntityExplosive)1 Field (java.lang.reflect.Field)1