Skip to content

Commit

Permalink
update to 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Boxadactle committed Apr 21, 2024
1 parent 37f4669 commit 9b756fb
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ public class MacroControls {

static int padding = 5;

public static RenderingLayout render(boolean disablePlayButton, boolean disablePauseButton) {
public static RenderingLayout createButtons(GuiGraphics graphics, boolean disablePlayButton, boolean disablePauseButton) {
RowLayout layout = new RowLayout(0, 0, padding);

layout.addComponent(new LayoutContainerComponent(renderPlayButton(disablePlayButton)));
layout.addComponent(new LayoutContainerComponent(renderPauseButton(disablePauseButton)));
layout.addComponent(new LayoutContainerComponent(renderStopButton()));

int w = ClientUtils.getClient().getWindow().getGuiScaledWidth();
int h = ClientUtils.getClient().getWindow().getGuiScaledHeight();
int w = graphics.guiWidth();
int h = graphics.guiHeight();

return new CenteredLayout(0, h - 100, w, layout.calculateRect().getHeight() + 20, layout);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import dev.boxadactle.boxlib.layouts.component.CenteredParagraphComponent;
import dev.boxadactle.boxlib.layouts.layout.CenteredLayout;
import dev.boxadactle.boxlib.layouts.layout.RowLayout;
import dev.boxadactle.boxlib.math.geometry.Rect;
import dev.boxadactle.boxlib.util.ClientUtils;
import dev.boxadactle.boxlib.util.GuiUtils;
import dev.boxadactle.boxlib.util.RenderUtils;
Expand All @@ -21,7 +22,9 @@

public class MacroPlayHud {

public static final ResourceLocation PROGRESS_BAR = new ResourceLocation(MacroCraft.MOD_ID, "textures/gui/progress_bar.png");
public static final ResourceLocation PROGRESS_BAR = new ResourceLocation(MacroCraft.MOD_ID, "progress/progress_bar");

public static final ResourceLocation PROGRESS_BACKGROUND = new ResourceLocation(MacroCraft.MOD_ID, "progress/progress_empty");

public static void render(GuiGraphics graphics) {
// information at the top of the screen
Expand Down Expand Up @@ -56,7 +59,8 @@ public static void render(GuiGraphics graphics) {
centeredInformation.render(graphics);

// controls at the bottom of the screen
RenderingLayout controls = MacroControls.render(
RenderingLayout controls = MacroControls.createButtons(
graphics,
MacroState.LOADED_MACRO.isPlaying,
MacroState.LOADED_MACRO.isPaused
);
Expand All @@ -69,12 +73,10 @@ public static void render(GuiGraphics graphics) {
int buttonWidth = graphics.guiWidth() - 130;
int buttonHeight = 12;

int textureY = 46;

graphics.setColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderSystem.enableBlend();
RenderSystem.enableDepthTest();
graphics.blitNineSliced(PROGRESS_BAR, buttonX, buttonY, buttonWidth, buttonHeight, 20, 4, 200, 20, 0, textureY);
graphics.blitSprite(PROGRESS_BACKGROUND, buttonX, buttonY, buttonWidth, buttonHeight);

int barX = buttonX + 1;
int barY = buttonY + 1;
Expand All @@ -96,14 +98,7 @@ public static void render(GuiGraphics graphics) {
graphics.setColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderSystem.enableBlend();
RenderSystem.enableDepthTest();
graphics.blitNineSliced(
PROGRESS_BAR,
barX, barY,
barWidth, barHeight,
20, 4,
198, 18,
1, textureY + 21
);
graphics.blitSprite(PROGRESS_BAR, barX, barY, barWidth, barHeight);
} catch (ArithmeticException ignored) {
// ignore divide by zero
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public static void render(GuiGraphics graphics) {

centeredInformation.render(graphics);

RenderingLayout controls = MacroControls.render(
RenderingLayout controls = MacroControls.createButtons(
graphics,
MacroState.IS_RECORDING,
MacroState.IS_PAUSED
);
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"gui": {
"scaling": {
"type": "nine_slice",
"width": 198,
"height": 18,
"border": 2
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"gui": {
"scaling": {
"type": "nine_slice",
"width": 200,
"height": 20,
"border": 3
}
}
}
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
org.gradle.jvmargs=-Xmx2048M

minecraft_version=1.20.1
minecraft_version=1.20.2
enabled_platforms=fabric,forge

archives_base_name=MacroCraft
mod_version=1.0.0
mod_version=2.0.0
maven_group=dev.boxadactle

architectury_version=${ARCHITECTURY_API_VERSION}

fabric_loader_version=0.14.22
fabric_api_version=0.88.1+1.20.1
fabric_api_version=0.89.2+1.20.2

forge_version=1.20.1-47.1.47
forge_version=1.20.2-48.0.4

boxlib_version=9.2.4
modmenu_version=7.2.1
boxlib_version=10.2.2
modmenu_version=8.0.0

0 comments on commit 9b756fb

Please sign in to comment.