Skip to content

Commit 96ab175

Browse files
committed
fix compile errors on older targets
1 parent 628a9ae commit 96ab175

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ dependencies {
101101
// Already included by YetAnotherConfigLib, but we need it too, so let's define explicit dep
102102
api("org.quiltmc.parsers:json:${property("deps.quiltparsers")}")
103103

104+
if (stonecutter.current.parsed < "1.21.11") {
105+
compileOnly("org.jspecify:jspecify:1.0.0")
106+
}
107+
104108
// sodium compat
105109
modDependency("sodium", { "maven.modrinth:sodium:$it" })
106110
// RSO compat

src/main/java/dev/isxander/controlify/gui/components/PlainTextWidget.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ public void setMessage(@NonNull Component message) {
2727

2828
@Override
2929
protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
30+
//? if >=1.21.11 {
3031
guiGraphics.textRenderer().accept(getX(), getY() + 1, getMessage());
32+
//?} else {
33+
/*guiGraphics.drawString(Minecraft.getInstance().font, getMessage(), getX(), getY() + 1, 0xFFFFFFFF);
34+
*///?}
3135
}
3236

3337
@Override

src/main/java/dev/isxander/controlify/gui/screen/BindConsumerScreen.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float tickDe
4242
//? if <1.21.6
4343
/*guiGraphics.pose().translate(0, 0, -20);*/
4444

45+
//? if >=1.21.10 {
4546
backgroundScreen.renderWithTooltipAndSubtitles(guiGraphics, dim.centerX(), dim.centerY(), tickDelta);
47+
//?} else {
48+
/*backgroundScreen.renderWithTooltip(guiGraphics, dim.centerX(), dim.centerY(), tickDelta);
49+
*///?}
4650

4751
pose.pop();
4852

src/main/java/dev/isxander/controlify/gui/screen/ControlifySettingsScreen.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ private class ProfileSlotEntry extends SlotEntry {
242242

243243
private final Button settingsButton;
244244
private final PlainTextWidget controllerNameText;
245-
private final ImageWidget controllerIcon;
245+
private /*? if >=1.21.8>>*/final ImageWidget controllerIcon;
246246
private final GridLayout gridLayout;
247247

248248
private final ImmutableList<? extends GuiEventListener> children;
@@ -307,16 +307,24 @@ private void updateControllerInfo(boolean force) {
307307
this.controller = currentController;
308308
if (this.controller != null) {
309309
this.controllerNameText.setMessage(Component.literal(this.controller.name()));
310-
this.controllerIcon.updateResource(this.controller.info().type().getIconSprite());
310+
this.updateIcon(this.controller.info().type().getIconSprite());
311311
} else {
312312
this.controllerNameText.setMessage(Component.translatable("controlify.gui.carousel.entry.keyboard_mouse"));
313-
this.controllerIcon.updateResource(KEYBOARD_MOUSE_SPRITE);
313+
this.updateIcon(KEYBOARD_MOUSE_SPRITE);
314314
}
315315

316316
this.gridLayout.arrangeElements();
317317
FrameLayout.centerInRectangle(this.gridLayout, x, y, width, height);
318318
}
319319

320+
private void updateIcon(Identifier iconSprite) {
321+
//? if >=1.21.8 {
322+
this.controllerIcon.updateResource(iconSprite);
323+
//?} else {
324+
/*this.controllerIcon = ImageWidget.sprite(64, 64, iconSprite);
325+
*///?}
326+
}
327+
320328
private @Nullable ControllerEntity getController() {
321329
return Controlify.instance().getCurrentController().orElse(null);
322330
}

0 commit comments

Comments
 (0)