RenderHelper.disableStandardItemLighting();
mc.entityRenderer.enableLightmap(0);
RenderUtil.bindBlockTexture();
Vector3d trans = new Vector3d((-origin.x) + eye.x, (-origin.y) + eye.y, (-origin.z) + eye.z);
for (int pass = 0; pass < 2; pass++) {
ForgeHooksClient.setRenderPass(pass);
setGlStateForPass(pass);
Tessellator.instance.startDrawingQuads();
Tessellator.instance.setTranslation(trans.x, trans.y, trans.z);
for (ViewableBlocks ug : blocks) {
if(ug.block.canRenderInPass(pass)) {
RB.setRenderBounds(0, 0, 0, 1, 1, 1);
RB.renderBlockByRenderType(ug.block, ug.bc.x, ug.bc.y, ug.bc.z);
}
}
Tessellator.instance.draw();
Tessellator.instance.setTranslation(0, 0, 0);
}
RenderHelper.enableStandardItemLighting();
TileEntityRendererDispatcher.instance.field_147558_l = origin.x - eye.x;
TileEntityRendererDispatcher.instance.field_147560_j = origin.y - eye.y;
TileEntityRendererDispatcher.instance.field_147561_k = origin.z - eye.z;
TileEntityRendererDispatcher.staticPlayerX = origin.x - eye.x;
TileEntityRendererDispatcher.staticPlayerY = origin.y - eye.y;
TileEntityRendererDispatcher.staticPlayerZ = origin.z - eye.z;
for (int pass = 0; pass < 2; pass++) {
ForgeHooksClient.setRenderPass(pass);
setGlStateForPass(pass);
for (ViewableBlocks ug : blocks) {
TileEntity tile = world.getTileEntity(ug.bc.x, ug.bc.y, ug.bc.z);
if(tile != null) {
Vector3d at = new Vector3d(eye.x - 0.5, eye.y - 0.5, eye.z - 0.5);
at.x += ug.bc.x - ioX;
at.y += ug.bc.y - ioY;
at.z += ug.bc.z - ioZ;
TileEntityRendererDispatcher.instance.renderTileEntityAt(tile, at.x, at.y, at.z, 0);
}