Search in sources :

Example 1 with BiomeInfectedBadlands

use of stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeInfectedBadlands in project MorePlanets by SteveKunG.

the class WorldTickEventHandler method onWeatherTick.

@SubscribeEvent
public void onWeatherTick(WeatherTickEvent event) {
    World world = event.getWorld();
    BlockPos pos = event.getStrikePos();
    if (DimensionManager.getWorld(ConfigManagerMP.moreplanets_dimension.idDimensionDiona) != null) {
        if (world.provider instanceof WorldProviderDiona) {
            if (this.canBeamStrike(world, pos) && world.rand.nextInt(75000) == 0) {
                if (world.isBlockLoaded(pos)) {
                    EntityAlienBeam beam = new EntityAlienBeam(world, pos.getX(), pos.getY(), pos.getZ());
                    beam.spawnWeather();
                }
            }
        }
    }
    if (DimensionManager.getWorld(ConfigManagerMP.moreplanets_dimension.idDimensionNibiru) != null) {
        if (world.provider instanceof WorldProviderNibiru) {
            boolean raining = world.isRaining();
            boolean thunder = world.isThundering();
            Biome biome = world.getBiome(pos);
            if (world.provider.canDoLightning(event.getChunk()) && raining && thunder && world.rand.nextInt(1000) == 0) {
                if (world.isRainingAt(pos)) {
                    EntityNibiruLightningBolt boltFire = new EntityNibiruLightningBolt(world, pos.getX(), pos.getY(), pos.getZ(), true);
                    boltFire.spawnWeather();
                }
            }
            if (world.rand.nextInt(16) == 0) {
                BlockPos pos1 = pos.down();
                if (world.isAreaLoaded(pos1, 1)) {
                    if (world.canBlockFreezeNoWater(pos1)) {
                        world.setBlockState(pos1, MPBlocks.INFECTED_ICE.getDefaultState());
                    }
                }
                if (raining) {
                    if (world.canSnowAt(pos, true)) {
                        world.setBlockState(pos, biome == MPBiomes.COLD_GREEN_VEIN_MOUTAINS ? MPBlocks.PURIFIED_SNOW_LAYER.getDefaultState() : MPBlocks.INFECTED_SNOW_LAYER.getDefaultState());
                    }
                    if (world.getBiome(pos1).canRain()) {
                        world.getBlockState(pos1).getBlock().fillWithRain(world, pos1);
                    }
                }
            }
            if (biome instanceof BiomeInfectedDesert || biome instanceof BiomeInfectedMountains || biome instanceof BiomeInfectedBadlands) {
                if (world.rand.nextInt(250000) == 0) {
                    EntityNibiruLightningBolt bolt = new EntityNibiruLightningBolt(world, pos.getX(), pos.getY(), pos.getZ(), false);
                    bolt.spawnWeather();
                }
            }
        }
    }
}
Also used : BiomeInfectedMountains(stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeInfectedMountains) WorldProviderDiona(stevekung.mods.moreplanets.planets.diona.dimension.WorldProviderDiona) Biome(net.minecraft.world.biome.Biome) WorldProviderNibiru(stevekung.mods.moreplanets.planets.nibiru.dimension.WorldProviderNibiru) BiomeInfectedDesert(stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeInfectedDesert) BlockPos(net.minecraft.util.math.BlockPos) EntityAlienBeam(stevekung.mods.moreplanets.planets.diona.entity.EntityAlienBeam) EntityNibiruLightningBolt(stevekung.mods.moreplanets.planets.nibiru.entity.weather.EntityNibiruLightningBolt) World(net.minecraft.world.World) BiomeInfectedBadlands(stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeInfectedBadlands) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1 Biome (net.minecraft.world.biome.Biome)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 WorldProviderDiona (stevekung.mods.moreplanets.planets.diona.dimension.WorldProviderDiona)1 EntityAlienBeam (stevekung.mods.moreplanets.planets.diona.entity.EntityAlienBeam)1 WorldProviderNibiru (stevekung.mods.moreplanets.planets.nibiru.dimension.WorldProviderNibiru)1 EntityNibiruLightningBolt (stevekung.mods.moreplanets.planets.nibiru.entity.weather.EntityNibiruLightningBolt)1 BiomeInfectedBadlands (stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeInfectedBadlands)1 BiomeInfectedDesert (stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeInfectedDesert)1 BiomeInfectedMountains (stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeInfectedMountains)1