[BUG] Fix Config GUI not rendering controls

This commit is contained in:
2023-11-26 00:37:10 +02:00
parent 374acec24b
commit f2f4428756
3 changed files with 5 additions and 6 deletions

View File

@@ -179,7 +179,6 @@ public class CraterConfigScreen extends Screen {
@Override @Override
public void render(@NotNull GuiGraphics matrices, int mouseX, int mouseY, float delta) { public void render(@NotNull GuiGraphics matrices, int mouseX, int mouseY, float delta) {
overlayBackground(matrices.pose(), TOP, height - BOTTOM, 32); overlayBackground(matrices.pose(), TOP, height - BOTTOM, 32);
renderScrollBar(); renderScrollBar();
matrices.pose().pushPose(); matrices.pose().pushPose();
@@ -188,9 +187,10 @@ public class CraterConfigScreen extends Screen {
overlayBackground(matrices.pose(), height - BOTTOM, height, 64); overlayBackground(matrices.pose(), height - BOTTOM, height, 64);
renderShadow(matrices.pose()); renderShadow(matrices.pose());
matrices.drawCenteredString(font, getTitle(), width / 2, 9, 0xFFFFFF); matrices.drawCenteredString(font, getTitle(), width / 2, 9, 0xFFFFFF);
super.render(matrices, mouseX, mouseY, delta);
matrices.pose().popPose(); matrices.pose().popPose();
super.render(matrices, mouseX, mouseY, delta);
int y = (int) (TOP + 4 - Math.round(scrollerAmount)); int y = (int) (TOP + 4 - Math.round(scrollerAmount));
for (Option<?> option : options) { for (Option<?> option : options) {
int height1 = option.height(); int height1 = option.height();
@@ -266,12 +266,11 @@ public class CraterConfigScreen extends Screen {
} }
protected void overlayBackground(Matrix4f matrix, int minX, int minY, int maxX, int maxY, int red, int green, int blue, int startAlpha, int endAlpha) { protected void overlayBackground(Matrix4f matrix, int minX, int minY, int maxX, int maxY, int red, int green, int blue, int startAlpha, int endAlpha) {
Tesselator tesselator = Tesselator.getInstance(); Tesselator tesselator = Tesselator.getInstance();
BufferBuilder buffer = tesselator.getBuilder(); BufferBuilder buffer = tesselator.getBuilder();
RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
RenderSystem.setShaderTexture(0, Screen.BACKGROUND_LOCATION); RenderSystem.setShaderTexture(0, Screen.BACKGROUND_LOCATION);
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR);
buffer.vertex(matrix, minX, maxY, 0.0F).uv(minX / 32.0F, maxY / 32.0F).color(red, green, blue, endAlpha).endVertex(); buffer.vertex(matrix, minX, maxY, 0.0F).uv(minX / 32.0F, maxY / 32.0F).color(red, green, blue, endAlpha).endVertex();
buffer.vertex(matrix, maxX, maxY, 0.0F).uv(maxX / 32.0F, maxY / 32.0F).color(red, green, blue, endAlpha).endVertex(); buffer.vertex(matrix, maxX, maxY, 0.0F).uv(maxX / 32.0F, maxY / 32.0F).color(red, green, blue, endAlpha).endVertex();

View File

@@ -50,7 +50,7 @@ public class BaseWidget<T> extends Option<T> {
} else { } else {
text.withStyle(ChatFormatting.GRAY); text.withStyle(ChatFormatting.GRAY);
} }
matrices.drawString(font, text, x, y, 0xFFFFFF); matrices.drawString(font, text, x, y + font.lineHeight - 2, 0xFFFFFF);
resetButton.setX(x + width - 46); resetButton.setX(x + width - 46);
resetButton.setY(y + 1); resetButton.setY(y + 1);
resetButton.active = isNotDefault(); resetButton.active = isNotDefault();

View File

@@ -21,7 +21,7 @@ public class WrappedEditBox extends EditBox {
for (GuiEventListener child : Minecraft.getInstance().screen.children()) { for (GuiEventListener child : Minecraft.getInstance().screen.children()) {
if (child instanceof TextConfigOption<?> option) { if (child instanceof TextConfigOption<?> option) {
WrappedEditBox box = option.widget; WrappedEditBox box = option.widget;
box.setFocused(box == this); super.setFocused(box == this);
} }
} }
super.setFocused(bl); super.setFocused(bl);