mod support: BOP, BYG, Environmental, Desolation
This commit is contained in:
@@ -79,8 +79,16 @@ class StandardDirtModel(
|
|||||||
val isShallowWater = isWater && state2Up.isAir
|
val isShallowWater = isWater && state2Up.isAir
|
||||||
val isSaltWater = isWater && ctx.biome?.biomeCategory in SALTWATER_BIOMES
|
val isSaltWater = isWater && ctx.biome?.biomeCategory in SALTWATER_BIOMES
|
||||||
|
|
||||||
|
// get the actual grass model to use for connected grass rendering
|
||||||
|
// return null if the grass specifically does not want to connect
|
||||||
|
val connectedGrassModel = if (!isConnectedGrass) null else getBlockModel(stateUp).let { model ->
|
||||||
|
(model as? SpecialRenderModel)?.resolve(random)?.let { grassModel ->
|
||||||
|
if ((grassModel as? StandardGrassModel)?.key?.noConnect == true) null else grassModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return DirtRenderData(
|
return DirtRenderData(
|
||||||
connectedGrassModel = if (isConnectedGrass) (getBlockModel(stateUp) as? SpecialRenderModel)?.resolve(random) else null,
|
connectedGrassModel = connectedGrassModel,
|
||||||
algaeIdx = random.idxOrNull(algaeModels) { Config.algae.enabled(random) && isDeepWater && isSaltWater },
|
algaeIdx = random.idxOrNull(algaeModels) { Config.algae.enabled(random) && isDeepWater && isSaltWater },
|
||||||
reedIdx = random.idxOrNull(reedModels) { Config.reed.enabled(random) && isShallowWater && !isSaltWater }
|
reedIdx = random.idxOrNull(reedModels) { Config.reed.enabled(random) && isShallowWater && !isSaltWater }
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ object StandardGrassDiscovery : ParametrizedModelDiscovery() {
|
|||||||
detailLogger.logTextureColor(INFO, "grass texture \"$texture\"", it)
|
detailLogger.logTextureColor(INFO, "grass texture \"$texture\"", it)
|
||||||
it.brighten().asColor
|
it.brighten().asColor
|
||||||
}
|
}
|
||||||
ctx.addReplacement(StandardGrassKey(texture, tint, color))
|
val noConnect = params["no-connect"] == "true"
|
||||||
|
ctx.addReplacement(StandardGrassKey(texture, tint, color, noConnect))
|
||||||
BetterFoliage.blockTypes.grass.add(ctx.blockState)
|
BetterFoliage.blockTypes.grass.add(ctx.blockState)
|
||||||
ctx.blockState.block.extendLayers()
|
ctx.blockState.block.extendLayers()
|
||||||
}
|
}
|
||||||
@@ -56,6 +57,7 @@ data class StandardGrassKey(
|
|||||||
val sprite: ResourceLocation,
|
val sprite: ResourceLocation,
|
||||||
val tintIndex: Int,
|
val tintIndex: Int,
|
||||||
val avgColor: Color,
|
val avgColor: Color,
|
||||||
|
val noConnect: Boolean
|
||||||
) : HalfBakedWrapperKey() {
|
) : HalfBakedWrapperKey() {
|
||||||
override fun bake(ctx: ModelBakingContext, wrapped: SpecialRenderModel): SpecialRenderModel {
|
override fun bake(ctx: ModelBakingContext, wrapped: SpecialRenderModel): SpecialRenderModel {
|
||||||
return StandardGrassModel(wrapped, this)
|
return StandardGrassModel(wrapped, this)
|
||||||
@@ -76,7 +78,7 @@ class GrassRenderData(
|
|||||||
|
|
||||||
class StandardGrassModel(
|
class StandardGrassModel(
|
||||||
wrapped: SpecialRenderModel,
|
wrapped: SpecialRenderModel,
|
||||||
key: StandardGrassKey
|
val key: StandardGrassKey
|
||||||
) : HalfBakedSpecialWrapper(wrapped) {
|
) : HalfBakedSpecialWrapper(wrapped) {
|
||||||
|
|
||||||
val tuftNormal by grassTuftMeshesNormal.delegate(key)
|
val tuftNormal by grassTuftMeshesNormal.delegate(key)
|
||||||
@@ -91,7 +93,7 @@ class StandardGrassModel(
|
|||||||
val stateAbove = ctx.state(UP)
|
val stateAbove = ctx.state(UP)
|
||||||
val isAir = ctx.isAir(UP)
|
val isAir = ctx.isAir(UP)
|
||||||
val isSnowed = stateAbove.isSnow
|
val isSnowed = stateAbove.isSnow
|
||||||
val connected = Config.connectedGrass.enabled &&
|
val connected = !key.noConnect && Config.connectedGrass.enabled &&
|
||||||
(!isSnowed || Config.connectedGrass.snowEnabled) &&
|
(!isSnowed || Config.connectedGrass.snowEnabled) &&
|
||||||
BetterFoliage.blockTypes.run { stateBelow in grass || stateBelow in dirt }
|
BetterFoliage.blockTypes.run { stateBelow in grass || stateBelow in dirt }
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
match isParam("type", "leaf")
|
||||||
|
model.extends("biomesoplenty:block/leaves_overlay")
|
||||||
|
setParam("texture", model.texture("leaves"))
|
||||||
|
setParam("tint", model.tint("leaves"))
|
||||||
|
end
|
||||||
|
|
||||||
|
match isParam("type", "grass")
|
||||||
|
model.extends("biomesoplenty:block/origin_grass_block")
|
||||||
|
setParam("texture", model.texture("top"))
|
||||||
|
setParam("tint", model.tint("top"))
|
||||||
|
end
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
// A lot of BYG leaf models are very sloppily made, extending "block/cube" or even "block/block"
|
||||||
|
// These rules are meh, but there's no better way to do it, there's no method to the madness here
|
||||||
|
|
||||||
|
// snowy leaves
|
||||||
|
match isParam("type", "leaf") block.name.contains("byg:leaves") model.contains("snowy")
|
||||||
|
setParam("texture", model.texture("up")) setParam("tint", model.tint("up")) end
|
||||||
|
|
||||||
|
// list of leaves where texture is "up"
|
||||||
|
match model.matches(
|
||||||
|
"byg:block/aspen_leaves",
|
||||||
|
"byg:block/baobab_leaves",
|
||||||
|
"byg:block/blue_enchanted_leaves"
|
||||||
|
) setParam("texture", model.texture("up")) setParam("tint", model.tint("up"))
|
||||||
|
end
|
||||||
|
|
||||||
|
// list of leaves where texture is "top"
|
||||||
|
match model.matches(
|
||||||
|
"byg:block/flowering_orchard_leaves",
|
||||||
|
"byg:block/joshua_leaves",
|
||||||
|
"byg:block/mahogany_leaves",
|
||||||
|
"byg:block/maple_leaves",
|
||||||
|
"byg:block/orchard_leaves",
|
||||||
|
"byg:block/rainbow_eucalyptus_leaves",
|
||||||
|
"byg:block/willow_leaves"
|
||||||
|
) setParam("texture", model.texture("top")) setParam("tint", model.tint("top"))
|
||||||
|
end
|
||||||
|
|
||||||
|
// ripe leaves (tint comes from overlay)
|
||||||
|
match model.matches(
|
||||||
|
"byg:block/ripe_joshua_leaves",
|
||||||
|
"byg:block/ripe_orchard_leaves"
|
||||||
|
) setParam("texture", model.texture("top")) setParam("tint", model.tint("overlay"))
|
||||||
|
end
|
||||||
|
|
||||||
|
//
|
||||||
|
// other blocks
|
||||||
|
//
|
||||||
|
match block.name.matches("byg:meadow_dirt") setParam("type", "dirt") end
|
||||||
|
match block.name.matches("byg:overgrown_crimson_blackstone") setParam("type", "mycelium") end
|
||||||
|
|
||||||
|
match model.matches("byg:block/meadow_grass_block", "byg:block/overgrown_stone", "byg:block/overgrown_dacite", "byg:block/overgrown_netherrack")
|
||||||
|
setParam("type", "grass")
|
||||||
|
setParam("texture", model.texture("top")) setParam("tint", model.tint("top"))
|
||||||
|
end
|
||||||
|
|
||||||
|
match block.name.matches("byg:overgrown_stone", "byg:overgrown_dacite", "byg:overgrown_netherrack", "byg:podzol_dacite")
|
||||||
|
setParam("no-connect", "true")
|
||||||
|
end
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
match block.class.extends(classOf("desolation:charred_branches")) setParam("type", "leaf") end
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
match block.class.extends(classOf("environmental:blue_wisteria_leaves")) setParam("type", "leaf") end
|
||||||
Reference in New Issue
Block a user