Java Code Examples for net.minecraft.world.World#addWeatherEffect()
The following examples show how to use
net.minecraft.world.World#addWeatherEffect() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: CommunityMod File: LexWand.java License: GNU Lesser General Public License v2.1 | 5 votes |
@Override public void onAltarAction(World world, BlockPos pos) { List<Entity> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AOE.offset(pos)); if (entities.isEmpty()) return; Entity entity = entities.get(world.rand.nextInt(entities.size())); world.getEntitiesWithinAABB(EntityPlayer.class, AOE.grow(6).offset(pos)).forEach((player) -> { player.sendMessage(new TextComponentString(getBanMsg(entity, world.rand))); }); BlockPos entityPos = entity.getPosition(); world.addWeatherEffect(new EntityLightningBolt(world, entityPos.getX(), entityPos.getY(), entityPos.getZ(), false)); }
Example 2
Source Project: AdvancedRocketry File: BlockElectricMushroom.java License: MIT License | 5 votes |
@Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { if(!world.isRemote && Configuration.electricPlantsSpawnLightning && world.isRaining() && world.getBiome(pos) == AdvancedRocketryBiomes.stormLandsBiome) { int lightningX = pos.getX() + rand.nextInt(24) - 12; int lightningZ = pos.getZ() + rand.nextInt(24) - 12; BlockPos lightning = new BlockPos(lightningX, 0, lightningZ ); lightning = world.getTopSolidOrLiquidBlock(lightning); world.addWeatherEffect(new EntityLightningBolt(world, lightning.getX(), lightning.getY(), lightning.getZ(), true)); } }
Example 3
Source Project: PneumaticCraft File: BlockLightningPlant.java License: GNU General Public License v3.0 | 5 votes |
@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); } } }
Example 4
Source Project: Gadomancy File: AuraEffects.java License: GNU Lesser General Public License v3.0 | 4 votes |
@Override public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) { int highestY = world.getTopSolidOrLiquidBlock(selectedBlock.posX, selectedBlock.posZ); EntityLightningBolt entityLightning = new EntityLightningBolt(world, selectedBlock.posX + 0.5, highestY, selectedBlock.posZ + 0.5); world.addWeatherEffect(entityLightning); }