Merge branch 'kotlin-1.8' into kotlin-1.8.8

This commit is contained in:
octarine-noise
2016-01-18 12:51:21 +01:00
6 changed files with 31 additions and 10 deletions

View File

@@ -2,7 +2,7 @@ apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: 'kotlin'
group = 'com.github.octarine-noise'
version = "2.0"
version = "2.0.2"
archivesBaseName = rootProject.name + '-MC1.8.8'
buildscript {

View File

@@ -147,10 +147,10 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
// set rotation for the current quadrant
val rotation = baseRotation + quadrantRotation
// disallow sharp discontinuities in the chamfer radius
// disallow sharp discontinuities in the chamfer radius, or tapering-in where inappropriate
if (quadrants[idx] == LARGE_RADIUS &&
upType == PARALLEL && quadrantsTop[idx] == SMALL_RADIUS &&
downType == PARALLEL && quadrantsBottom[idx] == SMALL_RADIUS) {
upType == PARALLEL && quadrantsTop[idx] != LARGE_RADIUS &&
downType == PARALLEL && quadrantsBottom[idx] != LARGE_RADIUS) {
quadrants[idx] = SMALL_RADIUS
}
@@ -179,6 +179,8 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
var downModel: Model? = null
var upIcon = upTexture
var downIcon = downTexture
var shouldRotateUp = true
var shouldRotateDown = true
when (upType) {
NONSOLID -> upModel = flatTop(quadrants[idx])
@@ -188,6 +190,7 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
} else {
upIcon = sideTexture
upModel = extendTop(quadrants[idx])
shouldRotateUp = false
}
}
PARALLEL -> {
@@ -206,6 +209,7 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
} else {
downIcon = sideTexture
downModel = extendBottom(quadrants[idx])
shouldRotateDown = false
}
}
PARALLEL -> {
@@ -222,7 +226,7 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
rotation,
blockContext.blockCenter,
icon = upIcon,
rotateUV = { 0 },
rotateUV = { if (shouldRotateUp) idx else 0 },
postProcess = noPost
)
if (downModel != null) modelRenderer.render(
@@ -231,7 +235,7 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
rotation,
blockContext.blockCenter,
icon = downIcon,
rotateUV = { 0 },
rotateUV = { if (shouldRotateDown) 3 - idx else 0 },
postProcess = noPost
)
}

View File

@@ -14,8 +14,10 @@ import mods.octarinecore.random
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.BlockRendererDispatcher
import net.minecraft.client.renderer.WorldRenderer
import net.minecraft.util.EnumFacing
import net.minecraft.util.EnumFacing.UP
import net.minecraft.util.EnumWorldBlockLayer
import net.minecraft.util.EnumFacing.Axis
import java.lang.Math.cos
import java.lang.Math.sin
@@ -23,7 +25,7 @@ class RenderLeaves : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
val leavesModel = model {
verticalRectangle(x1 = -0.5, z1 = 0.5, x2 = 0.5, z2 = -0.5, yBottom = -0.5 * 1.41, yTop = 0.5 * 1.41)
.setAoShader(edgeOrientedAuto(corner = cornerAoMaxGreen))
.setAoShader(edgeOrientedAuto(corner = cornerAo(Axis.Y)))
.setFlatShader(FlatOffset(Int3.zero))
.scale(Config.leaves.size)
.toCross(UP).addAll()

View File

@@ -38,12 +38,19 @@ class LeafInfo(
object LeafRegistry : BlockTextureInspector<LeafInfo>() {
val particles: MutableMap<String, IconSet> = hashMapOf()
val typeMappings = TextureMatcher().apply { loadMappings(ResourceLocation("betterfoliage", "leafTypeMappings.cfg")) }
val typeMappings = TextureMatcher()
init {
matchClassAndModel(Config.blocks.leaves, "minecraft:block/leaves", listOf("all"))
}
override fun onAfterModelLoad() {
super.onAfterModelLoad()
Client.log(INFO, "Inspecting leaf textures")
particles.clear()
typeMappings.loadMappings(ResourceLocation("betterfoliage", "leafTextureMappings.cfg"))
}
override fun processTextures(textures: List<TextureAtlasSprite>, atlas: TextureMap): LeafInfo {
val texture = textures[0]
var leafType = typeMappings.getType(texture) ?: "default"

View File

@@ -3,6 +3,7 @@ package mods.betterfoliage.client.texture
import mods.octarinecore.client.resource.resourceManager
import mods.octarinecore.client.resource.get
import mods.octarinecore.client.resource.getLines
import mods.octarinecore.stripStart
import net.minecraft.client.renderer.texture.TextureAtlasSprite
import net.minecraft.util.ResourceLocation
@@ -11,7 +12,8 @@ class TextureMatcher() {
data class Mapping(val domain: String?, val path: String, val type: String) {
fun matches(icon: TextureAtlasSprite): Boolean {
val iconLocation = ResourceLocation(icon.iconName)
return (domain == null || domain == iconLocation.resourceDomain) && iconLocation.resourcePath.contains(path)
return (domain == null || domain == iconLocation.resourceDomain) &&
iconLocation.resourcePath.stripStart("blocks/").contains(path)
}
}
@@ -27,7 +29,7 @@ class TextureMatcher() {
if (line2.size == 2) {
val mapping = line2[0].trim().split(':')
if (mapping.size == 1) mappings.add(Mapping(null, mapping[0].trim(), line2[1].trim()))
else if (mapping.size == 2) mappings.add(Mapping(mapping[1].trim(), mapping[0].trim(), line2[1].trim()))
else if (mapping.size == 2) mappings.add(Mapping(mapping[0].trim(), mapping[1].trim(), line2[1].trim()))
}
}
}

View File

@@ -0,0 +1,6 @@
// Vanilla
spruce=spruce
jungle=jungle
// Biomes O' Plenty
fir=spruce