Search in sources :

Example 1 with BiomeChunk

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;
}
Also used : Biome(net.minecraft.world.biome.Biome) BiomeChunk(com.almuradev.almura.feature.biome.BiomeChunk) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Example 2 with BiomeChunk

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;
}
Also used : Biome(net.minecraft.world.biome.Biome) BiomeChunk(com.almuradev.almura.feature.biome.BiomeChunk) BlockPos(net.minecraft.util.math.BlockPos) Overwrite(org.spongepowered.asm.mixin.Overwrite)

Example 3 with BiomeChunk

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));
}
Also used : Biome(net.minecraft.world.biome.Biome) BiomeChunk(com.almuradev.almura.feature.biome.BiomeChunk) Overwrite(org.spongepowered.asm.mixin.Overwrite) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with BiomeChunk

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));
}
Also used : Biome(net.minecraft.world.biome.Biome) BiomeChunk(com.almuradev.almura.feature.biome.BiomeChunk) Overwrite(org.spongepowered.asm.mixin.Overwrite) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

BiomeChunk (com.almuradev.almura.feature.biome.BiomeChunk)4 Biome (net.minecraft.world.biome.Biome)4 Overwrite (org.spongepowered.asm.mixin.Overwrite)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 BlockPos (net.minecraft.util.math.BlockPos)1 Redirect (org.spongepowered.asm.mixin.injection.Redirect)1