port to MC 1.9
This commit is contained in:
@@ -3,7 +3,7 @@ apply plugin: 'kotlin'
|
|||||||
|
|
||||||
group = 'com.github.octarine-noise'
|
group = 'com.github.octarine-noise'
|
||||||
version = "2.0.4"
|
version = "2.0.4"
|
||||||
archivesBaseName = rootProject.name + '-MC1.8.x'
|
archivesBaseName = rootProject.name + '-MC1.9'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.0.0'
|
ext.kotlin_version = '1.0.0'
|
||||||
@@ -32,8 +32,8 @@ dependencies {
|
|||||||
|
|
||||||
}
|
}
|
||||||
minecraft {
|
minecraft {
|
||||||
version = '1.8.8-11.15.0.1655'
|
version = '1.9-12.16.0.1776-1.9'
|
||||||
mappings = 'stable_20'
|
mappings = 'snapshot_20160320'
|
||||||
runDir = 'run'
|
runDir = 'run'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ object BetterFoliageMod {
|
|||||||
const val MOD_NAME = "Better Foliage"
|
const val MOD_NAME = "Better Foliage"
|
||||||
const val DOMAIN = "betterfoliage"
|
const val DOMAIN = "betterfoliage"
|
||||||
const val LEGACY_DOMAIN = "bettergrassandleaves"
|
const val LEGACY_DOMAIN = "bettergrassandleaves"
|
||||||
const val MC_VERSIONS = "[1.8.8,1.8.9]"
|
const val MC_VERSIONS = "[1.9]"
|
||||||
const val GUI_FACTORY = "mods.betterfoliage.client.gui.ConfigGuiFactory"
|
const val GUI_FACTORY = "mods.betterfoliage.client.gui.ConfigGuiFactory"
|
||||||
|
|
||||||
lateinit var log: Logger
|
lateinit var log: Logger
|
||||||
|
|||||||
@@ -71,6 +71,6 @@ object Client {
|
|||||||
OptifineCTM
|
OptifineCTM
|
||||||
)
|
)
|
||||||
|
|
||||||
fun log(level: Level, msg: String) = BetterFoliageMod.log!!.log(level, msg)
|
fun log(level: Level, msg: String) = BetterFoliageMod.log.log(level, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,13 +13,12 @@ import mods.octarinecore.common.plus
|
|||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.block.state.IBlockState
|
import net.minecraft.block.state.IBlockState
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.init.Blocks
|
import net.minecraft.init.Blocks
|
||||||
import net.minecraft.util.BlockPos
|
import net.minecraft.util.BlockRenderLayer
|
||||||
|
import net.minecraft.util.BlockRenderLayer.*
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.EnumFacing
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.EnumWorldBlockLayer.CUTOUT
|
|
||||||
import net.minecraft.util.EnumWorldBlockLayer.CUTOUT_MIPPED
|
|
||||||
import net.minecraft.world.IBlockAccess
|
import net.minecraft.world.IBlockAccess
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.client.model.ModelLoader
|
import net.minecraftforge.client.model.ModelLoader
|
||||||
@@ -28,16 +27,16 @@ import net.minecraftforge.fml.relauncher.Side
|
|||||||
import net.minecraftforge.fml.relauncher.SideOnly
|
import net.minecraftforge.fml.relauncher.SideOnly
|
||||||
|
|
||||||
fun shouldRenderBlockSideOverride(original: Boolean, blockAccess: IBlockAccess, pos: BlockPos, side: EnumFacing): Boolean {
|
fun shouldRenderBlockSideOverride(original: Boolean, blockAccess: IBlockAccess, pos: BlockPos, side: EnumFacing): Boolean {
|
||||||
return original || (Config.enabled && Config.roundLogs.enabled && Config.blocks.logs.matchesID(blockAccess.getBlockState(pos).block));
|
return original && !(Config.enabled && Config.roundLogs.enabled && Config.blocks.logs.matchesID(blockAccess.getBlockState(pos).block));
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAmbientOcclusionLightValueOverride(original: Float, block: Block): Float {
|
fun getAmbientOcclusionLightValueOverride(original: Float, state: IBlockState): Float {
|
||||||
if (Config.enabled && Config.roundLogs.enabled && Config.blocks.logs.matchesID(block)) return Config.roundLogs.dimming;
|
if (Config.enabled && Config.roundLogs.enabled && Config.blocks.logs.matchesID(state.block)) return Config.roundLogs.dimming;
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getUseNeighborBrightnessOverride(original: Boolean, block: Block): Boolean {
|
fun getUseNeighborBrightnessOverride(original: Boolean, state: IBlockState): Boolean {
|
||||||
return original || (Config.enabled && Config.roundLogs.enabled && Config.blocks.logs.matchesID(block));
|
return original || (Config.enabled && Config.roundLogs.enabled && Config.blocks.logs.matchesID(state.block));
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onRandomDisplayTick(world: World, state: IBlockState, pos: BlockPos) {
|
fun onRandomDisplayTick(world: World, state: IBlockState, pos: BlockPos) {
|
||||||
@@ -66,13 +65,14 @@ fun renderWorldBlock(dispatcher: BlockRendererDispatcher,
|
|||||||
state: IBlockState,
|
state: IBlockState,
|
||||||
pos: BlockPos,
|
pos: BlockPos,
|
||||||
blockAccess: IBlockAccess,
|
blockAccess: IBlockAccess,
|
||||||
worldRenderer: WorldRenderer,
|
worldRenderer: VertexBuffer,
|
||||||
layer: EnumWorldBlockLayer
|
layer: BlockRenderLayer
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val isCutout = layer == CUTOUT_MIPPED || layer == CUTOUT
|
val isCutout = layer == CUTOUT_MIPPED || layer == CUTOUT
|
||||||
val needsCutout = state.block.canRenderInLayer(CUTOUT_MIPPED) || state.block.canRenderInLayer(CUTOUT)
|
val needsCutout = state.block.canRenderInLayer(CUTOUT_MIPPED) || state.block.canRenderInLayer(CUTOUT)
|
||||||
val canRender = (isCutout && needsCutout) || state.block.canRenderInLayer(layer)
|
val canRender = (isCutout && needsCutout) || state.block.canRenderInLayer(layer)
|
||||||
|
|
||||||
|
|
||||||
blockContext.let { ctx ->
|
blockContext.let { ctx ->
|
||||||
ctx.set(blockAccess, pos)
|
ctx.set(blockAccess, pos)
|
||||||
Client.renderers.forEach { renderer ->
|
Client.renderers.forEach { renderer ->
|
||||||
@@ -88,7 +88,7 @@ fun renderWorldBlock(dispatcher: BlockRendererDispatcher,
|
|||||||
return if (canRender) dispatcher.renderBlock(state, pos, blockAccess, worldRenderer) else false
|
return if (canRender) dispatcher.renderBlock(state, pos, blockAccess, worldRenderer) else false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun canRenderBlockInLayer(block: Block, layer: EnumWorldBlockLayer): Boolean {
|
fun canRenderBlockInLayer(block: Block, layer: BlockRenderLayer): Boolean {
|
||||||
if (layer == CUTOUT_MIPPED && !block.canRenderInLayer(CUTOUT)) {
|
if (layer == CUTOUT_MIPPED && !block.canRenderInLayer(CUTOUT)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package mods.betterfoliage.client.config
|
|||||||
import mods.betterfoliage.BetterFoliageMod
|
import mods.betterfoliage.BetterFoliageMod
|
||||||
import mods.betterfoliage.client.gui.BiomeListConfigEntry
|
import mods.betterfoliage.client.gui.BiomeListConfigEntry
|
||||||
import mods.octarinecore.common.config.*
|
import mods.octarinecore.common.config.*
|
||||||
import mods.octarinecore.metaprog.reflectField
|
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.world.biome.BiomeGenBase
|
import net.minecraft.world.biome.BiomeGenBase
|
||||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent
|
import net.minecraftforge.fml.client.event.ConfigChangedEvent
|
||||||
@@ -14,7 +13,10 @@ import net.minecraftforge.fml.relauncher.SideOnly
|
|||||||
private fun featureEnable() = boolean(true).lang("enabled")
|
private fun featureEnable() = boolean(true).lang("enabled")
|
||||||
private fun distanceLimit() = int(min=1, max=1000, default=1000).lang("distance")
|
private fun distanceLimit() = int(min=1, max=1000, default=1000).lang("distance")
|
||||||
fun biomeList(defaults: (BiomeGenBase) -> Boolean) = intList {
|
fun biomeList(defaults: (BiomeGenBase) -> Boolean) = intList {
|
||||||
BiomeGenBase.getBiomeGenArray().filter { it != null && defaults(it) }.map { it.biomeID }.toTypedArray()
|
BiomeGenBase.biomeRegistry
|
||||||
|
.filter { it != null && defaults(it) }
|
||||||
|
.map { BiomeGenBase.biomeRegistry.getIDForObject(it) }
|
||||||
|
.toTypedArray()
|
||||||
}.apply { guiClass = BiomeListConfigEntry::class.java }
|
}.apply { guiClass = BiomeListConfigEntry::class.java }
|
||||||
|
|
||||||
// Biome filter methods
|
// Biome filter methods
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class BiomeListConfigEntry(
|
|||||||
configElement: IConfigElement)
|
configElement: IConfigElement)
|
||||||
: IdListConfigEntry<BiomeGenBase>(owningScreen, owningEntryList, configElement) {
|
: IdListConfigEntry<BiomeGenBase>(owningScreen, owningEntryList, configElement) {
|
||||||
|
|
||||||
override val baseSet: List<BiomeGenBase> get() = BiomeGenBase.getBiomeGenArray().filterNotNull()
|
override val baseSet: List<BiomeGenBase> get() = BiomeGenBase.biomeRegistry.filterNotNull()
|
||||||
override val BiomeGenBase.itemId: Int get() = this.biomeID
|
override val BiomeGenBase.itemId: Int get() = BiomeGenBase.biomeRegistry.getIDForObject(this)
|
||||||
override val BiomeGenBase.itemName: String get() = this.biomeName
|
override val BiomeGenBase.itemName: String get() = this.biomeName
|
||||||
}
|
}
|
||||||
@@ -5,12 +5,11 @@ import mods.betterfoliage.loader.Refs
|
|||||||
import mods.octarinecore.ThreadLocalDelegate
|
import mods.octarinecore.ThreadLocalDelegate
|
||||||
import mods.octarinecore.client.render.BlockContext
|
import mods.octarinecore.client.render.BlockContext
|
||||||
import mods.octarinecore.metaprog.allAvailable
|
import mods.octarinecore.metaprog.allAvailable
|
||||||
import net.minecraft.block.Block
|
|
||||||
import net.minecraft.block.state.BlockStateBase
|
import net.minecraft.block.state.BlockStateBase
|
||||||
import net.minecraft.block.state.IBlockState
|
import net.minecraft.block.state.IBlockState
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||||
import net.minecraft.util.BlockPos
|
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.EnumFacing
|
||||||
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.IBlockAccess
|
import net.minecraft.world.IBlockAccess
|
||||||
import net.minecraftforge.fml.relauncher.Side
|
import net.minecraftforge.fml.relauncher.Side
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly
|
import net.minecraftforge.fml.relauncher.SideOnly
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import mods.octarinecore.metaprog.allAvailable
|
|||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.block.BlockTallGrass
|
import net.minecraft.block.BlockTallGrass
|
||||||
import net.minecraft.block.state.IBlockState
|
import net.minecraft.block.state.IBlockState
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.init.Blocks
|
import net.minecraft.init.Blocks
|
||||||
import net.minecraftforge.fml.relauncher.Side
|
import net.minecraftforge.fml.relauncher.Side
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly
|
import net.minecraftforge.fml.relauncher.SideOnly
|
||||||
@@ -25,7 +25,7 @@ object ShadersModIntegration {
|
|||||||
|
|
||||||
fun entityDataFor(blockState: IBlockState) =
|
fun entityDataFor(blockState: IBlockState) =
|
||||||
(Block.blockRegistry.getIDForObject(blockState.block).toLong() and 65535) or
|
(Block.blockRegistry.getIDForObject(blockState.block).toLong() and 65535) or
|
||||||
((blockState.block.renderType.toLong() and 65535) shl 16) or
|
((blockState.renderType.ordinal.toLong() and 65535) shl 16) or
|
||||||
(blockState.block.getMetaFromState(blockState).toLong() shl 32)
|
(blockState.block.getMetaFromState(blockState).toLong() shl 32)
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ object ShadersModIntegration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Quads rendered inside this block will behave as tallgrass blocks in shader programs. */
|
/** Quads rendered inside this block will behave as tallgrass blocks in shader programs. */
|
||||||
inline fun grass(renderer: WorldRenderer, enabled: Boolean = true, func: ()->Unit) {
|
inline fun grass(renderer: VertexBuffer, enabled: Boolean = true, func: ()->Unit) {
|
||||||
if ((isPresent && enabled)) {
|
if ((isPresent && enabled)) {
|
||||||
val vertexBuilder = Refs.sVertexBuilder.get(renderer)!!
|
val vertexBuilder = Refs.sVertexBuilder.get(renderer)!!
|
||||||
Refs.pushEntity_num.invoke(vertexBuilder, tallGrassEntityData)
|
Refs.pushEntity_num.invoke(vertexBuilder, tallGrassEntityData)
|
||||||
@@ -59,7 +59,7 @@ object ShadersModIntegration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Quads rendered inside this block will behave as leaf blocks in shader programs. */
|
/** Quads rendered inside this block will behave as leaf blocks in shader programs. */
|
||||||
inline fun leaves(renderer: WorldRenderer, enabled: Boolean = true, func: ()->Unit) {
|
inline fun leaves(renderer: VertexBuffer, enabled: Boolean = true, func: ()->Unit) {
|
||||||
if ((isPresent && enabled)) {
|
if ((isPresent && enabled)) {
|
||||||
val vertexBuilder = Refs.sVertexBuilder.get(renderer)!!
|
val vertexBuilder = Refs.sVertexBuilder.get(renderer)!!
|
||||||
Refs.pushEntity_num.invoke(vertexBuilder, leavesEntityData.toLong())
|
Refs.pushEntity_num.invoke(vertexBuilder, leavesEntityData.toLong())
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ import mods.octarinecore.common.face
|
|||||||
import mods.octarinecore.common.rot
|
import mods.octarinecore.common.rot
|
||||||
import net.minecraft.block.state.IBlockState
|
import net.minecraft.block.state.IBlockState
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||||
import net.minecraft.client.renderer.texture.TextureMap
|
import net.minecraft.client.renderer.texture.TextureMap
|
||||||
|
import net.minecraft.util.BlockRenderLayer
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.EnumFacing
|
||||||
import net.minecraft.util.EnumFacing.*
|
import net.minecraft.util.EnumFacing.*
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
|
||||||
|
|
||||||
data class ColumnInfo(val topTexture: TextureAtlasSprite,
|
data class ColumnInfo(val topTexture: TextureAtlasSprite,
|
||||||
val bottomTexture: TextureAtlasSprite,
|
val bottomTexture: TextureAtlasSprite,
|
||||||
@@ -125,7 +125,7 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
|
|||||||
abstract val downTexture: (ShadingContext, Int, Quad)->TextureAtlasSprite?
|
abstract val downTexture: (ShadingContext, Int, Quad)->TextureAtlasSprite?
|
||||||
|
|
||||||
@Suppress("NON_EXHAUSTIVE_WHEN")
|
@Suppress("NON_EXHAUSTIVE_WHEN")
|
||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): 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
|
||||||
|
|
||||||
// get AO data
|
// get AO data
|
||||||
@@ -324,7 +324,7 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
|
|||||||
val offsetRot = offset.rotate(rotation)
|
val offsetRot = offset.rotate(rotation)
|
||||||
val state = blockState(offsetRot)
|
val state = blockState(offsetRot)
|
||||||
return if (!blockPredicate(state)) {
|
return if (!blockPredicate(state)) {
|
||||||
if (state.block.isOpaqueCube) SOLID else NONSOLID
|
if (state.isOpaqueCube) SOLID else NONSOLID
|
||||||
} else {
|
} else {
|
||||||
axisFunc(state)?.let { if (it == axis) PARALLEL else PERPENDICULAR } ?: SOLID
|
axisFunc(state)?.let { if (it == axis) PARALLEL else PERPENDICULAR } ?: SOLID
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,13 @@ import mods.octarinecore.common.Double3
|
|||||||
import mods.octarinecore.minmax
|
import mods.octarinecore.minmax
|
||||||
import mods.octarinecore.random
|
import mods.octarinecore.random
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.util.BlockPos
|
import net.minecraft.util.EnumFacing.DOWN
|
||||||
import net.minecraft.util.EnumFacing.*
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.MathHelper
|
import net.minecraft.util.math.MathHelper
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.common.MinecraftForge
|
import net.minecraftforge.common.MinecraftForge
|
||||||
import net.minecraftforge.event.world.WorldEvent
|
import net.minecraftforge.event.world.WorldEvent
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent
|
import net.minecraftforge.fml.common.gameevent.TickEvent
|
||||||
import net.minecraftforge.fml.relauncher.Side
|
import net.minecraftforge.fml.relauncher.Side
|
||||||
@@ -35,31 +34,31 @@ AbstractEntityFX(world, pos.x.toDouble() + 0.5, pos.y.toDouble(), pos.z.toDouble
|
|||||||
var particleRot = rand.nextInt(64)
|
var particleRot = rand.nextInt(64)
|
||||||
var rotPositive = true
|
var rotPositive = true
|
||||||
val isMirrored = (rand.nextInt() and 1) == 1
|
val isMirrored = (rand.nextInt() and 1) == 1
|
||||||
var wasOnGround = false
|
var wasCollided = false
|
||||||
|
|
||||||
init {
|
init {
|
||||||
particleMaxAge = MathHelper.floor_double(random(0.6, 1.0) * Config.fallingLeaves.lifetime * 20.0)
|
particleMaxAge = MathHelper.floor_double(random(0.6, 1.0) * Config.fallingLeaves.lifetime * 20.0)
|
||||||
motionY = -Config.fallingLeaves.speed
|
ySpeed = -Config.fallingLeaves.speed
|
||||||
particleScale = Config.fallingLeaves.size.toFloat() * 0.1f
|
particleScale = Config.fallingLeaves.size.toFloat() * 0.1f
|
||||||
|
|
||||||
val state = world.getBlockState(pos)
|
val state = world.getBlockState(pos)
|
||||||
LeafRegistry[state, world, pos, DOWN]?.let {
|
LeafRegistry[state, world, pos, DOWN]?.let {
|
||||||
particleIcon = it.particleTextures[rand.nextInt(1024)]
|
particleTexture = it.particleTextures[rand.nextInt(1024)]
|
||||||
calculateParticleColor(it.averageColor, state.block.colorMultiplier(world, pos))
|
calculateParticleColor(it.averageColor, Minecraft.getMinecraft().blockColors.colorMultiplier(state, world, pos, 0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override val isValid: Boolean get() = (particleIcon != null)
|
override val isValid: Boolean get() = (particleTexture != null)
|
||||||
|
|
||||||
override fun update() {
|
override fun update() {
|
||||||
if (rand.nextFloat() > 0.95f) rotPositive = !rotPositive
|
if (rand.nextFloat() > 0.95f) rotPositive = !rotPositive
|
||||||
if (particleAge > particleMaxAge - 20) particleAlpha = 0.05f * (particleMaxAge - particleAge)
|
if (particleAge > particleMaxAge - 20) particleAlpha = 0.05f * (particleMaxAge - particleAge)
|
||||||
|
|
||||||
if (onGround || wasOnGround) {
|
if (isCollided || wasCollided) {
|
||||||
velocity.setTo(0.0, 0.0, 0.0)
|
velocity.setTo(0.0, 0.0, 0.0)
|
||||||
if (!wasOnGround) {
|
if (!wasCollided) {
|
||||||
particleAge = Math.max(particleAge, particleMaxAge - 20)
|
particleAge = Math.max(particleAge, particleMaxAge - 20)
|
||||||
wasOnGround = true
|
wasCollided = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
velocity.setTo(cos[particleRot], 0.0, sin[particleRot]).mul(Config.fallingLeaves.perturb)
|
velocity.setTo(cos[particleRot], 0.0, sin[particleRot]).mul(Config.fallingLeaves.perturb)
|
||||||
@@ -68,7 +67,7 @@ AbstractEntityFX(world, pos.x.toDouble() + 0.5, pos.y.toDouble(), pos.z.toDouble
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(worldRenderer: WorldRenderer, partialTickTime: Float) {
|
override fun render(worldRenderer: VertexBuffer, partialTickTime: Float) {
|
||||||
if (Config.fallingLeaves.opacityHack) GL11.glDepthMask(true)
|
if (Config.fallingLeaves.opacityHack) GL11.glDepthMask(true)
|
||||||
renderParticleQuad(worldRenderer, partialTickTime, rotation = particleRot, isMirrored = isMirrored)
|
renderParticleQuad(worldRenderer, partialTickTime, rotation = particleRot, isMirrored = isMirrored)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import mods.octarinecore.client.render.AbstractEntityFX
|
|||||||
import mods.octarinecore.client.resource.ResourceHandler
|
import mods.octarinecore.client.resource.ResourceHandler
|
||||||
import mods.octarinecore.common.Double3
|
import mods.octarinecore.common.Double3
|
||||||
import mods.octarinecore.forEachPairIndexed
|
import mods.octarinecore.forEachPairIndexed
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.util.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.util.MathHelper
|
import net.minecraft.util.math.MathHelper
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraftforge.fml.relauncher.Side
|
import net.minecraftforge.fml.relauncher.Side
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly
|
import net.minecraftforge.fml.relauncher.SideOnly
|
||||||
@@ -23,9 +23,9 @@ AbstractEntityFX(world, pos.x.toDouble() + 0.5, pos.y.toDouble() + 1.0, pos.z.to
|
|||||||
val initialPhase = rand.nextInt(64)
|
val initialPhase = rand.nextInt(64)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
motionY = 0.1
|
ySpeed = 0.1
|
||||||
particleGravity = 0.0f
|
particleGravity = 0.0f
|
||||||
particleIcon = RisingSoulTextures.headIcons[rand.nextInt(256)]
|
particleTexture = RisingSoulTextures.headIcons[rand.nextInt(256)]
|
||||||
particleMaxAge = MathHelper.floor_double((0.6 + 0.4 * rand.nextDouble()) * Config.risingSoul.lifetime * 20.0)
|
particleMaxAge = MathHelper.floor_double((0.6 + 0.4 * rand.nextDouble()) * Config.risingSoul.lifetime * 20.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,10 +38,10 @@ AbstractEntityFX(world, pos.x.toDouble() + 0.5, pos.y.toDouble() + 1.0, pos.z.to
|
|||||||
particleTrail.addFirst(currentPos.copy())
|
particleTrail.addFirst(currentPos.copy())
|
||||||
while (particleTrail.size > Config.risingSoul.trailLength) particleTrail.removeLast()
|
while (particleTrail.size > Config.risingSoul.trailLength) particleTrail.removeLast()
|
||||||
|
|
||||||
if (!Config.enabled) setDead()
|
if (!Config.enabled) setExpired()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(worldRenderer: WorldRenderer, partialTickTime: Float) {
|
override fun render(worldRenderer: VertexBuffer, partialTickTime: Float) {
|
||||||
var alpha = Config.risingSoul.opacity
|
var alpha = Config.risingSoul.opacity
|
||||||
if (particleAge > particleMaxAge - 40) alpha *= (particleMaxAge - particleAge) / 40.0f
|
if (particleAge > particleMaxAge - 40) alpha *= (particleMaxAge - particleAge) / 40.0f
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import mods.octarinecore.common.Int3
|
|||||||
import mods.octarinecore.common.Rotation
|
import mods.octarinecore.common.Rotation
|
||||||
import net.minecraft.block.material.Material
|
import net.minecraft.block.material.Material
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
import net.minecraft.util.BlockRenderLayer
|
||||||
import org.apache.logging.log4j.Level.INFO
|
import org.apache.logging.log4j.Level.INFO
|
||||||
|
|
||||||
class RenderAlgae : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
class RenderAlgae : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||||
@@ -27,13 +27,13 @@ class RenderAlgae : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
override fun isEligible(ctx: BlockContext) =
|
override fun isEligible(ctx: BlockContext) =
|
||||||
Config.enabled && Config.algae.enabled &&
|
Config.enabled && Config.algae.enabled &&
|
||||||
ctx.cameraDistance < Config.algae.distance &&
|
ctx.cameraDistance < Config.algae.distance &&
|
||||||
ctx.block(up2).material == Material.water &&
|
ctx.blockState(up2).material == Material.water &&
|
||||||
ctx.block(up1).material == Material.water &&
|
ctx.blockState(up1).material == Material.water &&
|
||||||
Config.blocks.dirt.matchesID(ctx.block) &&
|
Config.blocks.dirt.matchesID(ctx.block) &&
|
||||||
ctx.biomeId in Config.algae.biomes &&
|
ctx.biomeId in Config.algae.biomes &&
|
||||||
noise[ctx.pos] < Config.algae.population
|
noise[ctx.pos] < Config.algae.population
|
||||||
|
|
||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): Boolean {
|
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
||||||
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
modelRenderer.updateShading(Int3.zero, allFaces)
|
modelRenderer.updateShading(Int3.zero, allFaces)
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,12 @@ import mods.betterfoliage.BetterFoliageMod
|
|||||||
import mods.betterfoliage.client.Client
|
import mods.betterfoliage.client.Client
|
||||||
import mods.betterfoliage.client.config.Config
|
import mods.betterfoliage.client.config.Config
|
||||||
import mods.octarinecore.client.render.*
|
import mods.octarinecore.client.render.*
|
||||||
import mods.octarinecore.client.resource.BlockTextureInspector
|
|
||||||
import mods.octarinecore.common.Int3
|
import mods.octarinecore.common.Int3
|
||||||
import mods.octarinecore.common.Rotation
|
import mods.octarinecore.common.Rotation
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
|
import net.minecraft.util.BlockRenderLayer
|
||||||
import net.minecraft.util.EnumFacing.*
|
import net.minecraft.util.EnumFacing.*
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
|
||||||
import org.apache.logging.log4j.Level
|
import org.apache.logging.log4j.Level
|
||||||
|
|
||||||
class RenderCactus : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
class RenderCactus : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||||
@@ -63,7 +62,7 @@ class RenderCactus : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
ctx.cameraDistance < Config.cactus.distance &&
|
ctx.cameraDistance < Config.cactus.distance &&
|
||||||
Config.blocks.cactus.matchesID(ctx.block)
|
Config.blocks.cactus.matchesID(ctx.block)
|
||||||
|
|
||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): Boolean {
|
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
||||||
// get AO data
|
// get AO data
|
||||||
modelRenderer.updateShading(Int3.zero, allFaces)
|
modelRenderer.updateShading(Int3.zero, allFaces)
|
||||||
val icons = iconBase[ctx.blockState(Int3.zero)] ?: return renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
val icons = iconBase[ctx.blockState(Int3.zero)] ?: return renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
|
|||||||
@@ -7,17 +7,17 @@ import mods.octarinecore.client.render.BlockContext
|
|||||||
import mods.octarinecore.client.render.withOffset
|
import mods.octarinecore.client.render.withOffset
|
||||||
import mods.octarinecore.common.Int3
|
import mods.octarinecore.common.Int3
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
import net.minecraft.util.BlockRenderLayer
|
||||||
|
|
||||||
class RenderConnectedGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
class RenderConnectedGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||||
override fun isEligible(ctx: BlockContext) =
|
override fun isEligible(ctx: BlockContext) =
|
||||||
Config.enabled && Config.connectedGrass.enabled &&
|
Config.enabled && Config.connectedGrass.enabled &&
|
||||||
Config.blocks.dirt.matchesID(ctx.block) &&
|
Config.blocks.dirt.matchesID(ctx.block) &&
|
||||||
Config.blocks.grass.matchesID(ctx.block(up1)) &&
|
Config.blocks.grass.matchesID(ctx.block(up1)) &&
|
||||||
(Config.connectedGrass.snowEnabled || !ctx.block(up2).isSnow)
|
(Config.connectedGrass.snowEnabled || !ctx.blockState(up2).isSnow)
|
||||||
|
|
||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): Boolean {
|
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
||||||
return ctx.withOffset(Int3.zero, up1) {
|
return ctx.withOffset(Int3.zero, up1) {
|
||||||
ctx.withOffset(up1, up2) {
|
ctx.withOffset(up1, up2) {
|
||||||
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import mods.octarinecore.client.render.withOffset
|
|||||||
import mods.octarinecore.common.Int3
|
import mods.octarinecore.common.Int3
|
||||||
import mods.octarinecore.common.offset
|
import mods.octarinecore.common.offset
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
|
import net.minecraft.util.BlockRenderLayer
|
||||||
import net.minecraft.util.EnumFacing.*
|
import net.minecraft.util.EnumFacing.*
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
|
||||||
|
|
||||||
class RenderConnectedGrassLog : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
class RenderConnectedGrassLog : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ class RenderConnectedGrassLog : AbstractBlockRenderingHandler(BetterFoliageMod.M
|
|||||||
Config.blocks.dirt.matchesID(ctx.block) &&
|
Config.blocks.dirt.matchesID(ctx.block) &&
|
||||||
Config.blocks.logs.matchesID(ctx.block(up1))
|
Config.blocks.logs.matchesID(ctx.block(up1))
|
||||||
|
|
||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): Boolean {
|
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
||||||
val grassDir = grassCheckDirs.find {
|
val grassDir = grassCheckDirs.find {
|
||||||
Config.blocks.grass.matchesID(ctx.block(it.offset))
|
Config.blocks.grass.matchesID(ctx.block(it.offset))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import mods.octarinecore.common.forgeDirs
|
|||||||
import mods.octarinecore.random
|
import mods.octarinecore.random
|
||||||
import net.minecraft.block.material.Material
|
import net.minecraft.block.material.Material
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
|
import net.minecraft.util.BlockRenderLayer
|
||||||
import net.minecraft.util.EnumFacing.Axis
|
import net.minecraft.util.EnumFacing.Axis
|
||||||
import net.minecraft.util.EnumFacing.UP
|
import net.minecraft.util.EnumFacing.UP
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
|
||||||
import org.apache.logging.log4j.Level.INFO
|
import org.apache.logging.log4j.Level.INFO
|
||||||
|
|
||||||
class RenderCoral : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
class RenderCoral : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||||
@@ -45,18 +45,18 @@ class RenderCoral : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
override fun isEligible(ctx: BlockContext) =
|
override fun isEligible(ctx: BlockContext) =
|
||||||
Config.enabled && Config.coral.enabled &&
|
Config.enabled && Config.coral.enabled &&
|
||||||
ctx.cameraDistance < Config.coral.distance &&
|
ctx.cameraDistance < Config.coral.distance &&
|
||||||
ctx.block(up2).material == Material.water &&
|
ctx.blockState(up2).material == Material.water &&
|
||||||
ctx.block(up1).material == Material.water &&
|
ctx.blockState(up1).material == Material.water &&
|
||||||
Config.blocks.sand.matchesID(ctx.block) &&
|
Config.blocks.sand.matchesID(ctx.block) &&
|
||||||
ctx.biomeId in Config.coral.biomes &&
|
ctx.biomeId in Config.coral.biomes &&
|
||||||
noise[ctx.pos] < Config.coral.population
|
noise[ctx.pos] < Config.coral.population
|
||||||
|
|
||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): Boolean {
|
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
||||||
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
modelRenderer.updateShading(Int3.zero, allFaces)
|
modelRenderer.updateShading(Int3.zero, allFaces)
|
||||||
|
|
||||||
forgeDirs.forEachIndexed { idx, face ->
|
forgeDirs.forEachIndexed { idx, face ->
|
||||||
if (!ctx.block(forgeDirOffsets[idx]).isOpaqueCube && blockContext.random(idx) < Config.coral.chance) {
|
if (!ctx.blockState(forgeDirOffsets[idx]).isOpaqueCube && blockContext.random(idx) < Config.coral.chance) {
|
||||||
var variation = blockContext.random(6)
|
var variation = blockContext.random(6)
|
||||||
modelRenderer.render(
|
modelRenderer.render(
|
||||||
renderer,
|
renderer,
|
||||||
|
|||||||
@@ -11,12 +11,11 @@ import mods.octarinecore.common.Double3
|
|||||||
import mods.octarinecore.common.Int3
|
import mods.octarinecore.common.Int3
|
||||||
import mods.octarinecore.common.Rotation
|
import mods.octarinecore.common.Rotation
|
||||||
import mods.octarinecore.random
|
import mods.octarinecore.random
|
||||||
import net.minecraft.block.material.Material
|
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
|
import net.minecraft.util.BlockRenderLayer
|
||||||
import net.minecraft.util.EnumFacing.Axis
|
import net.minecraft.util.EnumFacing.Axis
|
||||||
import net.minecraft.util.EnumFacing.UP
|
import net.minecraft.util.EnumFacing.UP
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
|
||||||
import org.apache.logging.log4j.Level.INFO
|
import org.apache.logging.log4j.Level.INFO
|
||||||
|
|
||||||
class RenderGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
class RenderGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||||
@@ -50,15 +49,15 @@ class RenderGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
(Config.shortGrass.grassEnabled || Config.connectedGrass.enabled) &&
|
(Config.shortGrass.grassEnabled || Config.connectedGrass.enabled) &&
|
||||||
Config.blocks.grass.matchesID(ctx.block)
|
Config.blocks.grass.matchesID(ctx.block)
|
||||||
|
|
||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): Boolean {
|
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
||||||
val isConnected = ctx.block(down1).let { Config.blocks.dirt.matchesID(it) || Config.blocks.grass.matchesID(it) }
|
val isConnected = ctx.block(down1).let { Config.blocks.dirt.matchesID(it) || Config.blocks.grass.matchesID(it) }
|
||||||
val isSnowed = ctx.block(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.blockState(Int3.zero)] ?: return renderWorldBlockBase(ctx, dispatcher, renderer, layer)
|
val grassInfo = GrassRegistry[ctx.blockState(Int3.zero)] ?: return renderWorldBlockBase(ctx, dispatcher, renderer, layer)
|
||||||
val grassTopTexture = OptifineCTM.override(grassInfo.grassTopTexture, ctx, UP)
|
val grassTopTexture = OptifineCTM.override(grassInfo.grassTopTexture, ctx, UP)
|
||||||
|
|
||||||
val blockColor = ctx.blockData(Int3.zero, 0).color
|
val blockColor = ctx.blockData(Int3.zero).color
|
||||||
|
|
||||||
if (connectedGrass) {
|
if (connectedGrass) {
|
||||||
// get full AO data
|
// get full AO data
|
||||||
@@ -86,7 +85,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.block(up1).isOpaqueCube) return true
|
if (ctx.blockState(up1).isOpaqueCube) return true
|
||||||
|
|
||||||
// render grass quads
|
// render grass quads
|
||||||
val iconset = if (isSnowed) snowedIcons else normalIcons
|
val iconset = if (isSnowed) snowedIcons else normalIcons
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package mods.betterfoliage.client.render
|
|||||||
|
|
||||||
import mods.betterfoliage.BetterFoliageMod
|
import mods.betterfoliage.BetterFoliageMod
|
||||||
import mods.betterfoliage.client.config.Config
|
import mods.betterfoliage.client.config.Config
|
||||||
import mods.betterfoliage.client.integration.OptifineCTM
|
|
||||||
import mods.betterfoliage.client.integration.ShadersModIntegration
|
import mods.betterfoliage.client.integration.ShadersModIntegration
|
||||||
import mods.betterfoliage.client.texture.LeafRegistry
|
import mods.betterfoliage.client.texture.LeafRegistry
|
||||||
import mods.octarinecore.PI2
|
import mods.octarinecore.PI2
|
||||||
@@ -14,10 +13,10 @@ import mods.octarinecore.common.vec
|
|||||||
import mods.octarinecore.random
|
import mods.octarinecore.random
|
||||||
import net.minecraft.block.material.Material
|
import net.minecraft.block.material.Material
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.BlockRenderLayer
|
||||||
import net.minecraft.util.EnumFacing.*
|
import net.minecraft.util.EnumFacing.DOWN
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
import net.minecraft.util.EnumFacing.UP
|
||||||
import java.lang.Math.cos
|
import java.lang.Math.cos
|
||||||
import java.lang.Math.sin
|
import java.lang.Math.sin
|
||||||
|
|
||||||
@@ -44,13 +43,13 @@ class RenderLeaves : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
ctx.cameraDistance < Config.leaves.distance &&
|
ctx.cameraDistance < Config.leaves.distance &&
|
||||||
Config.blocks.leaves.matchesID(ctx.block)
|
Config.blocks.leaves.matchesID(ctx.block)
|
||||||
|
|
||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): Boolean {
|
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
||||||
val isSnowed = ctx.block(up1).material.let {
|
val isSnowed = ctx.blockState(up1).material.let {
|
||||||
it == Material.snow || it == Material.craftedSnow
|
it == Material.snow || it == Material.craftedSnow
|
||||||
}
|
}
|
||||||
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
val leafInfo = LeafRegistry[ctx, DOWN] ?: return false
|
val leafInfo = LeafRegistry[ctx, DOWN] ?: return false
|
||||||
val blockColor = ctx.blockData(Int3.zero, 0).color
|
val blockColor = ctx.blockData(Int3.zero).color
|
||||||
|
|
||||||
modelRenderer.updateShading(Int3.zero, allFaces)
|
modelRenderer.updateShading(Int3.zero, allFaces)
|
||||||
ShadersModIntegration.leaves(renderer) {
|
ShadersModIntegration.leaves(renderer) {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import mods.octarinecore.client.render.*
|
|||||||
import mods.octarinecore.common.Int3
|
import mods.octarinecore.common.Int3
|
||||||
import mods.octarinecore.common.Rotation
|
import mods.octarinecore.common.Rotation
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
|
import net.minecraft.util.BlockRenderLayer
|
||||||
import net.minecraft.util.EnumFacing.DOWN
|
import net.minecraft.util.EnumFacing.DOWN
|
||||||
import net.minecraft.util.EnumFacing.UP
|
import net.minecraft.util.EnumFacing.UP
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
|
||||||
import org.apache.logging.log4j.Level
|
import org.apache.logging.log4j.Level
|
||||||
|
|
||||||
class RenderLilypad : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
class RenderLilypad : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||||
@@ -41,7 +41,7 @@ class RenderLilypad : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
ctx.cameraDistance < Config.lilypad.distance &&
|
ctx.cameraDistance < Config.lilypad.distance &&
|
||||||
Config.blocks.lilypad.matchesID(ctx.block)
|
Config.blocks.lilypad.matchesID(ctx.block)
|
||||||
|
|
||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): Boolean {
|
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
||||||
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
modelRenderer.updateShading(Int3.zero, allFaces)
|
modelRenderer.updateShading(Int3.zero, allFaces)
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class RenderLog : AbstractRenderColumn(BetterFoliageMod.MOD_ID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override val blockPredicate = { state: IBlockState -> Config.blocks.logs.matchesID(state.block) }
|
override val blockPredicate = { state: IBlockState -> Config.blocks.logs.matchesID(state.block) }
|
||||||
override val surroundPredicate = { state: IBlockState -> state.block.isOpaqueCube && !Config.blocks.logs.matchesID(state.block) }
|
override val surroundPredicate = { state: IBlockState -> state.isOpaqueCube && !Config.blocks.logs.matchesID(state.block) }
|
||||||
|
|
||||||
override val connectPerpendicular: Boolean get() = Config.roundLogs.connectPerpendicular
|
override val connectPerpendicular: Boolean get() = Config.roundLogs.connectPerpendicular
|
||||||
override val connectSolids: Boolean get() = Config.roundLogs.connectSolids
|
override val connectSolids: Boolean get() = Config.roundLogs.connectSolids
|
||||||
|
|||||||
@@ -9,11 +9,10 @@ import mods.octarinecore.client.render.modelRenderer
|
|||||||
import mods.octarinecore.client.render.noPost
|
import mods.octarinecore.client.render.noPost
|
||||||
import mods.octarinecore.common.Double3
|
import mods.octarinecore.common.Double3
|
||||||
import mods.octarinecore.common.Rotation
|
import mods.octarinecore.common.Rotation
|
||||||
import net.minecraft.block.material.Material
|
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.init.Blocks
|
import net.minecraft.init.Blocks
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
import net.minecraft.util.BlockRenderLayer
|
||||||
import org.apache.logging.log4j.Level.INFO
|
import org.apache.logging.log4j.Level.INFO
|
||||||
|
|
||||||
class RenderMycelium : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
class RenderMycelium : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||||
@@ -31,13 +30,13 @@ class RenderMycelium : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
ctx.cameraDistance < Config.shortGrass.distance
|
ctx.cameraDistance < Config.shortGrass.distance
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): Boolean {
|
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
||||||
val isSnowed = ctx.block(up1).isSnow
|
val isSnowed = ctx.blockState(up1).isSnow
|
||||||
|
|
||||||
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
|
|
||||||
if (isSnowed && !Config.shortGrass.snowEnabled) return true
|
if (isSnowed && !Config.shortGrass.snowEnabled) return true
|
||||||
if (ctx.block(up1).isOpaqueCube) return true
|
if (ctx.blockState(up1).isOpaqueCube) return true
|
||||||
|
|
||||||
val rand = ctx.semiRandomArray(2)
|
val rand = ctx.semiRandomArray(2)
|
||||||
modelRenderer.render(
|
modelRenderer.render(
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import mods.octarinecore.common.Int3
|
|||||||
import mods.octarinecore.common.Rotation
|
import mods.octarinecore.common.Rotation
|
||||||
import mods.octarinecore.random
|
import mods.octarinecore.random
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.init.Blocks
|
import net.minecraft.init.Blocks
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
import net.minecraft.util.BlockRenderLayer
|
||||||
import net.minecraft.util.EnumFacing.*
|
import net.minecraft.util.EnumFacing.*
|
||||||
import org.apache.logging.log4j.Level.INFO
|
import org.apache.logging.log4j.Level.INFO
|
||||||
|
|
||||||
@@ -36,9 +36,9 @@ class RenderNetherrack : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID)
|
|||||||
ctx.cameraDistance < Config.netherrack.distance
|
ctx.cameraDistance < Config.netherrack.distance
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): Boolean {
|
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
||||||
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
if (ctx.block(down1).isOpaqueCube) return true
|
if (ctx.blockState(down1).isOpaqueCube) return true
|
||||||
modelRenderer.updateShading(Int3.zero, allFaces)
|
modelRenderer.updateShading(Int3.zero, allFaces)
|
||||||
|
|
||||||
val rand = ctx.semiRandomArray(2)
|
val rand = ctx.semiRandomArray(2)
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import mods.octarinecore.common.Rotation
|
|||||||
import mods.octarinecore.random
|
import mods.octarinecore.random
|
||||||
import net.minecraft.block.material.Material
|
import net.minecraft.block.material.Material
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
|
import net.minecraft.util.BlockRenderLayer
|
||||||
import net.minecraft.util.EnumFacing.UP
|
import net.minecraft.util.EnumFacing.UP
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
|
||||||
import org.apache.logging.log4j.Level
|
import org.apache.logging.log4j.Level
|
||||||
|
|
||||||
class RenderReeds : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
class RenderReeds : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||||
@@ -44,13 +44,13 @@ class RenderReeds : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
|||||||
override fun isEligible(ctx: BlockContext) =
|
override fun isEligible(ctx: BlockContext) =
|
||||||
Config.enabled && Config.reed.enabled &&
|
Config.enabled && Config.reed.enabled &&
|
||||||
ctx.cameraDistance < Config.reed.distance &&
|
ctx.cameraDistance < Config.reed.distance &&
|
||||||
ctx.block(up2).material == Material.air &&
|
ctx.blockState(up2).material == Material.air &&
|
||||||
ctx.block(up1).material == Material.water &&
|
ctx.blockState(up1).material == Material.water &&
|
||||||
Config.blocks.dirt.matchesID(ctx.block) &&
|
Config.blocks.dirt.matchesID(ctx.block) &&
|
||||||
ctx.biomeId in Config.reed.biomes &&
|
ctx.biomeId in Config.reed.biomes &&
|
||||||
noise[ctx.pos] < Config.reed.population
|
noise[ctx.pos] < Config.reed.population
|
||||||
|
|
||||||
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): Boolean {
|
override fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean {
|
||||||
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
renderWorldBlockBase(ctx, dispatcher, renderer, null)
|
||||||
modelRenderer.updateShading(Int3.zero, allFaces)
|
modelRenderer.updateShading(Int3.zero, allFaces)
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import mods.octarinecore.common.Rotation
|
|||||||
import mods.octarinecore.common.times
|
import mods.octarinecore.common.times
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.block.material.Material
|
import net.minecraft.block.material.Material
|
||||||
|
import net.minecraft.block.state.IBlockState
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.EnumFacing
|
||||||
import net.minecraft.util.EnumFacing.*
|
import net.minecraft.util.EnumFacing.*
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ val denseLeavesRot = arrayOf(Rotation.identity, Rotation.rot90[EAST.ordinal], Ro
|
|||||||
val whitewash: RenderVertex.(ShadingContext, Int, Quad, Int, Vertex)->Unit = { ctx, qi, q, vi, v -> setGrey(1.4f) }
|
val whitewash: RenderVertex.(ShadingContext, Int, Quad, Int, Vertex)->Unit = { ctx, qi, q, vi, v -> setGrey(1.4f) }
|
||||||
val greywash: RenderVertex.(ShadingContext, Int, Quad, Int, Vertex)->Unit = { ctx, qi, q, vi, v -> setGrey(1.0f) }
|
val greywash: RenderVertex.(ShadingContext, Int, Quad, Int, Vertex)->Unit = { ctx, qi, q, vi, v -> setGrey(1.0f) }
|
||||||
|
|
||||||
val Block.isSnow: Boolean get() = material.let { it == Material.snow || it == Material.craftedSnow }
|
val IBlockState.isSnow: Boolean get() = material.let { it == Material.snow || it == Material.craftedSnow }
|
||||||
|
|
||||||
fun Quad.toCross(rotAxis: EnumFacing, trans: (Quad)->Quad) =
|
fun Quad.toCross(rotAxis: EnumFacing, trans: (Quad)->Quad) =
|
||||||
(0..3).map { rotIdx ->
|
(0..3).map { rotIdx ->
|
||||||
|
|||||||
@@ -11,13 +11,10 @@ import mods.octarinecore.common.Int3
|
|||||||
import net.minecraft.block.state.IBlockState
|
import net.minecraft.block.state.IBlockState
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||||
import net.minecraft.client.renderer.texture.TextureMap
|
import net.minecraft.client.renderer.texture.TextureMap
|
||||||
import net.minecraft.util.BlockPos
|
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.EnumFacing
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.IBlockAccess
|
import net.minecraft.world.IBlockAccess
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent
|
|
||||||
import net.minecraftforge.common.MinecraftForge
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
|
||||||
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.INFO
|
import org.apache.logging.log4j.Level.INFO
|
||||||
|
|||||||
@@ -24,54 +24,54 @@ class BetterFoliageTransformer : Transformer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun setupClient() {
|
fun setupClient() {
|
||||||
// where: WorldClient.doVoidFogParticles(), right before the end of the loop
|
// where: WorldClient.showBarrierParticles(), right after invoking Block.randomDisplayTick
|
||||||
// what: invoke BF code for every random display tick
|
// what: invoke BF code for every random display tick
|
||||||
// why: allows us to catch random display ticks, without touching block code
|
// why: allows us to catch random display ticks, without touching block code
|
||||||
transformMethod(Refs.doVoidFogParticles) {
|
transformMethod(Refs.showBarrierParticles) {
|
||||||
find(invokeRef(Refs.randomDisplayTick))?.insertAfter {
|
find(invokeRef(Refs.randomDisplayTick))?.insertAfter {
|
||||||
log.info("Applying random display tick call hook")
|
log.info("Applying random display tick call hook")
|
||||||
varinsn(ALOAD, 0)
|
varinsn(ALOAD, 0)
|
||||||
varinsn(ALOAD, 13)
|
varinsn(ALOAD, 11)
|
||||||
varinsn(ALOAD, 8)
|
varinsn(ALOAD, 7)
|
||||||
invokeStatic(Refs.onRandomDisplayTick)
|
invokeStatic(Refs.onRandomDisplayTick)
|
||||||
} ?: log.warn("Failed to apply random display tick call hook!")
|
} ?: log.warn("Failed to apply random display tick call hook!")
|
||||||
}
|
}
|
||||||
|
|
||||||
// where: Block.getAmbientOcclusionLightValue()
|
// where: BlockStateContainer$StateImplementation.getAmbientOcclusionLightValue()
|
||||||
// what: invoke BF code to overrule AO transparency value
|
// what: invoke BF code to overrule AO transparency value
|
||||||
// why: allows us to have light behave properly on non-solid log blocks without
|
// why: allows us to have light behave properly on non-solid log blocks without
|
||||||
// messing with isOpaqueBlock(), which could have gameplay effects
|
// messing with isOpaqueBlock(), which could have gameplay effects
|
||||||
transformMethod(Refs.getAmbientOcclusionLightValue) {
|
transformMethod(Refs.getAmbientOcclusionLightValue) {
|
||||||
find(FRETURN)?.insertBefore {
|
find(FRETURN)?.insertBefore {
|
||||||
log.info("Applying Block.getAmbientOcclusionLightValue() override")
|
log.info("Applying getAmbientOcclusionLightValue() override")
|
||||||
varinsn(ALOAD, 0)
|
varinsn(ALOAD, 0)
|
||||||
invokeStatic(Refs.getAmbientOcclusionLightValueOverride)
|
invokeStatic(Refs.getAmbientOcclusionLightValueOverride)
|
||||||
} ?: log.warn("Failed to apply Block.getAmbientOcclusionLightValue() override!")
|
} ?: log.warn("Failed to apply getAmbientOcclusionLightValue() override!")
|
||||||
}
|
}
|
||||||
|
|
||||||
// where: Block.getUseNeighborBrightness()
|
// where: BlockStateContainer$StateImplementation.useNeighborBrightness()
|
||||||
// what: invoke BF code to overrule _useNeighborBrightness_
|
// what: invoke BF code to overrule _useNeighborBrightness_
|
||||||
// why: allows us to have light behave properly on non-solid log blocks
|
// why: allows us to have light behave properly on non-solid log blocks
|
||||||
transformMethod(Refs.getUseNeighborBrightness) {
|
transformMethod(Refs.useNeighborBrightness) {
|
||||||
find(IRETURN)?.insertBefore {
|
find(IRETURN)?.insertBefore {
|
||||||
log.info("Applying Block.getUseNeighborBrightness() override")
|
log.info("Applying useNeighborBrightness() override")
|
||||||
varinsn(ALOAD, 0)
|
varinsn(ALOAD, 0)
|
||||||
invokeStatic(Refs.getUseNeighborBrightnessOverride)
|
invokeStatic(Refs.useNeighborBrightnessOverride)
|
||||||
} ?: log.warn("Failed to apply Block.getUseNeighborBrightness() override!")
|
} ?: log.warn("Failed to apply useNeighborBrightness() override!")
|
||||||
}
|
}
|
||||||
|
|
||||||
// where: Block.shouldSideBeRendered()
|
// where: BlockStateContainer$StateImplementation.doesSideBlockRendering()
|
||||||
// what: invoke BF code to overrule condition
|
// what: invoke BF code to overrule condition
|
||||||
// why: allows us to make log blocks non-solid without
|
// why: allows us to make log blocks non-solid without
|
||||||
// messing with isOpaqueBlock(), which could have gameplay effects
|
// messing with isOpaqueBlock(), which could have gameplay effects
|
||||||
transformMethod(Refs.shouldSideBeRendered) {
|
transformMethod(Refs.doesSideBlockRendering) {
|
||||||
find(IRETURN)?.insertBefore {
|
find(IRETURN)?.insertBefore {
|
||||||
log.info("Applying Block.shouldSideBeRendered() override")
|
log.info("Applying doesSideBlockRendering() override")
|
||||||
varinsn(ALOAD, 1)
|
varinsn(ALOAD, 1)
|
||||||
varinsn(ALOAD, 2)
|
varinsn(ALOAD, 2)
|
||||||
varinsn(ALOAD, 3)
|
varinsn(ALOAD, 3)
|
||||||
invokeStatic(Refs.shouldRenderBlockSideOverride)
|
invokeStatic(Refs.shouldRenderBlockSideOverride)
|
||||||
} ?: log.warn("Failed to apply Block.shouldSideBeRendered() override!")
|
} ?: log.warn("Failed to apply doesSideBlockRendering() override!")
|
||||||
}
|
}
|
||||||
|
|
||||||
// where: ModelLoader.setupModelRegistry(), right before the textures are loaded
|
// where: ModelLoader.setupModelRegistry(), right before the textures are loaded
|
||||||
@@ -82,7 +82,7 @@ class BetterFoliageTransformer : Transformer() {
|
|||||||
log.info("Applying ModelLoader lifecycle callback")
|
log.info("Applying ModelLoader lifecycle callback")
|
||||||
varinsn(ALOAD, 0)
|
varinsn(ALOAD, 0)
|
||||||
invokeStatic(Refs.onAfterLoadModelDefinitions)
|
invokeStatic(Refs.onAfterLoadModelDefinitions)
|
||||||
}
|
} ?: log.warn("Failed to apply ModelLoader lifecycle callback!")
|
||||||
}
|
}
|
||||||
|
|
||||||
// where: RenderChunk.rebuildChunk()
|
// where: RenderChunk.rebuildChunk()
|
||||||
|
|||||||
@@ -15,50 +15,49 @@ object Refs {
|
|||||||
val Random = ClassRef("java.util.Random")
|
val Random = ClassRef("java.util.Random")
|
||||||
|
|
||||||
// Minecraft
|
// Minecraft
|
||||||
val IBlockAccess = ClassRef("net.minecraft.world.IBlockAccess", "adq")
|
val IBlockAccess = ClassRef("net.minecraft.world.IBlockAccess", "ahx")
|
||||||
val IBlockState = ClassRef("net.minecraft.block.state.IBlockState", "alz")
|
val IBlockState = ClassRef("net.minecraft.block.state.IBlockState", "arc")
|
||||||
val BlockStateBase = ClassRef("net.minecraft.block.state.BlockStateBase", "aly")
|
val BlockStateBase = ClassRef("net.minecraft.block.state.BlockStateBase", "ara")
|
||||||
val BlockPos = ClassRef("net.minecraft.util.BlockPos", "cj")
|
val BlockPos = ClassRef("net.minecraft.util.math.BlockPos", "cj")
|
||||||
val EnumWorldBlockLayer = ClassRef("net.minecraft.util.EnumWorldBlockLayer", "adf")
|
val MutableBlockPos = ClassRef("net.minecraft.util.math.BlockPos\$MutableBlockPos", "cj\$a")
|
||||||
|
val BlockRenderLayer = ClassRef("net.minecraft.util.BlockRenderLayer", "ahm")
|
||||||
val EnumFacing = ClassRef("net.minecraft.util.EnumFacing", "cq")
|
val EnumFacing = ClassRef("net.minecraft.util.EnumFacing", "cq")
|
||||||
|
|
||||||
val World = ClassRef("net.minecraft.world.World", "adm")
|
val World = ClassRef("net.minecraft.world.World", "aht")
|
||||||
val WorldClient = ClassRef("net.minecraft.client.multiplayer.WorldClient", "bdb")
|
val WorldClient = ClassRef("net.minecraft.client.multiplayer.WorldClient", "bku")
|
||||||
val doVoidFogParticles = MethodRef(WorldClient, "doVoidFogParticles", "func_73029_E", "b", ClassRef.void, ClassRef.int, ClassRef.int, ClassRef.int)
|
val showBarrierParticles = MethodRef(WorldClient, "showBarrierParticles", "func_184153_a", "a", ClassRef.void, ClassRef.int, ClassRef.int, ClassRef.int, ClassRef.int, Random, ClassRef.boolean, MutableBlockPos)
|
||||||
|
|
||||||
val Block = ClassRef("net.minecraft.block.Block", "afh")
|
val Block = ClassRef("net.minecraft.block.Block", "ajt")
|
||||||
val canRenderInLayer = MethodRef(Block, "canRenderInLayer", ClassRef.boolean, EnumWorldBlockLayer)
|
val StateImplementation = ClassRef("net.minecraft.block.state.BlockStateContainer\$StateImplementation", "ard\$a")
|
||||||
val getAmbientOcclusionLightValue = MethodRef(Block, "getAmbientOcclusionLightValue", "func_149685_I", "f", ClassRef.float)
|
val canRenderInLayer = MethodRef(Block, "canRenderInLayer", ClassRef.boolean, BlockRenderLayer)
|
||||||
val getUseNeighborBrightness = MethodRef(Block, "getUseNeighborBrightness", "func_149710_n", "q", ClassRef.boolean)
|
val getAmbientOcclusionLightValue = MethodRef(StateImplementation, "getAmbientOcclusionLightValue", "func_185892_j", "j", ClassRef.float)
|
||||||
val shouldSideBeRendered = MethodRef(Block, "shouldSideBeRendered", "func_149646_a", "a", ClassRef.boolean, IBlockAccess, BlockPos, EnumFacing)
|
val useNeighborBrightness = MethodRef(StateImplementation, "useNeighborBrightness", "func_185916_f", "f", ClassRef.boolean)
|
||||||
|
val shouldSideBeRendered = MethodRef(StateImplementation, "shouldSideBeRendered", "func_185894_c", "c", ClassRef.boolean, IBlockAccess, BlockPos, EnumFacing)
|
||||||
|
val doesSideBlockRendering = MethodRef(StateImplementation, "doesSideBlockRendering", ClassRef.boolean, IBlockAccess, BlockPos, EnumFacing)
|
||||||
val randomDisplayTick = MethodRef(Block, "randomDisplayTick", "func_180655_c", "c", ClassRef.void, World, BlockPos, IBlockState, Random)
|
val randomDisplayTick = MethodRef(Block, "randomDisplayTick", "func_180655_c", "c", ClassRef.void, World, BlockPos, IBlockState, Random)
|
||||||
|
|
||||||
val BlockModelRenderer = ClassRef("net.minecraft.client.renderer.BlockModelRenderer", "bgf")
|
val BlockModelRenderer = ClassRef("net.minecraft.client.renderer.BlockModelRenderer", "boe")
|
||||||
val AmbientOcclusionFace = ClassRef("net.minecraft.client.renderer.BlockModelRenderer\$AmbientOcclusionFace", "bgf\$b")
|
val AmbientOcclusionFace = ClassRef("net.minecraft.client.renderer.BlockModelRenderer\$AmbientOcclusionFace", "boe\$b")
|
||||||
val ChunkCompileTaskGenerator = ClassRef("net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator", "bhn")
|
val ChunkCompileTaskGenerator = ClassRef("net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator", "bpz")
|
||||||
val WorldRenderer = ClassRef("net.minecraft.client.renderer.WorldRenderer", "bfd")
|
val VertexBuffer = ClassRef("net.minecraft.client.renderer.VertexBuffer", "bmz")
|
||||||
val AOF_constructor = MethodRef(AmbientOcclusionFace, "<init>", ClassRef.void, BlockModelRenderer)
|
val AOF_constructor = MethodRef(AmbientOcclusionFace, "<init>", ClassRef.void, BlockModelRenderer)
|
||||||
|
|
||||||
val RenderChunk = ClassRef("net.minecraft.client.renderer.chunk.RenderChunk", "bht")
|
val RenderChunk = ClassRef("net.minecraft.client.renderer.chunk.RenderChunk", "bqf")
|
||||||
val rebuildChunk = MethodRef(RenderChunk, "rebuildChunk", "func_178581_b", "b", ClassRef.void, ClassRef.float, ClassRef.float, ClassRef.float, ChunkCompileTaskGenerator)
|
val rebuildChunk = MethodRef(RenderChunk, "rebuildChunk", "func_178581_b", "b", ClassRef.void, ClassRef.float, ClassRef.float, ClassRef.float, ChunkCompileTaskGenerator)
|
||||||
|
|
||||||
val BlockRendererDispatcher = ClassRef("net.minecraft.client.renderer.BlockRendererDispatcher", "bgd")
|
val BlockRendererDispatcher = ClassRef("net.minecraft.client.renderer.BlockRendererDispatcher", "boc")
|
||||||
val renderBlock = MethodRef(BlockRendererDispatcher, "renderBlock", "func_175018_a", "a", ClassRef.boolean, IBlockState, BlockPos, IBlockAccess, WorldRenderer)
|
val renderBlock = MethodRef(BlockRendererDispatcher, "renderBlock", "func_175018_a", "a", ClassRef.boolean, IBlockState, BlockPos, IBlockAccess, VertexBuffer)
|
||||||
|
|
||||||
// val IMetadataSerializer = ClassRef("net.minecraft.client.resources.data.IMetadataSerializer", "brw")
|
val TextureAtlasSprite = ClassRef("net.minecraft.client.renderer.texture.TextureAtlasSprite", "bvh")
|
||||||
// val SimpleReloadableResourceManager = ClassRef("net.minecraft.client.resources.SimpleReloadableResourceManager", "brg")
|
|
||||||
// val metadataSerializer = FieldRef(SimpleReloadableResourceManager, "rmMetadataSerializer", "field_110547_c", "f", IMetadataSerializer)
|
|
||||||
|
|
||||||
val TextureAtlasSprite = ClassRef("net.minecraft.client.renderer.texture.TextureAtlasSprite", "bmi")
|
val IRegistry = ClassRef("net.minecraft.util.registry.IRegistry", "db")
|
||||||
|
|
||||||
val IRegistry = ClassRef("net.minecraft.util.IRegistry", "db")
|
|
||||||
val ModelLoader = ClassRef("net.minecraftforge.client.model.ModelLoader")
|
val ModelLoader = ClassRef("net.minecraftforge.client.model.ModelLoader")
|
||||||
val stateModels = FieldRef(ModelLoader, "stateModels", Map)
|
val stateModels = FieldRef(ModelLoader, "stateModels", Map)
|
||||||
val setupModelRegistry = MethodRef(ModelLoader, "setupModelRegistry", "func_177570_a", "a", IRegistry)
|
val setupModelRegistry = MethodRef(ModelLoader, "setupModelRegistry", "func_177570_a", "a", IRegistry)
|
||||||
|
|
||||||
val IModel = ClassRef("net.minecraftforge.client.model.IModel", "")
|
val IModel = ClassRef("net.minecraftforge.client.model.IModel")
|
||||||
val ModelBlock = ClassRef("net.minecraft.client.renderer.block.model.ModelBlock", "bgl")
|
val ModelBlock = ClassRef("net.minecraft.client.renderer.block.model.ModelBlock", "bok")
|
||||||
val ModelResourceLocation = ClassRef("net.minecraft.client.renderer.block.model.ModelResourceLocation", "bov")
|
val ModelResourceLocation = ClassRef("net.minecraft.client.renderer.block.model.ModelResourceLocation", "bxt")
|
||||||
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)
|
||||||
@@ -69,13 +68,13 @@ object Refs {
|
|||||||
|
|
||||||
// Better Foliage
|
// Better Foliage
|
||||||
val BetterFoliageHooks = ClassRef("mods.betterfoliage.client.Hooks")
|
val BetterFoliageHooks = ClassRef("mods.betterfoliage.client.Hooks")
|
||||||
val getAmbientOcclusionLightValueOverride = MethodRef(BetterFoliageHooks, "getAmbientOcclusionLightValueOverride", ClassRef.float, ClassRef.float, Block)
|
val getAmbientOcclusionLightValueOverride = MethodRef(BetterFoliageHooks, "getAmbientOcclusionLightValueOverride", ClassRef.float, ClassRef.float, IBlockState)
|
||||||
val getUseNeighborBrightnessOverride = MethodRef(BetterFoliageHooks, "getUseNeighborBrightnessOverride", ClassRef.boolean, ClassRef.boolean, Block)
|
val useNeighborBrightnessOverride = MethodRef(BetterFoliageHooks, "getUseNeighborBrightnessOverride", ClassRef.boolean, ClassRef.boolean, IBlockState)
|
||||||
val shouldRenderBlockSideOverride = MethodRef(BetterFoliageHooks, "shouldRenderBlockSideOverride", ClassRef.boolean, ClassRef.boolean, IBlockAccess, BlockPos, EnumFacing)
|
val shouldRenderBlockSideOverride = MethodRef(BetterFoliageHooks, "shouldRenderBlockSideOverride", ClassRef.boolean, ClassRef.boolean, IBlockAccess, BlockPos, EnumFacing)
|
||||||
val onRandomDisplayTick = MethodRef(BetterFoliageHooks, "onRandomDisplayTick", ClassRef.void, World, IBlockState, BlockPos)
|
val onRandomDisplayTick = MethodRef(BetterFoliageHooks, "onRandomDisplayTick", ClassRef.void, World, IBlockState, BlockPos)
|
||||||
val onAfterLoadModelDefinitions = MethodRef(BetterFoliageHooks, "onAfterLoadModelDefinitions", ClassRef.void, ModelLoader)
|
val onAfterLoadModelDefinitions = MethodRef(BetterFoliageHooks, "onAfterLoadModelDefinitions", ClassRef.void, ModelLoader)
|
||||||
val renderWorldBlock = MethodRef(BetterFoliageHooks, "renderWorldBlock", ClassRef.boolean, BlockRendererDispatcher, IBlockState, BlockPos, IBlockAccess, WorldRenderer, EnumWorldBlockLayer)
|
val renderWorldBlock = MethodRef(BetterFoliageHooks, "renderWorldBlock", ClassRef.boolean, BlockRendererDispatcher, IBlockState, BlockPos, IBlockAccess, VertexBuffer, BlockRenderLayer)
|
||||||
val canRenderBlockInLayer = MethodRef(BetterFoliageHooks, "canRenderBlockInLayer", ClassRef.boolean, Block, EnumWorldBlockLayer)
|
val canRenderBlockInLayer = MethodRef(BetterFoliageHooks, "canRenderBlockInLayer", ClassRef.boolean, Block, BlockRenderLayer)
|
||||||
|
|
||||||
// Optifine
|
// Optifine
|
||||||
val OptifineClassTransformer = ClassRef("optifine.OptiFineClassTransformer")
|
val OptifineClassTransformer = ClassRef("optifine.OptiFineClassTransformer")
|
||||||
@@ -94,8 +93,8 @@ object Refs {
|
|||||||
|
|
||||||
// ShadersMod
|
// ShadersMod
|
||||||
val SVertexBuilder = ClassRef("shadersmod.client.SVertexBuilder")
|
val SVertexBuilder = ClassRef("shadersmod.client.SVertexBuilder")
|
||||||
val sVertexBuilder = FieldRef(WorldRenderer, "sVertexBuilder", SVertexBuilder)
|
val sVertexBuilder = FieldRef(VertexBuffer, "sVertexBuilder", SVertexBuilder)
|
||||||
val pushEntity_state = MethodRef(SVertexBuilder, "pushEntity", ClassRef.void, IBlockState, BlockPos, IBlockAccess, WorldRenderer)
|
val pushEntity_state = MethodRef(SVertexBuilder, "pushEntity", ClassRef.void, IBlockState, BlockPos, IBlockAccess, VertexBuffer)
|
||||||
val pushEntity_num = MethodRef(SVertexBuilder, "pushEntity", ClassRef.void, ClassRef.long)
|
val pushEntity_num = MethodRef(SVertexBuilder, "pushEntity", ClassRef.void, ClassRef.long)
|
||||||
val popEntity = MethodRef(SVertexBuilder, "popEntity", ClassRef.void)
|
val popEntity = MethodRef(SVertexBuilder, "popEntity", ClassRef.void)
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ package mods.octarinecore.client.gui
|
|||||||
|
|
||||||
import net.minecraft.client.gui.GuiScreen
|
import net.minecraft.client.gui.GuiScreen
|
||||||
import net.minecraft.client.resources.I18n
|
import net.minecraft.client.resources.I18n
|
||||||
import net.minecraft.util.EnumChatFormatting.GOLD
|
import net.minecraft.util.text.TextFormatting.*
|
||||||
import net.minecraft.util.EnumChatFormatting.YELLOW
|
|
||||||
import net.minecraftforge.fml.client.config.*
|
import net.minecraftforge.fml.client.config.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package mods.octarinecore.client.gui
|
package mods.octarinecore.client.gui
|
||||||
|
|
||||||
import net.minecraft.client.resources.I18n
|
import net.minecraft.client.resources.I18n
|
||||||
import net.minecraft.util.EnumChatFormatting.AQUA
|
import net.minecraft.util.text.TextFormatting.*
|
||||||
import net.minecraftforge.fml.client.config.GuiConfig
|
import net.minecraftforge.fml.client.config.GuiConfig
|
||||||
import net.minecraftforge.fml.client.config.GuiConfigEntries
|
import net.minecraftforge.fml.client.config.GuiConfigEntries
|
||||||
import net.minecraftforge.fml.client.config.IConfigElement
|
import net.minecraftforge.fml.client.config.IConfigElement
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
@file:JvmName("Utils")
|
@file:JvmName("Utils")
|
||||||
package mods.octarinecore.client.gui
|
package mods.octarinecore.client.gui
|
||||||
|
|
||||||
import net.minecraft.util.EnumChatFormatting
|
import net.minecraft.util.text.TextFormatting.*
|
||||||
|
|
||||||
fun stripTooltipDefaultText(tooltip: MutableList<String>) {
|
fun stripTooltipDefaultText(tooltip: MutableList<String>) {
|
||||||
var defaultRows = false
|
var defaultRows = false
|
||||||
val iter = tooltip.iterator()
|
val iter = tooltip.iterator()
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
if (iter.next().startsWith(EnumChatFormatting.AQUA.toString())) defaultRows = true
|
if (iter.next().startsWith(AQUA.toString())) defaultRows = true
|
||||||
if (defaultRows) iter.remove()
|
if (defaultRows) iter.remove()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,11 +11,13 @@ import net.minecraft.block.Block
|
|||||||
import net.minecraft.block.state.IBlockState
|
import net.minecraft.block.state.IBlockState
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher
|
import net.minecraft.client.renderer.BlockRendererDispatcher
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.util.BlockPos
|
import net.minecraft.client.renderer.color.BlockColors
|
||||||
import net.minecraft.util.EnumWorldBlockLayer
|
import net.minecraft.util.BlockRenderLayer
|
||||||
import net.minecraft.util.MathHelper
|
import net.minecraft.util.math.BlockPos
|
||||||
|
import net.minecraft.util.math.MathHelper
|
||||||
import net.minecraft.world.IBlockAccess
|
import net.minecraft.world.IBlockAccess
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [ThreadLocal] instance of [BlockContext] representing the block being rendered.
|
* [ThreadLocal] instance of [BlockContext] representing the block being rendered.
|
||||||
@@ -27,6 +29,8 @@ val blockContext by ThreadLocalDelegate { BlockContext() }
|
|||||||
*/
|
*/
|
||||||
val modelRenderer by ThreadLocalDelegate { ModelRenderer() }
|
val modelRenderer by ThreadLocalDelegate { ModelRenderer() }
|
||||||
|
|
||||||
|
val blockColors = ThreadLocal<BlockColors>()
|
||||||
|
|
||||||
abstract class AbstractBlockRenderingHandler(modId: String) : ResourceHandler(modId) {
|
abstract class AbstractBlockRenderingHandler(modId: String) : ResourceHandler(modId) {
|
||||||
|
|
||||||
val moveToCutout: Boolean get() = true
|
val moveToCutout: Boolean get() = true
|
||||||
@@ -35,15 +39,15 @@ abstract class AbstractBlockRenderingHandler(modId: String) : ResourceHandler(mo
|
|||||||
// Custom rendering
|
// Custom rendering
|
||||||
// ============================
|
// ============================
|
||||||
abstract fun isEligible(ctx: BlockContext): Boolean
|
abstract fun isEligible(ctx: BlockContext): Boolean
|
||||||
abstract fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer): Boolean
|
abstract fun render(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer): Boolean
|
||||||
|
|
||||||
// ============================
|
// ============================
|
||||||
// Vanilla rendering wrapper
|
// Vanilla rendering wrapper
|
||||||
// ============================
|
// ============================
|
||||||
/**
|
/**
|
||||||
* Render the block in the current [BlockContext], and capture shading and texture data.
|
* Render the block in the current [BlockContext]
|
||||||
*/
|
*/
|
||||||
fun renderWorldBlockBase(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: WorldRenderer, layer: EnumWorldBlockLayer?): Boolean {
|
fun renderWorldBlockBase(ctx: BlockContext, dispatcher: BlockRendererDispatcher, renderer: VertexBuffer, layer: BlockRenderLayer?): Boolean {
|
||||||
ctx.blockState(Int3.zero).let {
|
ctx.blockState(Int3.zero).let {
|
||||||
if (layer == null || it.block.canRenderInLayer(layer))
|
if (layer == null || it.block.canRenderInLayer(layer))
|
||||||
return dispatcher.renderBlock(it, ctx.pos, ctx.world, renderer)
|
return dispatcher.renderBlock(it, ctx.pos, ctx.world, renderer)
|
||||||
@@ -68,18 +72,18 @@ class BlockContext() {
|
|||||||
val block: Block get() = block(Int3.zero)
|
val block: Block get() = block(Int3.zero)
|
||||||
fun block(offset: Int3) = blockState(offset).block
|
fun block(offset: Int3) = blockState(offset).block
|
||||||
fun blockState(offset: Int3) = (pos + offset).let { world!!.getBlockState(it) }
|
fun blockState(offset: Int3) = (pos + offset).let { world!!.getBlockState(it) }
|
||||||
fun blockData(offset: Int3, pass: Int) = (pos + offset).let { pos ->
|
fun blockData(offset: Int3) = (pos + offset).let { pos ->
|
||||||
world!!.getBlockState(pos).let { state ->
|
world!!.getBlockState(pos).let { state ->
|
||||||
BlockData(
|
BlockData(
|
||||||
state,
|
state,
|
||||||
state.block.colorMultiplier(world!!, pos, pass),
|
Minecraft.getMinecraft().blockColors.colorMultiplier(state, world!!, pos, 0),
|
||||||
state.block.getMixedBrightnessForBlock(world!!, pos)
|
state.block.getPackedLightmapCoords(state, world!!, pos)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the biome ID at the block position. */
|
/** Get the biome ID at the block position. */
|
||||||
val biomeId: Int get() = world!!.getBiomeGenForCoords(pos).biomeID
|
val biomeId: Int get() = BiomeGenBase.getIdForBiome(world!!.getBiomeGenForCoords(pos))
|
||||||
|
|
||||||
/** Get the centerpoint of the block being rendered. */
|
/** Get the centerpoint of the block being rendered. */
|
||||||
val blockCenter: Double3 get() = Double3(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
|
val blockCenter: Double3 get() = Double3(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import mods.octarinecore.PI2
|
|||||||
import mods.octarinecore.common.Double3
|
import mods.octarinecore.common.Double3
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.particle.EntityFX
|
import net.minecraft.client.particle.EntityFX
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
@@ -25,14 +25,14 @@ abstract class AbstractEntityFX(world: World, x: Double, y: Double, z: Double) :
|
|||||||
super.onUpdate()
|
super.onUpdate()
|
||||||
currentPos.setTo(posX, posY, posZ)
|
currentPos.setTo(posX, posY, posZ)
|
||||||
prevPos.setTo(prevPosX, prevPosY, prevPosZ)
|
prevPos.setTo(prevPosX, prevPosY, prevPosZ)
|
||||||
velocity.setTo(motionX, motionY, motionZ)
|
velocity.setTo(xSpeed, ySpeed, zSpeed)
|
||||||
update()
|
update()
|
||||||
posX = currentPos.x; posY = currentPos.y; posZ = currentPos.z;
|
posX = currentPos.x; posY = currentPos.y; posZ = currentPos.z;
|
||||||
motionX = velocity.x; motionY = velocity.y; motionZ = velocity.z;
|
xSpeed = velocity.x; ySpeed = velocity.y; zSpeed = velocity.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Render the particle. */
|
/** Render the particle. */
|
||||||
abstract fun render(worldRenderer: WorldRenderer, partialTickTime: Float)
|
abstract fun render(worldRenderer: VertexBuffer, partialTickTime: Float)
|
||||||
|
|
||||||
/** Update particle on world tick. */
|
/** Update particle on world tick. */
|
||||||
abstract fun update()
|
abstract fun update()
|
||||||
@@ -43,7 +43,7 @@ abstract class AbstractEntityFX(world: World, x: Double, y: Double, z: Double) :
|
|||||||
/** Add the particle to the effect renderer if it is valid. */
|
/** Add the particle to the effect renderer if it is valid. */
|
||||||
fun addIfValid() { if (isValid) Minecraft.getMinecraft().effectRenderer.addEffect(this) }
|
fun addIfValid() { if (isValid) Minecraft.getMinecraft().effectRenderer.addEffect(this) }
|
||||||
|
|
||||||
override fun renderParticle(worldRenderer: WorldRenderer, entity: Entity, partialTickTime: Float, rotX: Float, rotZ: Float, rotYZ: Float, rotXY: Float, rotXZ: Float) {
|
override fun renderParticle(worldRenderer: VertexBuffer, entity: Entity, partialTickTime: Float, rotX: Float, rotZ: Float, rotYZ: Float, rotXY: Float, rotXZ: Float) {
|
||||||
billboardRot.first.setTo(rotX + rotXY, rotZ, rotYZ + rotXZ)
|
billboardRot.first.setTo(rotX + rotXY, rotZ, rotYZ + rotXZ)
|
||||||
billboardRot.second.setTo(rotX - rotXY, -rotZ, rotYZ - rotXZ)
|
billboardRot.second.setTo(rotX - rotXY, -rotZ, rotYZ - rotXZ)
|
||||||
render(worldRenderer, partialTickTime)
|
render(worldRenderer, partialTickTime)
|
||||||
@@ -61,13 +61,13 @@ abstract class AbstractEntityFX(world: World, x: Double, y: Double, z: Double) :
|
|||||||
* @param[isMirrored] mirror particle texture along V-axis
|
* @param[isMirrored] mirror particle texture along V-axis
|
||||||
* @param[alpha] aplha blending
|
* @param[alpha] aplha blending
|
||||||
*/
|
*/
|
||||||
fun renderParticleQuad(worldRenderer: WorldRenderer,
|
fun renderParticleQuad(worldRenderer: VertexBuffer,
|
||||||
partialTickTime: Float,
|
partialTickTime: Float,
|
||||||
currentPos: Double3 = this.currentPos,
|
currentPos: Double3 = this.currentPos,
|
||||||
prevPos: Double3 = this.prevPos,
|
prevPos: Double3 = this.prevPos,
|
||||||
size: Double = particleScale.toDouble(),
|
size: Double = particleScale.toDouble(),
|
||||||
rotation: Int = 0,
|
rotation: Int = 0,
|
||||||
icon: TextureAtlasSprite = particleIcon,
|
icon: TextureAtlasSprite = particleTexture,
|
||||||
isMirrored: Boolean = false,
|
isMirrored: Boolean = false,
|
||||||
alpha: Float = this.particleAlpha) {
|
alpha: Float = this.particleAlpha) {
|
||||||
|
|
||||||
@@ -113,11 +113,6 @@ abstract class AbstractEntityFX(world: World, x: Double, y: Double, z: Double) :
|
|||||||
.color(particleRed, particleGreen, particleBlue, alpha)
|
.color(particleRed, particleGreen, particleBlue, alpha)
|
||||||
.lightmap(brLow, brHigh)
|
.lightmap(brLow, brHigh)
|
||||||
.endVertex()
|
.endVertex()
|
||||||
|
|
||||||
// worldRenderer.addVertexWithUV(center.x - v1.x, center.y - v1.y, center.z - v1.z, maxU, maxV)
|
|
||||||
// worldRenderer.addVertexWithUV(center.x - v2.x, center.y - v2.y, center.z - v2.z, maxU, minV)
|
|
||||||
// worldRenderer.addVertexWithUV(center.x + v1.x, center.y + v1.y, center.z + v1.z, minU, minV)
|
|
||||||
// worldRenderer.addVertexWithUV(center.x + v2.x, center.y + v2.y, center.z + v2.z, minU, maxV)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFXLayer() = 1
|
override fun getFXLayer() = 1
|
||||||
|
|||||||
@@ -2,12 +2,10 @@ package mods.octarinecore.client.render
|
|||||||
|
|
||||||
import mods.octarinecore.common.*
|
import mods.octarinecore.common.*
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.renderer.WorldRenderer
|
import net.minecraft.client.renderer.VertexBuffer
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.EnumFacing
|
||||||
import net.minecraft.util.EnumFacing.*
|
import net.minecraft.util.EnumFacing.*
|
||||||
import java.lang.Math.max
|
|
||||||
|
|
||||||
class ModelRenderer() : ShadingContext() {
|
class ModelRenderer() : ShadingContext() {
|
||||||
|
|
||||||
@@ -28,7 +26,7 @@ class ModelRenderer() : ShadingContext() {
|
|||||||
* @param[postProcess] lambda to perform arbitrary modifications on the [RenderVertex] just before it goes to the [Tessellator]
|
* @param[postProcess] lambda to perform arbitrary modifications on the [RenderVertex] just before it goes to the [Tessellator]
|
||||||
*/
|
*/
|
||||||
inline fun render(
|
inline fun render(
|
||||||
worldRenderer: WorldRenderer,
|
worldRenderer: VertexBuffer,
|
||||||
model: Model,
|
model: Model,
|
||||||
rot: Rotation,
|
rot: Rotation,
|
||||||
trans: Double3 = blockContext.blockCenter,
|
trans: Double3 = blockContext.blockCenter,
|
||||||
@@ -88,7 +86,7 @@ open class ShadingContext {
|
|||||||
fun aoShading(face: EnumFacing, corner1: EnumFacing, corner2: EnumFacing) =
|
fun aoShading(face: EnumFacing, corner1: EnumFacing, corner2: EnumFacing) =
|
||||||
aoFaces[face.rotate(rotation).ordinal][corner1.rotate(rotation), corner2.rotate(rotation)]
|
aoFaces[face.rotate(rotation).ordinal][corner1.rotate(rotation), corner2.rotate(rotation)]
|
||||||
|
|
||||||
fun blockData(offset: Int3) = blockContext.blockData(offset.rotate(rotation), 0)
|
fun blockData(offset: Int3) = blockContext.blockData(offset.rotate(rotation))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,7 +156,7 @@ class RenderVertex() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun WorldRenderer.ensureSpaceForQuads(num: Int) {
|
fun VertexBuffer.ensureSpaceForQuads(num: Int) {
|
||||||
rawIntBuffer.position(bufferSize)
|
rawIntBuffer.position(bufferSize)
|
||||||
growBuffer(num * vertexFormat.nextOffset)
|
growBuffer(num * vertexFormat.nextOffset)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package mods.octarinecore.client.render
|
|||||||
|
|
||||||
import mods.octarinecore.common.Int3
|
import mods.octarinecore.common.Int3
|
||||||
import mods.octarinecore.common.plus
|
import mods.octarinecore.common.plus
|
||||||
import net.minecraft.util.BlockPos
|
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.EnumFacing
|
||||||
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.IBlockAccess
|
import net.minecraft.world.IBlockAccess
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package mods.octarinecore.client.render
|
package mods.octarinecore.client.render
|
||||||
|
|
||||||
import mods.octarinecore.common.*
|
import mods.octarinecore.common.*
|
||||||
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.renderer.BlockModelRenderer
|
import net.minecraft.client.renderer.BlockModelRenderer
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.EnumFacing
|
||||||
import net.minecraft.util.EnumFacing.*
|
import net.minecraft.util.EnumFacing.*
|
||||||
@@ -40,7 +41,7 @@ class AoData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AoFaceData(val face: EnumFacing) {
|
class AoFaceData(val face: EnumFacing) {
|
||||||
val ao = BlockModelRenderer().AmbientOcclusionFace()
|
val ao = BlockModelRenderer(Minecraft.getMinecraft().blockColors).AmbientOcclusionFace()
|
||||||
val top = faceCorners[face.ordinal].topLeft.first
|
val top = faceCorners[face.ordinal].topLeft.first
|
||||||
val left = faceCorners[face.ordinal].topLeft.second
|
val left = faceCorners[face.ordinal].topLeft.second
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ class AoFaceData(val face: EnumFacing) {
|
|||||||
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, ctx.pos + offset, face, quadBounds, flags)
|
||||||
ordered.forEachIndexed { idx, aoData -> aoData.set(ao.vertexBrightness[idx], ao.vertexColorMultiplier[idx] * multiplier) }
|
ordered.forEachIndexed { idx, aoData -> aoData.set(ao.vertexBrightness[idx], ao.vertexColorMultiplier[idx] * multiplier) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import mods.octarinecore.stripStart
|
|||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.block.state.IBlockState
|
import net.minecraft.block.state.IBlockState
|
||||||
import net.minecraft.client.renderer.block.model.ModelBlock
|
import net.minecraft.client.renderer.block.model.ModelBlock
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation
|
||||||
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper
|
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper
|
||||||
import net.minecraft.client.renderer.block.statemap.IStateMapper
|
import net.minecraft.client.renderer.block.statemap.IStateMapper
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||||
import net.minecraft.client.renderer.texture.TextureMap
|
import net.minecraft.client.renderer.texture.TextureMap
|
||||||
import net.minecraft.client.resources.model.ModelResourceLocation
|
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent
|
import net.minecraftforge.client.event.TextureStitchEvent
|
||||||
import net.minecraftforge.client.model.IModel
|
import net.minecraftforge.client.model.IModel
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import net.minecraft.client.resources.IResourcePack
|
|||||||
import net.minecraft.client.resources.data.IMetadataSection
|
import net.minecraft.client.resources.data.IMetadataSection
|
||||||
import net.minecraft.client.resources.data.IMetadataSerializer
|
import net.minecraft.client.resources.data.IMetadataSerializer
|
||||||
import net.minecraft.client.resources.data.PackMetadataSection
|
import net.minecraft.client.resources.data.PackMetadataSection
|
||||||
import net.minecraft.util.ChatComponentText
|
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
|
import net.minecraft.util.text.TextComponentString
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler
|
import net.minecraftforge.fml.client.FMLClientHandler
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -28,7 +28,7 @@ class GeneratorPack(val name: String, vararg val generators: GeneratorBase) : IR
|
|||||||
override fun getPackImage() = null
|
override fun getPackImage() = null
|
||||||
override fun getResourceDomains() = HashSet(generators.map { it.domain })
|
override fun getResourceDomains() = HashSet(generators.map { it.domain })
|
||||||
override fun <T: IMetadataSection> getPackMetadata(serializer: IMetadataSerializer?, type: String?) =
|
override fun <T: IMetadataSection> getPackMetadata(serializer: IMetadataSerializer?, type: String?) =
|
||||||
if (type == "pack") PackMetadataSection(ChatComponentText("Generated resources"), 1) as? T else null
|
if (type == "pack") PackMetadataSection(TextComponentString("Generated resources"), 1) as? T else null
|
||||||
|
|
||||||
override fun resourceExists(location: ResourceLocation?): Boolean =
|
override fun resourceExists(location: ResourceLocation?): Boolean =
|
||||||
if (location == null) false
|
if (location == null) false
|
||||||
|
|||||||
@@ -5,16 +5,15 @@ import mods.octarinecore.common.Double3
|
|||||||
import mods.octarinecore.common.Int3
|
import mods.octarinecore.common.Int3
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||||
import net.minecraft.client.renderer.texture.TextureMap
|
import net.minecraft.client.renderer.texture.TextureMap
|
||||||
import net.minecraft.util.BlockPos
|
|
||||||
import net.minecraft.util.MathHelper
|
|
||||||
import net.minecraft.util.ResourceLocation
|
import net.minecraft.util.ResourceLocation
|
||||||
|
import net.minecraft.util.math.BlockPos
|
||||||
|
import net.minecraft.util.math.MathHelper
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import net.minecraft.world.gen.NoiseGeneratorSimplex
|
import net.minecraft.world.gen.NoiseGeneratorSimplex
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent
|
import net.minecraftforge.client.event.TextureStitchEvent
|
||||||
import net.minecraftforge.common.MinecraftForge
|
import net.minecraftforge.common.MinecraftForge
|
||||||
import net.minecraftforge.event.world.WorldEvent
|
import net.minecraftforge.event.world.WorldEvent
|
||||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent
|
import net.minecraftforge.fml.client.event.ConfigChangedEvent
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package mods.octarinecore.common
|
package mods.octarinecore.common
|
||||||
|
|
||||||
import mods.octarinecore.cross
|
import mods.octarinecore.cross
|
||||||
import net.minecraft.util.BlockPos
|
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.EnumFacing
|
||||||
import net.minecraft.util.EnumFacing.*
|
import net.minecraft.util.EnumFacing.*
|
||||||
import net.minecraft.util.EnumFacing.Axis.*
|
import net.minecraft.util.EnumFacing.Axis.*
|
||||||
import net.minecraft.util.EnumFacing.AxisDirection.*
|
import net.minecraft.util.EnumFacing.AxisDirection.NEGATIVE
|
||||||
|
import net.minecraft.util.EnumFacing.AxisDirection.POSITIVE
|
||||||
|
import net.minecraft.util.math.BlockPos
|
||||||
|
|
||||||
// ================================
|
// ================================
|
||||||
// Axes and directions
|
// Axes and directions
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ public net.minecraft.client.renderer.BlockModelRenderer$AmbientOcclusionFace
|
|||||||
public net.minecraft.client.renderer.BlockModelRenderer$AmbientOcclusionFace field_178206_b # vertexColorMultiplier
|
public net.minecraft.client.renderer.BlockModelRenderer$AmbientOcclusionFace field_178206_b # vertexColorMultiplier
|
||||||
public net.minecraft.client.renderer.BlockModelRenderer$AmbientOcclusionFace field_178207_c # vertexBrightness
|
public net.minecraft.client.renderer.BlockModelRenderer$AmbientOcclusionFace field_178207_c # vertexBrightness
|
||||||
|
|
||||||
public net.minecraft.client.resources.model.ModelBakery field_177610_k # blockModelShapes
|
public net.minecraft.client.renderer.block.model.ModelBakery field_177610_k # blockModelShapes
|
||||||
|
|
||||||
public net.minecraft.client.renderer.block.statemap.BlockStateMapper field_178450_a # blockStateMap
|
public net.minecraft.client.renderer.block.statemap.BlockStateMapper field_178450_a # blockStateMap
|
||||||
|
|
||||||
public net.minecraft.client.renderer.WorldRenderer field_178999_b # rawIntBuffer
|
public net.minecraft.client.renderer.VertexBuffer field_178999_b # rawIntBuffer
|
||||||
public net.minecraft.client.renderer.WorldRenderer func_181670_b(I)V # growBuffer
|
public net.minecraft.client.renderer.VertexBuffer func_181670_b(I)V # growBuffer
|
||||||
public net.minecraft.client.renderer.WorldRenderer func_181664_j()I # getBufferSize
|
public net.minecraft.client.renderer.VertexBuffer func_181664_j()I # getBufferSize
|
||||||
|
|
||||||
|
public net.minecraft.client.renderer.BlockModelRenderer field_187499_a # blockColors
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// Vanilla
|
// Vanilla
|
||||||
net.minecraft.block.BlockLeavesBase
|
net.minecraft.block.BlockLeaves
|
||||||
|
|
||||||
// Forestry
|
// Forestry
|
||||||
forestry.arboriculture.gadgets.BlockLeaves
|
forestry.arboriculture.gadgets.BlockLeaves
|
||||||
|
|||||||
Reference in New Issue
Block a user