Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.7.10][solved] Problem with lightning and TileEntitySpecialRenderer

Featured Replies

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();
	}

  • Author

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.