Jump to content

[1.7.10][solved] Problem with lightning and TileEntitySpecialRenderer


Recommended Posts

Posted

Hi, I'm working on a (ComputerCraft controlled) hologram projector.

 

The hologram projector projects above it smaller versions of blocks which are set by a lua program, that runs on a computer.

The projector tile entity implements IWorldAccess, so before rendering the RenderBlocks BlockAccess will be swapped out with mine and then I render the block by using RenderStandardBlock.

 

My problem is that if the sky isn't occluded by other blocks, the model is displayed too dark, but the grass colors(and colors generally work). If the sky is rendered then the model renders with full brightness, but the colors aren't rendered.

 

I already tried to disable brightness with reflection and with a custom tessellator draw method, nothing of this worked.

 

Here is my rendering code:

TileEntity projector = tile.getWorldObj().getTileEntity(tile.xCoord, tile.yCoord - 1, tile.zCoord);
	if (projector instanceof TileHologramProjector) {
		Tessellator t = Tessellator.instance;

		t.startDrawingQuads();

		IBlockAccess backupAccess = RenderBlocks.getInstance().blockAccess;
		RenderBlocks.getInstance().blockAccess = (IBlockAccess) projector;

		try {
			int previousVertexCount = fVertexCount.getInt(t);

			for (int y1 = 0; y1 < TileHologramProjector.hologramHeight; y1++) {
				for (int z1 = 0; z1 < TileHologramProjector.hologramDepth; z1++) {
					for (int x1 = 0; x1 < TileHologramProjector.hologramWidth; x1++) {

						RenderBlocks.getInstance().renderBlockByRenderType(
								((TileHologramProjector) projector).getBlock(x1, y1, z1), x1, y1, z1);

						if (fVertexCount.getInt(t) == previousVertexCount
								&& !((TileHologramProjector) projector).isAirBlock(x1, y1, z1)) {
							RenderBlocks.getInstance().renderStandardBlock(
									((TileHologramProjector) projector).getBlock(x1, y1, z1), x1, y1, z1);
							// RandomPeripherals.logger.info("Fallback
							// renderer!");
						}
						previousVertexCount = fVertexCount.getInt(t);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		RenderBlocks.getInstance().blockAccess = backupAccess;

		GL11.glPushMatrix();

		GL11.glTranslated(x, y, z);
		GL11.glScalef(0.125f, 0.125f, 0.125f);

		bindTexture(RandomPeripherals.proxy.blockResLoc);

		t.draw();

		GL11.glPopMatrix();
	}

Posted

Ok, I solved the problem by adding a call of the function RenderHelper.disableStandardItemLighting after binding the texture.

 

I don't know why Minecraft keeps the fixed Render pipeline light enabled when rendering tile entities with special renderer, but this seems to work.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.