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