use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.
the class WeatherRendererNibiru method addRainParticles.
private void addRainParticles(Minecraft mc) {
float f = mc.world.getRainStrength(1.0F);
if (!mc.gameSettings.fancyGraphics) {
f /= 2.0F;
}
if (f != 0.0F) {
this.random.setSeed(this.rendererUpdateCount * 312987231L);
Entity entity = mc.getRenderViewEntity();
World world = mc.world;
BlockPos blockpos = new BlockPos(entity);
int i = 10;
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
int j = 0;
int k = (int) (100.0F * f * f);
if (mc.gameSettings.particleSetting == 1) {
k >>= 1;
} else if (mc.gameSettings.particleSetting == 2) {
k = 0;
}
for (int l = 0; l < k; ++l) {
BlockPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.random.nextInt(i) - this.random.nextInt(i), 0, this.random.nextInt(i) - this.random.nextInt(i)));
Biome biomegenbase = world.getBiome(blockpos1);
BlockPos blockpos2 = blockpos1.down();
if (blockpos1.getY() <= blockpos.getY() + i && blockpos1.getY() >= blockpos.getY() - i && biomegenbase.canRain() && biomegenbase.getTemperature(blockpos1) >= 0.15F) {
double d3 = this.random.nextDouble();
double d4 = this.random.nextDouble();
AxisAlignedBB axisalignedbb = world.getBlockState(blockpos2).getBoundingBox(world, blockpos2);
if (world.getBlockState(blockpos2).getMaterial() == Material.LAVA) {
mc.world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, blockpos1.getX() + d3, blockpos1.getY() + 0.1F - axisalignedbb.minY, blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
} else if (world.getBlockState(blockpos2).getMaterial() != Material.AIR) {
++j;
if (this.random.nextInt(j) == 0) {
d0 = blockpos2.getX() + d3;
d1 = blockpos2.getY() + 0.1F + axisalignedbb.maxY - 1.0D;
d2 = blockpos2.getZ() + d4;
}
// TODO mc.effectRenderer.addEffect(new EntityInfectedRainFX(world, blockpos2.getX() + d3, blockpos2.getY() + 0.1F + block.getBlockBoundsMaxY(), blockpos2.getZ() + d4));
}
}
}
if (j > 0 && this.random.nextInt(3) < this.rainSoundCounter++) {
this.rainSoundCounter = 0;
if (d1 > blockpos.getY() + 1 && world.getPrecipitationHeight(blockpos).getY() > MathHelper.floor(blockpos.getY())) {
mc.world.playSound(d0, d1, d2, SoundEvents.WEATHER_RAIN_ABOVE, SoundCategory.WEATHER, 0.1F, 0.5F, false);
} else {
mc.world.playSound(d0, d1, d2, SoundEvents.WEATHER_RAIN, SoundCategory.WEATHER, 0.2F, 1.0F, false);
}
}
}
}
use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.
the class WorldProviderNibiru method canSnowAt.
@Override
public boolean canSnowAt(BlockPos pos, boolean checkLight) {
Biome biomegenbase = this.getBiomeForCoords(pos);
float f = biomegenbase.getTemperature(pos);
if (f > 0.15F) {
return false;
} else if (!checkLight) {
return true;
} else {
if (pos.getY() >= 0 && pos.getY() < 256 && this.world.getLightFor(EnumSkyBlock.BLOCK, pos) < 10) {
Block block = this.world.getBlockState(pos).getBlock();
if (block.isAir(this.world.getBlockState(pos), this.world, pos) && NibiruBlocks.INFECTED_SNOW_LAYER.canPlaceBlockAt(this.world, pos)) {
return true;
}
}
return false;
}
}
use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.
the class WorldProviderNibiru method canBlockFreeze.
@Override
public boolean canBlockFreeze(BlockPos pos, boolean byWater) {
Biome biomegenbase = this.getBiomeForCoords(pos);
float f = biomegenbase.getTemperature(pos);
if (f > 0.15F) {
return false;
} else {
if (pos.getY() >= 0 && pos.getY() < 256 && this.world.getLightFor(EnumSkyBlock.BLOCK, pos) < 10) {
IBlockState iblockstate = this.world.getBlockState(pos);
if (iblockstate == NibiruBlocks.INFECTED_WATER_FLUID_BLOCK.getDefaultState()) {
if (!byWater) {
return true;
}
boolean flag = this.isWater(pos.west()) && this.isWater(pos.east()) && this.isWater(pos.north()) && this.isWater(pos.south());
if (!flag) {
return true;
}
}
}
return false;
}
}
use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.
the class BiomeProviderNibiru method areBiomesViable.
@Override
public boolean areBiomesViable(int x, int z, int radius, List<Biome> allowed) {
IntCache.resetIntCache();
int i = x - radius >> 2;
int j = z - radius >> 2;
int k = x + radius >> 2;
int l = z + radius >> 2;
int i1 = k - i + 1;
int j1 = l - j + 1;
int[] aint = this.unzoomedBiomes.getInts(i, j, i1, j1);
for (int k1 = 0; k1 < i1 * j1; ++k1) {
Biome biomegenbase = Biome.getBiome(aint[k1]);
if (!allowed.contains(biomegenbase)) {
return false;
}
}
return true;
}
use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.
the class BiomeProviderNibiru method findBiomePosition.
@Override
public BlockPos findBiomePosition(int x, int z, int range, List<Biome> biomes, Random rand) {
IntCache.resetIntCache();
int i = x - range >> 2;
int j = z - range >> 2;
int k = x + range >> 2;
int l = z + range >> 2;
int i1 = k - i + 1;
int j1 = l - j + 1;
int[] aint = this.unzoomedBiomes.getInts(i, j, i1, j1);
BlockPos blockpos = null;
int k1 = 0;
for (int l1 = 0; l1 < i1 * j1; ++l1) {
int i2 = i + l1 % i1 << 2;
int j2 = j + l1 / i1 << 2;
Biome biomegenbase = Biome.getBiome(aint[l1]);
if (biomes.contains(biomegenbase) && (blockpos == null || rand.nextInt(k1 + 1) == 0)) {
blockpos = new BlockPos(i2, 0, j2);
++k1;
}
}
return blockpos;
}
Aggregations