Search in sources :

Example 1 with Vector3d

use of com.mojang.math.Vector3d in project MinecraftForge by MinecraftForge.

the class IBlockRenderProperties method getFogColor.

/**
 * NOT CURRENTLY IMPLEMENTED
 * <p>
 * Use this to change the fog color used when the entity is "inside" a material.
 * Vec3d is used here as "r/g/b" 0 - 1 values.
 *
 * @param Level         The Level.
 * @param pos           The position at the entity viewport.
 * @param state         The state at the entity viewport.
 * @param entity        the entity
 * @param originalColor The current fog color, You are not expected to use this, Return as the default if applicable.
 * @return The new fog color.
 */
default Vector3d getFogColor(BlockState state, LevelReader Level, BlockPos pos, Entity entity, Vector3d originalColor, float partialTicks) {
    if (state.getMaterial() == Material.WATER) {
        float f12 = 0.0F;
        if (entity instanceof LivingEntity) {
            LivingEntity ent = (LivingEntity) entity;
            f12 = (float) EnchantmentHelper.getRespiration(ent) * 0.2F;
            if (ent.hasEffect(MobEffects.WATER_BREATHING)) {
                f12 = f12 * 0.3F + 0.6F;
            }
        }
        return new Vector3d(0.02F + f12, 0.02F + f12, 0.2F + f12);
    } else if (state.getMaterial() == Material.LAVA) {
        return new Vector3d(0.6F, 0.1F, 0.0F);
    }
    return originalColor;
}
Also used : LivingEntity(net.minecraft.world.entity.LivingEntity) Vector3d(com.mojang.math.Vector3d)

Aggregations

Vector3d (com.mojang.math.Vector3d)1 LivingEntity (net.minecraft.world.entity.LivingEntity)1