update to latest recommended Forge

This commit is contained in:
octarine-noise
2018-10-25 14:14:30 +02:00
parent c593ff9bcb
commit 5b1b35a891
11 changed files with 21 additions and 21 deletions

View File

@@ -3,9 +3,9 @@ jarName = BetterFoliage-MC1.12
version = 2.2.0 version = 2.2.0
mc_version = 1.12 mc_version = 1.12.2
forge_version = 14.21.0.2373 forge_version = 14.23.5.2768
mcp_mappings = snapshot_20170626 mcp_mappings = stable_39
kotlin_version = 1.2.0 kotlin_version = 1.2.0
forgelin_version = 1.6.0 forgelin_version = 1.6.0

View File

@@ -9,7 +9,7 @@ import java.util.Map;
"mods.octarinecore.metaprog", "mods.octarinecore.metaprog",
"kotlin" "kotlin"
}) })
@IFMLLoadingPlugin.MCVersion("1.12") @IFMLLoadingPlugin.MCVersion("1.12.2")
@IFMLLoadingPlugin.SortingIndex(1400) @IFMLLoadingPlugin.SortingIndex(1400)
public class BetterFoliageLoader implements IFMLLoadingPlugin { public class BetterFoliageLoader implements IFMLLoadingPlugin {
@Override @Override

View File

@@ -22,7 +22,7 @@ fun biomeList(defaults: (Biome) -> Boolean) = intList {
}.apply { guiClass = BiomeListConfigEntry::class.java } }.apply { guiClass = BiomeListConfigEntry::class.java }
// Biome filter methods // 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.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() } private fun Biome.filterClass(vararg name: String) = name.any { it in this.javaClass.name.toLowerCase() }

View File

@@ -21,7 +21,7 @@ class LeafGenerator(domain: String) : TextureGenerator(domain) {
val leafType = params["type"] ?: "default" val leafType = params["type"] ?: "default"
val handDrawnLoc = target.second.stripStart("textures/").stripStart("blocks/").let { 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 } resourceManager[handDrawnLoc]?.loadImage()?.let { return it }

View File

@@ -12,8 +12,8 @@ class TextureMatcher() {
data class Mapping(val domain: String?, val path: String, val type: String) { data class Mapping(val domain: String?, val path: String, val type: String) {
fun matches(icon: TextureAtlasSprite): Boolean { fun matches(icon: TextureAtlasSprite): Boolean {
val iconLocation = ResourceLocation(icon.iconName) val iconLocation = ResourceLocation(icon.iconName)
return (domain == null || domain == iconLocation.resourceDomain) && return (domain == null || domain == iconLocation.namespace) &&
iconLocation.resourcePath.stripStart("blocks/").contains(path, ignoreCase = true) iconLocation.path.stripStart("blocks/").contains(path, ignoreCase = true)
} }
} }

View File

@@ -12,7 +12,7 @@ const val PI2 = 2.0 * PI
inline fun String.stripStart(str: String) = if (startsWith(str)) substring(str.length) else this 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 */ /** 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. */ /** 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) } inline fun <reified T> MutableList<T>.replace(transform: (T) -> T) = forEachIndexed { idx, value -> this[idx] = transform(value) }

View File

@@ -171,7 +171,7 @@ class RenderVertex() {
fun BufferBuilder.ensureSpaceForQuads(num: Int) { fun BufferBuilder.ensureSpaceForQuads(num: Int) {
rawIntBuffer.position(bufferSize) rawIntBuffer.position(bufferSize)
growBuffer(num * vertexFormat.nextOffset) growBuffer(num * vertexFormat.size)
} }
val allFaces: (EnumFacing) -> Boolean = { true } val allFaces: (EnumFacing) -> Boolean = { true }

View File

@@ -34,13 +34,13 @@ class GeneratorPack(val name: String, vararg val generators: GeneratorBase) : IR
override fun resourceExists(location: ResourceLocation?): Boolean = override fun resourceExists(location: ResourceLocation?): Boolean =
if (location == null) false if (location == null) false
else generators.find { else generators.find {
it.domain == location.resourceDomain && it.resourceExists(location) it.domain == location.namespace && it.resourceExists(location)
} != null } != null
override fun getInputStream(location: ResourceLocation?): InputStream? = override fun getInputStream(location: ResourceLocation?): InputStream? =
if (location == null) null if (location == null) null
else generators.filter { else generators.filter {
it.domain == location.resourceDomain && it.resourceExists(location) it.domain == location.namespace && it.resourceExists(location)
}.map { it.getInputStream(location) } }.map { it.getInputStream(location) }
.filterNotNull().first() .filterNotNull().first()
@@ -114,7 +114,7 @@ abstract class ParameterBasedGenerator(domain: String) : GeneratorBase(domain) {
abstract fun getInputStream(params: ParameterList): InputStream? abstract fun getInputStream(params: ParameterList): InputStream?
override fun resourceExists(location: ResourceLocation?) = override fun resourceExists(location: ResourceLocation?) =
resourceExists(ParameterList.fromString(location?.resourcePath ?: "")) resourceExists(ParameterList.fromString(location?.path ?: ""))
override fun getInputStream(location: ResourceLocation?) = override fun getInputStream(location: ResourceLocation?) =
getInputStream(ParameterList.fromString(location?.resourcePath ?: "")) getInputStream(ParameterList.fromString(location?.path ?: ""))
} }

View File

@@ -45,9 +45,9 @@ open class ResourceHandler(val modId: String) {
// Resource declarations // Resource declarations
// ============================ // ============================
fun iconStatic(domain: String, path: String) = IconHolder(domain, path).apply { resources.add(this) } 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(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 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 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) } fun vectorSet(num: Int, init: (Int)-> Double3) = VectorSet(num, init).apply { resources.add(this) }

View File

@@ -32,7 +32,7 @@ abstract class TextureGenerator(domain: String) : ParameterBasedGenerator(domain
domain, domain,
textureLocation(iconName).let { textureLocation(iconName).let {
ParameterList( 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()) }, extraParams.map { Pair(it.first, it.second.toString()) },
"generate" "generate"
).toString() ).toString()

View File

@@ -27,7 +27,7 @@ val resourceManager: SimpleReloadableResourceManager get() =
Minecraft.getMinecraft().resourceManager as SimpleReloadableResourceManager Minecraft.getMinecraft().resourceManager as SimpleReloadableResourceManager
/** Append a string to the [ResourceLocation]'s path. */ /** 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. */ /** Index operator to get a resource. */
operator fun IResourceManager.get(domain: String, path: String): IResource? = get(ResourceLocation(domain, path)) 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 TextureAtlasSprite.averageColor: Int? get() {
val locationNoDirs = ResourceLocation(iconName).stripStart("blocks/") 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 val image = resourceManager[locationWithDirs]?.loadImage() ?: return null
var numOpaque = 0 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]. * Get the actual location of a texture from the name of its [TextureAtlasSprite].
*/ */
fun textureLocation(iconName: String) = ResourceLocation(iconName).let { fun textureLocation(iconName: String) = ResourceLocation(iconName).let {
if (it.resourcePath.startsWith("mcpatcher")) it if (it.path.startsWith("mcpatcher")) it
else ResourceLocation(it.resourceDomain, "textures/${it.resourcePath}") else ResourceLocation(it.namespace, "textures/${it.path}")
} }
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")