diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/render/TransparencyBuffer.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/render/TransparencyBuffer.java index a1d65fd..cdd7c9e 100644 --- a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/render/TransparencyBuffer.java +++ b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/render/TransparencyBuffer.java @@ -5,8 +5,10 @@ import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.Window; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.*; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.GameRenderer; import org.lwjgl.opengl.GL30; /** @@ -44,18 +46,19 @@ public static void drawExtraFramebuffer(GuiGraphics graphics) { // Render the custom framebuffer's contents with transparency into the main buffer RenderSystem.setShaderTexture(0, framebuffer.getColorTextureId()); - /*Window window = Minecraft.getInstance().getWindow(); - graphics.blit( - framebuffer.getColorTextureId(), - 0, // x - 0, // y - window.getGuiScaledWidth(), // width - window.getGuiScaledHeight(), // height - 0, // left-most coordinate of the texture region - framebuffer.height, // top-most coordinate of the texture region - framebuffer.width, // width of the texture region - -framebuffer.height // height of the texture region - );*/ + Window window = Minecraft.getInstance().getWindow(); + int width = window.getGuiScaledWidth(); + int height = window.getGuiScaledHeight(); + RenderSystem.setShaderTexture(0, framebuffer.getColorTextureId()); + RenderSystem.setShader(GameRenderer::getPositionTexShader); + final var matrix4f = graphics.pose().last().pose(); + BufferBuilder bufferBuilder = Tesselator.getInstance().getBuilder(); + bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + bufferBuilder.vertex(matrix4f, 0, 0, 0).uv(0, 1).endVertex(); + bufferBuilder.vertex(matrix4f, 0, height, 0).uv(0, 0).endVertex(); + bufferBuilder.vertex(matrix4f, width, height, 0).uv(1, 0).endVertex(); + bufferBuilder.vertex(matrix4f, width, 0, 0).uv(1, 1).endVertex(); + BufferUploader.drawWithShader(bufferBuilder.end()); } public static void postInject() { diff --git a/gradle.properties b/gradle.properties index 2e05e80..7b1678b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ loader_version=0.14.22 #Fabric api fabric_version=0.89.3+1.20.2 # Mod Properties -mod_version=2.2.2 +mod_version=2.2.3 maven_group=org.samo_lego archives_base_name=clientstorage # Dependencies