From 81abad82e9e48a5cc3499aa8b3d7fc2d88e54a38 Mon Sep 17 00:00:00 2001 From: octarine-noise Date: Wed, 13 Jan 2016 22:55:07 +0100 Subject: [PATCH 1/6] fixed #36 --- .../mods/betterfoliage/client/texture/LeafRegistry.kt | 8 +++++++- .../assets/betterfoliage/leafTextureMappings.cfg | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/assets/betterfoliage/leafTextureMappings.cfg diff --git a/src/main/kotlin/mods/betterfoliage/client/texture/LeafRegistry.kt b/src/main/kotlin/mods/betterfoliage/client/texture/LeafRegistry.kt index e35f390..b5db24f 100644 --- a/src/main/kotlin/mods/betterfoliage/client/texture/LeafRegistry.kt +++ b/src/main/kotlin/mods/betterfoliage/client/texture/LeafRegistry.kt @@ -38,12 +38,18 @@ class LeafInfo( object LeafRegistry : BlockTextureInspector() { val particles: MutableMap = hashMapOf() - val typeMappings = TextureMatcher().apply { loadMappings(ResourceLocation("betterfoliage", "leafTypeMappings.cfg")) } + val typeMappings = TextureMatcher().apply { loadMappings(ResourceLocation("betterfoliage", "leafTextureMappings.cfg")) } init { matchClassAndModel(Config.blocks.leaves, "minecraft:block/leaves", listOf("all")) } + override fun onAfterModelLoad() { + super.onAfterModelLoad() + Client.log(INFO, "Inspecting leaf textures") + particles.clear() + } + override fun processTextures(textures: List, atlas: TextureMap): LeafInfo { val texture = textures[0] var leafType = typeMappings.getType(texture) ?: "default" diff --git a/src/main/resources/assets/betterfoliage/leafTextureMappings.cfg b/src/main/resources/assets/betterfoliage/leafTextureMappings.cfg new file mode 100644 index 0000000..99adbdb --- /dev/null +++ b/src/main/resources/assets/betterfoliage/leafTextureMappings.cfg @@ -0,0 +1,6 @@ +// Vanilla +spruce=spruce +jungle=jungle + +// Biomes O' Plenty +fir=spruce \ No newline at end of file From 9b717b549b1452dcc96310074ef0221870ca230c Mon Sep 17 00:00:00 2001 From: octarine-noise Date: Wed, 13 Jan 2016 23:00:19 +0100 Subject: [PATCH 2/6] fix for fix of #36 --- .../kotlin/mods/betterfoliage/client/texture/LeafRegistry.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/mods/betterfoliage/client/texture/LeafRegistry.kt b/src/main/kotlin/mods/betterfoliage/client/texture/LeafRegistry.kt index b5db24f..526842c 100644 --- a/src/main/kotlin/mods/betterfoliage/client/texture/LeafRegistry.kt +++ b/src/main/kotlin/mods/betterfoliage/client/texture/LeafRegistry.kt @@ -38,7 +38,7 @@ class LeafInfo( object LeafRegistry : BlockTextureInspector() { val particles: MutableMap = hashMapOf() - val typeMappings = TextureMatcher().apply { loadMappings(ResourceLocation("betterfoliage", "leafTextureMappings.cfg")) } + val typeMappings = TextureMatcher() init { matchClassAndModel(Config.blocks.leaves, "minecraft:block/leaves", listOf("all")) @@ -48,6 +48,7 @@ object LeafRegistry : BlockTextureInspector() { super.onAfterModelLoad() Client.log(INFO, "Inspecting leaf textures") particles.clear() + typeMappings.loadMappings(ResourceLocation("betterfoliage", "leafTextureMappings.cfg")) } override fun processTextures(textures: List, atlas: TextureMap): LeafInfo { From 2d70de00e73b0328d235e25832f99a8a7f3db70d Mon Sep 17 00:00:00 2001 From: octarine-noise Date: Wed, 13 Jan 2016 23:11:44 +0100 Subject: [PATCH 3/6] changed Round Log tapering rules --- .../betterfoliage/client/render/AbstractRenderColumn.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/mods/betterfoliage/client/render/AbstractRenderColumn.kt b/src/main/kotlin/mods/betterfoliage/client/render/AbstractRenderColumn.kt index 70a42e6..95123da 100644 --- a/src/main/kotlin/mods/betterfoliage/client/render/AbstractRenderColumn.kt +++ b/src/main/kotlin/mods/betterfoliage/client/render/AbstractRenderColumn.kt @@ -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 } From 3716804ffbbbda4cbaf1d25190c96c04242ed0c8 Mon Sep 17 00:00:00 2001 From: octarine-noise Date: Thu, 14 Jan 2016 00:07:03 +0100 Subject: [PATCH 4/6] fix Round Log top and bottom texture rotation --- .../betterfoliage/client/render/AbstractRenderColumn.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/mods/betterfoliage/client/render/AbstractRenderColumn.kt b/src/main/kotlin/mods/betterfoliage/client/render/AbstractRenderColumn.kt index 95123da..53789ab 100644 --- a/src/main/kotlin/mods/betterfoliage/client/render/AbstractRenderColumn.kt +++ b/src/main/kotlin/mods/betterfoliage/client/render/AbstractRenderColumn.kt @@ -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 ) } From e926f018e784a1263bf425784a4643b0c2601c38 Mon Sep 17 00:00:00 2001 From: octarine-noise Date: Sat, 16 Jan 2016 08:35:30 +0100 Subject: [PATCH 5/6] actually fix #36 --- build.gradle | 2 +- .../mods/betterfoliage/client/texture/TextureMatcher.kt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 8dc4bd2..1c88d27 100644 --- a/build.gradle +++ b/build.gradle @@ -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' buildscript { diff --git a/src/main/kotlin/mods/betterfoliage/client/texture/TextureMatcher.kt b/src/main/kotlin/mods/betterfoliage/client/texture/TextureMatcher.kt index 1791f99..7f2ef10 100644 --- a/src/main/kotlin/mods/betterfoliage/client/texture/TextureMatcher.kt +++ b/src/main/kotlin/mods/betterfoliage/client/texture/TextureMatcher.kt @@ -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())) } } } From 36c6b775db30e615fc3ae4646dd61f1e84575355 Mon Sep 17 00:00:00 2001 From: octarine-noise Date: Mon, 18 Jan 2016 12:50:08 +0100 Subject: [PATCH 6/6] changed Extra Leaves brightness calculation --- .../kotlin/mods/betterfoliage/client/render/RenderLeaves.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/mods/betterfoliage/client/render/RenderLeaves.kt b/src/main/kotlin/mods/betterfoliage/client/render/RenderLeaves.kt index d4f9f72..8c75eed 100644 --- a/src/main/kotlin/mods/betterfoliage/client/render/RenderLeaves.kt +++ b/src/main/kotlin/mods/betterfoliage/client/render/RenderLeaves.kt @@ -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()