Skip to content

Commit

Permalink
Update ObsidianUI to my 1.21.3 port
Browse files Browse the repository at this point in the history
  • Loading branch information
Motschen committed Nov 18, 2024
1 parent a23e8b8 commit 3eec0dd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ repositories {
maven {
url = "https://api.modrinth.com/maven"
}
flatDir {
dirs("localMaven")
}
}

subprojects {
Expand All @@ -22,6 +25,9 @@ subprojects {
url = "https://api.modrinth.com/maven"
}
maven { url 'https://jitpack.io' }
flatDir {
dirs("../localMaven")
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
import eu.midnightdust.midnightcontrols.client.util.platform.NetworkUtil;
import org.thinkingstudio.obsidianui.background.Background;
import org.thinkingstudio.obsidianui.mixin.DrawContextAccessor;
import org.thinkingstudio.obsidianui.widget.SpruceWidget;
import eu.midnightdust.lib.util.MidnightColorUtil;
import eu.midnightdust.midnightcontrols.MidnightControls;
Expand Down Expand Up @@ -501,27 +502,24 @@ public MidnightControlsBackground(int transparency) {
}
@Override
public void render(DrawContext context, SpruceWidget widget, int vOffset, int mouseX, int mouseY, float delta) {
fill(context.getMatrices(), widget.getX(), widget.getY(), widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(), MidnightColorUtil.hex2Rgb("#000000"));
fill(context, widget.getX(), widget.getY(), widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(), Color.black);
}
private static void fill(MatrixStack matrixStack, int x2, int y2, int x1, int y1, Color color) {
matrixStack.push();
private static void fill(DrawContext context, int x2, int y2, int x1, int y1, Color color) {
RenderLayer renderLayer = RenderLayer.getGui();
VertexConsumer vertexConsumer = ((DrawContextAccessor)context).getVertexConsumers().getBuffer(renderLayer);

Matrix4f matrix = matrixStack.peek().getPositionMatrix();
float r = (float)(color.getRed()) / 255.0F;
float g = (float)(color.getGreen()) / 255.0F;
float b = (float)(color.getBlue()) / 255.0F;
float t = (float)(transparency) / 255.0F;
BufferBuilder bufferBuilder = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
//RenderSystem.setShader(GameRenderer::getPositionColorProgram);
bufferBuilder.vertex(matrix, (float)x1, (float)y2, 0.0F).color(r, g, b, t);
bufferBuilder.vertex(matrix, (float)x2, (float)y2, 0.0F).color(r, g, b, t);
bufferBuilder.vertex(matrix, (float)x2, (float)y1, 0.0F).color(r, g, b, t);
bufferBuilder.vertex(matrix, (float)x1, (float)y1, 0.0F).color(r, g, b, t);
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
vertexConsumer.vertex((float)x1, (float)y2, 0.0F).color(r, g, b, t);
vertexConsumer.vertex((float)x2, (float)y2, 0.0F).color(r, g, b, t);
vertexConsumer.vertex((float)x2, (float)y1, 0.0F).color(r, g, b, t);
vertexConsumer.vertex((float)x1, (float)y1, 0.0F).color(r, g, b, t);
RenderSystem.disableBlend();
matrixStack.pop();
context.draw();
}
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ yarn_mappings=1.21.3+build.2
enabled_platforms=fabric,neoforge

archives_base_name=midnightcontrols
mod_version=1.10.0
mod_version=1.10.0+1.21.3-alpha.1
maven_group=eu.midnightdust
release_type=beta
modrinth_id = bXX9h73M
Expand All @@ -27,7 +27,7 @@ quilt_loader_version=0.19.0-beta.18
quilt_fabric_api_version=7.0.1+0.83.0-1.20

sodium_version=mc1.21-0.6.0-beta.1
obsidianui_version=0.2.7+mc1.21
obsidianui_version=0.2.9+mc1.21.3
modmenu_version=10.0.0-beta.1
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
bendylib_version=2.0.+
Expand Down
Binary file added localMaven/obsidianui-0.2.9+mc1.21.3-fabric.jar
Binary file not shown.
Binary file not shown.

0 comments on commit 3eec0dd

Please sign in to comment.