dev: switch to stonecutter build system

- This will allow us to build the library for different Minecraft versions at the same time
- Right now, only Fabric and Neoforge 1.21.10 are fully working
- As a bonus, the jar is now even smaller!
This commit is contained in:
Martin Prokoph
2025-11-04 22:21:15 +01:00
parent b484d0287c
commit 8138e17b42
78 changed files with 668 additions and 981 deletions

View File

@@ -0,0 +1,29 @@
package eu.midnightdust.lib.config;
import net.minecraft.client.gui.components.AbstractSliderButton;
import net.minecraft.network.chat.Component;
public class MidnightSliderWidget extends AbstractSliderButton {
private final EntryInfo info;
private final MidnightConfig.Entry e;
public MidnightSliderWidget(int x, int y, int width, int height, Component text, double value, EntryInfo info) {
super(x, y, width, height, text, value);
this.e = info.entry;
this.info = info;
}
@Override
public void updateMessage() {
this.setMessage(Component.nullToEmpty(info.tempValue));
}
@Override
public void applyValue() {
if (info.dataType == int.class) info.setValue(((Number) (e.min() + value * (e.max() - e.min()))).intValue());
else if (info.dataType == double.class)
info.setValue(Math.round((e.min() + value * (e.max() - e.min())) * (double) e.precision()) / (double) e.precision());
else if (info.dataType == float.class)
info.setValue(Math.round((e.min() + value * (e.max() - e.min())) * (float) e.precision()) / (float) e.precision());
}
}