port to MC 1.8.8
This commit is contained in:
@@ -82,11 +82,42 @@ abstract class AbstractEntityFX(world: World, x: Double, y: Double, z: Double) :
|
||||
val v2 = if (rotation == 0) billboardRot.second * size else
|
||||
Double3.weight(billboardRot.first, -sin[rotation and 63] * size, billboardRot.second, cos[rotation and 63] * size)
|
||||
|
||||
worldRenderer.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, alpha)
|
||||
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)
|
||||
val renderBrightness = this.getBrightnessForRender(partialTickTime)
|
||||
val brLow = renderBrightness shr 16 and 65535
|
||||
val brHigh = renderBrightness and 65535
|
||||
|
||||
worldRenderer
|
||||
.pos(center.x - v1.x, center.y - v1.y, center.z - v1.z)
|
||||
.tex(maxU, maxV)
|
||||
.color(particleRed, particleGreen, particleBlue, alpha)
|
||||
.lightmap(brLow, brHigh)
|
||||
.endVertex()
|
||||
|
||||
worldRenderer
|
||||
.pos(center.x - v2.x, center.y - v2.y, center.z - v2.z)
|
||||
.tex(maxU, minV)
|
||||
.color(particleRed, particleGreen, particleBlue, alpha)
|
||||
.lightmap(brLow, brHigh)
|
||||
.endVertex()
|
||||
|
||||
worldRenderer
|
||||
.pos(center.x + v1.x, center.y + v1.y, center.z + v1.z)
|
||||
.tex(minU, minV)
|
||||
.color(particleRed, particleGreen, particleBlue, alpha)
|
||||
.lightmap(brLow, brHigh)
|
||||
.endVertex()
|
||||
|
||||
worldRenderer
|
||||
.pos(center.x + v2.x, center.y + v2.y, center.z + v2.z)
|
||||
.tex(minU, maxV)
|
||||
.color(particleRed, particleGreen, particleBlue, alpha)
|
||||
.lightmap(brLow, brHigh)
|
||||
.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
|
||||
|
||||
@@ -5,6 +5,7 @@ import mods.octarinecore.common.*
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.WorldRenderer
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
|
||||
import net.minecraft.util.EnumFacing
|
||||
import net.minecraft.util.EnumFacing.*
|
||||
|
||||
@@ -39,6 +40,12 @@ class ModelRenderer() : ShadingContext() {
|
||||
rotation = rot
|
||||
aoEnabled = Minecraft.isAmbientOcclusionEnabled()
|
||||
|
||||
// make sure we have space in the buffer for our quads plus one
|
||||
worldRenderer.apply {
|
||||
rawIntBuffer.position(bufferSize)
|
||||
growBuffer((model.quads.size * 4 + 1) * vertexFormat.func_181719_f())
|
||||
}
|
||||
|
||||
model.quads.forEachIndexed { quadIdx, quad ->
|
||||
val drawIcon = icon(this, quadIdx, quad)
|
||||
if (drawIcon != null) {
|
||||
@@ -49,11 +56,13 @@ class ModelRenderer() : ShadingContext() {
|
||||
val shader = if (aoEnabled && !forceFlat) vert.aoShader else vert.flatShader
|
||||
shader.shade(this, temp)
|
||||
temp.postProcess(this, quadIdx, quad, vertIdx, vert)
|
||||
worldRenderer.setTextureUV(temp.u, temp.v)
|
||||
worldRenderer.setBrightness(temp.brightness)
|
||||
worldRenderer.setColorOpaque_F(temp.red, temp.green, temp.blue)
|
||||
worldRenderer.addVertex(temp.x, temp.y, temp.z)
|
||||
|
||||
worldRenderer
|
||||
.pos(temp.x, temp.y, temp.z)
|
||||
.color(temp.red, temp.green, temp.blue, 1.0f)
|
||||
.tex(temp.u, temp.v)
|
||||
.lightmap(temp.brightness shr 16 and 65535, temp.brightness and 65535)
|
||||
.endVertex()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,6 +102,8 @@ class RenderVertex() {
|
||||
var green: Float = 0.0f
|
||||
var blue: Float = 0.0f
|
||||
|
||||
val rawData = IntArray(7)
|
||||
|
||||
fun init(vertex: Vertex, rot: Rotation, trans: Double3): RenderVertex {
|
||||
val result = vertex.xyz.rotate(rot) + trans
|
||||
x = result.x; y = result.y; z = result.z
|
||||
@@ -140,6 +151,7 @@ class RenderVertex() {
|
||||
green = (color shr 8 and 255) / 256.0f
|
||||
blue = (color and 255) / 256.0f
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val allFaces: (EnumFacing) -> Boolean = { true }
|
||||
|
||||
@@ -2,6 +2,7 @@ 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.PackMetadataSection
|
||||
import net.minecraft.util.ChatComponentText
|
||||
@@ -26,8 +27,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(ChatComponentText("Generated resources"), 1) else null
|
||||
override fun <T: IMetadataSection> getPackMetadata(serializer: IMetadataSerializer?, type: String?) =
|
||||
if (type == "pack") PackMetadataSection(ChatComponentText("Generated resources"), 1) as? T else null
|
||||
|
||||
override fun resourceExists(location: ResourceLocation?): Boolean =
|
||||
if (location == null) false
|
||||
@@ -42,7 +43,9 @@ class GeneratorPack(val name: String, vararg val generators: GeneratorBase) : IR
|
||||
}.map { it.getInputStream(location) }
|
||||
.filterNotNull().first()
|
||||
|
||||
operator fun get(location: ResourceLocation?) = getInputStream(location)
|
||||
// override fun <T : IMetadataSection?> getPackMetadata(p_135058_1_: IMetadataSerializer?, p_135058_2_: String?): T {
|
||||
// return if (type == "pack") PackMetadataSection(ChatComponentText("Generated resources"), 1) else null
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,10 +40,7 @@ open class ResourceHandler(val modId: String) {
|
||||
// ============================
|
||||
// Self-registration
|
||||
// ============================
|
||||
init {
|
||||
MinecraftForge.EVENT_BUS.register(this)
|
||||
FMLCommonHandler.instance().bus().register(this)
|
||||
}
|
||||
init { MinecraftForge.EVENT_BUS.register(this) }
|
||||
|
||||
// ============================
|
||||
// Resource declarations
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.LinkedListMultimap
|
||||
import mods.octarinecore.metaprog.reflectField
|
||||
import mods.octarinecore.metaprog.reflectFieldsOfType
|
||||
import mods.octarinecore.metaprog.reflectNestedObjects
|
||||
import net.minecraftforge.common.MinecraftForge
|
||||
import net.minecraftforge.common.config.ConfigElement
|
||||
import net.minecraftforge.common.config.Configuration
|
||||
import net.minecraftforge.common.config.Property
|
||||
@@ -33,7 +34,7 @@ import kotlin.reflect.KProperty
|
||||
*/
|
||||
abstract class DelegatingConfig(val modId: String, val langPrefix: String) {
|
||||
|
||||
init { FMLCommonHandler.instance().bus().register(this) }
|
||||
init { MinecraftForge.EVENT_BUS.register(this) }
|
||||
|
||||
/** The [Configuration] backing this config object. */
|
||||
var config: Configuration? = null
|
||||
|
||||
Reference in New Issue
Block a user