Posted January 19, 20214 yr The following code just sets a small rendered plane with the texture of "polished_andesite" at the coordinates 0|60|0 But even in complete darkness, the plane still "glows". How can I get the plane to interact with the local light level? Im using the following options: public static final RenderType OVERLAY_PLATE = makeType("overlay_plate", DefaultVertexFormats.POSITION_TEX, GL11.GL_QUADS, 256, RenderType.State.getBuilder() .layer(PROJECTION_LAYERING) .transparency(TRANSLUCENT_TRANSPARENCY) .texture(new TextureState(new ResourceLocation("minecraft:textures/block/polished_andesite.png"), false, false)) .depthTest(DEPTH_ALWAYS) .cull(CULL_DISABLED) .lightmap(LIGHTMAP_DISABLED) .writeMask(COLOR_WRITE) .build(true)); And the following code to render: @SubscribeEvent public void render(RenderWorldLastEvent event) { IRenderTypeBuffer.Impl bufferSource = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource(); IVertexBuilder builder = bufferSource.getBuffer(ModRenderTypes.OVERLAY_PLATE); Vec3d view = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView(); int x = 0; int y = 60; int z = 0; MatrixStack stack = event.getMatrixStack(); stack.push(); stack.translate(-view.x, -view.y, -view.z); Matrix4f lastStack = stack.getLast().getMatrix(); builder.pos(lastStack, x, y + 1.0f, z + 1.0f).tex(0, 1).endVertex(); builder.pos(lastStack, x + 1.0f, y + 1.0f, z + 1.0f).tex(1, 1).lightmap(0, 240).endVertex(); builder.pos(lastStack, x + 1.0f, y + 1.0f, z).tex(1, 0).lightmap(0, 240).endVertex(); builder.pos(lastStack, x, y + 1.0f, z).tex(0, 0).lightmap(0, 240).endVertex(); stack.pop(); bufferSource.finish(ModRenderTypes.OVERLAY_PLATE); } My idea was to copy some code out of the BlockRendererDispatcher and use it every tick with the measured light level. Is that a possible? Any help is appreciated, -Lukas
January 20, 20214 yr Well, it might help if you enable the lightmap associated with the block. Also, why not render a block using BlockRendererDispatcher? Finally, why do you even need to render a custom version of a block?
January 20, 20214 yr Author 6 hours ago, ChampionAsh5357 said: Well, it might help if you enable the lightmap associated with the block. Also, why not render a block using BlockRendererDispatcher? Finally, why do you even need to render a custom version of a block? OK, thats a good idea, Ive managed to do that, now I have two problems: 1)The Lighting, the "blockRenderer.renderBlock" requires a field called "combinedLighting", Ive found the method "mc.worldRenderer.getCombinedLight()" it requires the a "BlockPos", and a "ILightReader", how can I get the current ILightReader instance? 2) The block is "wobbling" because now I only translate with "stack.translate(0, 60, 1);" what can I do against that? Before, I was translating with: Vec3d view = mc.gameRenderer.getActiveRenderInfo().getProjectedView(); stack.translate(-view.x, -view.y, -view.z);
January 20, 20214 yr 6 hours ago, CookieLukas said: how can I get the current ILightReader instance? You can look at what implements the interface. You can also infer which classes might need to know the light value (for example, the world). 6 hours ago, CookieLukas said: 2) The block is "wobbling" because now I only translate with "stack.translate(0, 60, 1);" what can I do against that? Before, I was translating with: To be able to statically project an object, you need to take the position and subtract it from the projected view.
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.