
CookieLukas
Members-
Content Count
5 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout CookieLukas
- Currently Viewing Topic: [1.15.2] Custom Dimension/Chunk Generator/World gen
-
Rank
Tree Puncher
-
[1.15.2] Custom rendering interact with lighting
CookieLukas replied to CookieLukas's topic in Modder Support
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); -
CookieLukas started following [1.15.2] Custom rendering interact with lighting
-
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
-
Hi, what is the difference between them, and when should you use which? Also, whats the correct way of using them in 1.15.2? In 1.14.4 I used this code to render something static in the world: Vec3d projectedView = mc.gameRenderer.getActiveRenderInfo().getProjectedView(); GL11.glTranslated(-projectedView.x, -projectedView.y, -projectedView.z); But this wont work in 1.15.2. If this question is dumb, forgive me, Im a beginner in termstherms of rendering. Thanks in advance, -Lukas
-
Oh, sorry, the code was 1.10.2, but as its not allowed here, I updated it to 1.14.4.
-
Im trying to render a simple plane with the following code: Minecraft mc = Minecraft.getInstance(); @SubscribeEvent public void renderWorldLastEvent(RenderWorldLastEvent evt){ System.out.println("renderWorldLast"); GL11.glPushMatrix(); Vec3d projectedView = mc.gameRenderer.getActiveRenderInfo().getProjectedView(); GL11.glTranslated(-projectedView.x, -projectedView.y, -projectedView.z); float x = 0; float y = 57; float z = 0; ResourceLocation texture = new ResourceLocation(ExampleMod.MODID, "debug.png"); mc.textureManager.bindTexture(texture); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GL11.glEnable(GL11.GL_TEXTURE_2D); bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(x, y + 1.1, z + 1.0D).tex(0, 1).endVertex(); bufferbuilder.pos(x + 1.0D, y + 1.1, z + 1.0D).tex(1, 1).endVertex(); bufferbuilder.pos(x + 1.0D, y + 1.1, z).tex(1, 0).endVertex(); bufferbuilder.pos(x, y + 1.1, z).tex(0, 0).endVertex(); GL11.glEnd(); tessellator.draw(); GlStateManager.popMatrix(); } It renders the plane perfectly, but it just completly ignores lighting. I tried stuff like GlStateManager.enableLighting(); but I cant get it work. Also, some textures like staind glass or water wont render in from of it. How can I fix those issues? Thanks in advance -Lukas