port until 19w46a

This commit is contained in:
Bixilon 2021-04-08 01:06:29 +02:00
parent 02e842a370
commit 6a0b10100a
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 12 additions and 3 deletions

View File

@ -17,7 +17,7 @@
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<minecraft.version>21w14a</minecraft.version>
<minecraft.version>1.15-pre3</minecraft.version>
</properties>
<repositories>

View File

@ -4,6 +4,7 @@ import com.google.gson.JsonObject
import de.bixilon.pixlyzer.generator.Generator
import de.bixilon.pixlyzer.util.ReflectionUtil.getClass
import de.bixilon.pixlyzer.util.ReflectionUtil.getField
import de.bixilon.pixlyzer.util.ReflectionUtil.getGetter
import net.minecraft.sound.SoundEvent
import net.minecraft.util.Identifier
import net.minecraft.util.math.BlockPos
@ -90,6 +91,8 @@ object BiomeGenerator : Generator(
if (!biomeData.has("sky_color")) {
BIOME_SKY_COLOR_FIELD?.getInt(biome)?.let {
biomeData.addProperty("sky_color", it)
} ?: let {
SKY_COLOR_GETTER?.invoke(biome)
} ?: let {
biomeData.addProperty("sky_color", SKY_COLOR_FUNCTION!!.invoke(biome, 0.0f) as Int)
}
@ -108,13 +111,18 @@ object BiomeGenerator : Generator(
private val FOLIAGE_COLOR_METHOD = try {
Biome::class.java.getMethod("getFoliageColor")
} catch (exception: Exception) {
null
try {
Biome::class.java.getMethod("getFoliageColorAt")
} catch (exception: Exception) {
null
}
}
private val GRASS_COLOR_OVERRIDE_METHOD = try {
Biome::class.java.getMethod("getGrassColorAt", BlockPos::class.java)
} catch (exception: Exception) {
null
}
private val SKY_COLOR_GETTER = getGetter(Biome::class.java, "getSkyColor")
private val SKY_COLOR_FUNCTION = try {
Biome::class.java.getDeclaredMethod("getSkyColor", Float::class.java)
@ -143,7 +151,7 @@ object BiomeGenerator : Generator(
private val DOWNFALL_FIELD = getField(CLIMATE_SETTINGS_CLASS, "downfall")!!
private val BIOME_SKY_COLOR_FIELD = getField(Biome::class.java, "skyColor")
private val BIOME_SKY_COLOR_FIELD = getField(Biome::class.java, "field_21806", "skyColor")
private val MUSIC_CLASS_EVENT_FIELD = getField(getClass("net.minecraft.sound.MusicSound"), "sound", "event")

View File

@ -161,6 +161,7 @@
"ABSORPTION_AMOUNT": "PLAYER_ABSORPTION_HEARTS",
"SCORE": "PLAYER_SCORE",
"PLAYER_MODEL_PARTS": "PLAYER_SKIN_PARTS_FLAGS",
"PLAYER_MODEL_BIT_MASK": "PLAYER_SKIN_PARTS_FLAGS",
"MAIN_ARM": "PLAYER_SKIN_MAIN_HAND",
"LEFT_SHOULDER_ENTITY": "PLAYER_LEFT_SHOULDER_DATA",
"RIGHT_SHOULDER_ENTITY": "PLAYER_RIGHT_SHOULDER_DATA"