Skip to content

Commit 507c375

Browse files
committed
stuff
1 parent d7a6e73 commit 507c375

File tree

5 files changed

+49
-9
lines changed

5 files changed

+49
-9
lines changed

build.gradle.kts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ subprojects {
5454

5555
dependencies {
5656
"minecraft"("com.mojang:minecraft:$minecraftVersion")
57-
"mappings"(loom.layered {
58-
mappings("net.fabricmc:yarn:$minecraftVersion+$yarnMappings:v2")
59-
mappings("dev.architectury:yarn-mappings-patch-neoforge:1.21+build.4")
60-
})
57+
"mappings"("net.fabricmc:yarn:$minecraftVersion+$yarnMappings:v2")
6158
}
6259

6360
publishing {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2025 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.mixin.render;
19+
20+
import com.lambda.graphics.buffer.Buffer;
21+
import com.mojang.blaze3d.buffers.GpuBuffer;
22+
import com.mojang.blaze3d.vertex.VertexFormat;
23+
import net.minecraft.client.gl.GlGpuBuffer;
24+
import org.spongepowered.asm.mixin.Mixin;
25+
import org.spongepowered.asm.mixin.injection.At;
26+
import org.spongepowered.asm.mixin.injection.Inject;
27+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
28+
29+
import java.nio.ByteBuffer;
30+
31+
@Mixin(VertexFormat.class)
32+
public class VertexFormatMixin {
33+
@Inject(method = "uploadImmediateVertexBuffer(Ljava/nio/ByteBuffer;)Lcom/mojang/blaze3d/buffers/GpuBuffer;", at = @At("RETURN"))
34+
void interceptIndexBufferConfiguration(ByteBuffer vertexBuffer, CallbackInfoReturnable<GpuBuffer> cir) {
35+
GlGpuBuffer value = (GlGpuBuffer)cir.getReturnValue();
36+
Buffer.lastIbo = value.id;
37+
}
38+
}

common/src/main/kotlin/com/lambda/graphics/buffer/frame/FrameBuffer.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717

1818
package com.lambda.graphics.buffer.frame
1919

20+
import com.lambda.Lambda.mc
2021
import com.lambda.graphics.buffer.vertex.attributes.VertexAttrib
2122
import com.lambda.graphics.buffer.vertex.attributes.VertexMode
2223
import com.lambda.graphics.pipeline.VertexPipeline
2324
import com.lambda.graphics.texture.TextureUtils
25+
import net.minecraft.client.texture.GlTexture
2426
import org.lwjgl.opengl.GL12C.GL_CLAMP_TO_EDGE
2527
import org.lwjgl.opengl.GL30C.GL_COLOR_ATTACHMENT0
2628
import org.lwjgl.opengl.GL30C.GL_COLOR_BUFFER_BIT
@@ -67,19 +69,18 @@ open class FrameBuffer(
6769
private var lastWidth = -1
6870
private var lastHeight = -1
6971

70-
@Deprecated(message = "Fix this code")
7172
open fun write(block: () -> Unit): FrameBuffer {
72-
//val prev = lastFrameBuffer ?: mc.framebuffer.fbo
73+
val prev = lastFrameBuffer ?: (mc.framebuffer.colorAttachment as GlTexture).glId
7374

7475
glBindFramebuffer(GL_FRAMEBUFFER, fbo)
75-
//lastFrameBuffer = fbo
76+
lastFrameBuffer = fbo
7677

7778
update()
7879

7980
block()
8081

81-
//lastFrameBuffer = prev
82-
glBindFramebuffer(GL_FRAMEBUFFER, 0)
82+
lastFrameBuffer = prev
83+
glBindFramebuffer(GL_FRAMEBUFFER, prev)
8384
return this
8485
}
8586

common/src/main/resources/lambda.accesswidener

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ accessible method net/minecraft/client/render/Camera setRotation (FF)V
4242
# Renderer
4343
accessible field net/minecraft/client/texture/NativeImage pointer J
4444
accessible class net/minecraft/client/gui/screen/SplashOverlay$LogoTexture
45+
accessible field com/mojang/blaze3d/systems/RenderSystem$ShapeIndexBuffer indexBuffer Lcom/mojang/blaze3d/buffers/GpuBuffer;
46+
accessible field net/minecraft/client/gl/GlGpuBuffer id I
47+
4548

4649
# Text
4750
accessible field net/minecraft/text/Style color Lnet/minecraft/text/TextColor;

common/src/main/resources/lambda.mixins.common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"render.SplashOverlayMixin",
5050
"render.SplashOverlayMixin$LogoTextureMixin",
5151
"render.TooltipComponentMixin",
52+
"render.VertexFormatMixin",
5253
"render.WorldRendererMixin",
5354
"world.BlockCollisionSpliteratorMixin",
5455
"world.ClientChunkManagerMixin",

0 commit comments

Comments
 (0)