fix particle mapping

Forestry support
This commit is contained in:
octarine-noise
2016-08-11 11:56:52 +02:00
parent 62294bb2bb
commit f032814d99
4 changed files with 14 additions and 8 deletions

View File

@@ -58,6 +58,7 @@ object ForestryLeavesSupport : ILeafRegistry {
textureToValue.clear()
val allLeaves = ForestryIntegration.TeLleafTextures.getStatic() as Map<*, *>
allLeaves.entries.forEach {
Client.logDetail("ForestryLeavesSupport: base leaf type ${it.key.toString()}")
listOf(
ForestryIntegration.TeLplain.get(it.value) as ResourceLocation,
ForestryIntegration.TeLfancy.get(it.value) as ResourceLocation,
@@ -72,6 +73,8 @@ object ForestryLeavesSupport : ILeafRegistry {
fun registerLeaf(textureLocation: ResourceLocation, atlas: TextureMap) {
val texture = atlas[textureLocation.toString()] ?: return
var leafType = LeafRegistry.typeMappings.getType(texture) ?: "default"
Client.logDetail("ForestryLeavesSupport: texture ${texture.iconName}")
Client.logDetail("ForestryLeavesSupport: particle $leafType")
val generated = atlas.registerSprite(
Client.genLeaves.generatedResource(texture.iconName, "type" to leafType)
)

View File

@@ -14,6 +14,7 @@ import net.minecraft.block.state.IBlockState
import net.minecraft.client.renderer.texture.TextureAtlasSprite
import net.minecraft.client.renderer.texture.TextureMap
import net.minecraft.util.EnumFacing
import net.minecraft.util.ResourceLocation
import net.minecraft.util.math.BlockPos
import net.minecraft.world.IBlockAccess
import net.minecraftforge.client.event.TextureStitchEvent
@@ -58,6 +59,7 @@ object LeafRegistry : ILeafRegistry {
@SubscribeEvent(priority = EventPriority.HIGHEST)
fun handlePreStitch(event: TextureStitchEvent.Pre) {
particles.clear()
typeMappings.loadMappings(ResourceLocation(BetterFoliageMod.DOMAIN, "leafTextureMappings.cfg"))
}
override fun get(state: IBlockState, world: IBlockAccess, pos: BlockPos, face: EnumFacing) =
@@ -114,14 +116,18 @@ object StandardLeafSupport :
override fun processStitch(state: IBlockState, key: List<String>, atlas: TextureMap) = atlas[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}")
registerLeaf(texture, atlas)
OptifineCTM.getAllCTM(states, texture).forEach {
logger?.log(Level.DEBUG, "$logName: CTM ${texture.iconName}")
registerLeaf(it, atlas)
}
}
fun registerLeaf(texture: TextureAtlasSprite, atlas: TextureMap) {
var leafType = LeafRegistry.typeMappings.getType(texture) ?: "default"
logger?.log(Level.DEBUG, "$logName: particle $leafType")
val generated = atlas.registerSprite(
Client.genLeaves.generatedResource(texture.iconName, "type" to leafType)
)

View File

@@ -1,8 +1,2 @@
// Vanilla
net.minecraft.block.BlockLeaves
// Forestry
forestry.arboriculture.gadgets.BlockLeaves
// Thaumcraft
thaumcraft.common.blocks.BlockMagicalLeaves
net.minecraft.block.BlockLeaves

View File

@@ -3,4 +3,7 @@ spruce=spruce
jungle=jungle
// Biomes O' Plenty
fir=spruce
fir=spruce
// Forestry
forestry:conifers=spruce