Merge branch 'kotlin-1.11.2' into kotlin-1.12
This commit is contained in:
@@ -8,6 +8,7 @@ import net.minecraft.world.biome.Biome
|
||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent
|
||||
import net.minecraftforge.fml.relauncher.Side
|
||||
import net.minecraftforge.fml.relauncher.SideOnly
|
||||
import org.lwjgl.opengl.GL11
|
||||
|
||||
// BetterFoliage-specific property delegates
|
||||
private val OBSOLETE = ObsoleteConfigProperty()
|
||||
@@ -30,12 +31,14 @@ private fun Biome.filterClass(vararg name: String) = name.any { it in this.javaC
|
||||
object Config : DelegatingConfig(BetterFoliageMod.MOD_ID, BetterFoliageMod.DOMAIN) {
|
||||
|
||||
var enabled by boolean(true)
|
||||
var nVidia by boolean(GL11.glGetString(GL11.GL_VENDOR).toLowerCase().contains("nvidia"))
|
||||
|
||||
object blocks {
|
||||
val leavesClasses = ConfigurableBlockMatcher(BetterFoliageMod.DOMAIN, "leaves_blocks_default.cfg")
|
||||
val leavesModels = ModelTextureListConfigOption(BetterFoliageMod.DOMAIN, "leaves_models_default.cfg", 1)
|
||||
val grassClasses = ConfigurableBlockMatcher(BetterFoliageMod.DOMAIN, "grass_blocks_default.cfg")
|
||||
val grassModels = ModelTextureListConfigOption(BetterFoliageMod.DOMAIN, "grass_models_default.cfg", 1)
|
||||
val mycelium = ConfigurableBlockMatcher(BetterFoliageMod.DOMAIN, "mycelium_blocks_default.cfg")
|
||||
val dirt = ConfigurableBlockMatcher(BetterFoliageMod.DOMAIN, "dirt_default.cfg")
|
||||
val crops = ConfigurableBlockMatcher(BetterFoliageMod.DOMAIN, "crop_default.cfg")
|
||||
val logClasses = ConfigurableBlockMatcher(BetterFoliageMod.DOMAIN, "log_blocks_default.cfg")
|
||||
@@ -43,6 +46,7 @@ object Config : DelegatingConfig(BetterFoliageMod.MOD_ID, BetterFoliageMod.DOMAI
|
||||
val sand = ConfigurableBlockMatcher(BetterFoliageMod.DOMAIN, "sand_default.cfg")
|
||||
val lilypad = ConfigurableBlockMatcher(BetterFoliageMod.DOMAIN, "lilypad_default.cfg")
|
||||
val cactus = ConfigurableBlockMatcher(BetterFoliageMod.DOMAIN, "cactus_default.cfg")
|
||||
val netherrack = ConfigurableBlockMatcher(BetterFoliageMod.DOMAIN, "netherrack_blocks_default.cfg")
|
||||
|
||||
val leavesWhitelist = OBSOLETE
|
||||
val leavesBlacklist = OBSOLETE
|
||||
|
||||
@@ -7,10 +7,9 @@ import mods.betterfoliage.client.render.*
|
||||
import mods.betterfoliage.client.texture.ILeafRegistry
|
||||
import mods.betterfoliage.client.texture.LeafInfo
|
||||
import mods.betterfoliage.client.texture.LeafRegistry
|
||||
import mods.betterfoliage.client.texture.StandardLeafSupport
|
||||
import mods.betterfoliage.loader.Refs
|
||||
import mods.octarinecore.client.resource.ModelProcessor
|
||||
import mods.octarinecore.client.resource.get
|
||||
import mods.octarinecore.client.resource.ModelVariant
|
||||
import mods.octarinecore.client.resource.registerSprite
|
||||
import mods.octarinecore.metaprog.ClassRef
|
||||
import mods.octarinecore.metaprog.FieldRef
|
||||
@@ -20,7 +19,6 @@ import mods.octarinecore.tryDefault
|
||||
import net.minecraft.block.state.IBlockState
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||
import net.minecraft.client.renderer.texture.TextureMap
|
||||
import net.minecraft.util.EnumFacing
|
||||
import net.minecraft.util.ResourceLocation
|
||||
@@ -35,6 +33,7 @@ import net.minecraftforge.fml.relauncher.Side
|
||||
import net.minecraftforge.fml.relauncher.SideOnly
|
||||
import org.apache.logging.log4j.Level
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
object ForestryIntegration {
|
||||
|
||||
@@ -104,9 +103,9 @@ object ForestryLeavesSupport : ILeafRegistry {
|
||||
textureToValue[textureLocation] = LeafInfo(generated, LeafRegistry.getParticleType(texture, atlas))
|
||||
}
|
||||
|
||||
override fun get(state: IBlockState) = null
|
||||
override fun get(state: IBlockState, rand: Int) = null
|
||||
|
||||
override fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing): LeafInfo? {
|
||||
override fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing, rand: Int): LeafInfo? {
|
||||
// check variant property (used in decorative leaves)
|
||||
state.properties.entries.find {
|
||||
ForestryIntegration.PropertyTreeType.isInstance(it.key) && ForestryIntegration.TreeDefinition.isInstance(it.value)
|
||||
@@ -128,21 +127,22 @@ object ForestryLeavesSupport : ILeafRegistry {
|
||||
@SideOnly(Side.CLIENT)
|
||||
object ForestryLogSupport : ModelProcessor<List<String>, IColumnTextureInfo>, IColumnRegistry {
|
||||
|
||||
override var stateToKey = mutableMapOf<IBlockState, List<String>>()
|
||||
override var stateToValue = mapOf<IBlockState, IColumnTextureInfo>()
|
||||
override var variants = mutableMapOf<IBlockState, MutableList<ModelVariant>>()
|
||||
override var variantToKey = mutableMapOf<ModelVariant, List<String>>()
|
||||
override var variantToValue = mapOf<ModelVariant, IColumnTextureInfo>()
|
||||
|
||||
override val logger = BetterFoliageMod.logDetail
|
||||
|
||||
init { MinecraftForge.EVENT_BUS.register(this) }
|
||||
|
||||
override fun processModelLoad(state: IBlockState, modelLoc: ModelResourceLocation, model: IModel): List<String>? {
|
||||
override fun processModelLoad(state: IBlockState, modelLoc: ModelResourceLocation, model: IModel) {
|
||||
// respect class list to avoid triggering on fences, stairs, etc.
|
||||
if (!Config.blocks.logClasses.matchesClass(state.block)) return null
|
||||
if (!Config.blocks.logClasses.matchesClass(state.block)) return
|
||||
|
||||
// find wood type property
|
||||
val woodType = state.properties.entries.find {
|
||||
ForestryIntegration.PropertyWoodType.isInstance(it.key) && ForestryIntegration.IWoodType.isInstance(it.value)
|
||||
} ?: return null
|
||||
} ?: return
|
||||
|
||||
logger.log(Level.DEBUG, "ForestryLogSupport: block state ${state.toString()}")
|
||||
logger.log(Level.DEBUG, "ForestryLogSupport: variant ${woodType.value.toString()}")
|
||||
@@ -152,14 +152,14 @@ object ForestryLogSupport : ModelProcessor<List<String>, IColumnTextureInfo>, IC
|
||||
val heart = ForestryIntegration.heartTex.invoke(woodType.value) as String?
|
||||
|
||||
logger.log(Level.DEBUG, "ForestryLogSupport: textures [heart=$heart, bark=$bark]")
|
||||
return if (bark != null && heart != null) listOf(heart, bark) else null
|
||||
if (bark != null && heart != null) putKeySingle(state, listOf(heart, bark))
|
||||
}
|
||||
|
||||
override fun processStitch(state: IBlockState, key: List<String>, atlas: TextureMap): IColumnTextureInfo? {
|
||||
override fun processStitch(variant: ModelVariant, key: List<String>, atlas: TextureMap): IColumnTextureInfo? {
|
||||
val heart = atlas.registerSprite(key[0])
|
||||
val bark = atlas.registerSprite(key[1])
|
||||
return StaticColumnInfo(StandardLogSupport.getAxis(state), heart, heart, bark)
|
||||
return StaticColumnInfo(StandardLogSupport.getAxis(variant.state), heart, heart, listOf(bark))
|
||||
}
|
||||
|
||||
override fun get(state: IBlockState) = stateToValue[state]
|
||||
override fun get(state: IBlockState, rand: Int) = variants[state]?.let { variantToValue[it[0]] }
|
||||
}
|
||||
@@ -4,10 +4,15 @@ import mods.betterfoliage.client.Client
|
||||
import mods.betterfoliage.loader.Refs
|
||||
import mods.octarinecore.ThreadLocalDelegate
|
||||
import mods.octarinecore.client.render.BlockContext
|
||||
import mods.octarinecore.common.Int3
|
||||
import mods.octarinecore.metaprog.allAvailable
|
||||
import mods.octarinecore.metaprog.reflectField
|
||||
import net.minecraft.block.state.BlockStateBase
|
||||
import net.minecraft.block.state.IBlockState
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||
import net.minecraft.util.EnumFacing
|
||||
import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.world.IBlockAccess
|
||||
@@ -22,18 +27,24 @@ import org.apache.logging.log4j.Level.INFO
|
||||
@SideOnly(Side.CLIENT)
|
||||
object OptifineCTM {
|
||||
|
||||
val isAvailable = allAvailable(
|
||||
val isCTMAvailable = allAvailable(
|
||||
Refs.ConnectedTextures, Refs.ConnectedProperties,
|
||||
Refs.getConnectedTexture,
|
||||
Refs.CTblockProperties, Refs.CTtileProperties,
|
||||
Refs.CPtileIcons, Refs.CPmatchesIcon
|
||||
)
|
||||
val isColorAvailable = allAvailable(
|
||||
Refs.CustomColors, Refs.getColorMultiplier
|
||||
)
|
||||
|
||||
init {
|
||||
Client.log(INFO, "Optifine CTM support is ${if (isAvailable) "enabled" else "disabled" }")
|
||||
Client.log(INFO, "Optifine CTM support is ${if (isCTMAvailable) "enabled" else "disabled" }")
|
||||
Client.log(INFO, "Optifine custom color support is ${if (isColorAvailable) "enabled" else "disabled" }")
|
||||
}
|
||||
|
||||
val renderEnv by ThreadLocalDelegate { OptifineRenderEnv() }
|
||||
val fakeQuad = BakedQuad(IntArray(0), 1, EnumFacing.UP, null, true, DefaultVertexFormats.BLOCK)
|
||||
val isCustomColors: Boolean get() = if (!isCTMAvailable) false else Minecraft.getMinecraft().gameSettings.reflectField<Boolean>("ofCustomColors") ?: false
|
||||
|
||||
val connectedProperties: Iterable<Any> get() {
|
||||
val result = hashSetOf<Any>()
|
||||
@@ -49,7 +60,7 @@ object OptifineCTM {
|
||||
/** Get all the CTM [TextureAtlasSprite]s that could possibly be used for this block. */
|
||||
fun getAllCTM(state: IBlockState, icon: TextureAtlasSprite): Collection<TextureAtlasSprite> {
|
||||
val result = hashSetOf<TextureAtlasSprite>()
|
||||
if (state !is BlockStateBase || !isAvailable) return result
|
||||
if (state !is BlockStateBase || !isCTMAvailable) return result
|
||||
|
||||
connectedProperties.forEach { cp ->
|
||||
if (Refs.CPmatchesBlock.invoke(cp, Refs.getBlockId.invoke(state), Refs.getMetadata.invoke(state)) as Boolean &&
|
||||
@@ -68,7 +79,7 @@ object OptifineCTM {
|
||||
override(texture, ctx.world!!, ctx.pos, face)
|
||||
|
||||
fun override(texture: TextureAtlasSprite, world: IBlockAccess, pos: BlockPos, face: EnumFacing): TextureAtlasSprite {
|
||||
if (!isAvailable) return texture
|
||||
if (!isCTMAvailable) return texture
|
||||
val state = world.getBlockState(pos)
|
||||
|
||||
return renderEnv.let {
|
||||
@@ -76,6 +87,14 @@ object OptifineCTM {
|
||||
Refs.getConnectedTexture.invokeStatic(world, state, pos, face, texture, it.wrapped) as TextureAtlasSprite
|
||||
}
|
||||
}
|
||||
|
||||
fun getBlockColor(ctx: BlockContext): Int {
|
||||
val ofColor = if (isColorAvailable && Minecraft.getMinecraft().gameSettings.reflectField<Boolean>("ofCustomColors") == true) {
|
||||
renderEnv.reset(ctx.world!!, ctx.blockState(Int3.zero), ctx.pos)
|
||||
Refs.getColorMultiplier.invokeStatic(fakeQuad, ctx.blockState(Int3.zero), ctx.world!!, ctx.pos, renderEnv.wrapped) as? Int
|
||||
} else null
|
||||
return if (ofColor == null || ofColor == -1) ctx.blockData(Int3.zero).color else ofColor
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -7,7 +7,6 @@ import mods.betterfoliage.client.render.IColumnRegistry
|
||||
import mods.betterfoliage.client.render.IColumnTextureInfo
|
||||
import mods.betterfoliage.client.render.LogRegistry
|
||||
import mods.betterfoliage.client.render.StaticColumnInfo
|
||||
import mods.betterfoliage.client.texture.LeafRegistry
|
||||
import mods.betterfoliage.client.texture.StandardLeafSupport
|
||||
import mods.betterfoliage.loader.Refs
|
||||
import mods.octarinecore.client.render.Quad
|
||||
@@ -18,8 +17,6 @@ import mods.octarinecore.common.rotate
|
||||
import mods.octarinecore.metaprog.ClassRef
|
||||
import mods.octarinecore.metaprog.MethodRef
|
||||
import mods.octarinecore.metaprog.allAvailable
|
||||
import mods.octarinecore.tryDefault
|
||||
import net.minecraft.block.properties.PropertyDirection
|
||||
import net.minecraft.block.state.IBlockState
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||
@@ -91,36 +88,40 @@ data class RubberLogColumnInfo(override val axis: EnumFacing.Axis?,
|
||||
@SideOnly(Side.CLIENT)
|
||||
abstract class RubberLogSupportBase : ModelProcessor<RubberLogModelInfo, IColumnTextureInfo>, IColumnRegistry {
|
||||
|
||||
override var stateToKey = mutableMapOf<IBlockState, RubberLogModelInfo>()
|
||||
override var stateToValue = mapOf<IBlockState, IColumnTextureInfo>()
|
||||
override var variants = mutableMapOf<IBlockState, MutableList<ModelVariant>>()
|
||||
override var variantToKey = mutableMapOf<ModelVariant, RubberLogModelInfo>()
|
||||
override var variantToValue = mapOf<ModelVariant, IColumnTextureInfo>()
|
||||
|
||||
override val logger = BetterFoliageMod.logDetail
|
||||
|
||||
init { MinecraftForge.EVENT_BUS.register(this) }
|
||||
|
||||
override fun processStitch(state: IBlockState, key: RubberLogModelInfo, atlas: TextureMap): IColumnTextureInfo? {
|
||||
override fun processStitch(variant: ModelVariant, key: RubberLogModelInfo, atlas: TextureMap): IColumnTextureInfo? {
|
||||
val topTex = atlas.registerSprite(key.textures[0])
|
||||
val bottomTex = atlas.registerSprite(key.textures[1])
|
||||
val sideTex = atlas.registerSprite(key.textures[2])
|
||||
if (key.spotDir == null)
|
||||
return StaticColumnInfo(key.axis, topTex, bottomTex, sideTex)
|
||||
return StaticColumnInfo(key.axis, topTex, bottomTex, listOf(sideTex))
|
||||
else {
|
||||
val spotTex = atlas.registerSprite(key.textures[3])
|
||||
return RubberLogColumnInfo(key.axis, key.spotDir, topTex, bottomTex, sideTex, spotTex)
|
||||
}
|
||||
}
|
||||
|
||||
override fun get(state: IBlockState) = stateToValue[state]
|
||||
override fun get(state: IBlockState, rand: Int): IColumnTextureInfo? {
|
||||
val variant = getVariant(state, rand) ?: return null
|
||||
return variantToValue[variant]
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
object IC2LogSupport : RubberLogSupportBase() {
|
||||
|
||||
override fun processModelLoad(state: IBlockState, modelLoc: ModelResourceLocation, model: IModel): RubberLogModelInfo? {
|
||||
override fun processModelLoad(state: IBlockState, modelLoc: ModelResourceLocation, model: IModel) {
|
||||
// check for proper block class, existence of ModelBlock, and "state" blockstate property
|
||||
if (!IC2Integration.BlockRubWood.isInstance(state.block)) return null
|
||||
val blockLoc = model.modelBlockAndLoc.firstOrNull() ?: return null
|
||||
val type = state.properties.entries.find { it.key.getName() == "state" }?.value?.toString() ?: return null
|
||||
if (!IC2Integration.BlockRubWood.isInstance(state.block)) return
|
||||
val blockLoc = model.modelBlockAndLoc.firstOrNull() ?: return
|
||||
val type = state.properties.entries.find { it.key.getName() == "state" }?.value?.toString() ?: return
|
||||
|
||||
// logs with no rubber spot
|
||||
if (blockLoc.derivesFrom(ResourceLocation("block/cube_column"))) {
|
||||
@@ -133,7 +134,10 @@ object IC2LogSupport : RubberLogSupportBase() {
|
||||
val textureNames = listOf("end", "end", "side").map { blockLoc.first.resolveTextureName(it) }
|
||||
logger.log(Level.DEBUG, "IC2LogSupport: block state ${state.toString()}")
|
||||
logger.log(Level.DEBUG, "IC2LogSupport: axis=$axis, end=${textureNames[0]}, side=${textureNames[2]}")
|
||||
return if (textureNames.all { it != "missingno" }) RubberLogModelInfo(axis, null, textureNames) else null
|
||||
if (textureNames.all { it != "missingno" }) {
|
||||
putKeySingle(state, RubberLogModelInfo(axis, null, textureNames))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// logs with rubber spot
|
||||
@@ -147,30 +151,36 @@ object IC2LogSupport : RubberLogSupportBase() {
|
||||
val textureNames = listOf("up", "down", "south", "north").map { blockLoc.first.resolveTextureName(it) }
|
||||
logger.log(Level.DEBUG, "IC2LogSupport: block state ${state.toString()}")
|
||||
logger.log(Level.DEBUG, "IC2LogSupport: spotDir=$spotDir, up=${textureNames[0]}, down=${textureNames[1]}, side=${textureNames[2]}, spot=${textureNames[3]}")
|
||||
return if (textureNames.all { it != "missingno" }) RubberLogModelInfo(EnumFacing.Axis.Y, spotDir, textureNames) else null
|
||||
if (textureNames.all { it != "missingno" }) {
|
||||
putKeySingle(state, RubberLogModelInfo(EnumFacing.Axis.Y, spotDir, textureNames))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
object TechRebornLogSupport : RubberLogSupportBase() {
|
||||
|
||||
override fun processModelLoad(state: IBlockState, modelLoc: ModelResourceLocation, model: IModel): RubberLogModelInfo? {
|
||||
override fun processModelLoad(state: IBlockState, modelLoc: ModelResourceLocation, model: IModel) {
|
||||
// check for proper block class, existence of ModelBlock
|
||||
if (!TechRebornIntegration.BlockRubberLog.isInstance(state.block)) return null
|
||||
val blockLoc = model.modelBlockAndLoc.firstOrNull() ?: return null
|
||||
if (!TechRebornIntegration.BlockRubberLog.isInstance(state.block)) return
|
||||
val blockLoc = model.modelBlockAndLoc.firstOrNull() ?: return
|
||||
|
||||
val hasSap = state.properties.entries.find { it.key.getName() == "hassap" }?.value as? Boolean ?: return null
|
||||
val sapSide = state.properties.entries.find { it.key.getName() == "sapside" }?.value as? EnumFacing ?: return null
|
||||
val hasSap = state.properties.entries.find { it.key.getName() == "hassap" }?.value as? Boolean ?: return
|
||||
val sapSide = state.properties.entries.find { it.key.getName() == "sapside" }?.value as? EnumFacing ?: return
|
||||
|
||||
val textureNames = listOf("end", "end", "side", "sapside").map { blockLoc.first.resolveTextureName(it) }
|
||||
|
||||
logger.log(Level.DEBUG, "TechRebornLogSupport: block state ${state.toString()}")
|
||||
if (hasSap) {
|
||||
logger.log(Level.DEBUG, "TechRebornLogSupport: spotDir=$sapSide, end=${textureNames[0]}, side=${textureNames[2]}, spot=${textureNames[3]}")
|
||||
return if (textureNames.all { it != "missingno" }) RubberLogModelInfo(EnumFacing.Axis.Y, sapSide, textureNames) else null
|
||||
if (textureNames.all { it != "missingno" }) {
|
||||
putKeySingle(state, RubberLogModelInfo(EnumFacing.Axis.Y, sapSide, textureNames))
|
||||
}
|
||||
} else {
|
||||
logger.log(Level.DEBUG, "TechRebornLogSupport: end=${textureNames[0]}, side=${textureNames[2]}")
|
||||
return if (textureNames.all { it != "missingno" }) RubberLogModelInfo(EnumFacing.Axis.Y, null, textureNames) else null
|
||||
if (textureNames.all { it != "missingno" }) {
|
||||
putKeySingle(state, RubberLogModelInfo(EnumFacing.Axis.Y, null, textureNames))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,14 +27,18 @@ interface IColumnTextureInfo {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
interface IColumnRegistry {
|
||||
operator fun get(state: IBlockState): IColumnTextureInfo?
|
||||
operator fun get(state: IBlockState, rand: Int): IColumnTextureInfo?
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
data class StaticColumnInfo(override val axis: Axis?,
|
||||
val topTexture: TextureAtlasSprite,
|
||||
val bottomTexture: TextureAtlasSprite,
|
||||
val sideTexture: TextureAtlasSprite) : IColumnTextureInfo {
|
||||
val sideTextures: List<TextureAtlasSprite>) : IColumnTextureInfo {
|
||||
|
||||
// index offsets for EnumFacings, to make it less likely for neighboring faces to get the same bark texture
|
||||
val dirToIdx = arrayOf(0, 1, 2, 4, 3, 5)
|
||||
|
||||
override val top: QuadIconResolver = { ctx, _, _ ->
|
||||
OptifineCTM.override(topTexture, blockContext, UP.rotate(ctx.rotation))
|
||||
}
|
||||
@@ -42,7 +46,9 @@ data class StaticColumnInfo(override val axis: Axis?,
|
||||
OptifineCTM.override(bottomTexture, blockContext, DOWN.rotate(ctx.rotation))
|
||||
}
|
||||
override val side: QuadIconResolver = { ctx, idx, _ ->
|
||||
OptifineCTM.override(sideTexture, blockContext, (if ((idx and 1) == 0) SOUTH else EAST).rotate(ctx.rotation))
|
||||
val worldFace = (if ((idx and 1) == 0) SOUTH else EAST).rotate(ctx.rotation)
|
||||
val baseTexture = sideTextures[(blockContext.random(1) + dirToIdx[worldFace.ordinal]) % sideTextures.size]
|
||||
OptifineCTM.override(baseTexture, blockContext, worldFace)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +146,7 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
|
||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: BufferBuilder, layer: BlockRenderLayer): Boolean {
|
||||
if (ctx.isSurroundedBy(surroundPredicate) ) return false
|
||||
|
||||
val columnTextures = registry[ctx.blockState(Int3.zero)]
|
||||
val columnTextures = registry[ctx.blockState(Int3.zero), ctx.random(0)]
|
||||
if (columnTextures == null) {
|
||||
Client.logRenderError(ctx.blockState(Int3.zero), ctx.pos)
|
||||
return renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||
@@ -345,7 +351,7 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
|
||||
return if (!blockPredicate(state)) {
|
||||
if (state.isOpaqueCube) SOLID else NONSOLID
|
||||
} else {
|
||||
(registry[state]?.axis ?: if (Config.roundLogs.defaultY) Axis.Y else null)?.let {
|
||||
(registry[state, random(0)]?.axis ?: if (Config.roundLogs.defaultY) Axis.Y else null)?.let {
|
||||
if (it == axis) PARALLEL else PERPENDICULAR
|
||||
} ?: SOLID
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import mods.octarinecore.client.render.HSB
|
||||
import mods.octarinecore.common.Double3
|
||||
import mods.octarinecore.minmax
|
||||
import mods.octarinecore.random
|
||||
import mods.octarinecore.semiRandom
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.BufferBuilder
|
||||
import net.minecraft.util.EnumFacing.DOWN
|
||||
@@ -44,7 +45,7 @@ AbstractEntityFX(world, pos.x.toDouble() + 0.5, pos.y.toDouble(), pos.z.toDouble
|
||||
|
||||
val state = world.getBlockState(pos)
|
||||
val blockColor = Minecraft.getMinecraft().blockColors.colorMultiplier(state, world, pos, 0)
|
||||
val leafInfo = LeafRegistry.get(state, world, pos, DOWN)
|
||||
val leafInfo = LeafRegistry.get(state, world, pos, DOWN, semiRandom(pos.x, pos.y, pos.z, 0))
|
||||
if (leafInfo != null) {
|
||||
particleTexture = leafInfo.particleTextures?.get(rand.nextInt(1024))
|
||||
calculateParticleColor(leafInfo.averageColor, blockColor)
|
||||
|
||||
@@ -14,9 +14,6 @@ const val chamferAffinity = 0.9f
|
||||
/** Amount to shrink column extension bits to stop Z-fighting. */
|
||||
val zProtectionScale: Double3 get() = Double3(Config.roundLogs.zProtection, 1.0, Config.roundLogs.zProtection)
|
||||
|
||||
/** nVidia does it different... */
|
||||
val nVidia = GL11.glGetString(GL11.GL_VENDOR).toLowerCase().contains("nvidia")
|
||||
|
||||
fun Model.columnSide(radius: Double, yBottom: Double, yTop: Double, transform: (Quad) -> Quad = { it }) {
|
||||
val halfRadius = radius * 0.5
|
||||
listOf(
|
||||
@@ -96,14 +93,14 @@ fun Model.columnLid(radius: Double, transform: (Quad)->Quad = { it }) {
|
||||
1 -> EdgeInterpolateFallback(UP, SOUTH, 0.0)
|
||||
else -> vertex.aoShader
|
||||
})}
|
||||
.cycleVertices(if (nVidia) 0 else 1)
|
||||
.cycleVertices(if (Config.nVidia) 0 else 1)
|
||||
val q2 = Quad(v1, v4, v5, v6).setAoShader(faceOrientedAuto(overrideFace = UP, corner = cornerAo(Axis.Y)))
|
||||
.transformVI { vertex, idx -> vertex.copy(aoShader = when(idx) {
|
||||
0 -> FaceCenter(UP)
|
||||
3 -> EdgeInterpolateFallback(UP, EAST, 0.0)
|
||||
else -> vertex.aoShader
|
||||
})}
|
||||
.cycleVertices(if (nVidia) 0 else 1)
|
||||
.cycleVertices(if (Config.nVidia) 0 else 1)
|
||||
listOf(q1, q2).forEach { transform(it.setFlatShader(FaceFlat(UP))).add() }
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import mods.betterfoliage.BetterFoliageMod
|
||||
import mods.betterfoliage.client.Client
|
||||
import mods.betterfoliage.client.config.Config
|
||||
import mods.octarinecore.client.render.*
|
||||
import mods.octarinecore.client.resource.ModelVariant
|
||||
import mods.octarinecore.client.resource.TextureListModelProcessor
|
||||
import mods.octarinecore.client.resource.registerSprite
|
||||
import mods.octarinecore.common.Int3
|
||||
@@ -35,8 +36,9 @@ class RenderCactus : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
|
||||
init { MinecraftForge.EVENT_BUS.register(this) }
|
||||
|
||||
override var stateToKey = mutableMapOf<IBlockState, List<String>>()
|
||||
override var stateToValue = mapOf<IBlockState, IColumnTextureInfo>()
|
||||
override var variants = mutableMapOf<IBlockState, MutableList<ModelVariant>>()
|
||||
override var variantToKey = mutableMapOf<ModelVariant, List<String>>()
|
||||
override var variantToValue = mapOf<ModelVariant, IColumnTextureInfo>()
|
||||
|
||||
override val logger = BetterFoliageMod.logDetail
|
||||
override val logName = "CactusTextures"
|
||||
@@ -45,14 +47,17 @@ class RenderCactus : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
modelTextures("block/cactus", "top", "bottom", "side")
|
||||
)
|
||||
|
||||
override fun processStitch(state: IBlockState, key: List<String>, atlas: TextureMap): IColumnTextureInfo? {
|
||||
override fun processStitch(variant: ModelVariant, key: List<String>, atlas: TextureMap): IColumnTextureInfo? {
|
||||
val topTex = atlas.registerSprite(key[0])
|
||||
val bottomTex = atlas.registerSprite(key[1])
|
||||
val sideTex = atlas.registerSprite(key[2])
|
||||
return StaticColumnInfo(Axis.Y, topTex, bottomTex, sideTex)
|
||||
return StaticColumnInfo(Axis.Y, topTex, bottomTex, listOf(sideTex))
|
||||
}
|
||||
|
||||
override fun get(state: IBlockState) = stateToValue[state]
|
||||
override fun get(state: IBlockState, rand: Int): IColumnTextureInfo? {
|
||||
val variant = getVariant(state, rand) ?: return null
|
||||
return variantToValue[variant]
|
||||
}
|
||||
}
|
||||
|
||||
val modelStem = model {
|
||||
@@ -98,7 +103,7 @@ class RenderCactus : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
|
||||
// get AO data
|
||||
modelRenderer.updateShading(Int3.zero, allFaces)
|
||||
val icons = cactusTextures[ctx.blockState(Int3.zero)] ?: return renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||
val icons = cactusTextures[ctx.blockState(Int3.zero), ctx.random(0)] ?: return renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||
|
||||
modelRenderer.render(
|
||||
renderer,
|
||||
|
||||
@@ -3,6 +3,7 @@ package mods.betterfoliage.client.render
|
||||
import mods.betterfoliage.BetterFoliageMod
|
||||
import mods.betterfoliage.client.Client
|
||||
import mods.betterfoliage.client.config.Config
|
||||
import mods.betterfoliage.client.integration.OptifineCTM
|
||||
import mods.betterfoliage.client.integration.ShadersModIntegration
|
||||
import mods.betterfoliage.client.texture.GrassRegistry
|
||||
import mods.octarinecore.client.render.*
|
||||
@@ -68,7 +69,7 @@ class RenderGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
Client.logRenderError(ctx.blockState(Int3.zero), ctx.pos)
|
||||
return renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||
}
|
||||
val blockColor = ctx.blockData(Int3.zero).color
|
||||
val blockColor = OptifineCTM.getBlockColor(ctx)
|
||||
|
||||
if (connectedGrass) {
|
||||
// get full AO data
|
||||
|
||||
@@ -3,6 +3,7 @@ package mods.betterfoliage.client.render
|
||||
import mods.betterfoliage.BetterFoliageMod
|
||||
import mods.betterfoliage.client.Client
|
||||
import mods.betterfoliage.client.config.Config
|
||||
import mods.betterfoliage.client.integration.OptifineCTM
|
||||
import mods.betterfoliage.client.integration.ShadersModIntegration
|
||||
import mods.betterfoliage.client.texture.LeafRegistry
|
||||
import mods.octarinecore.PI2
|
||||
@@ -57,7 +58,7 @@ class RenderLeaves : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
Client.logRenderError(ctx.blockState(Int3.zero), ctx.pos)
|
||||
return renderWorldBlockBase(ctx, dispatcher, renderer, layer)
|
||||
}
|
||||
val blockColor = ctx.blockData(Int3.zero).color
|
||||
val blockColor = OptifineCTM.getBlockColor(ctx)
|
||||
|
||||
renderWorldBlockBase(ctx, dispatcher, renderer, layer)
|
||||
if (!layer.isCutout) return true
|
||||
|
||||
@@ -3,6 +3,7 @@ package mods.betterfoliage.client.render
|
||||
import mods.betterfoliage.BetterFoliageMod
|
||||
import mods.betterfoliage.client.config.Config
|
||||
import mods.octarinecore.client.render.BlockContext
|
||||
import mods.octarinecore.client.resource.ModelVariant
|
||||
import mods.octarinecore.client.resource.TextureListModelProcessor
|
||||
import mods.octarinecore.client.resource.registerSprite
|
||||
import mods.octarinecore.common.config.ConfigurableBlockMatcher
|
||||
@@ -43,7 +44,7 @@ class RenderLog : AbstractRenderColumn(BetterFoliageMod.MOD_ID) {
|
||||
@SideOnly(Side.CLIENT)
|
||||
object LogRegistry : IColumnRegistry {
|
||||
val subRegistries: MutableList<IColumnRegistry> = mutableListOf()
|
||||
override fun get(state: IBlockState) = subRegistries.findFirst { it[state] }
|
||||
override fun get(state: IBlockState, rand: Int) = subRegistries.findFirst { it[state, rand] }
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -54,22 +55,27 @@ object StandardLogSupport : TextureListModelProcessor<IColumnTextureInfo>, IColu
|
||||
MinecraftForge.EVENT_BUS.register(this)
|
||||
}
|
||||
|
||||
override var stateToKey = mutableMapOf<IBlockState, List<String>>()
|
||||
override var stateToValue = mapOf<IBlockState, IColumnTextureInfo>()
|
||||
override var variants = mutableMapOf<IBlockState, MutableList<ModelVariant>>()
|
||||
override var variantToKey = mutableMapOf<ModelVariant, List<String>>()
|
||||
override var variantToValue = mapOf<ModelVariant, IColumnTextureInfo>()
|
||||
|
||||
override val logger = BetterFoliageMod.logDetail
|
||||
override val logName = "StandardLogSupport"
|
||||
override val matchClasses: ConfigurableBlockMatcher get() = Config.blocks.logClasses
|
||||
override val modelTextures: List<ModelTextureList> get() = Config.blocks.logModels.list
|
||||
|
||||
override fun processStitch(state: IBlockState, key: List<String>, atlas: TextureMap): IColumnTextureInfo? {
|
||||
override fun processStitch(variant: ModelVariant, key: List<String>, atlas: TextureMap): IColumnTextureInfo? {
|
||||
val topTex = atlas.registerSprite(key[0])
|
||||
val bottomTex = atlas.registerSprite(key[1])
|
||||
val sideTex = atlas.registerSprite(key[2])
|
||||
return StaticColumnInfo(getAxis(state), topTex, bottomTex, sideTex)
|
||||
val sideTexList = key.drop(2).map { atlas.registerSprite(it) }
|
||||
if (sideTexList.isEmpty()) return null
|
||||
return StaticColumnInfo(getAxis(variant.state), topTex, bottomTex, sideTexList)
|
||||
}
|
||||
|
||||
override fun get(state: IBlockState) = stateToValue[state]
|
||||
override fun get(state: IBlockState, rand: Int): IColumnTextureInfo? {
|
||||
val variant = getVariant(state, rand) ?: return null
|
||||
return variantToValue[variant]
|
||||
}
|
||||
|
||||
fun getAxis(state: IBlockState): Axis? {
|
||||
val axis = tryDefault(null) { state.getValue(BlockLog.LOG_AXIS).toString() } ?:
|
||||
|
||||
@@ -11,7 +11,6 @@ import mods.octarinecore.common.Double3
|
||||
import mods.octarinecore.common.Rotation
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||
import net.minecraft.client.renderer.BufferBuilder
|
||||
import net.minecraft.init.Blocks
|
||||
import net.minecraft.util.BlockRenderLayer
|
||||
import net.minecraftforge.fml.relauncher.Side
|
||||
import net.minecraftforge.fml.relauncher.SideOnly
|
||||
@@ -29,8 +28,8 @@ class RenderMycelium : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
|
||||
override fun isEligible(ctx: BlockContext): Boolean {
|
||||
if (!Config.enabled || !Config.shortGrass.myceliumEnabled) return false
|
||||
return ctx.block == Blocks.MYCELIUM &&
|
||||
ctx.cameraDistance < Config.shortGrass.distance
|
||||
return Config.blocks.mycelium.matchesClass(ctx.block) &&
|
||||
ctx.cameraDistance < Config.shortGrass.distance
|
||||
}
|
||||
|
||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: BufferBuilder, layer: BlockRenderLayer): Boolean {
|
||||
|
||||
@@ -9,7 +9,6 @@ import mods.octarinecore.common.Rotation
|
||||
import mods.octarinecore.random
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||
import net.minecraft.client.renderer.BufferBuilder
|
||||
import net.minecraft.init.Blocks
|
||||
import net.minecraft.util.BlockRenderLayer
|
||||
import net.minecraft.util.EnumFacing.*
|
||||
import net.minecraftforge.fml.relauncher.Side
|
||||
@@ -35,8 +34,8 @@ class RenderNetherrack : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID)
|
||||
|
||||
override fun isEligible(ctx: BlockContext): Boolean {
|
||||
if (!Config.enabled || !Config.netherrack.enabled) return false
|
||||
return ctx.block == Blocks.NETHERRACK &&
|
||||
ctx.cameraDistance < Config.netherrack.distance
|
||||
return Config.blocks.netherrack.matchesClass(ctx.block) &&
|
||||
ctx.cameraDistance < Config.netherrack.distance
|
||||
}
|
||||
|
||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: BufferBuilder, layer: BlockRenderLayer): Boolean {
|
||||
|
||||
@@ -39,8 +39,8 @@ class GrassInfo(
|
||||
)
|
||||
|
||||
interface IGrassRegistry {
|
||||
fun get(state: IBlockState): GrassInfo?
|
||||
fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing): GrassInfo?
|
||||
operator fun get(state: IBlockState, rand: Int): GrassInfo?
|
||||
operator fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing, rand: Int): GrassInfo?
|
||||
}
|
||||
|
||||
/** Collects and manages rendering-related information for grass blocks. */
|
||||
@@ -48,12 +48,12 @@ interface IGrassRegistry {
|
||||
object GrassRegistry : IGrassRegistry {
|
||||
val subRegistries: MutableList<IGrassRegistry> = mutableListOf(StandardGrassSupport)
|
||||
|
||||
override fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing) =
|
||||
subRegistries.findFirst { it.get(state, world, pos, face) }
|
||||
override fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing, rand: Int) =
|
||||
subRegistries.findFirst { it.get(state, world, pos, face, rand) }
|
||||
|
||||
operator fun get(ctx: BlockContext, face: EnumFacing) = get(ctx.blockState(Int3.zero), ctx.world!!, ctx.pos, face)
|
||||
operator fun get(ctx: BlockContext, face: EnumFacing) = get(ctx.blockState(Int3.zero), ctx.world!!, ctx.pos, face, ctx.random(0))
|
||||
|
||||
override fun get(state: IBlockState) = subRegistries.findFirst { it.get(state) }
|
||||
override fun get(state: IBlockState, rand: Int) = subRegistries.findFirst { it[state, rand] }
|
||||
}
|
||||
|
||||
object StandardGrassSupport :
|
||||
@@ -63,8 +63,9 @@ object StandardGrassSupport :
|
||||
{
|
||||
init { MinecraftForge.EVENT_BUS.register(this) }
|
||||
|
||||
override var stateToKey = mutableMapOf<IBlockState, List<String>>()
|
||||
override var stateToValue = mapOf<IBlockState, TextureAtlasSprite>()
|
||||
override var variants = mutableMapOf<IBlockState, MutableList<ModelVariant>>()
|
||||
override var variantToKey = mutableMapOf<ModelVariant, List<String>>()
|
||||
override var variantToValue = mapOf<ModelVariant, TextureAtlasSprite>()
|
||||
override var textureToValue = mutableMapOf<TextureAtlasSprite, GrassInfo>()
|
||||
|
||||
override val logger = BetterFoliageMod.logDetail
|
||||
@@ -72,20 +73,22 @@ object StandardGrassSupport :
|
||||
override val matchClasses: ConfigurableBlockMatcher get() = Config.blocks.grassClasses
|
||||
override val modelTextures: List<ModelTextureList> get() = Config.blocks.grassModels.list
|
||||
|
||||
override fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing): GrassInfo? {
|
||||
val baseTexture = stateToValue[state] ?: return null
|
||||
override fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing, rand: Int): GrassInfo? {
|
||||
val variant = getVariant(state, rand) ?: return null
|
||||
val baseTexture = variantToValue[variant] ?: return null
|
||||
return textureToValue[OptifineCTM.override(baseTexture, world, pos, face)] ?: textureToValue[baseTexture]
|
||||
}
|
||||
|
||||
override fun get(state: IBlockState) = StandardLeafSupport.stateToValue[state].let {
|
||||
if (it == null) null else textureToValue[it]
|
||||
override fun get(state: IBlockState, rand: Int): GrassInfo? {
|
||||
val variant = getVariant(state, rand) ?: return null
|
||||
return variantToValue[variant].let { if (it == null) null else textureToValue[it] }
|
||||
}
|
||||
|
||||
override fun processStitch(state: IBlockState, key: List<String>, atlas: TextureMap) = atlas.registerSprite(key[0])
|
||||
override fun processStitch(variant: ModelVariant, key: List<String>, atlas: TextureMap) = atlas.registerSprite(key[0])
|
||||
|
||||
override fun processTexture(states: List<IBlockState>, texture: TextureAtlasSprite, atlas: TextureMap) {
|
||||
override fun processTexture(variants: List<ModelVariant>, texture: TextureAtlasSprite, atlas: TextureMap) {
|
||||
registerGrass(texture, atlas)
|
||||
OptifineCTM.getAllCTM(states, texture).forEach {
|
||||
OptifineCTM.getAllCTM(variants.map { it.state }, texture).forEach {
|
||||
registerGrass(it, atlas)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ class LeafInfo(
|
||||
}
|
||||
|
||||
interface ILeafRegistry {
|
||||
operator fun get(state: IBlockState): LeafInfo?
|
||||
operator fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing): LeafInfo?
|
||||
operator fun get(state: IBlockState, rand: Int): LeafInfo?
|
||||
operator fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing, rand: Int): LeafInfo?
|
||||
}
|
||||
|
||||
/** Collects and manages rendering-related information for grass blocks. */
|
||||
@@ -62,12 +62,12 @@ object LeafRegistry : ILeafRegistry {
|
||||
typeMappings.loadMappings(ResourceLocation(BetterFoliageMod.DOMAIN, "leaf_texture_mappings.cfg"))
|
||||
}
|
||||
|
||||
override fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing) =
|
||||
subRegistries.findFirst { it.get(state, world, pos, face) }
|
||||
override fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing, rand: Int) =
|
||||
subRegistries.findFirst { it.get(state, world, pos, face, rand) }
|
||||
|
||||
operator fun get(ctx: BlockContext, face: EnumFacing) = get(ctx.blockState(Int3.zero), ctx.world!!, ctx.pos, face)
|
||||
operator fun get(ctx: BlockContext, face: EnumFacing) = get(ctx.blockState(Int3.zero), ctx.world!!, ctx.pos, face, ctx.random(0))
|
||||
|
||||
override fun get(state: IBlockState) = subRegistries.findFirst { it.get(state) }
|
||||
override fun get(state: IBlockState, rand: Int) = subRegistries.findFirst { it[state, rand] }
|
||||
|
||||
fun getParticleType(texture: TextureAtlasSprite, atlas: TextureMap): String {
|
||||
var leafType = typeMappings.getType(texture) ?: "default"
|
||||
@@ -100,26 +100,30 @@ object StandardLeafSupport :
|
||||
override val modelTextures: List<ModelTextureList> get() = Config.blocks.leavesModels.list
|
||||
override val logger: Logger? get() = BetterFoliageMod.logDetail
|
||||
|
||||
override var stateToKey = mutableMapOf<IBlockState, List<String>>()
|
||||
override var stateToValue = mapOf<IBlockState, TextureAtlasSprite>()
|
||||
override var variants = mutableMapOf<IBlockState, MutableList<ModelVariant>>()
|
||||
override var variantToKey = mutableMapOf<ModelVariant, List<String>>()
|
||||
override var variantToValue = mapOf<ModelVariant, TextureAtlasSprite>()
|
||||
override var textureToValue = mutableMapOf<TextureAtlasSprite, LeafInfo>()
|
||||
|
||||
override fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing): LeafInfo? {
|
||||
val baseTexture = stateToValue[state] ?: return null
|
||||
override fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing, rand: Int): LeafInfo? {
|
||||
val variant = getVariant(state, rand) ?: return null
|
||||
val baseTexture = variantToValue[variant] ?: return null
|
||||
return textureToValue[OptifineCTM.override(baseTexture, world, pos, face)] ?: textureToValue[baseTexture]
|
||||
}
|
||||
|
||||
override fun get(state: IBlockState) = stateToValue[state].let {
|
||||
if (it == null) null else textureToValue[it]
|
||||
override fun get(state: IBlockState, rand: Int): LeafInfo? {
|
||||
val variant = getVariant(state, rand) ?: return null
|
||||
return variantToValue[variant].let { if (it == null) null else textureToValue[it] }
|
||||
}
|
||||
|
||||
override fun processStitch(state: IBlockState, key: List<String>, atlas: TextureMap) = atlas.registerSprite(key[0])
|
||||
override fun processStitch(variant: ModelVariant, key: List<String>, atlas: TextureMap) = atlas.registerSprite(key[0])
|
||||
|
||||
override fun processTexture(states: List<IBlockState>, texture: TextureAtlasSprite, atlas: TextureMap) {
|
||||
logger?.log(Level.DEBUG, "$logName: leaf texture ${texture.iconName}")
|
||||
logger?.log(Level.DEBUG, "$logName: #states ${states.size}")
|
||||
override fun processTexture(variants: List<ModelVariant>, texture: TextureAtlasSprite, atlas: TextureMap) {
|
||||
logger?.log(Level.DEBUG, "$logName: leaf texture ${texture.iconName}")
|
||||
logger?.log(Level.DEBUG, "$logName: #variants ${variants.size}")
|
||||
logger?.log(Level.DEBUG, "$logName: #states ${variants.distinctBy { it.state }.size}")
|
||||
registerLeaf(texture, atlas)
|
||||
OptifineCTM.getAllCTM(states, texture).forEach {
|
||||
OptifineCTM.getAllCTM(variants.map { it.state }, texture).forEach {
|
||||
logger?.log(Level.DEBUG, "$logName: CTM ${texture.iconName}")
|
||||
registerLeaf(it, atlas)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user