Merge branch 'kotlin-1.8' into kotlin-1.8.8
This commit is contained in:
@@ -6,7 +6,7 @@ version = "2.0.3"
|
|||||||
archivesBaseName = rootProject.name + '-MC1.8.x'
|
archivesBaseName = rootProject.name + '-MC1.8.x'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.0.0-beta-4589'
|
ext.kotlin_version = '1.0.0'
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven {
|
maven {
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
|||||||
*/
|
*/
|
||||||
class BlockMatcher(val domain: String, val path: String) : ConfigPropertyBase() {
|
class BlockMatcher(val domain: String, val path: String) : ConfigPropertyBase() {
|
||||||
|
|
||||||
val blackList = linkedListOf<Class<*>>()
|
val blackList = mutableListOf<Class<*>>()
|
||||||
val whiteList = linkedListOf<Class<*>>()
|
val whiteList = mutableListOf<Class<*>>()
|
||||||
val blockIDs = hashSetOf<Int>()
|
val blockIDs = hashSetOf<Int>()
|
||||||
var blacklistProperty: Property? = null
|
var blacklistProperty: Property? = null
|
||||||
var whitelistProperty: Property? = null
|
var whitelistProperty: Property? = null
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import java.util.*
|
|||||||
class EntityRisingSoulFX(world: World, pos: BlockPos) :
|
class EntityRisingSoulFX(world: World, pos: BlockPos) :
|
||||||
AbstractEntityFX(world, pos.x.toDouble() + 0.5, pos.y.toDouble() + 1.0, pos.z.toDouble() + 0.5) {
|
AbstractEntityFX(world, pos.x.toDouble() + 0.5, pos.y.toDouble() + 1.0, pos.z.toDouble() + 0.5) {
|
||||||
|
|
||||||
val particleTrail: Deque<Double3> = linkedListOf()
|
val particleTrail: Deque<Double3> = LinkedList<Double3>()
|
||||||
val initialPhase = rand.nextInt(64)
|
val initialPhase = rand.nextInt(64)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class RenderLeaves : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
|
|
||||||
val leavesModel = model {
|
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)
|
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 = cornerAo(Axis.Y)))
|
.setAoShader(edgeOrientedAuto(corner = cornerAoMaxGreen))
|
||||||
.setFlatShader(FlatOffset(Int3.zero))
|
.setFlatShader(FlatOffset(Int3.zero))
|
||||||
.scale(Config.leaves.size)
|
.scale(Config.leaves.size)
|
||||||
.toCross(UP).addAll()
|
.toCross(UP).addAll()
|
||||||
|
|||||||
@@ -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, "textures/blocks/${it.resourceDomain}/${it.resourcePath}")
|
ResourceLocation(BetterFoliageMod.DOMAIN, "${it.resourceDomain}/textures/blocks/${it.resourcePath}")
|
||||||
}
|
}
|
||||||
resourceManager[handDrawnLoc]?.loadImage()?.let { return it }
|
resourceManager[handDrawnLoc]?.loadImage()?.let { return it }
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class TextureMatcher() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val mappings: MutableList<Mapping> = linkedListOf()
|
val mappings: MutableList<Mapping> = mutableListOf()
|
||||||
|
|
||||||
fun getType(icon: TextureAtlasSprite): String? = mappings.filter { it.matches(icon) }.map { it.type }.firstOrNull()
|
fun getType(icon: TextureAtlasSprite): String? = mappings.filter { it.matches(icon) }.map { it.type }.firstOrNull()
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ data class Quad(val v1: Vertex, val v2: Vertex, val v3: Vertex, val v4: Vertex)
|
|||||||
*/
|
*/
|
||||||
class Model() {
|
class Model() {
|
||||||
constructor(other: List<Quad>) : this() { quads.addAll(other) }
|
constructor(other: List<Quad>) : this() { quads.addAll(other) }
|
||||||
val quads = linkedListOf<Quad>()
|
val quads = mutableListOf<Quad>()
|
||||||
|
|
||||||
fun Quad.add() = quads.add(this)
|
fun Quad.add() = quads.add(this)
|
||||||
fun Iterable<Quad>.addAll() = forEach { quads.add(it) }
|
fun Iterable<Quad>.addAll() = forEach { quads.add(it) }
|
||||||
|
|||||||
@@ -74,8 +74,15 @@ open class ShadingContext {
|
|||||||
var aoEnabled = Minecraft.isAmbientOcclusionEnabled()
|
var aoEnabled = Minecraft.isAmbientOcclusionEnabled()
|
||||||
val aoFaces = Array(6) { AoFaceData(forgeDirs[it]) }
|
val aoFaces = Array(6) { AoFaceData(forgeDirs[it]) }
|
||||||
|
|
||||||
|
val EnumFacing.aoMultiplier: Float get() = when(this) {
|
||||||
|
UP -> 1.0f
|
||||||
|
DOWN -> 0.5f
|
||||||
|
NORTH, SOUTH -> 0.8f
|
||||||
|
EAST, WEST -> 0.6f
|
||||||
|
}
|
||||||
|
|
||||||
fun updateShading(offset: Int3, predicate: (EnumFacing) -> Boolean = { true }) {
|
fun updateShading(offset: Int3, predicate: (EnumFacing) -> Boolean = { true }) {
|
||||||
forgeDirs.forEach { if (predicate(it)) aoFaces[it.ordinal].update(offset) }
|
forgeDirs.forEach { if (predicate(it)) aoFaces[it.ordinal].update(offset, multiplier = it.aoMultiplier) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun aoShading(face: EnumFacing, corner1: EnumFacing, corner2: EnumFacing) =
|
fun aoShading(face: EnumFacing, corner1: EnumFacing, corner2: EnumFacing) =
|
||||||
|
|||||||
@@ -57,14 +57,14 @@ class AoFaceData(val face: EnumFacing) {
|
|||||||
EAST -> listOf(topRight, topLeft, bottomLeft, bottomRight)
|
EAST -> listOf(topRight, topLeft, bottomLeft, bottomRight)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun update(offset: Int3, useBounds: Boolean = false) {
|
fun update(offset: Int3, useBounds: Boolean = false, multiplier: Float = 1.0f) {
|
||||||
val ctx = blockContext
|
val ctx = blockContext
|
||||||
val blockState = ctx.blockState(offset)
|
val blockState = ctx.blockState(offset)
|
||||||
val quadBounds: FloatArray = FloatArray(12)
|
val quadBounds: FloatArray = FloatArray(12)
|
||||||
val flags = BitSet(3).apply { set(0) }
|
val flags = BitSet(3).apply { set(0) }
|
||||||
|
|
||||||
ao.updateVertexBrightness(ctx.world, blockState.block, ctx.pos + offset, face, quadBounds, flags)
|
ao.updateVertexBrightness(ctx.world, blockState.block, ctx.pos + offset, face, quadBounds, flags)
|
||||||
ordered.forEachIndexed { idx, aoData -> aoData.set(ao.vertexBrightness[idx], ao.vertexColorMultiplier[idx]) }
|
ordered.forEachIndexed { idx, aoData -> aoData.set(ao.vertexBrightness[idx], ao.vertexColorMultiplier[idx] * multiplier) }
|
||||||
}
|
}
|
||||||
|
|
||||||
operator fun get(dir1: EnumFacing, dir2: EnumFacing): AoData {
|
operator fun get(dir1: EnumFacing, dir2: EnumFacing): AoData {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ abstract class ModelDataInspector {
|
|||||||
abstract class BlockTextureInspector<T> : ModelDataInspector() {
|
abstract class BlockTextureInspector<T> : ModelDataInspector() {
|
||||||
|
|
||||||
val state2Names = hashMapOf<IBlockState, Iterable<String>>()
|
val state2Names = hashMapOf<IBlockState, Iterable<String>>()
|
||||||
val modelMappings = linkedListOf<Pair<(IBlockState, IModel)->Boolean, Iterable<String>>>()
|
val modelMappings = mutableListOf<Pair<(IBlockState, IModel)->Boolean, Iterable<String>>>()
|
||||||
val stateMap = hashMapOf<IBlockState, T>()
|
val stateMap = hashMapOf<IBlockState, T>()
|
||||||
|
|
||||||
fun match(textureNames: Iterable<String>, predicate: (IBlockState, IModel)->Boolean) =
|
fun match(textureNames: Iterable<String>, predicate: (IBlockState, IModel)->Boolean) =
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ interface IWorldLoadListener { fun onWorldLoad(world: World) }
|
|||||||
*/
|
*/
|
||||||
open class ResourceHandler(val modId: String) {
|
open class ResourceHandler(val modId: String) {
|
||||||
|
|
||||||
val resources = linkedListOf<Any>()
|
val resources = mutableListOf<Any>()
|
||||||
open fun afterStitch() {}
|
open fun afterStitch() {}
|
||||||
|
|
||||||
// ============================
|
// ============================
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ abstract class TextureGenerator(domain: String) : ParameterBasedGenerator(domain
|
|||||||
*/
|
*/
|
||||||
fun getMultisizeTexture(maxSize: Int, maskPath: (Int)->ResourceLocation): IResource? {
|
fun getMultisizeTexture(maxSize: Int, maskPath: (Int)->ResourceLocation): IResource? {
|
||||||
var size = maxSize
|
var size = maxSize
|
||||||
val sizes = linkedListOf<Int>()
|
val sizes = mutableListOf<Int>()
|
||||||
while(size > 2) { sizes.add(size); size /= 2 }
|
while(size > 2) { sizes.add(size); size /= 2 }
|
||||||
return sizes.map { resourceManager[maskPath(it)] }.filterNotNull().firstOrNull()
|
return sizes.map { resourceManager[maskPath(it)] }.filterNotNull().firstOrNull()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ abstract class DelegatingConfig(val modId: String, val langPrefix: String) {
|
|||||||
|
|
||||||
/** The [Configuration] backing this config object. */
|
/** The [Configuration] backing this config object. */
|
||||||
var config: Configuration? = null
|
var config: Configuration? = null
|
||||||
val rootGuiElements = linkedListOf<IConfigElement>()
|
val rootGuiElements = mutableListOf<IConfigElement>()
|
||||||
|
|
||||||
/** Attach this config object to the given [Configuration] and update all properties. */
|
/** Attach this config object to the given [Configuration] and update all properties. */
|
||||||
fun attach(config: Configuration) {
|
fun attach(config: Configuration) {
|
||||||
|
|||||||
Reference in New Issue
Block a user