Search in sources :

Example 6 with BiomeInfo

use of org.blockartistry.DynSurround.registry.BiomeInfo in project DynamicSurroundings by OreCruncher.

the class RainSplashAccent method provide.

@Override
@Nonnull
public ObjectArray<IAcoustic> provide(@Nonnull final EntityLivingBase entity, @Nullable final BlockPos blockPos, @Nonnull final ObjectArray<IAcoustic> in) {
    if (ModOptions.sound.enablePuddleSound && Weather.isRaining() && EnvironState.isPlayer(entity)) {
        if (blockPos != null) {
            this.mutable.setPos(blockPos.getX(), blockPos.getY() + 1, blockPos.getZ());
        } else {
            this.mutable.setPos(entity);
        }
        final World world = entity.getEntityWorld();
        final SeasonInfo season = ClientRegistry.SEASON.getData(world);
        final int precipHeight = season.getPrecipitationHeight(world, this.mutable).getY();
        if (precipHeight == this.mutable.getY()) {
            final BiomeInfo biome = ClientRegistry.BIOME.get(ClientChunkCache.INSTANCE.getBiome(this.mutable));
            if (biome.hasWeatherEffect() && !biome.getHasDust()) {
                this.mutable.setY(precipHeight);
                if (!season.canWaterFreeze(world, this.mutable))
                    in.addAll(AcousticsManager.SPLASH);
            }
        }
    }
    return in;
}
Also used : BiomeInfo(org.blockartistry.DynSurround.registry.BiomeInfo) SeasonInfo(org.blockartistry.DynSurround.registry.season.SeasonInfo) World(net.minecraft.world.World) Nonnull(javax.annotation.Nonnull)

Aggregations

BiomeInfo (org.blockartistry.DynSurround.registry.BiomeInfo)6 BlockPos (net.minecraft.util.math.BlockPos)4 World (net.minecraft.world.World)4 Nonnull (javax.annotation.Nonnull)3 Minecraft (net.minecraft.client.Minecraft)2 Entity (net.minecraft.entity.Entity)2 EntityLivingBase (net.minecraft.entity.EntityLivingBase)2 SeasonInfo (org.blockartistry.DynSurround.registry.season.SeasonInfo)2 Color (org.blockartistry.lib.Color)2 IBlockAccessEx (org.blockartistry.lib.chunk.IBlockAccessEx)2 TObjectFloatHashMap (gnu.trove.map.hash.TObjectFloatHashMap)1 IBlockState (net.minecraft.block.state.IBlockState)1 GameSettings (net.minecraft.client.settings.GameSettings)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 SoundEffect (org.blockartistry.DynSurround.client.sound.SoundEffect)1 ObjectArray (org.blockartistry.lib.collections.ObjectArray)1