use of net.minecraft.world.biome.BiomeGenBase in project BetterRain by OreCruncher.
the class StormSplashRenderer method addRainParticles.
public void addRainParticles(final EntityRenderer theThis) {
if (theThis.mc.gameSettings.particleSetting == 2)
return;
if (!DimensionRegistry.hasWeather(EnvironState.getWorld()))
return;
float rainStrengthFactor = theThis.mc.theWorld.getRainStrength(1.0F);
if (!theThis.mc.gameSettings.fancyGraphics)
rainStrengthFactor /= 2.0F;
if (rainStrengthFactor <= 0.0F)
return;
RANDOM.setSeed((long) theThis.rendererUpdateCount * 312987231L);
final Entity entity = theThis.mc.getRenderViewEntity();
final WorldClient worldclient = theThis.mc.theWorld;
final int playerX = MathHelper.floor_double(entity.posX);
final int playerY = MathHelper.floor_double(entity.posY);
final int playerZ = MathHelper.floor_double(entity.posZ);
double spawnX = 0.0D;
double spawnY = 0.0D;
double spawnZ = 0.0D;
int particlesSpawned = 0;
int particleCount = (int) (ModOptions.particleCountBase * rainStrengthFactor * rainStrengthFactor);
if (theThis.mc.gameSettings.particleSetting == 1)
particleCount >>= 1;
BlockPos.MutableBlockPos posXZ = new BlockPos.MutableBlockPos();
for (int j1 = 0; j1 < particleCount; ++j1) {
final int locX = playerX + RANDOM.nextInt(RANGE) - RANDOM.nextInt(RANGE);
final int locZ = playerZ + RANDOM.nextInt(RANGE) - RANDOM.nextInt(RANGE);
posXZ.set(locX, 0, locZ);
final BlockPos precipHeight = getPrecipitationHeight(worldclient, RANGE / 2, posXZ);
final BiomeGenBase biome = worldclient.getBiomeGenForCoords(posXZ);
final boolean hasDust = WeatherUtils.biomeHasDust(biome);
if (precipHeight.getY() <= playerY + RANGE && precipHeight.getY() >= playerY - RANGE && (hasDust || (BiomeRegistry.hasPrecipitation(biome) && biome.getFloatTemperature(precipHeight) >= 0.15F))) {
final Block block = worldclient.getBlockState(precipHeight.down()).getBlock();
final double posX = locX + RANDOM.nextFloat();
final double posY = precipHeight.getY() + 0.1F - block.getBlockBoundsMinY();
final double posZ = locZ + RANDOM.nextFloat();
final EntityFX particle = getBlockParticleFX(block, hasDust, worldclient, posX, posY, posZ);
if (particle != null)
theThis.mc.effectRenderer.addEffect(particle);
if (RANDOM.nextInt(++particlesSpawned) == 0) {
spawnX = posX;
spawnY = posY;
spawnZ = posZ;
}
}
}
if (particlesSpawned > 0 && RANDOM.nextInt(PARTICLE_SOUND_CHANCE) < theThis.rainSoundCounter++) {
theThis.rainSoundCounter = 0;
playSplashSound(theThis, worldclient, entity, spawnX, spawnY, spawnZ);
}
}
use of net.minecraft.world.biome.BiomeGenBase in project BetterRain by OreCruncher.
the class PlayerUtils method getPlayerBiome.
public static BiomeGenBase getPlayerBiome(final EntityPlayer player, final boolean getTrue) {
final int theX = MathHelper.floor_double(player.posX);
final int theY = MathHelper.floor_double(player.posY);
final int theZ = MathHelper.floor_double(player.posZ);
BiomeGenBase biome = player.worldObj.getBiomeGenForCoords(new BlockPos(theX, 0, theZ));
if (!getTrue) {
if (isUnderWater(player)) {
if (REGEX_DEEP_OCEAN.matcher(biome.biomeName).matches())
biome = BiomeRegistry.UNDERDEEPOCEAN;
else if (REGEX_OCEAN.matcher(biome.biomeName).matches())
biome = BiomeRegistry.UNDEROCEAN;
else if (REGEX_RIVER.matcher(biome.biomeName).matches())
biome = BiomeRegistry.UNDERRIVER;
else
biome = BiomeRegistry.UNDERWATER;
} else if (isUnderGround(player, INSIDE_Y_ADJUST))
biome = BiomeRegistry.UNDERGROUND;
else if (theY >= DimensionRegistry.getSpaceHeight(player.worldObj))
biome = BiomeRegistry.OUTERSPACE;
else if (theY >= DimensionRegistry.getCloudHeight(player.worldObj))
biome = BiomeRegistry.CLOUDS;
}
return biome;
}
use of net.minecraft.world.biome.BiomeGenBase in project MineFactoryReloaded by powercrystals.
the class MineFactoryReloadedWorldGen method generate.
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
if (_blacklistedDimensions == null) {
_blacklistedDimensions = buildBlacklistedDimensions();
}
if (_blacklistedDimensions.contains(world.provider.dimensionId)) {
return;
}
int x = chunkX * 16 + random.nextInt(16);
int z = chunkZ * 16 + random.nextInt(16);
BiomeGenBase b = world.getBiomeGenForCoords(x, z);
if (MFRConfig.rubberTreeWorldGen.getBoolean(true)) {
if (MFRRegistry.getRubberTreeBiomes().contains(b.biomeName)) {
if (random.nextInt(100) < 40) {
new WorldGenRubberTree().generate(world, random, x, random.nextInt(3) + 4, z);
}
}
}
if (MFRConfig.mfrLakeWorldGen.getBoolean(true) && world.provider.canRespawnHere()) {
if (random.nextInt(MFRConfig.mfrLakeSludgeRarity.getInt()) == 0) {
int lakeX = x - 8 + random.nextInt(16);
int lakeY = random.nextInt(128);
int lakeZ = z - 8 + random.nextInt(16);
new WorldGenLakesMeta(MineFactoryReloadedCore.sludgeLiquid.blockID, 7).generate(world, random, lakeX, lakeY, lakeZ);
}
if (random.nextInt(MFRConfig.mfrLakeSewageRarity.getInt()) == 0) {
int lakeX = x - 8 + random.nextInt(16);
int lakeY = random.nextInt(128);
int lakeZ = z - 8 + random.nextInt(16);
if (b.biomeName.toLowerCase().contains("mushroom")) {
new WorldGenLakesMeta(MineFactoryReloadedCore.mushroomSoupLiquid.blockID, 7).generate(world, random, lakeX, lakeY, lakeZ);
} else {
new WorldGenLakesMeta(MineFactoryReloadedCore.sewageLiquid.blockID, 7).generate(world, random, lakeX, lakeY, lakeZ);
}
}
}
}
use of net.minecraft.world.biome.BiomeGenBase in project ForestryMC by ForestryMC.
the class TileBeehouse method updateBiome.
public void updateBiome() {
if (worldObj != null) {
BiomeGenBase biome = Utils.getBiomeAt(worldObj, xCoord, zCoord);
if (biome != null) {
this.biome = biome;
setErrorState(EnumErrorCode.OK);
}
}
}
use of net.minecraft.world.biome.BiomeGenBase in project ForestryMC by ForestryMC.
the class ItemHabitatLocator method onUpdate.
@Override
public void onUpdate(ItemStack p_77663_1_, World world, Entity player, int p_77663_4_, boolean p_77663_5_) {
if (!Proxies.common.isSimulating(world)) {
return;
}
if (this.searchCenter == null) {
this.searchCenter = new Vect((int) player.posX, (int) player.posY, (int) player.posZ);
BiomeGenBase currentBiome = world.getBiomeGenForCoords(searchCenter.x, searchCenter.z);
removeInvalidBiomes(currentBiome, biomesToSearch);
}
if (biomesToSearch.isEmpty()) {
return;
}
// once we've found the biome, slow down to conserve cpu and network data
if (biomeFound && world.getTotalWorldTime() % 20 != 0) {
return;
}
ChunkCoordinates target = findNearestBiome(player, biomesToSearch);
// send an update if we find the biome
if (target != null) {
Proxies.common.setHabitatLocatorCoordinates(player, target);
biomeFound = true;
}
}
Aggregations