Jump to content

[1.16.5] Disable lighting effects for block rendered in TileEntityRenderer


bradsk88

Recommended Posts

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
Link to comment
Share on other sites

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.