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.16.5] Disable lighting effects for block rendered in TileEntityRenderer

Featured Replies

Posted

For my mod, there is a clump of blocks that can only be seen when the player is wearing a certain item. I have succeeded in implementing that part:

152889615-c3f48dc2-92eb-425d-a434-e2c548

However, I would also like these block clumps to be "lit up" under any lighting conditions.

152889747-01bca8bf-575a-43c7-bbe8-a7abbf

I have tried setting properties on the block itself, but they don't seem to make any difference to the blocks rendered by the TileEntityRenderer:

public static final Properties PROPS = Properties.
  copy(Blocks.AIR).
  noOcclusion().
  lightLevel((BlockState bs) -> 10).
  emissiveRendering(
    (BlockState bs, IBlockReader r, BlockPos p) -> true
  );

Here's my TileEntityRenderer code (source):

    @Override
    public void render(
      TraparWaveBlock.TileEntity te, float partialTicks, MatrixStack matrixStackIn,
      IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn
    ) {

        ClientPlayerEntity player = mc.player;
        ItemStack helmet = player.getItemBySlot(EquipmentSlotType.HEAD);
        if (helmet.isEmpty()) {
            return;
        }

        for (BlockPos p : te.getShape().getAsRelativeBlockPositions()) {
            renderBlock(p, matrixStackIn, bufferIn,  1.0f);
        }
    }

    private void renderBlock(Vector3i translation, MatrixStack matrixStack,
                             IRenderTypeBuffer buffer, float scale) {
        matrixStack.pushPose();
        matrixStack.translate(
          translation.getX(), translation.getY(), translation.getZ()
        );
        matrixStack.scale(scale, scale, scale);

        BlockState bs = BlocksInit.TRAPAR_WAVE_CHILD_BLOCK.get().
          defaultBlockState();
      
        mc.getBlockRenderer().renderBlock(
          bs, matrixStack, buffer, Integer.MAX_VALUE, 
          OverlayTexture.NO_OVERLAY, EmptyModelData.INSTANCE
        );
      
        matrixStack.popPose();
    }

I have also tried calling `RenderHelper.turnOff()` and `RenderHelper.turnBackOn()` wrapped around the "renderBlock" code.  No joy.

Can anyone help me out? I'd like these blocks to be "full bright" at all times. Thanks.

 

Edited by bradsk88
More details

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.