Merge branch 'kotlin-1.10' into kotlin-1.11.2
This commit is contained in:
@@ -2,7 +2,7 @@ apply plugin: "net.minecraftforge.gradle.forge"
|
|||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
group = 'com.github.octarine-noise'
|
group = 'com.github.octarine-noise'
|
||||||
version = "2.1.4"
|
version = "2.1.5"
|
||||||
archivesBaseName = rootProject.name + '-MC1.11.2'
|
archivesBaseName = rootProject.name + '-MC1.11.2'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
|
|||||||
@@ -6,9 +6,16 @@ import mods.betterfoliage.client.integration.*
|
|||||||
import mods.betterfoliage.client.render.*
|
import mods.betterfoliage.client.render.*
|
||||||
import mods.betterfoliage.client.texture.*
|
import mods.betterfoliage.client.texture.*
|
||||||
import mods.octarinecore.client.KeyHandler
|
import mods.octarinecore.client.KeyHandler
|
||||||
|
import mods.octarinecore.client.gui.textComponent
|
||||||
import mods.octarinecore.client.resource.CenteringTextureGenerator
|
import mods.octarinecore.client.resource.CenteringTextureGenerator
|
||||||
import mods.octarinecore.client.resource.GeneratorPack
|
import mods.octarinecore.client.resource.GeneratorPack
|
||||||
|
import net.minecraft.block.Block
|
||||||
|
import net.minecraft.block.state.IBlockState
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
|
import net.minecraft.util.math.BlockPos
|
||||||
|
import net.minecraft.util.text.TextComponentString
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation
|
||||||
|
import net.minecraft.util.text.TextFormatting
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler
|
import net.minecraftforge.fml.client.FMLClientHandler
|
||||||
import net.minecraftforge.fml.relauncher.Side
|
import net.minecraftforge.fml.relauncher.Side
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly
|
import net.minecraftforge.fml.relauncher.SideOnly
|
||||||
@@ -71,6 +78,8 @@ object Client {
|
|||||||
StandardLogSupport // add _after_ all other log registries
|
StandardLogSupport // add _after_ all other log registries
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val suppressRenderErrors = mutableSetOf<IBlockState>()
|
||||||
|
|
||||||
fun log(level: Level, msg: String) {
|
fun log(level: Level, msg: String) {
|
||||||
BetterFoliageMod.log.log(level, "[BetterFoliage] $msg")
|
BetterFoliageMod.log.log(level, "[BetterFoliage] $msg")
|
||||||
BetterFoliageMod.logDetail.log(level, msg)
|
BetterFoliageMod.logDetail.log(level, msg)
|
||||||
@@ -79,5 +88,19 @@ object Client {
|
|||||||
fun logDetail(msg: String) {
|
fun logDetail(msg: String) {
|
||||||
BetterFoliageMod.logDetail.log(Level.DEBUG, msg)
|
BetterFoliageMod.logDetail.log(Level.DEBUG, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun logRenderError(state: IBlockState, location: BlockPos) {
|
||||||
|
if (state in suppressRenderErrors) return
|
||||||
|
suppressRenderErrors.add(state)
|
||||||
|
|
||||||
|
val blockName = Block.REGISTRY.getNameForObject(state.block).toString()
|
||||||
|
val blockLoc = "${location.x},${location.y},${location.z}"
|
||||||
|
Minecraft.getMinecraft().thePlayer.addChatMessage(TextComponentTranslation(
|
||||||
|
"betterfoliage.rendererror",
|
||||||
|
textComponent(blockName, TextFormatting.GOLD),
|
||||||
|
textComponent(blockLoc, TextFormatting.GOLD)
|
||||||
|
))
|
||||||
|
logDetail("Error rendering block $state at $blockLoc")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ object Config : DelegatingConfig(BetterFoliageMod.MOD_ID, BetterFoliageMod.DOMAI
|
|||||||
val heightMin by double(min=0.1, max=2.5, default=0.6).lang("heightMin")
|
val heightMin by double(min=0.1, max=2.5, default=0.6).lang("heightMin")
|
||||||
val heightMax by double(min=0.1, max=2.5, default=0.8).lang("heightMax")
|
val heightMax by double(min=0.1, max=2.5, default=0.8).lang("heightMax")
|
||||||
val size by double(min=0.5, max=1.5, default=1.0).lang("size")
|
val size by double(min=0.5, max=1.5, default=1.0).lang("size")
|
||||||
|
val population by int(max=64, default=64).lang("population")
|
||||||
val useGenerated by boolean(false)
|
val useGenerated by boolean(false)
|
||||||
val shaderWind by boolean(true).lang("shaderWind")
|
val shaderWind by boolean(true).lang("shaderWind")
|
||||||
val saturationThreshold by double(default=0.1)
|
val saturationThreshold by double(default=0.1)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import mods.octarinecore.common.rotate
|
|||||||
import mods.octarinecore.metaprog.ClassRef
|
import mods.octarinecore.metaprog.ClassRef
|
||||||
import mods.octarinecore.metaprog.MethodRef
|
import mods.octarinecore.metaprog.MethodRef
|
||||||
import mods.octarinecore.metaprog.allAvailable
|
import mods.octarinecore.metaprog.allAvailable
|
||||||
|
import mods.octarinecore.tryDefault
|
||||||
import net.minecraft.block.properties.PropertyDirection
|
import net.minecraft.block.properties.PropertyDirection
|
||||||
import net.minecraft.block.state.IBlockState
|
import net.minecraft.block.state.IBlockState
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation
|
||||||
@@ -133,7 +134,7 @@ object IC2LogSupport : RubberLogSupportBase() {
|
|||||||
override fun processModelLoad(state: IBlockState, modelLoc: ModelResourceLocation, model: IModel): RubberLogModelInfo? {
|
override fun processModelLoad(state: IBlockState, modelLoc: ModelResourceLocation, model: IModel): RubberLogModelInfo? {
|
||||||
// check for proper block class, existence of ModelBlock, and "state" blockstate property
|
// check for proper block class, existence of ModelBlock, and "state" blockstate property
|
||||||
if (!IC2Integration.BlockRubWood.isInstance(state.block)) return null
|
if (!IC2Integration.BlockRubWood.isInstance(state.block)) return null
|
||||||
val blockLoc = model.modelBlockAndLoc ?: return null
|
val blockLoc = model.modelBlockAndLoc.firstOrNull() ?: return null
|
||||||
val type = state.properties.entries.find { it.key.getName() == "state" }?.value?.toString() ?: return null
|
val type = state.properties.entries.find { it.key.getName() == "state" }?.value?.toString() ?: return null
|
||||||
|
|
||||||
// logs with no rubber spot
|
// logs with no rubber spot
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package mods.betterfoliage.client.render
|
package mods.betterfoliage.client.render
|
||||||
|
|
||||||
|
import mods.betterfoliage.client.Client
|
||||||
import mods.betterfoliage.client.config.Config
|
import mods.betterfoliage.client.config.Config
|
||||||
import mods.betterfoliage.client.integration.OptifineCTM
|
import mods.betterfoliage.client.integration.OptifineCTM
|
||||||
import mods.betterfoliage.client.integration.ShadersModIntegration
|
import mods.betterfoliage.client.integration.ShadersModIntegration
|
||||||
@@ -140,7 +141,11 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
|
|||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
||||||
if (ctx.isSurroundedBy(surroundPredicate) ) return false
|
if (ctx.isSurroundedBy(surroundPredicate) ) return false
|
||||||
|
|
||||||
val columnTextures = registry[ctx.blockState(Int3.zero)] ?: return false
|
val columnTextures = registry[ctx.blockState(Int3.zero)]
|
||||||
|
if (columnTextures == null) {
|
||||||
|
Client.logRenderError(ctx.blockState(Int3.zero), ctx.pos)
|
||||||
|
return renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
|
}
|
||||||
|
|
||||||
// get AO data
|
// get AO data
|
||||||
modelRenderer.updateShading(Int3.zero, allFaces)
|
modelRenderer.updateShading(Int3.zero, allFaces)
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ class RenderGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val noise = simplexNoise()
|
||||||
|
|
||||||
val normalIcons = iconSet(BetterFoliageMod.LEGACY_DOMAIN, "blocks/better_grass_long_%d")
|
val normalIcons = iconSet(BetterFoliageMod.LEGACY_DOMAIN, "blocks/better_grass_long_%d")
|
||||||
val snowedIcons = iconSet(BetterFoliageMod.LEGACY_DOMAIN, "blocks/better_grass_snowed_%d")
|
val snowedIcons = iconSet(BetterFoliageMod.LEGACY_DOMAIN, "blocks/better_grass_snowed_%d")
|
||||||
val normalGenIcon = iconStatic(Client.genGrass.generatedResource("minecraft:blocks/tallgrass", "snowed" to false))
|
val normalGenIcon = iconStatic(Client.genGrass.generatedResource("minecraft:blocks/tallgrass", "snowed" to false))
|
||||||
@@ -57,7 +59,12 @@ class RenderGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
val isSnowed = ctx.blockState(up1).isSnow
|
val isSnowed = ctx.blockState(up1).isSnow
|
||||||
val connectedGrass = isConnected && Config.connectedGrass.enabled && (!isSnowed || Config.connectedGrass.snowEnabled)
|
val connectedGrass = isConnected && Config.connectedGrass.enabled && (!isSnowed || Config.connectedGrass.snowEnabled)
|
||||||
|
|
||||||
val grassInfo = GrassRegistry[ctx, UP]!!
|
val grassInfo = GrassRegistry[ctx, UP]
|
||||||
|
if (grassInfo == null) {
|
||||||
|
// shouldn't happen
|
||||||
|
Client.logRenderError(ctx.blockState(Int3.zero), ctx.pos)
|
||||||
|
return renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
|
}
|
||||||
val blockColor = ctx.blockData(Int3.zero).color
|
val blockColor = ctx.blockData(Int3.zero).color
|
||||||
|
|
||||||
if (connectedGrass) {
|
if (connectedGrass) {
|
||||||
@@ -92,6 +99,7 @@ class RenderGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
if (!Config.shortGrass.grassEnabled) return true
|
if (!Config.shortGrass.grassEnabled) return true
|
||||||
if (isSnowed && !Config.shortGrass.snowEnabled) return true
|
if (isSnowed && !Config.shortGrass.snowEnabled) return true
|
||||||
if (ctx.blockState(up1).isOpaqueCube) return true
|
if (ctx.blockState(up1).isOpaqueCube) return true
|
||||||
|
if (Config.shortGrass.population < 64 && noise[ctx.pos] >= Config.shortGrass.population) return true
|
||||||
|
|
||||||
// render grass quads
|
// render grass quads
|
||||||
val iconset = if (isSnowed) snowedIcons else normalIcons
|
val iconset = if (isSnowed) snowedIcons else normalIcons
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package mods.betterfoliage.client.render
|
package mods.betterfoliage.client.render
|
||||||
|
|
||||||
import mods.betterfoliage.BetterFoliageMod
|
import mods.betterfoliage.BetterFoliageMod
|
||||||
|
import mods.betterfoliage.client.Client
|
||||||
import mods.betterfoliage.client.config.Config
|
import mods.betterfoliage.client.config.Config
|
||||||
import mods.betterfoliage.client.integration.ShadersModIntegration
|
import mods.betterfoliage.client.integration.ShadersModIntegration
|
||||||
import mods.betterfoliage.client.texture.LeafRegistry
|
import mods.betterfoliage.client.texture.LeafRegistry
|
||||||
@@ -50,7 +51,12 @@ class RenderLeaves : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
val isSnowed = ctx.blockState(up1).material.let {
|
val isSnowed = ctx.blockState(up1).material.let {
|
||||||
it == Material.SNOW || it == Material.CRAFTED_SNOW
|
it == Material.SNOW || it == Material.CRAFTED_SNOW
|
||||||
}
|
}
|
||||||
val leafInfo = LeafRegistry[ctx, DOWN] ?: return false
|
val leafInfo = LeafRegistry[ctx, DOWN]
|
||||||
|
if (leafInfo == null) {
|
||||||
|
// shouldn't happen
|
||||||
|
Client.logRenderError(ctx.blockState(Int3.zero), ctx.pos)
|
||||||
|
return renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
|
}
|
||||||
val blockColor = ctx.blockData(Int3.zero).color
|
val blockColor = ctx.blockData(Int3.zero).color
|
||||||
|
|
||||||
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import net.minecraftforge.common.MinecraftForge
|
|||||||
import net.minecraftforge.fml.relauncher.Side
|
import net.minecraftforge.fml.relauncher.Side
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly
|
import net.minecraftforge.fml.relauncher.SideOnly
|
||||||
import org.apache.logging.log4j.Level
|
import org.apache.logging.log4j.Level
|
||||||
|
import java.lang.Math.min
|
||||||
|
|
||||||
const val defaultGrassColor = 0
|
const val defaultGrassColor = 0
|
||||||
|
|
||||||
@@ -93,8 +94,9 @@ object StandardGrassSupport :
|
|||||||
logger.log(Level.DEBUG, "$logName: texture ${texture.iconName}")
|
logger.log(Level.DEBUG, "$logName: texture ${texture.iconName}")
|
||||||
val hsb = HSB.fromColor(texture.averageColor ?: defaultGrassColor)
|
val hsb = HSB.fromColor(texture.averageColor ?: defaultGrassColor)
|
||||||
val overrideColor = if (hsb.saturation >= Config.shortGrass.saturationThreshold) {
|
val overrideColor = if (hsb.saturation >= Config.shortGrass.saturationThreshold) {
|
||||||
|
logger.log(Level.DEBUG, "$logName: brightness ${hsb.brightness}")
|
||||||
logger.log(Level.DEBUG, "$logName: saturation ${hsb.saturation} >= ${Config.shortGrass.saturationThreshold}, using texture color")
|
logger.log(Level.DEBUG, "$logName: saturation ${hsb.saturation} >= ${Config.shortGrass.saturationThreshold}, using texture color")
|
||||||
hsb.copy(brightness = 0.9f).asColor
|
hsb.copy(brightness = min(0.9f, hsb.brightness * 2.0f)).asColor
|
||||||
} else {
|
} else {
|
||||||
logger.log(Level.DEBUG, "$logName: saturation ${hsb.saturation} < ${Config.shortGrass.saturationThreshold}, using block color")
|
logger.log(Level.DEBUG, "$logName: saturation ${hsb.saturation} < ${Config.shortGrass.saturationThreshold}, using block color")
|
||||||
null
|
null
|
||||||
|
|||||||
@@ -63,14 +63,12 @@ object Refs {
|
|||||||
val VanillaModelWrapper = ClassRef("net.minecraftforge.client.model.ModelLoader\$VanillaModelWrapper")
|
val VanillaModelWrapper = ClassRef("net.minecraftforge.client.model.ModelLoader\$VanillaModelWrapper")
|
||||||
val model_VMW = FieldRef(VanillaModelWrapper, "model", ModelBlock)
|
val model_VMW = FieldRef(VanillaModelWrapper, "model", ModelBlock)
|
||||||
val location_VMW = FieldRef(VanillaModelWrapper, "location", ModelBlock)
|
val location_VMW = FieldRef(VanillaModelWrapper, "location", ModelBlock)
|
||||||
// val WeightedPartWrapper = ClassRef("net.minecraftforge.client.model.ModelLoader\$WeightedPartWrapper")
|
|
||||||
// val model_WPW = FieldRef(WeightedPartWrapper, "model", IModel)
|
|
||||||
val WeightedRandomModel = ClassRef("net.minecraftforge.client.model.ModelLoader\$WeightedRandomModel")
|
val WeightedRandomModel = ClassRef("net.minecraftforge.client.model.ModelLoader\$WeightedRandomModel")
|
||||||
val models_WRM = FieldRef(WeightedRandomModel, "models", List)
|
val models_WRM = FieldRef(WeightedRandomModel, "models", List)
|
||||||
val MultiModel = ClassRef("net.minecraftforge.client.model.MultiModel")
|
val MultiModel = ClassRef("net.minecraftforge.client.model.MultiModel")
|
||||||
val base_MM = FieldRef(MultiModel, "base", IModel)
|
val base_MM = FieldRef(MultiModel, "base", IModel)
|
||||||
val WeightedBakedModel = ClassRef("net.minecraft.client.renderer.block.model.WeightedBakedModel")
|
val MultipartModel = ClassRef("net.minecraftforge.client.model.ModelLoader\$MultipartModel")
|
||||||
val models_WBM = FieldRef(WeightedBakedModel, "models", List)
|
val partModels_MPM = FieldRef(MultipartModel, "partModels", List)
|
||||||
|
|
||||||
val resetChangedState = MethodRef(ClassRef("net.minecraftforge.common.config.Configuration"), "resetChangedState", ClassRef.void)
|
val resetChangedState = MethodRef(ClassRef("net.minecraftforge.common.config.Configuration"), "resetChangedState", ClassRef.void)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
@file:JvmName("Utils")
|
@file:JvmName("Utils")
|
||||||
package mods.octarinecore.client.gui
|
package mods.octarinecore.client.gui
|
||||||
|
|
||||||
import net.minecraft.util.text.TextFormatting.*
|
import net.minecraft.util.text.Style
|
||||||
|
import net.minecraft.util.text.TextComponentString
|
||||||
|
import net.minecraft.util.text.TextFormatting
|
||||||
|
import net.minecraft.util.text.TextFormatting.AQUA
|
||||||
|
import net.minecraft.util.text.TextFormatting.GRAY
|
||||||
|
|
||||||
fun stripTooltipDefaultText(tooltip: MutableList<String>) {
|
fun stripTooltipDefaultText(tooltip: MutableList<String>) {
|
||||||
var defaultRows = false
|
var defaultRows = false
|
||||||
@@ -10,4 +14,9 @@ fun stripTooltipDefaultText(tooltip: MutableList<String>) {
|
|||||||
if (iter.next().startsWith(AQUA.toString())) defaultRows = true
|
if (iter.next().startsWith(AQUA.toString())) defaultRows = true
|
||||||
if (defaultRows) iter.remove()
|
if (defaultRows) iter.remove()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun textComponent(msg: String, color: TextFormatting = GRAY): TextComponentString {
|
||||||
|
val style = Style().apply { this.color = color }
|
||||||
|
return TextComponentString(msg).apply { this.style = style }
|
||||||
}
|
}
|
||||||
@@ -75,23 +75,24 @@ interface TextureListModelProcessor<T2> : ModelProcessor<List<String>, T2> {
|
|||||||
logger?.log(Level.DEBUG, "$logName: block state ${state.toString()}")
|
logger?.log(Level.DEBUG, "$logName: block state ${state.toString()}")
|
||||||
logger?.log(Level.DEBUG, "$logName: class ${state.block.javaClass.name} matches ${matchClass.name}")
|
logger?.log(Level.DEBUG, "$logName: class ${state.block.javaClass.name} matches ${matchClass.name}")
|
||||||
|
|
||||||
val blockLoc = model.modelBlockAndLoc
|
val allModels = model.modelBlockAndLoc
|
||||||
if (blockLoc == null) {
|
if (allModels.isEmpty()) {
|
||||||
logger?.log(Level.DEBUG, "$logName: no models found")
|
logger?.log(Level.DEBUG, "$logName: no models found")
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
val modelMatch = modelTextures.firstOrNull { blockLoc.derivesFrom(it.modelLocation) }
|
allModels.forEach { blockLoc ->
|
||||||
if (modelMatch == null) {
|
modelTextures.firstOrNull { blockLoc.derivesFrom(it.modelLocation) }?.let{ modelMatch ->
|
||||||
logger?.log(Level.DEBUG, "$logName: no matching models found")
|
logger?.log(Level.DEBUG, "$logName: model ${blockLoc.second} matches ${modelMatch.modelLocation.toString()}")
|
||||||
return null
|
|
||||||
|
val textures = modelMatch.textureNames.map { it to blockLoc.first.resolveTextureName(it) }
|
||||||
|
val texMapString = Joiner.on(", ").join(textures.map { "${it.first}=${it.second}" })
|
||||||
|
logger?.log(Level.DEBUG, "$logName: textures [$texMapString]")
|
||||||
|
|
||||||
|
return if (textures.all { it.second != "missingno" }) textures.map { it.second } else null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
logger?.log(Level.DEBUG, "$logName: model ${blockLoc.second} matches ${modelMatch.modelLocation.toString()}")
|
logger?.log(Level.DEBUG, "$logName: no matching models found")
|
||||||
|
return null
|
||||||
val textures = modelMatch.textureNames.map { it to blockLoc.first.resolveTextureName(it) }
|
|
||||||
val texMapString = Joiner.on(", ").join(textures.map { "${it.first}=${it.second}" })
|
|
||||||
logger?.log(Level.DEBUG, "$logName: textures [$texMapString]")
|
|
||||||
|
|
||||||
return if (textures.all { it.second != "missingno" }) textures.map { it.second } else null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,19 +102,19 @@ fun textureLocation(iconName: String) = ResourceLocation(iconName).let {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
val IModel.modelBlockAndLoc: Pair<ModelBlock, ResourceLocation>? get() {
|
val IModel.modelBlockAndLoc: List<Pair<ModelBlock, ResourceLocation>> get() {
|
||||||
if (Refs.VanillaModelWrapper.isInstance(this))
|
if (Refs.VanillaModelWrapper.isInstance(this))
|
||||||
return Pair(Refs.model_VMW.get(this) as ModelBlock, Refs.location_VMW.get(this) as ResourceLocation)
|
return listOf(Pair(Refs.model_VMW.get(this) as ModelBlock, Refs.location_VMW.get(this) as ResourceLocation))
|
||||||
else if (Refs.WeightedRandomModel.isInstance(this)) Refs.models_WRM.get(this)?.let {
|
else if (Refs.WeightedRandomModel.isInstance(this)) Refs.models_WRM.get(this)?.let {
|
||||||
(it as List<IModel>).forEach {
|
return (it as List<IModel>).flatMap(IModel::modelBlockAndLoc)
|
||||||
it.modelBlockAndLoc.let { if (it != null) return it }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (Refs.MultiModel.isInstance(this)) Refs.base_MM.get(this)?.let {
|
else if (Refs.MultiModel.isInstance(this)) Refs.base_MM.get(this)?.let {
|
||||||
return (it as IModel).modelBlockAndLoc
|
return (it as IModel).modelBlockAndLoc
|
||||||
}
|
}
|
||||||
// TODO support net.minecraftforge.client.model.ModelLoader.MultipartModel
|
else if (Refs.MultipartModel.isInstance(this)) Refs.partModels_MPM.get(this)?.let {
|
||||||
return null
|
return (it as Map<Any, IModel>).flatMap { it.value.modelBlockAndLoc }
|
||||||
|
}
|
||||||
|
return listOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Pair<ModelBlock, ResourceLocation>.derivesFrom(targetLocation: ResourceLocation): Boolean {
|
fun Pair<ModelBlock, ResourceLocation>.derivesFrom(targetLocation: ResourceLocation): Boolean {
|
||||||
@@ -123,5 +123,3 @@ fun Pair<ModelBlock, ResourceLocation>.derivesFrom(targetLocation: ResourceLocat
|
|||||||
return Pair(first.parent, first.parentLocation!!).derivesFrom(targetLocation)
|
return Pair(first.parent, first.parentLocation!!).derivesFrom(targetLocation)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IModel.derivesFromModel(modelLoc: String) = modelBlockAndLoc?.derivesFrom(ResourceLocation(modelLoc)) ?: false
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import org.objectweb.asm.ClassReader
|
|||||||
import org.objectweb.asm.ClassWriter
|
import org.objectweb.asm.ClassWriter
|
||||||
import org.objectweb.asm.Opcodes
|
import org.objectweb.asm.Opcodes
|
||||||
import org.objectweb.asm.tree.*
|
import org.objectweb.asm.tree.*
|
||||||
|
import java.io.File
|
||||||
|
import java.io.FileOutputStream
|
||||||
|
|
||||||
@IFMLLoadingPlugin.TransformerExclusions(
|
@IFMLLoadingPlugin.TransformerExclusions(
|
||||||
"mods.octarinecore.metaprog",
|
"mods.octarinecore.metaprog",
|
||||||
@@ -55,6 +57,15 @@ open class Transformer : IClassTransformer {
|
|||||||
MCP -> log.info("Found method ${targetMethod.parentClass.name}.${targetMethod.name(MCP)} ${targetMethod.asmDescriptor(MCP)}")
|
MCP -> log.info("Found method ${targetMethod.parentClass.name}.${targetMethod.name(MCP)} ${targetMethod.asmDescriptor(MCP)}")
|
||||||
SRG -> log.info("Found method ${targetMethod.parentClass.name}.${targetMethod.name(namespace)} ${targetMethod.asmDescriptor(namespace)} (matching ${targetMethod.name(MCP)})")
|
SRG -> log.info("Found method ${targetMethod.parentClass.name}.${targetMethod.name(namespace)} ${targetMethod.asmDescriptor(namespace)} (matching ${targetMethod.name(MCP)})")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// write input bytecode for debugging - definitely not in production...
|
||||||
|
//File("BF_debug").mkdir()
|
||||||
|
//FileOutputStream(File("BF_debug/$transformedName.class")).apply {
|
||||||
|
// write(classData)
|
||||||
|
// close()
|
||||||
|
//}
|
||||||
|
|
||||||
|
// transform
|
||||||
MethodTransformContext(method, namespace).transform()
|
MethodTransformContext(method, namespace).transform()
|
||||||
workDone = true
|
workDone = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,3 +12,7 @@ enhancedbiomes.blocks.BlockGrassEB
|
|||||||
|
|
||||||
// TerraFirmaCraft
|
// TerraFirmaCraft
|
||||||
com.bioxx.tfc.Blocks.Terrain.BlockGrass
|
com.bioxx.tfc.Blocks.Terrain.BlockGrass
|
||||||
|
|
||||||
|
// AbyssalCraft
|
||||||
|
com.shinoow.abyssalcraft.common.blocks.BlockDreadGrass
|
||||||
|
com.shinoow.abyssalcraft.common.blocks.BlockDarklandsgrass
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ betterfoliage.population.tooltip=Chance (N in 64) that an eligible block will ha
|
|||||||
betterfoliage.shaderWind=Shader wind effects
|
betterfoliage.shaderWind=Shader wind effects
|
||||||
betterfoliage.shaderWind.tooltip=Apply wind effects from ShaderMod shaders to this element?
|
betterfoliage.shaderWind.tooltip=Apply wind effects from ShaderMod shaders to this element?
|
||||||
betterfoliage.distance=Distance limit
|
betterfoliage.distance=Distance limit
|
||||||
betterfoliage.distance.tooltip=Maximum distance from player at which to render this feature
|
betterfoliage.distance.tooltip=Maximum distance from player at which to render this feature
|
||||||
|
|
||||||
|
betterfoliage.rendererror=§a[BetterFoliage]§f Error rendering block %s at position %s
|
||||||
|
|
||||||
betterfoliage.blocks=Block Types
|
betterfoliage.blocks=Block Types
|
||||||
betterfoliage.blocks.tooltip=Configure lists of block classes that will have specific features applied to them
|
betterfoliage.blocks.tooltip=Configure lists of block classes that will have specific features applied to them
|
||||||
|
|||||||
Reference in New Issue
Block a user