mirror of
https://gitlab.bixilon.de/bixilon/pixlyzer.git
synced 2025-09-25 13:11:30 -04:00
biomes: add sky color (just the base color), blocks: fix tint color
This commit is contained in:
parent
40edfdffcc
commit
172651ce17
@ -33,10 +33,11 @@ object BiomeGenerator : Generator(
|
||||
|
||||
BIOME_SKY_COLOR_FIELD?.getInt(biome)?.let {
|
||||
biomeData.addProperty("sky_color", it)
|
||||
} ?: let {
|
||||
biomeData.addProperty("sky_color", SKY_COLOR_FUNCTION!!.invoke(biome, 0.0f) as Int)
|
||||
}
|
||||
|
||||
|
||||
|
||||
getField(Biome::class.java, "specialEffects")?.get(biome)?.let {
|
||||
FOG_COLOR_SPECIAL_EFFECTS_FIELD?.getInt(it)?.let {
|
||||
biomeData.addProperty("fog_color", it)
|
||||
@ -73,6 +74,12 @@ object BiomeGenerator : Generator(
|
||||
}
|
||||
}
|
||||
|
||||
private val SKY_COLOR_FUNCTION = try {
|
||||
Biome::class.java.getDeclaredMethod("getSkyColor", Float::class.java)
|
||||
} catch (exception: Exception) {
|
||||
null
|
||||
}
|
||||
|
||||
private val SPECIAL_EFFECTS_CLASS = getClass("net.minecraft.world.level.biome.BiomeSpecialEffects")
|
||||
private val CLIMATE_SETTINGS_CLASS = getClass("net.minecraft.world.level.biome.Biome\$ClimateSettings", "net.minecraft.world.level.biome.Biome", "net.minecraft.world.biome.Biome")!!
|
||||
|
||||
|
@ -127,7 +127,8 @@ object BlockGenerator : Generator(
|
||||
}
|
||||
|
||||
val hasColorProperties = (TINT_PROPERTIES_METHOD?.invoke(DEFAULT_BLOCK_COLORS, block) as Set<*>?)?.size?.let { it > 0 } ?: let {
|
||||
true
|
||||
val blockColorProviderList = BLOCK_COLORS_PROVIDERS_ID_LIST!!.get(DEFAULT_BLOCK_COLORS) as IdList<Any>
|
||||
blockColorProviderList.get(Registry.BLOCK.getRawId(block)) != null
|
||||
}
|
||||
|
||||
val states = JsonObject()
|
||||
@ -199,10 +200,9 @@ object BlockGenerator : Generator(
|
||||
try {
|
||||
if (hasColorProperties) {
|
||||
val tintColor = DEFAULT_BLOCK_COLORS.getColor(state, null, null)
|
||||
if (tintColor == -1) {
|
||||
throw IllegalStateException()
|
||||
if (tintColor != -1 && tintColor != 0) {
|
||||
stateData.addProperty("tint_color", tintColor)
|
||||
}
|
||||
stateData.addProperty("tint_color", tintColor)
|
||||
}
|
||||
} catch (exception: Exception) {
|
||||
}
|
||||
@ -332,6 +332,8 @@ object BlockGenerator : Generator(
|
||||
}
|
||||
}
|
||||
|
||||
private val BLOCK_COLORS_PROVIDERS_ID_LIST = getField(BlockColors::class.java, "providers")
|
||||
|
||||
private val TINT_PROPERTIES_METHOD = try {
|
||||
BlockColors::class.java.getDeclaredMethod("method_21592")
|
||||
} catch (exception: Exception) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user