Merge branch 'kotlin-1.8' into kotlin-1.8.8
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,3 +5,4 @@
|
||||
run/
|
||||
.gradle/
|
||||
build/
|
||||
classes/
|
||||
|
||||
@@ -6,7 +6,7 @@ version = "2.0.3"
|
||||
archivesBaseName = rootProject.name + '-MC1.8.x'
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.0.0-beta-4584'
|
||||
ext.kotlin_version = '1.0.0-beta-4589'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
@@ -34,6 +34,7 @@ dependencies {
|
||||
minecraft {
|
||||
version = '1.8.8-11.15.0.1655'
|
||||
mappings = 'stable_20'
|
||||
runDir = 'run'
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
||||
@@ -116,7 +116,7 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
|
||||
inline fun continous(q1: QuadrantType, q2: QuadrantType) =
|
||||
q1 == q2 || ((q1 == SQUARE || q1 == INVISIBLE) && (q2 == SQUARE || q2 == INVISIBLE))
|
||||
|
||||
abstract val axisFunc: (IBlockState)->EnumFacing.Axis
|
||||
abstract val axisFunc: (IBlockState)->EnumFacing.Axis?
|
||||
abstract val blockPredicate: (IBlockState)->Boolean
|
||||
|
||||
abstract val sideTexture: (ShadingContext, Int, Quad)->TextureAtlasSprite?
|
||||
@@ -131,7 +131,7 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
|
||||
modelRenderer.updateShading(Int3.zero, allFaces)
|
||||
|
||||
// check log neighborhood
|
||||
val logAxis = ctx.blockAxis
|
||||
val logAxis = ctx.blockAxis ?: return renderWorldBlockBase(ctx, dispatcher, renderer, layer)
|
||||
val baseRotation = rotationFromUp[(logAxis to AxisDirection.POSITIVE).face.ordinal]
|
||||
|
||||
val upType = ctx.blockType(baseRotation, logAxis, Int3(0, 1, 0))
|
||||
@@ -314,7 +314,7 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
|
||||
}
|
||||
|
||||
/** Get the axis of the block */
|
||||
val BlockContext.blockAxis: Axis get() = axisFunc(blockState(Int3.zero))
|
||||
val BlockContext.blockAxis: Axis? get() = axisFunc(blockState(Int3.zero))
|
||||
|
||||
/**
|
||||
* Get the type of the block at the given offset in a rotated reference frame.
|
||||
|
||||
@@ -18,7 +18,8 @@ fun Model.columnSide(radius: Double, yBottom: Double, yTop: Double, transform: (
|
||||
listOf(
|
||||
verticalRectangle(x1 = 0.0, z1 = 0.5, x2 = 0.5 - radius, z2 = 0.5, yBottom = yBottom, yTop = yTop)
|
||||
.clampUV(minU = 0.0, maxU = 0.5 - radius)
|
||||
.setAoShader(faceOrientedInterpolate(overrideFace = SOUTH)),
|
||||
.setAoShader(faceOrientedInterpolate(overrideFace = SOUTH))
|
||||
.setAoShader(faceOrientedAuto(corner = cornerAo(Axis.Y)), predicate = { v, vi -> vi == 1 || vi == 2}),
|
||||
|
||||
verticalRectangle(x1 = 0.5 - radius, z1 = 0.5, x2 = 0.5 - halfRadius, z2 = 0.5 - halfRadius, yBottom = yBottom, yTop = yTop)
|
||||
.clampUV(minU = 0.5 - radius)
|
||||
@@ -44,6 +45,7 @@ fun Model.columnSide(radius: Double, yBottom: Double, yTop: Double, transform: (
|
||||
verticalRectangle(x1 = 0.5, z1 = 0.5 - radius, x2 = 0.5, z2 = 0.0, yBottom = yBottom, yTop = yTop)
|
||||
.clampUV(minU = radius - 0.5, maxU = 0.0)
|
||||
.setAoShader(faceOrientedInterpolate(overrideFace = EAST))
|
||||
.setAoShader(faceOrientedAuto(corner = cornerAo(Axis.Y)), predicate = { v, vi -> vi == 0 || vi == 3})
|
||||
).forEach { transform(it.setFlatShader(FaceFlat(EAST))).add() }
|
||||
|
||||
quads.exchange(1, 2)
|
||||
@@ -64,7 +66,7 @@ fun Model.columnSideSquare(yBottom: Double, yTop: Double, transform: (Quad) -> Q
|
||||
verticalRectangle(x1 = 0.5, z1 = 0.5, x2 = 0.5, z2 = 0.0, yBottom = yBottom, yTop = yTop)
|
||||
.clampUV(maxU = 0.0)
|
||||
.setAoShader(faceOrientedInterpolate(overrideFace = EAST))
|
||||
.setAoShader(faceOrientedAuto(corner = cornerAo(Axis.Y)), predicate = { v, vi -> vi == 1 || vi == 2})
|
||||
.setAoShader(faceOrientedAuto(corner = cornerAo(Axis.Y)), predicate = { v, vi -> vi == 0 || vi == 3})
|
||||
).forEach {
|
||||
transform(it.setFlatShader(faceOrientedAuto(corner = cornerFlat))).add()
|
||||
}
|
||||
|
||||
@@ -22,11 +22,13 @@ class RenderLog : AbstractRenderColumn(BetterFoliageMod.MOD_ID) {
|
||||
Config.blocks.logs.matchesID(ctx.block)
|
||||
|
||||
override var axisFunc = { state: IBlockState ->
|
||||
val axis = tryDefault("none") { state.getValue(BlockLog.LOG_AXIS).toString() }
|
||||
val axis = tryDefault(null) { state.getValue(BlockLog.LOG_AXIS).toString() } ?:
|
||||
state.properties.entries.find { it.key.getName().toLowerCase() == "axis" }?.let { it.value.toString() }
|
||||
when (axis) {
|
||||
"x" -> Axis.X
|
||||
"y" -> Axis.Y
|
||||
"z" -> Axis.Z
|
||||
else -> Axis.Y
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,19 @@ fun brSum(multiplier: Float?, vararg brightness: Int): Int {
|
||||
return result
|
||||
}
|
||||
|
||||
fun brWeighted(br1: Int, weight1: Float, br2: Int, weight2: Float): Int {
|
||||
val w1int = (weight1 * 256.0f + 0.5f).toInt()
|
||||
val w2int = (weight2 * 256.0f + 0.5f).toInt()
|
||||
var result = 0
|
||||
brightnessComponents.forEachIndexed { idx, shift ->
|
||||
val comp1 = (br1 shr shift) and 15
|
||||
val comp2 = (br2 shr shift) and 15
|
||||
val compWeighted = (comp1 * w1int + comp2 * w2int) / 256
|
||||
result = result or ((compWeighted and 15) shl shift)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
data class HSB(var hue: Float, var saturation: Float, var brightness: Float) {
|
||||
companion object {
|
||||
fun fromColor(color: Int): HSB {
|
||||
|
||||
@@ -106,7 +106,7 @@ interface Shader {
|
||||
red = min(shading1.red * weight1 + shading2.red * weight2, 1.0f)
|
||||
green = min(shading1.green * weight1 + shading2.green * weight2, 1.0f)
|
||||
blue = min(shading1.blue * weight1 + shading2.blue * weight2, 1.0f)
|
||||
brightness = brSum(null, shading1.brightness brMul weight1, shading2.brightness brMul weight2)
|
||||
brightness = brWeighted(shading1.brightness, weight1, shading2.brightness, weight2)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,7 @@ mods.natura.blocks.trees.LogTwoxTwo
|
||||
mods.natura.blocks.trees.SimpleLog
|
||||
|
||||
// Thaumcraft
|
||||
thaumcraft.common.blocks.BlockMagicalLog
|
||||
thaumcraft.common.blocks.world.plants.BlockLogsTC
|
||||
|
||||
// Forestry
|
||||
forestry.arboriculture.gadgets.BlockLog
|
||||
|
||||
Reference in New Issue
Block a user