port to 1.9.4
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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) }
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -119,7 +119,7 @@ val IModel.modelBlockAndLoc: Pair<ModelBlock, ResourceLocation>? get() {
|
||||
fun Pair<ModelBlock, ResourceLocation>.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
|
||||
}
|
||||
|
||||
|
||||
@@ -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 <T: IMetadataSection> getPackMetadata(serializer: IMetadataSerializer?, type: String?) =
|
||||
if (type == "pack") PackMetadataSection(TextComponentString("Generated resources"), 1) as? T else null
|
||||
override fun <T : IMetadataSection?> 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
|
||||
|
||||
Reference in New Issue
Block a user