update to latest recommended Forge
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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() }
|
||||
|
||||
|
||||
@@ -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 }
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 <reified T> MutableList<T>.replace(transform: (T) -> T) = forEachIndexed { idx, value -> this[idx] = transform(value) }
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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 ?: ""))
|
||||
}
|
||||
@@ -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) }
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user