diff --git a/src/main/scala/mrtjp/core/render/TCubeMapRender.scala b/src/main/scala/mrtjp/core/render/TCubeMapRender.scala index b1190ad..b94c974 100644 --- a/src/main/scala/mrtjp/core/render/TCubeMapRender.scala +++ b/src/main/scala/mrtjp/core/render/TCubeMapRender.scala @@ -14,88 +14,88 @@ import net.minecraft.util.IIcon import net.minecraft.world.IBlockAccess object TCubeMapRender { - val models = { - val array = Array.ofDim[CCModel](6, 4) - val box = CCModel.quadModel(24).generateBlock(0, Cuboid6.full) - for (s <- 0 until 6) for (r <- 0 until 4) { - val m = box.copy.apply(Rotation.sideOrientation(s, r).at(Vector3.center)) - m.computeNormals() - array(s)(r) = m - } - array + val models = { + val array = Array.ofDim[CCModel](6, 4) + val box = CCModel.quadModel(24).generateBlock(0, Cuboid6.full) + for (s <- 0 until 6) for (r <- 0 until 4) { + val m = box.copy.apply(Rotation.sideOrientation(s, r).at(Vector3.center)) + m.computeNormals() + array(s)(r) = m } + array + } - val invTranslation = new Translation(-0.5, -0.5, -0.5) + val invTranslation = new Translation(-0.5, -0.5, -0.5) } trait TCubeMapRender extends TInstancedBlockRender { - import mrtjp.core.render.TCubeMapRender._ + import mrtjp.core.render.TCubeMapRender._ - override def renderWorldBlock( - r: RenderBlocks, - w: IBlockAccess, - x: Int, - y: Int, - z: Int, - meta: Int - ) { - val (s, rot, icon) = getData(w, x, y, z) - TextureUtils.bindAtlas(0) - val state = CCRenderState.instance - state.reset() - state.lightMatrix.locate(w, x, y, z) - models(s)(rot).render( - new Translation(x, y, z), - icon, - state.lightMatrix - ) - } + override def renderWorldBlock( + r: RenderBlocks, + w: IBlockAccess, + x: Int, + y: Int, + z: Int, + meta: Int + ) { + val (s, rot, icon) = getData(w, x, y, z) + TextureUtils.bindAtlas(0) + val state = CCRenderState.instance + state.reset() + state.lightMatrix.locate(w, x, y, z) + models(s)(rot).render( + new Translation(x, y, z), + icon, + state.lightMatrix + ) + } - override def renderBreaking( - w: IBlockAccess, - x: Int, - y: Int, - z: Int, - icon: IIcon - ) { - val b = w.getBlock(x, y, z) - val state = CCRenderState.instance - state.reset() - state.setPipeline( - new Translation(x, y, z), - new IconTransformation(icon) - ) - BlockRenderer.renderCuboid( - new Cuboid6( - b.getBlockBoundsMinX, - b.getBlockBoundsMinY, - b.getBlockBoundsMinZ, - b.getBlockBoundsMaxX, - b.getBlockBoundsMaxY, - b.getBlockBoundsMaxZ - ), - 0 - ) - } + override def renderBreaking( + w: IBlockAccess, + x: Int, + y: Int, + z: Int, + icon: IIcon + ) { + val b = w.getBlock(x, y, z) + val state = CCRenderState.instance + state.reset() + state.setPipeline( + new Translation(x, y, z), + new IconTransformation(icon) + ) + BlockRenderer.renderCuboid( + new Cuboid6( + b.getBlockBoundsMinX, + b.getBlockBoundsMinY, + b.getBlockBoundsMinZ, + b.getBlockBoundsMaxX, + b.getBlockBoundsMaxY, + b.getBlockBoundsMaxZ + ), + 0 + ) + } - override def renderInvBlock(r: RenderBlocks, meta: Int) { - val (s, r, icon) = getInvData + override def renderInvBlock(r: RenderBlocks, meta: Int) { + val (s, r, icon) = getInvData - TextureUtils.bindAtlas(0) - val state = CCRenderState.instance - state.reset() - state.setDynamic() - state.pullLightmap() - state.startDrawing() - models(s)(r).render(invTranslation, icon) - state.draw() - } + TextureUtils.bindAtlas(0) + val state = CCRenderState.instance + state.reset() + state.setDynamic() + state.pullLightmap() + state.startDrawing() + models(s)(r).render(invTranslation, icon) + state.draw() + } - def getData( - w: IBlockAccess, - x: Int, - y: Int, - z: Int - ): (Int, Int, UVTransformation) - def getInvData: (Int, Int, UVTransformation) + def getData( + w: IBlockAccess, + x: Int, + y: Int, + z: Int + ): (Int, Int, UVTransformation) + def getInvData: (Int, Int, UVTransformation) }