mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-10-25 20:22:27 +00:00
Merge pull request #21 from GTNewHorizons/chicken
update to support 1.2.0 CCL - needs work to be more performant
This commit is contained in:
10 files changed
+44
-46
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api("com.github.GTNewHorizons:CodeChickenLib:1.1.8:dev")
|
||||
api("com.github.GTNewHorizons:CodeChickenLib:1.2.0:dev")
|
||||
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev")
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"repo": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.5.5/",
|
||||
"file": "CodeChickenLib-1.7.10-1.1.5.5.jar",
|
||||
"dev": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.5.5/CodeChickenLib-1.7.10-1.1.5.5-dev.jar",
|
||||
"class": "codechicken.lib.asm.ASMHelper",
|
||||
"coreLib": true
|
||||
}
|
||||
@@ -24,7 +24,7 @@ object MaterialRenderHelper {
|
||||
|
||||
def start(pos: Vector3, pass: Int, uvt: UVTransformation) = {
|
||||
this.pass = pass
|
||||
builder = CCRenderState.pipeline.builder()
|
||||
builder = CCRenderState.instance().pipeline.builder()
|
||||
builder.add(pos.translation()).add(uvt)
|
||||
this
|
||||
}
|
||||
@@ -36,7 +36,7 @@ object MaterialRenderHelper {
|
||||
|
||||
def lighting() = {
|
||||
if (pass != -1)
|
||||
builder.add(CCRenderState.lightMatrix)
|
||||
builder.add(CCRenderState.instance().lightMatrix)
|
||||
this
|
||||
}
|
||||
|
||||
@@ -85,9 +85,10 @@ class BlockMicroMaterial(val block: Block, val meta: Int = 0)
|
||||
if (pass == -1)
|
||||
block.getBlockColor << 8 | 0xff
|
||||
else {
|
||||
val pos = CCRenderState.lightMatrix.pos
|
||||
val state = CCRenderState.instance
|
||||
val pos = state.lightMatrix.pos
|
||||
block.colorMultiplier(
|
||||
CCRenderState.lightMatrix.access,
|
||||
state.lightMatrix.access,
|
||||
pos.x,
|
||||
pos.y,
|
||||
pos.z
|
||||
|
||||
@@ -2,7 +2,7 @@ package codechicken.microblock
|
||||
|
||||
import codechicken.lib.vec.{Cuboid6, Vector3}
|
||||
import net.minecraft.block.Block
|
||||
import codechicken.lib.render.{ColourMultiplier, CCRenderState}
|
||||
import codechicken.lib.render.CCRenderState
|
||||
import net.minecraft.block.BlockGrass
|
||||
import net.minecraft.init.Blocks
|
||||
import codechicken.lib.render.uv.{UVTranslation, IconTransformation}
|
||||
@@ -17,7 +17,7 @@ class GrassMicroMaterial extends BlockMicroMaterial(Blocks.grass, 0) {
|
||||
}
|
||||
|
||||
override def renderMicroFace(pos: Vector3, pass: Int, bounds: Cuboid6) {
|
||||
val face = CCRenderState.model.asInstanceOf[BlockFace]
|
||||
val face = CCRenderState.instance().model.asInstanceOf[BlockFace]
|
||||
if (pass != -1)
|
||||
face.computeLightCoords()
|
||||
|
||||
@@ -42,7 +42,7 @@ class GrassMicroMaterial extends BlockMicroMaterial(Blocks.grass, 0) {
|
||||
class TopMicroMaterial($block: Block, $meta: Int = 0)
|
||||
extends BlockMicroMaterial($block, $meta) {
|
||||
override def renderMicroFace(pos: Vector3, pass: Int, bounds: Cuboid6) {
|
||||
val face = CCRenderState.model.asInstanceOf[BlockFace]
|
||||
val face = CCRenderState.instance().model.asInstanceOf[BlockFace]
|
||||
if (face.side <= 1)
|
||||
MaterialRenderHelper
|
||||
.start(pos, pass, icont)
|
||||
|
||||
@@ -14,7 +14,6 @@ import Vector3._
|
||||
import codechicken.lib.raytracer.IndexedCuboid6
|
||||
import org.lwjgl.opengl.GL11
|
||||
import codechicken.lib.render.uv.IconTransformation
|
||||
import codechicken.lib.lighting.LightMatrix
|
||||
|
||||
object HollowPlacement extends PlacementProperties {
|
||||
object HollowPlacementGrid extends FaceEdgeGrid(3 / 8d)
|
||||
@@ -74,8 +73,9 @@ trait HollowMicroblockClient
|
||||
}
|
||||
|
||||
override def drawBreaking(renderBlocks: RenderBlocks) {
|
||||
CCRenderState.reset()
|
||||
CCRenderState.setPipeline(
|
||||
val state = CCRenderState.instance
|
||||
state.reset()
|
||||
state.setPipeline(
|
||||
new Translation(x, y, z),
|
||||
new IconTransformation(renderBlocks.overrideBlockTexture)
|
||||
)
|
||||
|
||||
@@ -170,17 +170,17 @@ object ItemMicroPartRenderer extends IItemRenderer {
|
||||
GL11.glScaled(0.5, 0.5, 0.5)
|
||||
if (t == ItemRenderType.INVENTORY || t == ItemRenderType.ENTITY)
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f)
|
||||
|
||||
TextureUtils.bindAtlas(0)
|
||||
CCRenderState.reset()
|
||||
CCRenderState.useNormals = true
|
||||
CCRenderState.pullLightmap()
|
||||
CCRenderState.startDrawing()
|
||||
val state = CCRenderState.instance
|
||||
state.reset()
|
||||
state.useNormals = true
|
||||
state.pullLightmap()
|
||||
state.startDrawing()
|
||||
val part =
|
||||
mcrClass.create(true, getMaterialID(item)).asInstanceOf[MicroblockClient]
|
||||
part.setShape(size, mcrClass.itemSlot)
|
||||
part.render(new Vector3(0.5, 0.5, 0.5).subtract(part.getBounds.center), -1)
|
||||
CCRenderState.draw()
|
||||
state.draw()
|
||||
GL11.glPopMatrix()
|
||||
}
|
||||
|
||||
|
||||
@@ -112,17 +112,17 @@ object ItemSawRenderer extends IItemRenderer {
|
||||
)
|
||||
case _ => return
|
||||
}
|
||||
|
||||
CCRenderState.reset()
|
||||
CCRenderState.useNormals = true
|
||||
CCRenderState.pullLightmap()
|
||||
val state = CCRenderState.instance
|
||||
state.reset()
|
||||
state.useNormals = true
|
||||
state.pullLightmap()
|
||||
CCRenderState.changeTexture("microblock:textures/items/saw.png")
|
||||
CCRenderState.startDrawing()
|
||||
state.startDrawing()
|
||||
handle.render(t)
|
||||
holder.render(t)
|
||||
CCRenderState.draw()
|
||||
state.draw()
|
||||
GL11.glDisable(GL11.GL_CULL_FACE)
|
||||
CCRenderState.startDrawing()
|
||||
state.startDrawing()
|
||||
blade.render(
|
||||
t,
|
||||
new UVTranslation(
|
||||
@@ -130,7 +130,7 @@ object ItemSawRenderer extends IItemRenderer {
|
||||
(item.getItem.asInstanceOf[Saw].getCuttingStrength(item) - 1) * 4 / 64d
|
||||
)
|
||||
)
|
||||
CCRenderState.draw()
|
||||
state.draw()
|
||||
GL11.glEnable(GL11.GL_CULL_FACE)
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ object MicroblockRender {
|
||||
return
|
||||
val pos = placement.pos
|
||||
val part = placement.part.asInstanceOf[MicroblockClient]
|
||||
val state = CCRenderState.instance
|
||||
|
||||
glPushMatrix()
|
||||
glTranslated(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
|
||||
@@ -40,14 +41,14 @@ object MicroblockRender {
|
||||
glEnable(GL_BLEND)
|
||||
glDepthMask(false)
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
|
||||
|
||||
// TODO: update to use a thread local copy
|
||||
TextureUtils.bindAtlas(0)
|
||||
CCRenderState.reset()
|
||||
CCRenderState.alphaOverride = 80
|
||||
CCRenderState.useNormals = true
|
||||
CCRenderState.startDrawing()
|
||||
state.reset()
|
||||
state.alphaOverride = 80
|
||||
state.useNormals = true
|
||||
state.startDrawing()
|
||||
part.render(Vector3.zero, -1)
|
||||
CCRenderState.draw()
|
||||
state.draw()
|
||||
|
||||
glDisable(GL_BLEND)
|
||||
glDepthMask(true)
|
||||
@@ -62,7 +63,7 @@ object MicroblockRender {
|
||||
c: Cuboid6,
|
||||
faces: Int
|
||||
) {
|
||||
CCRenderState.setModel(face)
|
||||
CCRenderState.instance().setModel(face)
|
||||
for (s <- 0 until 6 if (faces & 1 << s) == 0) {
|
||||
face.loadCuboidFace(c, s)
|
||||
mat.renderMicroFace(pos, pass, c)
|
||||
|
||||
@@ -36,9 +36,10 @@ object MultipartRenderer
|
||||
if (tmpart.partList.isEmpty)
|
||||
return
|
||||
|
||||
CCRenderState.reset()
|
||||
CCRenderState.pullLightmap()
|
||||
CCRenderState.useNormals = true
|
||||
val state = CCRenderState.instance
|
||||
state.reset()
|
||||
state.pullLightmap()
|
||||
state.useNormals = true
|
||||
|
||||
val pos = new Vector3(x, y, z)
|
||||
tmpart.renderDynamic(pos, f, pass)
|
||||
@@ -81,8 +82,9 @@ object MultipartRenderer
|
||||
return false
|
||||
}
|
||||
|
||||
CCRenderState.reset()
|
||||
CCRenderState.lightMatrix.locate(world, x, y, z)
|
||||
val state = CCRenderState.instance
|
||||
state.reset()
|
||||
state.lightMatrix.locate(world, x, y, z)
|
||||
return tmpart.renderStatic(new Vector3(x, y, z), pass)
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,9 @@ trait TCuboidPart extends TMultiPart {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def drawBreaking(renderBlocks: RenderBlocks) {
|
||||
CCRenderState.reset()
|
||||
CCRenderState.setPipeline(
|
||||
val state = CCRenderState.instance
|
||||
state.reset()
|
||||
state.setPipeline(
|
||||
new Translation(x, y, z),
|
||||
new IconTransformation(renderBlocks.overrideBlockTexture)
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user