Skip to content

Commit cacd351

Browse files
committed
Port to 1.19.4, Add tab support & Large code cleanup
1 parent b5052ff commit cacd351

File tree

8 files changed

+111
-66
lines changed

8 files changed

+111
-66
lines changed

MidnightConfigExample.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package eu.midnightdust.core.config;
22

3+
import com.google.common.collect.Lists;
34
import eu.midnightdust.lib.config.MidnightConfig;
45

56
import java.util.List;
@@ -14,19 +15,19 @@ public class MidnightConfigExample extends MidnightConfig {
1415

1516
@Comment public static Comment text1; // Comments are rendered like an option without a button and are excluded from the config file
1617
@Comment(centered = true) public static Comment text2; // Centered comments are the same as normal ones - just centered!
17-
@Entry public static int fabric = 16777215; // Example for an int option
18-
@Entry public static double world = 1.4D; // Example for a double option
1918
@Entry public static boolean showInfo = true; // Example for a boolean option
20-
@Entry public static String name = "Hello World!"; // Example for a string option
21-
@Entry public static TestEnum testEnum = TestEnum.FABRIC; // Example for an enum option
19+
@Entry(category = "text") public static String name = "Hello World!"; // Example for a string option, which is in a category!
20+
@Entry(category = "text") public static TestEnum testEnum = TestEnum.FABRIC; // Example for an enum option
2221
public enum TestEnum { // Enums allow the user to cycle through predefined options
2322
QUILT, FABRIC, FORGE
2423
}
25-
@Entry(min=69,max=420) public static int hello = 420; // - The entered number has to be larger than 69 and smaller than 420
26-
@Entry(width = 7, min = 7, isColor = true, name = "I am a color!") public static String titleColor = "#ffffff"; // The isColor property adds a preview box for a hexadecimal color
27-
@Entry(name = "I am an array list!") public static List<String> arrayList = List.of("String1", "String2"); // Array String Lists are also supported
28-
@Entry(name = "I am an int slider.",isSlider = true, min = 0, max = 100) public static int intSlider = 35; // Int fields can also be displayed as a Slider
29-
@Entry(name = "I am a float slider!", isSlider = true, min = 0f, max = 1f, precision = 1000) public static float floatSlider = 0.24f; // And so can floats! Precision defines the amount of decimal places
24+
@Entry(category = "numbers") public static int fabric = 16777215; // Example for an int option
25+
@Entry(category = "numbers") public static double world = 1.4D; // Example for a double option
26+
@Entry(category = "numbers", min=69,max=420) public static int hello = 420; // - The entered number has to be larger than 69 and smaller than 420
27+
@Entry(category = "text", width = 7, min = 7, isColor = true, name = "I am a color!") public static String titleColor = "#ffffff"; // The isColor property adds a preview box for a hexadecimal color
28+
@Entry(category = "sliders", name = "I am an array list!") public static List<String> arrayList = Lists.newArrayList("String1", "String2"); // Array String Lists are also supported
29+
@Entry(category = "sliders", name = "I am an int slider.",isSlider = true, min = 0, max = 100) public static int intSlider = 35; // Int fields can also be displayed as a Slider
30+
@Entry(category = "sliders", name = "I am a float slider!", isSlider = true, min = 0f, max = 1f, precision = 1000) public static float floatSlider = 0.24f; // And so can floats! Precision defines the amount of decimal places
3031
// The name field can be used to specify a custom translation string or plain text
3132

3233
public static int imposter = 16777215; // - Entries without an @Entry or @Comment annotation are ignored
@@ -49,11 +50,13 @@ public enum TestEnum { // Enums allow the user to
4950
"modid.midnightconfig.testEnum":"I am an enum!",
5051
"modid.midnightconfig.enum.TestEnum.FORGE":"Slow",
5152
"modid.midnightconfig.enum.TestEnum.FABRIC":"Fancy",
52-
"modid.midnightconfig.enum.TestEnum.QUILT":"Fabulous"
53+
"modid.midnightconfig.enum.TestEnum.QUILT":"Fabulous",
54+
"modid.midnightconfig.category.numbers": "Numbers",
55+
"modid.midnightconfig.category.text": "Text",
56+
"modid.midnightconfig.category.sliders": "Sliders"
5357
}
5458
To initialize the config you have to call "MidnightConfig.init("modid", MidnightConfigExample.class)" in your ModInitializer
5559
To get an instance of the config screen you have to call "MidnightConfig.getScreen(parent, "modid");"
56-
5760
If you don't use the whole library and therefore not the automatic ModMenu integration, the code in your ModMenu integration class would look something like this:
5861
@Override
5962
public ConfigScreenFactory<?> getModConfigScreenFactory() {

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ subprojects {
1515
// The following line declares the mojmap mappings, you may use other mappings as well
1616
//mappings loom.officialMojangMappings()
1717
// The following line declares the yarn mappings you may select this one as well.
18-
mappings "net.fabricmc:yarn:1.19.3+build.3:v2"
18+
mappings "net.fabricmc:yarn:${rootProject.yarn_mappings}:v2"
1919
}
2020
}
2121

common/src/main/java/eu/midnightdust/core/MidnightLibClient.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public class MidnightLibClient {
1414

1515
public static void onInitializeClient() {
1616
MidnightConfig.init("midnightlib", MidnightLibConfig.class);
17-
hiddenMods.add("puzzle");
1817

1918
if (MidnightLibConfig.special_hats) HatLoader.init();
2019
}

common/src/main/java/eu/midnightdust/core/screen/MidnightConfigOverviewScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected void init() {
4646
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
4747
this.renderBackground(matrices);
4848
this.list.render(matrices, mouseX, mouseY, delta);
49-
drawCenteredText(matrices, textRenderer, title, width / 2, 15, 0xFFFFFF);
49+
drawCenteredTextWithShadow(matrices, textRenderer, title, width / 2, 15, 0xFFFFFF);
5050
super.render(matrices, mouseX, mouseY, delta);
5151
}
5252
@Environment(EnvType.CLIENT)

0 commit comments

Comments
 (0)