mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 11:24:56 -04:00
replace BiomePrecipitation.NONE ang GrassColorModifiers.NONE with null
This commit is contained in:
parent
4ffd4b6470
commit
f9d9325384
@ -59,6 +59,8 @@ abstract class RegistryLoadingTest(val versionName: String) {
|
||||
fun biome() {
|
||||
if (version >= V_1_17) throw SkipException("Biomes are datapack only")
|
||||
|
||||
assertNotNull(registries.biome[minecraft("plains")]?.identifier)
|
||||
val plains = registries.biome[minecraft("plains")]!!
|
||||
assertEquals(plains.temperature, 0.8f)
|
||||
assertEquals(plains.downfall, 0.4f)
|
||||
}
|
||||
}
|
||||
|
@ -32,9 +32,9 @@ data class Biome(
|
||||
val fogColor: RGBColor? = null,
|
||||
val waterColor: RGBColor?,
|
||||
val waterFogColor: RGBColor?,
|
||||
val precipitation: BiomePrecipitation,
|
||||
val precipitation: BiomePrecipitation?,
|
||||
) : RegistryItem() {
|
||||
val grassColorModifier = GrassColorModifiers.BIOME_MAP[identifier] ?: GrassColorModifiers.NONE
|
||||
val grassColorModifier = GrassColorModifiers.BIOME_MAP[identifier]
|
||||
val temperatureColorMapCoordinate = getColorMapCoordinate(temperature)
|
||||
val downfallColorMapCoordinate = getColorMapCoordinate(downfall * temperature)
|
||||
val colorMapPixelIndex = downfallColorMapCoordinate shl 8 or temperatureColorMapCoordinate
|
||||
@ -70,7 +70,7 @@ data class Biome(
|
||||
fogColor = fogColor,
|
||||
waterColor = waterColor,
|
||||
waterFogColor = waterFogColor,
|
||||
precipitation = data["precipitation"]?.let { BiomePrecipitation[it] } ?: BiomePrecipitation.NONE,
|
||||
precipitation = data["precipitation"]?.let { BiomePrecipitation[it] },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -17,7 +17,6 @@ import de.bixilon.kutil.enums.EnumUtil
|
||||
import de.bixilon.kutil.enums.ValuesEnum
|
||||
|
||||
enum class BiomePrecipitation {
|
||||
NONE,
|
||||
RAIN,
|
||||
SNOW,
|
||||
;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -17,7 +17,6 @@ import de.bixilon.kutil.enums.EnumUtil
|
||||
import de.bixilon.kutil.enums.ValuesEnum
|
||||
|
||||
enum class GrassColorModifiers {
|
||||
NONE,
|
||||
DARK_FOREST,
|
||||
SWAMP,
|
||||
;
|
||||
|
@ -35,16 +35,16 @@ class WeatherOverlay(private val context: RenderContext) : Overlay {
|
||||
private val config = context.connection.profiles.rendering.overlay.weather
|
||||
private val rain = context.textures.staticTextures.createTexture(RAIN)
|
||||
private val snow = context.textures.staticTextures.createTexture(SNOW)
|
||||
private val precipitation get() = context.connection.player.physics.positionInfo.biome?.precipitation ?: BiomePrecipitation.NONE
|
||||
private val precipitation get() = context.connection.player.physics.positionInfo.biome?.precipitation
|
||||
override val render: Boolean
|
||||
get() = world.dimension.effects.weather && world.weather.raining && when (precipitation) { // ToDo: Check if exposed to the sky
|
||||
BiomePrecipitation.NONE -> false
|
||||
null -> false
|
||||
BiomePrecipitation.RAIN -> config.rain
|
||||
BiomePrecipitation.SNOW -> config.snow
|
||||
}
|
||||
private val texture: Texture?
|
||||
get() = when (precipitation) {
|
||||
BiomePrecipitation.NONE -> null
|
||||
null -> null
|
||||
BiomePrecipitation.RAIN -> rain
|
||||
BiomePrecipitation.SNOW -> snow
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class GrassTintCalculator : TintProvider {
|
||||
val color = getColor(biome.colorMapPixelIndex)
|
||||
|
||||
return when (biome.grassColorModifier) {
|
||||
GrassColorModifiers.NONE -> color
|
||||
null -> color
|
||||
GrassColorModifiers.SWAMP -> 0x6A7039 // ToDo: Biome noise is applied here
|
||||
GrassColorModifiers.DARK_FOREST -> (color and 0xFEFEFE) + 0x28340A shr 1
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user