Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
cbfaeb3
MidnightLib 1.5.0 - 1.20.2, slight redesign & cleanup
Motschen Sep 16, 2023
38e2e55
Re-enable Forge support
Motschen Sep 30, 2023
29c8a9c
MidnightLib 1.5.1 for 1.20.4
Motschen Dec 7, 2023
fb1c4c1
MidnightLib 1.5.2 - NeoForge & more cleanness
Motschen Dec 11, 2023
2ff9252
Fix ModMenu integration
Motschen Dec 19, 2023
2f1bfbf
Experimental 24w09a port
Motschen Mar 5, 2024
0241f81
Fix button positioning
Motschen Apr 4, 2024
afc3c09
Fixed #48
Motschen Apr 4, 2024
ce23e81
Merge pull request #52 from TeamMidnightDust/architectury
Motschen Apr 21, 2024
a43820c
Update to 1.20.5-rc2
Motschen Apr 21, 2024
64ccaf6
Merge branch '24w09a' of https://github.com/TeamMidnightDust/Midnight…
Motschen Apr 21, 2024
d75d34d
MidnightLib 1.5.5
Motschen May 4, 2024
e7a0b72
Merge pull request #54 from TeamMidnightDust/1.20.5
Motschen May 4, 2024
d1df2e4
fix NeoForge for 1.20.5/6
12emin34 May 15, 2024
9c02d39
oops, forgot to remove unneeded pack.mcmeta file
12emin34 May 15, 2024
5cae2a0
Merge pull request #55 from 12emin34/neo-1.20.6
Motschen Jun 8, 2024
aeeed99
Add unified publishing for NeoForge
Motschen Jun 8, 2024
f0c8895
Port to 1.21-pre4
Motschen Jun 8, 2024
03d70cf
Update to rc1
Motschen Jun 12, 2024
86a665c
Fix crash with multiple visible tabs
Motschen Jun 13, 2024
dfb53f3
NeoForge 1.21
Motschen Jun 17, 2024
c16b9be
Create zh_cn.json
Mccandycube6623 Jun 21, 2024
b0a7e51
Merge pull request #59 from Mccandycube6623/patch-1
Motschen Aug 10, 2024
4c91779
Merge pull request #61 from TeamMidnightDust/architectury
Motschen Aug 10, 2024
91e264c
Update Neoforge to fix #60
Motschen Aug 10, 2024
9cce0ff
Bump version
Motschen Aug 10, 2024
fbde598
- add file chooser for String field in 1.6.0
Jaffe2718 Aug 22, 2024
7deccf4
- use `fileChooser.showDialog(null, null)` instead of `fileChooser.sh…
Jaffe2718 Aug 22, 2024
145188a
Merge pull request #63 from Jaffe2718/architectury-1.21
Motschen Aug 23, 2024
3e20b90
Improved layout and lists
Motschen Aug 23, 2024
5fa6359
Show errors again and correctly handle closing
Motschen Aug 23, 2024
8aab796
More compact code & finishing touches
Motschen Aug 25, 2024
64d26e3
Minify json files and images
Motschen Aug 25, 2024
8039bf3
Improved automatic command registration
Motschen Aug 28, 2024
545a845
Improved button injection
Motschen Aug 28, 2024
db32a41
Enable commands in all environments
Motschen Aug 29, 2024
48390ab
Open path from last location
Motschen Aug 29, 2024
b8a54e3
Run command registration after main method
Motschen Sep 2, 2024
765ad60
Fix crash on MacOS since v1.6.0
Motschen Sep 6, 2024
07e6049
Allow Entries to be conditionally shown
Motschen Oct 10, 2024
1820960
MidnightLib 1.6.4 (Port to 1.21.2/3)
Motschen Oct 29, 2024
b4c4454
Update zh_cn.json
NumberSir Nov 14, 2024
a2c0a8a
Update to 1.21.4
Motschen Dec 3, 2024
56bbb8b
Update to final 1.21.4 release
Motschen Dec 4, 2024
a90cb02
Add Malay and Malay (Jawi) translations
NuruddinPlays Dec 5, 2024
7cdd7cd
Entry Title rendered as MultilineTextWidget
maloryware Dec 31, 2024
00e080e
bunp.
maloryware Dec 31, 2024
8036072
added javadocs for Server and Hidden annotations.
maloryware Dec 31, 2024
674f5fc
Merge pull request #76 from NuruddinPlays/architectury-1.21
Motschen Jan 9, 2025
0b10a22
Merge pull request #73 from NumberSir/patch-1
Motschen Jan 9, 2025
d8952a6
Merge pull request #80 from maloryware/architectury-1.21
Motschen Jan 9, 2025
a32593e
feat: improve label tooltip code
Motschen Jan 14, 2025
6f35fb5
docs: improve javadocs
Motschen Jan 14, 2025
37fff5a
clean: compactify tooltip code
Motschen Jan 14, 2025
2c92bf3
Merge pull request #81 from TeamMidnightDust/wip-tooltip-refactor
Motschen Jan 14, 2025
e938682
MidnightLib 1.6.7
Motschen Jan 19, 2025
6aa0536
Backported to 1.21(.1)
maloryware Jan 27, 2025
81d2a66
i should really stop pressing "commit and push" unconditionally but i…
maloryware Jan 27, 2025
26d7948
Merge branch 'architectury-1.21.1' into architectury-1.21.x
Motschen Jan 27, 2025
c067d13
Merge pull request #83 from maloryware/architectury-1.21.x
Motschen Jan 27, 2025
fe6669e
fix: crash on pure Wayland sessions
Motschen Feb 15, 2025
e294664
chore: improve version formatting & bump version
Motschen Feb 15, 2025
d73b968
feat: support non-primitive fields
Motschen Feb 15, 2025
fdb4a1a
feat: use enum variant name when missing translation
Motschen Feb 15, 2025
28166aa
fix(neoforge): move command registration to post init
Motschen Feb 15, 2025
596f68f
chore: adjust version naming for better integration
Motschen Feb 15, 2025
a0fde5d
Merge branch 'architectury-1.21.1' into architectury-1.21.4
Motschen Feb 15, 2025
7c0e4d5
Revert "Merge branch 'architectury-1.21.1' into architectury-1.21.4"
Motschen Feb 15, 2025
d2f5b26
feat: maintain tab order
Motschen Feb 22, 2025
422cb5f
Create `ru_ru.json`
mpustovoi Feb 23, 2025
30fb35f
feat: minimal custom type adapter for Identifiers
Motschen Mar 20, 2025
32822e6
clean: remove blend functions
Motschen Mar 20, 2025
7902042
refactor: identifier item display
Motschen Mar 20, 2025
5da96ac
chore: bump version
Motschen Mar 20, 2025
060ca33
clean: various code improvements
Motschen Mar 26, 2025
8bf4cfa
Merge pull request #88 from mpustovoi/patch-1
Motschen Mar 26, 2025
465af95
clean: optimize translation files & metadata
Motschen Mar 26, 2025
2abf904
feat: conditions! + large cleanup
Motschen Mar 27, 2025
ebcafa6
chore: bump version
Motschen Mar 27, 2025
faf8c19
fix bug: the `@Condition` does not trigger in real-time to update the…
Jaffe2718 Apr 2, 2025
6eceade
fix bugs: The condition update algorithm is chaotic and does not work…
Jaffe2718 Apr 3, 2025
c1299c2
add examples
Jaffe2718 Apr 3, 2025
170363e
chore: bump version
Jaffe2718 Apr 3, 2025
f4d1183
cleanup & suppress unused warnings
Jaffe2718 Apr 3, 2025
ac5a035
optimize: use hash tables to reduce complexity
Jaffe2718 Apr 3, 2025
1c3a81f
Merge pull request #93 from Jaffe2718/architectury-1.21.4
Motschen Apr 5, 2025
ee705b2
feat: replace Hashtable with LinkedHashMap
Motschen Apr 5, 2025
64be14f
clean: improve entry access further
Motschen Apr 5, 2025
386a95a
feat: optimize AutoCommand's file-size
Motschen Apr 5, 2025
9b29b20
docs: improve multi-conditions example
Motschen Apr 5, 2025
a3f4dfc
chore: bump version
Motschen Apr 5, 2025
57d881d
Merge pull request #94 from TeamMidnightDust/dev
Motschen Apr 5, 2025
1606646
- fix bug: avoid the crash due to `Identifier` syntax not legitimate.
Jaffe2718 Apr 13, 2025
a4ce164
- fix bug+: illegal Identifier cannot input character
Jaffe2718 Apr 13, 2025
e046463
- rollback: boolean field (`CheckboxWidget` -> `ButtonWidget`)
Jaffe2718 Apr 14, 2025
517d3c8
- adjust: optimize code & add comment
Jaffe2718 Apr 14, 2025
dd128bd
Merge pull request #97 from Jaffe2718/architectury-1.21.4
Motschen Apr 14, 2025
dcf0dbc
fix: improve identifier crash fix
Motschen Apr 14, 2025
3e6a72c
feat: checkbox buttons next to boolean yes/no text buttons
Motschen Apr 14, 2025
0297d91
feat: 'visibleButLocked' now applies for all buttons
Motschen Apr 14, 2025
5905eed
- feat: add clickable url for `@Comment`
Jaffe2718 Apr 18, 2025
4def02a
Merge pull request #98 from Jaffe2718/dev
Motschen Apr 18, 2025
e58c7fc
feat: improve URL handling
Motschen Apr 18, 2025
82889b8
docs: improve JavaDocs
Motschen Apr 21, 2025
06ef4fd
clean: remove unused import
Motschen Apr 21, 2025
356064b
chore: bump version
Motschen Apr 21, 2025
6693580
Merge pull request #99 from TeamMidnightDust/dev
Motschen Apr 21, 2025
daec2a3
feat: respect TranslatableOption on enums
joriskleiber Apr 25, 2025
03223b8
Translation into Argentine Spanish (es_ar) for MidnightLib
Texaliuz Apr 29, 2025
f986d10
Translation into Argentine Spanish (es_ar) for MidnightLib
Texaliuz Apr 29, 2025
3eb345c
Update es_ar.json
Texaliuz May 4, 2025
3027281
feat: new method to manually add widgets
Motschen May 12, 2025
b2c2401
fix: adjust option title position
Motschen May 12, 2025
7a15f1f
fix: conditions are not applied in default tab
Motschen May 12, 2025
f9fc657
Merge branch 'architectury-1.21.4' into architectury-1.21.4
Motschen May 12, 2025
f1a3b2c
Merge pull request #101 from joriskleiber/architectury-1.21.4
Motschen May 12, 2025
3e2ceb0
Merge pull request #103 from Texaliuz/patch-2
Motschen May 12, 2025
74d8800
Merge pull request #102 from Texaliuz/patch-1
Motschen May 12, 2025
f1fe868
feat: remove checkbox widgets
Motschen May 12, 2025
6bbaf1a
optimize: remove unchanged translations in es_ar
Motschen May 12, 2025
7ddfadd
clean: some code cleanup
Motschen May 13, 2025
a1ad6dd
chore: bump version
Motschen May 13, 2025
aea8559
prepare 1.20.1 backport
maloryware Aug 3, 2025
19981cc
fix weird compilation issues
xtrm-en Aug 3, 2025
9fe2ab7
Merge pull request #1 from x-random-forks/architectury-1.20.1
maloryware Aug 4, 2025
206ea38
fixed rendering order for (most) screens & widgets
maloryware Aug 4, 2025
31e071c
wip: define IconButtonWidget texture/icon sizes
maloryware Aug 4, 2025
cab608f
chore: appended "1.20.1" to mod_version
maloryware Aug 21, 2025
9656737
comment cleanup
maloryware Aug 21, 2025
d266a5a
undo version change; change supported_versions
maloryware Aug 23, 2025
12b8718
fix: reset and picker buttons
maloryware Aug 23, 2025
6fb951a
chore: gradle files cleanup
maloryware Aug 23, 2025
2fa968f
chore: comment cleanup
maloryware Aug 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 0 additions & 67 deletions MidnightConfigExample.java

This file was deleted.

38 changes: 33 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import groovy.json.JsonSlurper
import groovy.json.JsonOutput

plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.1-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.10-SNAPSHOT" apply false
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
}

architectury {
Expand All @@ -12,10 +17,10 @@ subprojects {

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
//mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.
mappings "net.fabricmc:yarn:${rootProject.yarn_mappings}:v2"
mappings loom.layered {
it.mappings("net.fabricmc:yarn:$rootProject.yarn_mappings:v2")
}
}
}

Expand All @@ -36,10 +41,33 @@ allprojects {
// for more information about repositories.
}

tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = 17
}
ext {
releaseChangelog = {
def changes = new StringBuilder()
changes << "## MidnightLib v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/MidnightLib/commits/)"
def proc = "git log --max-count=1 --pretty=format:%s".execute()
proc.in.eachLine { line ->
def processedLine = line.toString()
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
changes << "\n- ${processedLine.capitalize()}"
}
}
proc.waitFor()
return changes.toString()
}
}
processResources {
// Minify json resources
doLast {
fileTree(dir: outputs.files.asPath, include: "**/*.json").each {
File file -> file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
}
}
}

java {
withSourcesJar()
Expand Down
4 changes: 1 addition & 3 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ architectury {
common(rootProject.enabled_platforms.split(","))
}

loom {
}

dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"

}

publishing {
Expand Down
39 changes: 39 additions & 0 deletions common/src/main/java/eu/midnightdust/core/MidnightLib.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package eu.midnightdust.core;

import eu.midnightdust.core.config.MidnightLibConfig;
import eu.midnightdust.lib.config.AutoCommand;
import eu.midnightdust.lib.config.MidnightConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.swing.UIManager;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

import static net.minecraft.client.MinecraftClient.IS_SYSTEM_MAC;

public class MidnightLib {
public static List<String> hiddenMods = new ArrayList<>();
public static final String MOD_ID = "midnightlib";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

@Environment(EnvType.CLIENT)
public static void onInitializeClient() {
try { if (!IS_SYSTEM_MAC) {
System.setProperty("java.awt.headless", "false");
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}} catch (Exception | Error e) { LOGGER.error("Error setting system look and feel", e); }
MidnightLibConfig.init(MOD_ID, MidnightLibConfig.class);
}
public static void registerAutoCommand() {
MidnightConfig.configClass.forEach((modid, config) -> {
for (Field field : config.getFields()) {
if (field.isAnnotationPresent(MidnightConfig.Entry.class) && !field.isAnnotationPresent(MidnightConfig.Client.class) && !field.isAnnotationPresent(MidnightConfig.Hidden.class))
new AutoCommand(field, modid);
}
});
}
}
15 changes: 0 additions & 15 deletions common/src/main/java/eu/midnightdust/core/MidnightLibClient.java

This file was deleted.

18 changes: 0 additions & 18 deletions common/src/main/java/eu/midnightdust/core/MidnightLibServer.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
import eu.midnightdust.lib.config.MidnightConfig;
import eu.midnightdust.lib.util.PlatformFunctions;

import java.util.Objects;

public class MidnightLibConfig extends MidnightConfig {
@Entry // Enable or disable the MidnightConfig overview screen button
public static ConfigButton config_screen_list = PlatformFunctions.isModLoaded("modmenu") ? ConfigButton.MODMENU : ConfigButton.TRUE;
public static final boolean HAS_MODMENU = PlatformFunctions.isModLoaded("modmenu") || Objects.equals(PlatformFunctions.getPlatformName(), "neoforge");

@Entry public static ConfigButton config_screen_list = HAS_MODMENU ? ConfigButton.MODMENU : ConfigButton.TRUE;

public enum ConfigButton {
TRUE,FALSE,MODMENU
TRUE, FALSE, MODMENU
}

public static boolean shouldShowButton() {
return config_screen_list.equals(ConfigButton.TRUE) || (config_screen_list.equals(ConfigButton.MODMENU) && !HAS_MODMENU);
}
}
31 changes: 25 additions & 6 deletions common/src/main/java/eu/midnightdust/core/mixin/MixinOptionsScreen.java
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
package eu.midnightdust.core.mixin;

import eu.midnightdust.core.config.MidnightLibConfig;
import eu.midnightdust.core.screen.MidnightConfigOverviewScreen;
import eu.midnightdust.lib.util.PlatformFunctions;
import eu.midnightdust.lib.util.screen.TexturedOverlayButtonWidget;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.option.OptionsScreen;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.Objects;

import static eu.midnightdust.core.config.MidnightLibConfig.shouldShowButton;

@Mixin(OptionsScreen.class)
public class MixinOptionsScreen extends Screen {
private static final Identifier MIDNIGHTLIB_ICON_TEXTURE = new Identifier("midnightlib","textures/gui/midnightlib_button.png");

@Unique private static final Identifier MIDNIGHTLIB_ICON_TEXTURE = Identifier.of("midnightlib","icon/midnightlib.png");

@Unique
TexturedOverlayButtonWidget midnightlib$button = new TexturedOverlayButtonWidget(
this.width / 2 + 158,
this.height / 6 - 12,
20,
20,
0, 0, 20,
MIDNIGHTLIB_ICON_TEXTURE,
32, 64,
(buttonWidget) ->
Objects.requireNonNull(client).setScreen(new MidnightConfigOverviewScreen(this)),
Text.translatable("midnightlib.overview.title"));

protected MixinOptionsScreen(Text title) {
super(title);
}

@Inject(at = @At("HEAD"),method = "init")
@Inject(at = @At("HEAD"), method = "init")
private void midnightlib$init(CallbackInfo ci) {
if (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.TRUE) || (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.MODMENU) && !PlatformFunctions.isModLoaded("modmenu")))
this.addDrawableChild(new TexturedOverlayButtonWidget(this.width / 2 + 158, this.height / 6 - 12, 20, 20, 0, 0, 20, MIDNIGHTLIB_ICON_TEXTURE, 32, 64, (buttonWidget) -> Objects.requireNonNull(client).setScreen(new MidnightConfigOverviewScreen(this)), Text.translatable("midnightlib.overview.title")));
if (shouldShowButton()){
midnightlib$button.setPosition(this.width / 2 + 158, this.height / 6 - 12);
this.addDrawableChild(midnightlib$button);
}
}

}
Loading