Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Dec 3, 2024
1 parent 14ae1f7 commit daafa19
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import java.util.List;
import java.util.function.Function;

import static io.github.gaming32.worldhost.gui.screen.WorldHostScreen.*;

//#if MC >= 1.20.0
import net.minecraft.client.gui.GuiGraphics;
//#else
Expand Down Expand Up @@ -93,11 +95,11 @@ public void renderWidget(
//#endif
int mouseX, int mouseY, float partialTick
) {
context.pose().pushPose();
pose(context).pushPose();

//#if MC >= 1.21.4
context.enableScissor(getX(), getY(), getX() + width, getY() + height);
context.pose().translate(0, -scrollAmount(), 0);
pose(context).translate(0, -scrollAmount(), 0);
//#endif

final int textYOffset = 10 - font.lineHeight / 2;
Expand Down Expand Up @@ -129,18 +131,15 @@ public void renderWidget(
}
y += 24;
}
context.pose().popPose();
pose(context).popPose();

for (final var button : actionButtons) {
var buttonX = button.baseX;
var buttonY = button.baseY;
//#if MC >= 1.21.4
if (scrollbarVisible()) {
buttonX -= 10;
}
buttonY -= (int)scrollAmount();
button.button.setPosition(
button.baseX - (scrollbarVisible() ? 10 : 0),
button.baseY - (int)scrollAmount()
);
//#endif
button.button.setPosition(buttonX, buttonY);
button.button.render(context, mouseX, mouseY, partialTick);
}

Expand Down Expand Up @@ -195,8 +194,9 @@ private void addButtons(int fromI) {
int x = getRight() - 24 * user.actions.size() + 4;
for (final Action action : user.actions) {
actionButtons.add(new ActionButtonWrapper(
WorldHostScreen.button(action.text, b -> action.apply.run())
button(action.text, b -> action.apply.run())
.tooltip(action.tooltip)
.pos(x, y)
.size(20, 20)
.build(),
x, y
Expand Down

0 comments on commit daafa19

Please sign in to comment.