Merge branch 'kotlin-1.8' into kotlin-1.9
This commit is contained in:
@@ -2,7 +2,7 @@ apply plugin: "net.minecraftforge.gradle.forge"
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
group = 'com.github.octarine-noise'
|
||||
version = "2.0.8"
|
||||
version = "2.0.9"
|
||||
archivesBaseName = rootProject.name + '-MC1.9'
|
||||
|
||||
buildscript {
|
||||
|
||||
@@ -18,7 +18,7 @@ class RenderAlgae : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
val noise = simplexNoise()
|
||||
|
||||
val algaeIcons = iconSet(BetterFoliageMod.LEGACY_DOMAIN, "blocks/better_algae_%d")
|
||||
val algaeModels = modelSet(64, RenderGrass.grassTopQuads)
|
||||
val algaeModels = modelSet(64, RenderGrass.grassTopQuads(Config.algae.heightMin, Config.algae.heightMax))
|
||||
|
||||
override fun afterStitch() {
|
||||
Client.log(INFO, "Registered ${algaeIcons.num} algae textures")
|
||||
|
||||
@@ -45,7 +45,7 @@ class RenderCoral : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
override fun isEligible(ctx: BlockContext) =
|
||||
Config.enabled && Config.coral.enabled &&
|
||||
ctx.cameraDistance < Config.coral.distance &&
|
||||
ctx.blockState(up2).material == Material.water &&
|
||||
(ctx.blockState(up2).material == Material.water || Config.coral.shallowWater) &&
|
||||
ctx.blockState(up1).material == Material.water &&
|
||||
Config.blocks.sand.matchesID(ctx.block) &&
|
||||
ctx.biomeId in Config.coral.biomes &&
|
||||
|
||||
@@ -21,9 +21,9 @@ import org.apache.logging.log4j.Level.INFO
|
||||
class RenderGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
|
||||
companion object {
|
||||
@JvmStatic val grassTopQuads: Model.(Int)->Unit = { modelIdx ->
|
||||
@JvmStatic fun grassTopQuads(heightMin: Double, heightMax: Double): Model.(Int)->Unit = { modelIdx ->
|
||||
verticalRectangle(x1 = -0.5, z1 = 0.5, x2 = 0.5, z2 = -0.5, yBottom = 0.5,
|
||||
yTop = 0.5 + random(Config.shortGrass.heightMin, Config.shortGrass.heightMax)
|
||||
yTop = 0.5 + random(heightMin, heightMax)
|
||||
)
|
||||
.setAoShader(faceOrientedAuto(overrideFace = UP, corner = cornerAo(Axis.Y)))
|
||||
.setFlatShader(faceOrientedAuto(overrideFace = UP, corner = cornerFlat))
|
||||
@@ -36,7 +36,7 @@ class RenderGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
val normalGenIcon = iconStatic(Client.genGrass.generatedResource("minecraft:blocks/tallgrass", "snowed" to false))
|
||||
val snowedGenIcon = iconStatic(Client.genGrass.generatedResource("minecraft:blocks/tallgrass", "snowed" to true))
|
||||
|
||||
val grassModels = modelSet(64, grassTopQuads)
|
||||
val grassModels = modelSet(64, grassTopQuads(Config.shortGrass.heightMin, Config.shortGrass.heightMax))
|
||||
|
||||
override fun afterStitch() {
|
||||
Client.log(INFO, "Registered ${normalIcons.num} grass textures")
|
||||
|
||||
@@ -16,6 +16,8 @@ import net.minecraft.util.EnumFacing.*
|
||||
|
||||
class RenderLog : AbstractRenderColumn(BetterFoliageMod.MOD_ID) {
|
||||
|
||||
override val moveToCutout: Boolean get() = false
|
||||
|
||||
override fun isEligible(ctx: BlockContext) =
|
||||
Config.enabled && Config.roundLogs.enabled &&
|
||||
ctx.cameraDistance < Config.roundLogs.distance &&
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.apache.logging.log4j.Level.INFO
|
||||
class RenderMycelium : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
|
||||
val myceliumIcon = iconSet(BetterFoliageMod.LEGACY_DOMAIN, "blocks/better_mycel_%d")
|
||||
val myceliumModel = modelSet(64, RenderGrass.grassTopQuads)
|
||||
val myceliumModel = modelSet(64, RenderGrass.grassTopQuads(Config.shortGrass.heightMin, Config.shortGrass.heightMax))
|
||||
|
||||
override fun afterStitch() {
|
||||
Client.log(INFO, "Registered ${myceliumIcon.num} mycelium textures")
|
||||
|
||||
@@ -18,10 +18,25 @@ class GrassGenerator(domain: String) : TextureGenerator(domain) {
|
||||
|
||||
val baseTexture = resourceManager[target.second]?.loadImage() ?: return null
|
||||
|
||||
// draw bottom half of texture
|
||||
val result = BufferedImage(baseTexture.width, baseTexture.height, BufferedImage.TYPE_4BYTE_ABGR)
|
||||
val graphics = result.createGraphics()
|
||||
graphics.drawImage(baseTexture, 0, 3 * baseTexture.height / 8, null)
|
||||
|
||||
val size = baseTexture.width
|
||||
val frames = baseTexture.height / size
|
||||
|
||||
// iterate all frames
|
||||
for (frame in 0 .. frames - 1) {
|
||||
val baseFrame = baseTexture.getSubimage(0, size * frame, size, size)
|
||||
val grassFrame = BufferedImage(size, size, BufferedImage.TYPE_4BYTE_ABGR)
|
||||
|
||||
// draw bottom half of texture
|
||||
grassFrame.createGraphics().apply {
|
||||
drawImage(baseFrame, 0, 3 * size / 8, null)
|
||||
}
|
||||
|
||||
// add to animated png
|
||||
graphics.drawImage(grassFrame, 0, size * frame, null)
|
||||
}
|
||||
|
||||
// blend with white if snowed
|
||||
if (isSnowed && target.first == ResourceType.COLOR) {
|
||||
|
||||
@@ -33,7 +33,7 @@ val blockColors = ThreadLocal<BlockColors>()
|
||||
|
||||
abstract class AbstractBlockRenderingHandler(modId: String) : ResourceHandler(modId) {
|
||||
|
||||
val moveToCutout: Boolean get() = true
|
||||
open val moveToCutout: Boolean get() = true
|
||||
|
||||
// ============================
|
||||
// Custom rendering
|
||||
|
||||
Reference in New Issue
Block a user