mirror of
https://github.com/TeamMidnightDust/MidnightLib.git
synced 2025-12-16 17:25:09 +01:00
Fix crash on MacOS since v1.6.0
- Closes #67 - Temporarily disabled function popups on MacOS until a solution without non-headless java mode is found - Also exposed a couple of fields for an upcoming Puzzle update
This commit is contained in:
@@ -22,9 +22,10 @@ public class MidnightLib {
|
|||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public static void onInitializeClient() {
|
public static void onInitializeClient() {
|
||||||
try { System.setProperty("java.awt.headless", "false");
|
try { if (!IS_SYSTEM_MAC) {
|
||||||
if (!IS_SYSTEM_MAC) UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
System.setProperty("java.awt.headless", "false");
|
||||||
} catch (Exception e) { LOGGER.error("Error setting system look and feel", e); }
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
|
}} catch (Exception e) { LOGGER.error("Error setting system look and feel", e); }
|
||||||
MidnightLibConfig.init(MOD_ID, MidnightLibConfig.class);
|
MidnightLibConfig.init(MOD_ID, MidnightLibConfig.class);
|
||||||
}
|
}
|
||||||
public static void registerAutoCommand() {
|
public static void registerAutoCommand() {
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import java.util.*;
|
|||||||
import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Predicate;
|
import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Predicate;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static net.minecraft.client.MinecraftClient.IS_SYSTEM_MAC;
|
||||||
|
|
||||||
/** MidnightConfig v2.6.0 by Martin "Motschen" Prokoph
|
/** MidnightConfig v2.6.0 by Martin "Motschen" Prokoph
|
||||||
* Single class config library - feel free to copy!
|
* Single class config library - feel free to copy!
|
||||||
* Based on <a href="https://github.com/Minenash/TinyConfig">...</a>
|
* Based on <a href="https://github.com/Minenash/TinyConfig">...</a>
|
||||||
@@ -372,6 +374,7 @@ public abstract class MidnightConfig {
|
|||||||
}
|
}
|
||||||
List<ClickableWidget> widgets = Lists.newArrayList(widget, resetButton);
|
List<ClickableWidget> widgets = Lists.newArrayList(widget, resetButton);
|
||||||
if (info.actionButton != null) {
|
if (info.actionButton != null) {
|
||||||
|
if (IS_SYSTEM_MAC) info.actionButton.active = false;
|
||||||
widget.setWidth(widget.getWidth() - 22); widget.setX(widget.getX() + 22);
|
widget.setWidth(widget.getWidth() - 22); widget.setX(widget.getX() + 22);
|
||||||
widgets.add(info.actionButton);
|
widgets.add(info.actionButton);
|
||||||
} if (cycleButton != null) {
|
} if (cycleButton != null) {
|
||||||
@@ -401,7 +404,7 @@ public abstract class MidnightConfig {
|
|||||||
}
|
}
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public static class MidnightConfigListWidget extends ElementListWidget<ButtonEntry> {
|
public static class MidnightConfigListWidget extends ElementListWidget<ButtonEntry> {
|
||||||
boolean renderHeaderSeparator = true;
|
public boolean renderHeaderSeparator = true;
|
||||||
public MidnightConfigListWidget(MinecraftClient client, int width, int height, int y, int itemHeight) { super(client, width, height, y, itemHeight); }
|
public MidnightConfigListWidget(MinecraftClient client, int width, int height, int y, int itemHeight) { super(client, width, height, y, itemHeight); }
|
||||||
@Override public int getScrollbarX() { return this.width -7; }
|
@Override public int getScrollbarX() { return this.width -7; }
|
||||||
|
|
||||||
@@ -418,7 +421,7 @@ public abstract class MidnightConfig {
|
|||||||
}
|
}
|
||||||
public static class ButtonEntry extends ElementListWidget.Entry<ButtonEntry> {
|
public static class ButtonEntry extends ElementListWidget.Entry<ButtonEntry> {
|
||||||
private static final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
private static final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||||
private final Text text;
|
public final Text text;
|
||||||
public final List<ClickableWidget> buttons;
|
public final List<ClickableWidget> buttons;
|
||||||
public final EntryInfo info;
|
public final EntryInfo info;
|
||||||
public boolean centered = false;
|
public boolean centered = false;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ yarn_mappings=1.21+build.1
|
|||||||
enabled_platforms=fabric,neoforge
|
enabled_platforms=fabric,neoforge
|
||||||
|
|
||||||
archives_base_name=midnightlib
|
archives_base_name=midnightlib
|
||||||
mod_version=1.6.2
|
mod_version=1.6.3
|
||||||
maven_group=eu.midnightdust
|
maven_group=eu.midnightdust
|
||||||
release_type=release
|
release_type=release
|
||||||
curseforge_id=488090
|
curseforge_id=488090
|
||||||
|
|||||||
Reference in New Issue
Block a user