diff --git a/build.gradle b/build.gradle index 4f9c515..d37baba 100644 --- a/build.gradle +++ b/build.gradle @@ -2,8 +2,8 @@ apply plugin: "net.minecraftforge.gradle.forge" apply plugin: 'kotlin' group = 'com.github.octarine-noise' -version = "2.0.11" -archivesBaseName = rootProject.name + '-MC1.9' +version = "2.0.12b" +archivesBaseName = rootProject.name + '-MC1.9.4' buildscript { ext.kotlin_version = '1.0.0' @@ -19,7 +19,7 @@ buildscript { } } dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT" + classpath "net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -32,8 +32,8 @@ dependencies { } minecraft { - version = '1.9-12.16.1.1894' - mappings = 'snapshot_20160509' + version = '1.9.4-12.17.0.1968' + mappings = 'snapshot_20160619' runDir = 'run' } diff --git a/src/main/kotlin/mods/betterfoliage/BetterFoliageMod.kt b/src/main/kotlin/mods/betterfoliage/BetterFoliageMod.kt index f3689b9..14bf402 100644 --- a/src/main/kotlin/mods/betterfoliage/BetterFoliageMod.kt +++ b/src/main/kotlin/mods/betterfoliage/BetterFoliageMod.kt @@ -24,7 +24,7 @@ object BetterFoliageMod { const val MOD_NAME = "Better Foliage" const val DOMAIN = "betterfoliage" const val LEGACY_DOMAIN = "bettergrassandleaves" - const val MC_VERSIONS = "[1.9]" + const val MC_VERSIONS = "[1.9.4]" const val GUI_FACTORY = "mods.betterfoliage.client.gui.ConfigGuiFactory" lateinit var log: Logger diff --git a/src/main/kotlin/mods/betterfoliage/client/config/Config.kt b/src/main/kotlin/mods/betterfoliage/client/config/Config.kt index 57ff98f..5fb836e 100644 --- a/src/main/kotlin/mods/betterfoliage/client/config/Config.kt +++ b/src/main/kotlin/mods/betterfoliage/client/config/Config.kt @@ -4,7 +4,7 @@ import mods.betterfoliage.BetterFoliageMod import mods.betterfoliage.client.gui.BiomeListConfigEntry import mods.octarinecore.common.config.* import net.minecraft.client.Minecraft -import net.minecraft.world.biome.BiomeGenBase +import net.minecraft.world.biome.Biome import net.minecraftforge.fml.client.event.ConfigChangedEvent import net.minecraftforge.fml.relauncher.Side import net.minecraftforge.fml.relauncher.SideOnly @@ -12,17 +12,17 @@ import net.minecraftforge.fml.relauncher.SideOnly // BetterFoliage-specific property delegates private fun featureEnable() = boolean(true).lang("enabled") private fun distanceLimit() = int(min=1, max=1000, default=1000).lang("distance") -fun biomeList(defaults: (BiomeGenBase) -> Boolean) = intList { - BiomeGenBase.REGISTRY +fun biomeList(defaults: (Biome) -> Boolean) = intList { + Biome.REGISTRY .filter { it != null && defaults(it) } - .map { BiomeGenBase.REGISTRY.getIDForObject(it) } + .map { Biome.REGISTRY.getIDForObject(it) } .toTypedArray() }.apply { guiClass = BiomeListConfigEntry::class.java } // Biome filter methods -private fun BiomeGenBase.filterTemp(min: Float?, max: Float?) = (min == null || min <= temperature) && (max == null || max >= temperature) -private fun BiomeGenBase.filterRain(min: Float?, max: Float?) = (min == null || min <= rainfall) && (max == null || max >= rainfall) -private fun BiomeGenBase.filterClass(vararg name: String) = name.any { it in this.javaClass.name.toLowerCase() } +private fun Biome.filterTemp(min: Float?, max: Float?) = (min == null || min <= temperature) && (max == null || max >= temperature) +private fun Biome.filterRain(min: Float?, max: Float?) = (min == null || min <= rainfall) && (max == null || max >= rainfall) +private fun Biome.filterClass(vararg name: String) = name.any { it in this.javaClass.name.toLowerCase() } // Config singleton @SideOnly(Side.CLIENT) diff --git a/src/main/kotlin/mods/betterfoliage/client/gui/BiomeListConfigEntry.kt b/src/main/kotlin/mods/betterfoliage/client/gui/BiomeListConfigEntry.kt index 6d18a2f..a2d791d 100644 --- a/src/main/kotlin/mods/betterfoliage/client/gui/BiomeListConfigEntry.kt +++ b/src/main/kotlin/mods/betterfoliage/client/gui/BiomeListConfigEntry.kt @@ -1,7 +1,7 @@ package mods.betterfoliage.client.gui import mods.octarinecore.client.gui.IdListConfigEntry -import net.minecraft.world.biome.BiomeGenBase +import net.minecraft.world.biome.Biome import net.minecraftforge.fml.client.config.GuiConfig import net.minecraftforge.fml.client.config.GuiConfigEntries import net.minecraftforge.fml.client.config.IConfigElement @@ -11,9 +11,9 @@ class BiomeListConfigEntry( owningScreen: GuiConfig, owningEntryList: GuiConfigEntries, configElement: IConfigElement) -: IdListConfigEntry(owningScreen, owningEntryList, configElement) { +: IdListConfigEntry(owningScreen, owningEntryList, configElement) { - override val baseSet: List get() = BiomeGenBase.REGISTRY.filterNotNull() - override val BiomeGenBase.itemId: Int get() = BiomeGenBase.REGISTRY.getIDForObject(this) - override val BiomeGenBase.itemName: String get() = this.biomeName + override val baseSet: List get() = Biome.REGISTRY.filterNotNull() + override val Biome.itemId: Int get() = Biome.REGISTRY.getIDForObject(this) + override val Biome.itemName: String get() = this.biomeName } \ No newline at end of file diff --git a/src/main/kotlin/mods/betterfoliage/loader/BetterFoliageCore.kt b/src/main/kotlin/mods/betterfoliage/loader/BetterFoliageCore.kt index 4a13230..6d9c9eb 100644 --- a/src/main/kotlin/mods/betterfoliage/loader/BetterFoliageCore.kt +++ b/src/main/kotlin/mods/betterfoliage/loader/BetterFoliageCore.kt @@ -103,14 +103,14 @@ class BetterFoliageTransformer : Transformer() { transformMethod(Refs.rebuildChunk) { find(invokeRef(Refs.renderBlock))?.replace { log.info("Applying RenderChunk block render override") - varinsn(ALOAD, if (isOptifinePresent) 22 else 21) + varinsn(ALOAD, if (isOptifinePresent) 22 else 20) invokeStatic(Refs.renderWorldBlock) } if (isOptifinePresent) { find(varinsn(ISTORE, 23))?.insertAfter { log.info("Applying RenderChunk block layer override") varinsn(ALOAD, 19) - varinsn(ALOAD, 20) + varinsn(ALOAD, 18) varinsn(ALOAD, 22) invokeStatic(Refs.canRenderBlockInLayer) varinsn(ISTORE, 23) diff --git a/src/main/kotlin/mods/betterfoliage/loader/Refs.kt b/src/main/kotlin/mods/betterfoliage/loader/Refs.kt index 851ae93..86106a2 100644 --- a/src/main/kotlin/mods/betterfoliage/loader/Refs.kt +++ b/src/main/kotlin/mods/betterfoliage/loader/Refs.kt @@ -16,19 +16,19 @@ object Refs { // Minecraft val IBlockAccess = ClassRef("net.minecraft.world.IBlockAccess", "ahx") - val IBlockState = ClassRef("net.minecraft.block.state.IBlockState", "arc") + val IBlockState = ClassRef("net.minecraft.block.state.IBlockState", "ard") val BlockStateBase = ClassRef("net.minecraft.block.state.BlockStateBase", "ara") - val BlockPos = ClassRef("net.minecraft.util.math.BlockPos", "cj") - val MutableBlockPos = ClassRef("net.minecraft.util.math.BlockPos\$MutableBlockPos", "cj\$a") + val BlockPos = ClassRef("net.minecraft.util.math.BlockPos", "cl") + val MutableBlockPos = ClassRef("net.minecraft.util.math.BlockPos\$MutableBlockPos", "cl\$a") val BlockRenderLayer = ClassRef("net.minecraft.util.BlockRenderLayer", "ahm") - val EnumFacing = ClassRef("net.minecraft.util.EnumFacing", "cq") + val EnumFacing = ClassRef("net.minecraft.util.EnumFacing", "cs") val World = ClassRef("net.minecraft.world.World", "aht") - val WorldClient = ClassRef("net.minecraft.client.multiplayer.WorldClient", "bku") + val WorldClient = ClassRef("net.minecraft.client.multiplayer.WorldClient", "bks") 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", "ajt") - val StateImplementation = ClassRef("net.minecraft.block.state.BlockStateContainer\$StateImplementation", "ard\$a") + val StateImplementation = ClassRef("net.minecraft.block.state.BlockStateContainer\$StateImplementation", "are\$a") val canRenderInLayer = MethodRef(Block, "canRenderInLayer", ClassRef.boolean, IBlockState, BlockRenderLayer) val getAmbientOcclusionLightValue = MethodRef(StateImplementation, "getAmbientOcclusionLightValue", "func_185892_j", "j", ClassRef.float) val useNeighborBrightness = MethodRef(StateImplementation, "useNeighborBrightness", "func_185916_f", "f", ClassRef.boolean) @@ -36,28 +36,28 @@ object Refs { val isOpaqueCube = MethodRef(StateImplementation, "isOpaqueCube", "", "p", ClassRef.boolean) val randomDisplayTick = MethodRef(Block, "randomDisplayTick", "func_180655_c", "a", ClassRef.void, IBlockState, World, BlockPos, Random) - val BlockModelRenderer = ClassRef("net.minecraft.client.renderer.BlockModelRenderer", "boe") - val AmbientOcclusionFace = ClassRef("net.minecraft.client.renderer.BlockModelRenderer\$AmbientOcclusionFace", "boe\$b") - val ChunkCompileTaskGenerator = ClassRef("net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator", "bpz") - val VertexBuffer = ClassRef("net.minecraft.client.renderer.VertexBuffer", "bmz") + val BlockModelRenderer = ClassRef("net.minecraft.client.renderer.BlockModelRenderer", "bob") + val AmbientOcclusionFace = ClassRef("net.minecraft.client.renderer.BlockModelRenderer\$AmbientOcclusionFace", "bob\$b") + val ChunkCompileTaskGenerator = ClassRef("net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator", "bpw") + val VertexBuffer = ClassRef("net.minecraft.client.renderer.VertexBuffer", "bmx") val AOF_constructor = MethodRef(AmbientOcclusionFace, "", ClassRef.void, BlockModelRenderer) - val RenderChunk = ClassRef("net.minecraft.client.renderer.chunk.RenderChunk", "bqf") + val RenderChunk = ClassRef("net.minecraft.client.renderer.chunk.RenderChunk", "bqc") 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", "boc") + val BlockRendererDispatcher = ClassRef("net.minecraft.client.renderer.BlockRendererDispatcher", "bnz") val renderBlock = MethodRef(BlockRendererDispatcher, "renderBlock", "func_175018_a", "a", ClassRef.boolean, IBlockState, BlockPos, IBlockAccess, VertexBuffer) - val TextureAtlasSprite = ClassRef("net.minecraft.client.renderer.texture.TextureAtlasSprite", "bvh") + val TextureAtlasSprite = ClassRef("net.minecraft.client.renderer.texture.TextureAtlasSprite", "bve") - val IRegistry = ClassRef("net.minecraft.util.registry.IRegistry", "db") + val IRegistry = ClassRef("net.minecraft.util.registry.IRegistry", "dd") val ModelLoader = ClassRef("net.minecraftforge.client.model.ModelLoader") val stateModels = FieldRef(ModelLoader, "stateModels", Map) val setupModelRegistry = MethodRef(ModelLoader, "setupModelRegistry", "func_177570_a", "a", IRegistry) val IModel = ClassRef("net.minecraftforge.client.model.IModel") - val ModelBlock = ClassRef("net.minecraft.client.renderer.block.model.ModelBlock", "bok") - val ModelResourceLocation = ClassRef("net.minecraft.client.renderer.block.model.ModelResourceLocation", "bxt") + val ModelBlock = ClassRef("net.minecraft.client.renderer.block.model.ModelBlock", "boh") + val ModelResourceLocation = ClassRef("net.minecraft.client.renderer.block.model.ModelResourceLocation", "bxc") val VanillaModelWrapper = ClassRef("net.minecraftforge.client.model.ModelLoader\$VanillaModelWrapper") val model_VMW = FieldRef(VanillaModelWrapper, "model", ModelBlock) val location_VMW = FieldRef(VanillaModelWrapper, "location", ModelBlock) diff --git a/src/main/kotlin/mods/octarinecore/client/render/AbstractBlockRenderingHandler.kt b/src/main/kotlin/mods/octarinecore/client/render/AbstractBlockRenderingHandler.kt index 92cd7b3..4aeb148 100644 --- a/src/main/kotlin/mods/octarinecore/client/render/AbstractBlockRenderingHandler.kt +++ b/src/main/kotlin/mods/octarinecore/client/render/AbstractBlockRenderingHandler.kt @@ -17,7 +17,7 @@ import net.minecraft.util.BlockRenderLayer import net.minecraft.util.math.BlockPos import net.minecraft.util.math.MathHelper import net.minecraft.world.IBlockAccess -import net.minecraft.world.biome.BiomeGenBase +import net.minecraft.world.biome.Biome /** * [ThreadLocal] instance of [BlockContext] representing the block being rendered. @@ -83,7 +83,7 @@ class BlockContext() { } /** Get the biome ID at the block position. */ - val biomeId: Int get() = BiomeGenBase.getIdForBiome(world!!.getBiomeGenForCoords(pos)) + val biomeId: Int get() = Biome.getIdForBiome(world!!.getBiome(pos)) /** 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) diff --git a/src/main/kotlin/mods/octarinecore/client/render/AbstractEntityFX.kt b/src/main/kotlin/mods/octarinecore/client/render/AbstractEntityFX.kt index 4960200..45d1ba9 100644 --- a/src/main/kotlin/mods/octarinecore/client/render/AbstractEntityFX.kt +++ b/src/main/kotlin/mods/octarinecore/client/render/AbstractEntityFX.kt @@ -3,13 +3,13 @@ package mods.octarinecore.client.render import mods.octarinecore.PI2 import mods.octarinecore.common.Double3 import net.minecraft.client.Minecraft -import net.minecraft.client.particle.EntityFX +import net.minecraft.client.particle.Particle import net.minecraft.client.renderer.VertexBuffer import net.minecraft.client.renderer.texture.TextureAtlasSprite import net.minecraft.entity.Entity import net.minecraft.world.World -abstract class AbstractEntityFX(world: World, x: Double, y: Double, z: Double) : EntityFX(world, x, y, z) { +abstract class AbstractEntityFX(world: World, x: Double, y: Double, z: Double) : Particle(world, x, y, z) { companion object { @JvmStatic val sin = Array(64) { idx -> Math.sin(PI2 / 64.0 * idx) } diff --git a/src/main/kotlin/mods/octarinecore/client/render/OffsetBlockAccess.kt b/src/main/kotlin/mods/octarinecore/client/render/OffsetBlockAccess.kt index fb2a6c8..df41cb9 100644 --- a/src/main/kotlin/mods/octarinecore/client/render/OffsetBlockAccess.kt +++ b/src/main/kotlin/mods/octarinecore/client/render/OffsetBlockAccess.kt @@ -19,7 +19,7 @@ class OffsetBlockAccess(val original: IBlockAccess, val modded: BlockPos, val ta if (pos != null && pos.x == modded.x && pos.y == modded.y && pos.z == modded.z) target else pos override fun extendedLevelsInChunkCache() = original.extendedLevelsInChunkCache() - override fun getBiomeGenForCoords(pos: BlockPos?) = original.getBiomeGenForCoords(actualPos(pos)) + override fun getBiome(pos: BlockPos?) = original.getBiome(actualPos(pos)) override fun getBlockState(pos: BlockPos?) = original.getBlockState(actualPos(pos)) override fun getCombinedLight(pos: BlockPos?, lightValue: Int) = original.getCombinedLight(actualPos(pos), lightValue) override fun getStrongPower(pos: BlockPos?, direction: EnumFacing?) = original.getStrongPower(actualPos(pos), direction) diff --git a/src/main/kotlin/mods/octarinecore/client/resource/ModelDataInspector.kt b/src/main/kotlin/mods/octarinecore/client/resource/ModelDataInspector.kt index 448ad3b..c7c22a6 100644 --- a/src/main/kotlin/mods/octarinecore/client/resource/ModelDataInspector.kt +++ b/src/main/kotlin/mods/octarinecore/client/resource/ModelDataInspector.kt @@ -119,7 +119,7 @@ val IModel.modelBlockAndLoc: Pair? get() { fun Pair.derivesFrom(targetLocation: String): Boolean { if (second.stripStart("models/") == ResourceLocation(targetLocation)) return true if (first.parent != null && first.parentLocation != null) - return Pair(first.parent, first.parentLocation).derivesFrom(targetLocation) + return Pair(first.parent, first.parentLocation!!).derivesFrom(targetLocation) return false } diff --git a/src/main/kotlin/mods/octarinecore/client/resource/ResourceGeneration.kt b/src/main/kotlin/mods/octarinecore/client/resource/ResourceGeneration.kt index 9ea19a9..1f73870 100644 --- a/src/main/kotlin/mods/octarinecore/client/resource/ResourceGeneration.kt +++ b/src/main/kotlin/mods/octarinecore/client/resource/ResourceGeneration.kt @@ -3,7 +3,8 @@ package mods.octarinecore.client.resource import mods.octarinecore.metaprog.reflectField import net.minecraft.client.resources.IResourcePack import net.minecraft.client.resources.data.IMetadataSection -import net.minecraft.client.resources.data.IMetadataSerializer +import net.minecraft.client.resources.data.IMetadataSectionSerializer +import net.minecraft.client.resources.data.MetadataSerializer import net.minecraft.client.resources.data.PackMetadataSection import net.minecraft.util.ResourceLocation import net.minecraft.util.text.TextComponentString @@ -27,8 +28,8 @@ class GeneratorPack(val name: String, vararg val generators: GeneratorBase) : IR override fun getPackName() = name override fun getPackImage() = null override fun getResourceDomains() = HashSet(generators.map { it.domain }) - override fun getPackMetadata(serializer: IMetadataSerializer?, type: String?) = - if (type == "pack") PackMetadataSection(TextComponentString("Generated resources"), 1) as? T else null + override fun getPackMetadata(serializer: MetadataSerializer?, sectionName: String?) = + if (sectionName == "pack") PackMetadataSection(TextComponentString("Generated resources"), 1) as? T else null override fun resourceExists(location: ResourceLocation?): Boolean = if (location == null) false