mirror of
https://gitlab.bixilon.de/bixilon/pixlyzer.git
synced 2025-09-26 13:40:02 -04:00
generate biome categories
This commit is contained in:
parent
a494adccb6
commit
c23a271ae7
@ -13,6 +13,8 @@ object Generators {
|
|||||||
CatVariantGenerator,
|
CatVariantGenerator,
|
||||||
FrogVariantGenerator,
|
FrogVariantGenerator,
|
||||||
|
|
||||||
|
BiomeCategoryGenerator,
|
||||||
|
|
||||||
EntityDataDataTypeGenerator,
|
EntityDataDataTypeGenerator,
|
||||||
MiscGenerator,
|
MiscGenerator,
|
||||||
ContainerTypeGenerator,
|
ContainerTypeGenerator,
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package de.bixilon.pixlyzer.generator.generators
|
||||||
|
|
||||||
|
import de.bixilon.pixlyzer.generator.Generator
|
||||||
|
import de.bixilon.pixlyzer.util.ReflectionUtil.getClass
|
||||||
|
|
||||||
|
object BiomeCategoryGenerator : Generator(
|
||||||
|
"biome_categories",
|
||||||
|
allowEmpty = true,
|
||||||
|
) {
|
||||||
|
private val CATEGORY_CLASS = getClass("net.minecraft.world.biome.Biome\$Category")
|
||||||
|
|
||||||
|
override fun generate() {
|
||||||
|
val categories = CATEGORY_CLASS?.enumConstants ?: return
|
||||||
|
for (biomeCategory in categories) {
|
||||||
|
check(biomeCategory is Enum<*>)
|
||||||
|
data[biomeCategory.ordinal] = mutableMapOf("name" to biomeCategory.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -20,9 +20,15 @@ object BiomeGenerator : Generator(
|
|||||||
for ((resourceLocation, id, biome) in getBiomes()) {
|
for ((resourceLocation, id, biome) in getBiomes()) {
|
||||||
val biomeData: MutableMap<Any, Any> = mutableMapOf(
|
val biomeData: MutableMap<Any, Any> = mutableMapOf(
|
||||||
"id" to id,
|
"id" to id,
|
||||||
"water_color" to biome.getWaterColor(), // do not cleanuo!
|
"water_color" to biome.getWaterColor(), // do not clean up!
|
||||||
"water_fog_color" to biome.getWaterFogColor(), // do not cleanuo!
|
"water_fog_color" to biome.getWaterFogColor(), // do not clean up!
|
||||||
)
|
)
|
||||||
|
|
||||||
|
getField(Biome::class.java, "category")?.get(biome)?.let {
|
||||||
|
check(it is Enum<*>)
|
||||||
|
biomeData["category"] = Enum::class.java.getDeclaredMethod("ordinal").apply { isAccessible = true }.invoke(it)
|
||||||
|
}
|
||||||
|
|
||||||
BIOME_DEPTH_FIELD?.let { biomeData["depth"] = it.getFloat(biome) }
|
BIOME_DEPTH_FIELD?.let { biomeData["depth"] = it.getFloat(biome) }
|
||||||
BIOME_SCALE_FIELD?.let { biomeData["scale"] = it.getFloat(biome) }
|
BIOME_SCALE_FIELD?.let { biomeData["scale"] = it.getFloat(biome) }
|
||||||
|
|
||||||
|
@ -152,7 +152,6 @@ object DimensionGenerator : Generator(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (exception: Exception) {
|
} catch (exception: Exception) {
|
||||||
exception.printStackTrace()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (types.isEmpty()) {
|
if (types.isEmpty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user