diff --git a/gradle.properties b/gradle.properties index 02fce0a..7bb867f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,9 +3,9 @@ jarName = BetterFoliage-MC1.12 version = 2.2.0 -mc_version = 1.12 -forge_version = 14.21.0.2373 -mcp_mappings = snapshot_20170626 +mc_version = 1.12.2 +forge_version = 14.23.5.2768 +mcp_mappings = stable_39 kotlin_version = 1.2.0 forgelin_version = 1.6.0 \ No newline at end of file diff --git a/src/main/java/mods/betterfoliage/loader/BetterFoliageLoader.java b/src/main/java/mods/betterfoliage/loader/BetterFoliageLoader.java index 29828d6..864f910 100644 --- a/src/main/java/mods/betterfoliage/loader/BetterFoliageLoader.java +++ b/src/main/java/mods/betterfoliage/loader/BetterFoliageLoader.java @@ -9,7 +9,7 @@ import java.util.Map; "mods.octarinecore.metaprog", "kotlin" }) -@IFMLLoadingPlugin.MCVersion("1.12") +@IFMLLoadingPlugin.MCVersion("1.12.2") @IFMLLoadingPlugin.SortingIndex(1400) public class BetterFoliageLoader implements IFMLLoadingPlugin { @Override diff --git a/src/main/kotlin/mods/betterfoliage/client/config/Config.kt b/src/main/kotlin/mods/betterfoliage/client/config/Config.kt index 8b86620..a0526df 100644 --- a/src/main/kotlin/mods/betterfoliage/client/config/Config.kt +++ b/src/main/kotlin/mods/betterfoliage/client/config/Config.kt @@ -22,7 +22,7 @@ fun biomeList(defaults: (Biome) -> Boolean) = intList { }.apply { guiClass = BiomeListConfigEntry::class.java } // Biome filter methods -private fun Biome.filterTemp(min: Float?, max: Float?) = (min == null || min <= temperature) && (max == null || max >= temperature) +private fun Biome.filterTemp(min: Float?, max: Float?) = (min == null || min <= defaultTemperature) && (max == null || max >= defaultTemperature) private fun Biome.filterRain(min: Float?, max: Float?) = (min == null || min <= rainfall) && (max == null || max >= rainfall) private fun Biome.filterClass(vararg name: String) = name.any { it in this.javaClass.name.toLowerCase() } diff --git a/src/main/kotlin/mods/betterfoliage/client/texture/LeafGenerator.kt b/src/main/kotlin/mods/betterfoliage/client/texture/LeafGenerator.kt index 778b7ad..2c94caa 100644 --- a/src/main/kotlin/mods/betterfoliage/client/texture/LeafGenerator.kt +++ b/src/main/kotlin/mods/betterfoliage/client/texture/LeafGenerator.kt @@ -21,7 +21,7 @@ class LeafGenerator(domain: String) : TextureGenerator(domain) { val leafType = params["type"] ?: "default" val handDrawnLoc = target.second.stripStart("textures/").stripStart("blocks/").let { - ResourceLocation(BetterFoliageMod.DOMAIN, "${it.resourceDomain}/textures/blocks/${it.resourcePath}") + ResourceLocation(BetterFoliageMod.DOMAIN, "${it.namespace}/textures/blocks/${it.path}") } resourceManager[handDrawnLoc]?.loadImage()?.let { return it } diff --git a/src/main/kotlin/mods/betterfoliage/client/texture/TextureMatcher.kt b/src/main/kotlin/mods/betterfoliage/client/texture/TextureMatcher.kt index 827dd46..8c20fa0 100644 --- a/src/main/kotlin/mods/betterfoliage/client/texture/TextureMatcher.kt +++ b/src/main/kotlin/mods/betterfoliage/client/texture/TextureMatcher.kt @@ -12,8 +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.stripStart("blocks/").contains(path, ignoreCase = true) + return (domain == null || domain == iconLocation.namespace) && + iconLocation.path.stripStart("blocks/").contains(path, ignoreCase = true) } } diff --git a/src/main/kotlin/mods/octarinecore/Utils.kt b/src/main/kotlin/mods/octarinecore/Utils.kt index 19e2a34..1a58a3f 100644 --- a/src/main/kotlin/mods/octarinecore/Utils.kt +++ b/src/main/kotlin/mods/octarinecore/Utils.kt @@ -12,7 +12,7 @@ const val PI2 = 2.0 * PI inline fun String.stripStart(str: String) = if (startsWith(str)) substring(str.length) else this /** Strip the given prefix off the start of the resource path, if present */ -inline fun ResourceLocation.stripStart(str: String) = ResourceLocation(resourceDomain, resourcePath.stripStart(str)) +inline fun ResourceLocation.stripStart(str: String) = ResourceLocation(namespace, path.stripStart(str)) /** Mutating version of _map_. Replace each element of the list with the result of the given transformation. */ inline fun MutableList.replace(transform: (T) -> T) = forEachIndexed { idx, value -> this[idx] = transform(value) } diff --git a/src/main/kotlin/mods/octarinecore/client/render/ModelRenderer.kt b/src/main/kotlin/mods/octarinecore/client/render/ModelRenderer.kt index 24edf0b..be6d06e 100644 --- a/src/main/kotlin/mods/octarinecore/client/render/ModelRenderer.kt +++ b/src/main/kotlin/mods/octarinecore/client/render/ModelRenderer.kt @@ -171,7 +171,7 @@ class RenderVertex() { fun BufferBuilder.ensureSpaceForQuads(num: Int) { rawIntBuffer.position(bufferSize) - growBuffer(num * vertexFormat.nextOffset) + growBuffer(num * vertexFormat.size) } val allFaces: (EnumFacing) -> Boolean = { true } diff --git a/src/main/kotlin/mods/octarinecore/client/resource/ResourceGeneration.kt b/src/main/kotlin/mods/octarinecore/client/resource/ResourceGeneration.kt index 02d75be..772e1e9 100644 --- a/src/main/kotlin/mods/octarinecore/client/resource/ResourceGeneration.kt +++ b/src/main/kotlin/mods/octarinecore/client/resource/ResourceGeneration.kt @@ -34,13 +34,13 @@ class GeneratorPack(val name: String, vararg val generators: GeneratorBase) : IR override fun resourceExists(location: ResourceLocation?): Boolean = if (location == null) false else generators.find { - it.domain == location.resourceDomain && it.resourceExists(location) + it.domain == location.namespace && it.resourceExists(location) } != null override fun getInputStream(location: ResourceLocation?): InputStream? = if (location == null) null else generators.filter { - it.domain == location.resourceDomain && it.resourceExists(location) + it.domain == location.namespace && it.resourceExists(location) }.map { it.getInputStream(location) } .filterNotNull().first() @@ -114,7 +114,7 @@ abstract class ParameterBasedGenerator(domain: String) : GeneratorBase(domain) { abstract fun getInputStream(params: ParameterList): InputStream? override fun resourceExists(location: ResourceLocation?) = - resourceExists(ParameterList.fromString(location?.resourcePath ?: "")) + resourceExists(ParameterList.fromString(location?.path ?: "")) override fun getInputStream(location: ResourceLocation?) = - getInputStream(ParameterList.fromString(location?.resourcePath ?: "")) + getInputStream(ParameterList.fromString(location?.path ?: "")) } \ No newline at end of file diff --git a/src/main/kotlin/mods/octarinecore/client/resource/ResourceHandler.kt b/src/main/kotlin/mods/octarinecore/client/resource/ResourceHandler.kt index c6aa189..ac5b481 100644 --- a/src/main/kotlin/mods/octarinecore/client/resource/ResourceHandler.kt +++ b/src/main/kotlin/mods/octarinecore/client/resource/ResourceHandler.kt @@ -45,9 +45,9 @@ open class ResourceHandler(val modId: String) { // Resource declarations // ============================ fun iconStatic(domain: String, path: String) = IconHolder(domain, path).apply { resources.add(this) } - fun iconStatic(location: ResourceLocation) = iconStatic(location.resourceDomain, location.resourcePath) + fun iconStatic(location: ResourceLocation) = iconStatic(location.namespace, location.path) fun iconSet(domain: String, pathPattern: String) = IconSet(domain, pathPattern).apply { resources.add(this) } - fun iconSet(location: ResourceLocation) = iconSet(location.resourceDomain, location.resourcePath) + fun iconSet(location: ResourceLocation) = iconSet(location.namespace, location.path) fun model(init: Model.()->Unit) = ModelHolder(init).apply { resources.add(this) } fun modelSet(num: Int, init: Model.(Int)->Unit) = ModelSet(num, init).apply { resources.add(this) } fun vectorSet(num: Int, init: (Int)-> Double3) = VectorSet(num, init).apply { resources.add(this) } diff --git a/src/main/kotlin/mods/octarinecore/client/resource/TextureGenerator.kt b/src/main/kotlin/mods/octarinecore/client/resource/TextureGenerator.kt index 2e74fa4..713aac1 100644 --- a/src/main/kotlin/mods/octarinecore/client/resource/TextureGenerator.kt +++ b/src/main/kotlin/mods/octarinecore/client/resource/TextureGenerator.kt @@ -32,7 +32,7 @@ abstract class TextureGenerator(domain: String) : ParameterBasedGenerator(domain domain, textureLocation(iconName).let { ParameterList( - mapOf("dom" to it.resourceDomain, "path" to it.resourcePath) + + mapOf("dom" to it.namespace, "path" to it.path) + extraParams.map { Pair(it.first, it.second.toString()) }, "generate" ).toString() diff --git a/src/main/kotlin/mods/octarinecore/client/resource/Utils.kt b/src/main/kotlin/mods/octarinecore/client/resource/Utils.kt index c437503..a07a290 100644 --- a/src/main/kotlin/mods/octarinecore/client/resource/Utils.kt +++ b/src/main/kotlin/mods/octarinecore/client/resource/Utils.kt @@ -27,7 +27,7 @@ val resourceManager: SimpleReloadableResourceManager get() = Minecraft.getMinecraft().resourceManager as SimpleReloadableResourceManager /** Append a string to the [ResourceLocation]'s path. */ -operator fun ResourceLocation.plus(str: String) = ResourceLocation(resourceDomain, resourcePath + str) +operator fun ResourceLocation.plus(str: String) = ResourceLocation(namespace, path + str) /** Index operator to get a resource. */ operator fun IResourceManager.get(domain: String, path: String): IResource? = get(ResourceLocation(domain, path)) @@ -66,7 +66,7 @@ val BufferedImage.asStream: InputStream get() = */ val TextureAtlasSprite.averageColor: Int? get() { val locationNoDirs = ResourceLocation(iconName).stripStart("blocks/") - val locationWithDirs = ResourceLocation(locationNoDirs.resourceDomain, "textures/blocks/%s.png".format(locationNoDirs.resourcePath)) + val locationWithDirs = ResourceLocation(locationNoDirs.namespace, "textures/blocks/%s.png".format(locationNoDirs.path)) val image = resourceManager[locationWithDirs]?.loadImage() ?: return null var numOpaque = 0 @@ -97,8 +97,8 @@ val TextureAtlasSprite.averageColor: Int? get() { * Get the actual location of a texture from the name of its [TextureAtlasSprite]. */ fun textureLocation(iconName: String) = ResourceLocation(iconName).let { - if (it.resourcePath.startsWith("mcpatcher")) it - else ResourceLocation(it.resourceDomain, "textures/${it.resourcePath}") + if (it.path.startsWith("mcpatcher")) it + else ResourceLocation(it.namespace, "textures/${it.path}") } @Suppress("UNCHECKED_CAST")