use of com.almuradev.almura.feature.biome.BiomeChunk in project Almura by AlmuraDev.
the class MixinWorld method redirectCanSnowAt.
@Redirect(method = "isRainingAt", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;canSnowAt(Lnet/minecraft/util/math/BlockPos;Z)Z"))
private boolean redirectCanSnowAt(World world, BlockPos pos, boolean checkLight) {
final BiomeChunk biomeChunk = BiomeUtil.getChunk(pos);
if (biomeChunk == null) {
return world.canSnowAt(pos, checkLight);
}
final Biome biome = world.getBiome(pos);
final float temperature = biomeChunk.getTemperature(pos, biome);
return temperature < 0.15f;
}
use of com.almuradev.almura.feature.biome.BiomeChunk in project Almura by AlmuraDev.
the class MixinBiomeColorHelper method getColorAtPos.
/**
* @author Zidane - Chris Sanders
* @reason Have water respect our config
*/
@Overwrite
private static int getColorAtPos(IBlockAccess blockAccess, BlockPos pos, BiomeColorHelper.ColorResolver colorResolver) {
int i = 0;
int j = 0;
int k = 0;
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(pos.add(-1, 0, -1), pos.add(1, 0, 1))) {
final Biome biome = blockAccess.getBiome(blockpos$mutableblockpos);
int l;
if (colorResolver == BiomeColorHelper.WATER_COLOR) {
final BiomeChunk biomeChunk = BiomeUtil.getChunk(blockpos$mutableblockpos);
if (biomeChunk == null) {
l = colorResolver.getColorAtPos(biome, blockpos$mutableblockpos);
} else {
l = biomeChunk.getWaterColor(pos, biome);
}
} else {
l = colorResolver.getColorAtPos(biome, blockpos$mutableblockpos);
}
i += (l & 16711680) >> 16;
j += (l & 65280) >> 8;
k += l & 255;
}
return (i / 9 & 255) << 16 | (j / 9 & 255) << 8 | k / 9 & 255;
}
use of com.almuradev.almura.feature.biome.BiomeChunk in project Almura by AlmuraDev.
the class MixinBiome method getGrassColorAtPos.
/**
* @author Zidane - Chris Sanders
* @reason Have Grass color use temperature/rainfall.
*/
@Overwrite
@SideOnly(Side.CLIENT)
public int getGrassColorAtPos(BlockPos pos) {
final BiomeChunk chunk = BiomeUtil.getChunk(pos);
float temperature;
float rainfall;
if (chunk == null) {
temperature = ((Biome) (Object) this).getTemperature(pos);
rainfall = ((Biome) (Object) this).getRainfall();
} else {
temperature = chunk.getTemperature(pos, (Biome) (Object) this);
rainfall = chunk.getRainfall(pos, (Biome) (Object) this);
}
double d0 = (double) MathHelper.clamp(temperature, 0.0F, 1.0F);
double d1 = (double) MathHelper.clamp(rainfall, 0.0F, 1.0F);
return ((Biome) (Object) this).getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(d0, d1));
}
use of com.almuradev.almura.feature.biome.BiomeChunk in project Almura by AlmuraDev.
the class MixinBiome method getFoliageColorAtPos.
/**
* @author Zidane - Chris Sanders
* @reason Have Foilage color use temperature/rainfall.
*/
@Overwrite
@SideOnly(Side.CLIENT)
public int getFoliageColorAtPos(BlockPos pos) {
final BiomeChunk chunk = BiomeUtil.getChunk(pos);
float temperature;
float rainfall;
if (chunk == null) {
temperature = ((Biome) (Object) this).getTemperature(pos);
rainfall = ((Biome) (Object) this).getRainfall();
} else {
temperature = chunk.getTemperature(pos, (Biome) (Object) this);
rainfall = chunk.getRainfall(pos, (Biome) (Object) this);
}
double d0 = (double) MathHelper.clamp(temperature, 0.0F, 1.0F);
double d1 = (double) MathHelper.clamp(rainfall, 0.0F, 1.0F);
return ((Biome) (Object) this).getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1));
}
Aggregations