mirror of
https://github.com/TeamMidnightDust/MidnightLib.git
synced 2025-12-15 17:05:09 +01:00
Compare commits
2 Commits
1.2.1
...
fabric-1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d5fcd7e71 | ||
|
|
c501c63d30 |
@@ -23,7 +23,7 @@ dependencies {
|
||||
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
modImplementation ("com.terraformersmc:modmenu:${project.mod_menu_version}")
|
||||
modCompileOnlyApi ("com.terraformersmc:modmenu:${project.mod_menu_version}")
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
||||
@@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.19-rc2
|
||||
yarn_mappings=1.19-rc2+build.1
|
||||
loader_version=0.14.6
|
||||
minecraft_version=22w43a
|
||||
yarn_mappings=22w43a+build.4
|
||||
loader_version=0.14.10
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 0.6.1
|
||||
mod_version = 0.6.1+22w43a
|
||||
maven_group = eu.midnightdust
|
||||
archives_base_name = midnightlib
|
||||
|
||||
# Dependencies
|
||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||
fabric_version=0.55.1+1.19
|
||||
fabric_version=0.65.1+1.19.3
|
||||
mod_menu_version = 4.0.0-beta.4
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MidnightConfigOverviewScreen extends Screen {
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height - 28, 200, 20, ScreenTexts.DONE, (button) -> Objects.requireNonNull(client).setScreen(parent)));
|
||||
this.addDrawableChild(ButtonWidget.method_46430(ScreenTexts.DONE, (button) -> Objects.requireNonNull(client).setScreen(parent)).method_46434(this.width / 2 - 100, this.height - 28, 200, 20).method_46431());
|
||||
|
||||
this.list = new MidnightOverviewListWidget(this.client, this.width, this.height, 32, this.height - 32, 25);
|
||||
if (this.client != null && this.client.world != null) this.list.setRenderBackground(false);
|
||||
@@ -37,8 +37,8 @@ public class MidnightConfigOverviewScreen extends Screen {
|
||||
Collections.sort(sortedMods);
|
||||
sortedMods.forEach((modid) -> {
|
||||
if (!MidnightLibClient.hiddenMods.contains(modid)) {
|
||||
list.addButton(new ButtonWidget(this.width / 2 - 100, this.height - 28, 200, 20, Text.translatable(modid +".midnightconfig.title"), (button) ->
|
||||
Objects.requireNonNull(client).setScreen(MidnightConfig.getScreen(this,modid))));
|
||||
list.addButton(ButtonWidget.method_46430(Text.translatable(modid +".midnightconfig.title"), (button) ->
|
||||
Objects.requireNonNull(client).setScreen(MidnightConfig.getScreen(this,modid))).method_46434(this.width / 2 - 100, this.height - 28, 200, 20).method_46431());
|
||||
}
|
||||
});
|
||||
super.init();
|
||||
@@ -78,7 +78,7 @@ public class MidnightConfigOverviewScreen extends Screen {
|
||||
}
|
||||
public static OverviewButtonEntry create(ClickableWidget button) {return new OverviewButtonEntry(button);}
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
button.y = y;
|
||||
button.method_46419(y);
|
||||
button.render(matrices, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
public List<? extends Element> children() {return buttonList;}
|
||||
|
||||
@@ -238,12 +238,12 @@ public abstract class MidnightConfig {
|
||||
super.init();
|
||||
if (!reload) loadValues();
|
||||
|
||||
this.addDrawableChild(new ButtonWidget(this.width / 2 - 154, this.height - 28, 150, 20, ScreenTexts.CANCEL, button -> {
|
||||
this.addDrawableChild(ButtonWidget.method_46430(ScreenTexts.CANCEL, button -> {
|
||||
loadValues();
|
||||
Objects.requireNonNull(client).setScreen(parent);
|
||||
}));
|
||||
}).method_46434(this.width / 2 - 154, this.height - 28, 150, 20).method_46431());
|
||||
|
||||
ButtonWidget done = this.addDrawableChild(new ButtonWidget(this.width / 2 + 4, this.height - 28, 150, 20, ScreenTexts.DONE, (button) -> {
|
||||
ButtonWidget done = this.addDrawableChild(ButtonWidget.method_46430(ScreenTexts.DONE, (button) -> {
|
||||
for (EntryInfo info : entries)
|
||||
if (info.id.equals(modid)) {
|
||||
try {
|
||||
@@ -252,7 +252,7 @@ public abstract class MidnightConfig {
|
||||
}
|
||||
write(modid);
|
||||
Objects.requireNonNull(client).setScreen(parent);
|
||||
}));
|
||||
}).method_46434(this.width / 2 + 4, this.height - 28, 150, 20).method_46431());
|
||||
|
||||
this.list = new MidnightConfigListWidget(this.client, this.width, this.height, 32, this.height - 32, 25);
|
||||
if (this.client != null && this.client.world != null) this.list.setRenderBackground(false);
|
||||
@@ -260,7 +260,7 @@ public abstract class MidnightConfig {
|
||||
for (EntryInfo info : entries) {
|
||||
if (info.id.equals(modid)) {
|
||||
Text name = Objects.requireNonNullElseGet(info.name, () -> Text.translatable(translationPrefix + info.field.getName()));
|
||||
ButtonWidget resetButton = new ButtonWidget(width - 205, 0, 40, 20, Text.translatable("Reset").formatted(Formatting.RED), (button -> {
|
||||
ButtonWidget resetButton = ButtonWidget.method_46430(Text.translatable("Reset").formatted(Formatting.RED), (button -> {
|
||||
info.value = info.defaultValue;
|
||||
info.tempValue = info.defaultValue.toString();
|
||||
info.index = 0;
|
||||
@@ -268,12 +268,12 @@ public abstract class MidnightConfig {
|
||||
this.reload = true;
|
||||
Objects.requireNonNull(client).setScreen(this);
|
||||
list.setScrollAmount(scrollAmount);
|
||||
}));
|
||||
})).method_46434(width - 205, 0, 40, 20).method_46431();
|
||||
|
||||
if (info.widget instanceof Map.Entry) {
|
||||
Map.Entry<ButtonWidget.PressAction, Function<Object, Text>> widget = (Map.Entry<ButtonWidget.PressAction, Function<Object, Text>>) info.widget;
|
||||
if (info.field.getType().isEnum()) widget.setValue(value -> Text.translatable(translationPrefix + "enum." + info.field.getType().getSimpleName() + "." + info.value.toString()));
|
||||
this.list.addButton(List.of(new ButtonWidget(width - 160, 0,150, 20, widget.getValue().apply(info.value), widget.getKey()),resetButton), name, info);
|
||||
this.list.addButton(List.of(ButtonWidget.method_46430(widget.getValue().apply(info.value), widget.getKey()).method_46434(width - 160, 0,150, 20).method_46431(),resetButton), name, info);
|
||||
} else if (info.field.getType() == List.class) {
|
||||
if (!reload) info.index = 0;
|
||||
TextFieldWidget widget = new TextFieldWidget(textRenderer, width - 160, 0, 150, 20, null);
|
||||
@@ -284,7 +284,7 @@ public abstract class MidnightConfig {
|
||||
widget.setTextPredicate(processor);
|
||||
resetButton.setWidth(20);
|
||||
resetButton.setMessage(Text.literal("R").formatted(Formatting.RED));
|
||||
ButtonWidget cycleButton = new ButtonWidget(width - 185, 0, 20, 20, Text.literal(String.valueOf(info.index)).formatted(Formatting.GOLD), (button -> {
|
||||
ButtonWidget cycleButton = ButtonWidget.method_46430(Text.literal(String.valueOf(info.index)).formatted(Formatting.GOLD), (button -> {
|
||||
((List<String>)info.value).remove("");
|
||||
double scrollAmount = list.getScrollAmount();
|
||||
this.reload = true;
|
||||
@@ -292,7 +292,7 @@ public abstract class MidnightConfig {
|
||||
if (info.index > ((List<String>)info.value).size()) info.index = 0;
|
||||
Objects.requireNonNull(client).setScreen(this);
|
||||
list.setScrollAmount(scrollAmount);
|
||||
}));
|
||||
})).method_46434(width - 185, 0, 20, 20).method_46431();
|
||||
this.list.addButton(List.of(widget, resetButton, cycleButton), name, info);
|
||||
} else if (info.widget != null) {
|
||||
TextFieldWidget widget = new TextFieldWidget(textRenderer, width - 160, 0, 150, 20, null);
|
||||
@@ -303,7 +303,7 @@ public abstract class MidnightConfig {
|
||||
if (info.field.getAnnotation(Entry.class).isColor()) {
|
||||
resetButton.setWidth(20);
|
||||
resetButton.setMessage(Text.literal("R").formatted(Formatting.RED));
|
||||
ButtonWidget colorButton = new ButtonWidget(width - 185, 0, 20, 20, Text.literal("⬛"), (button -> {}));
|
||||
ButtonWidget colorButton = ButtonWidget.method_46430(Text.literal("⬛"), (button -> {})).method_46434(width - 185, 0, 20, 20).method_46431();
|
||||
try {colorButton.setMessage(Text.literal("⬛").setStyle(Style.EMPTY.withColor(Color.decode(info.tempValue).getRGB())));} catch (Exception ignored) {}
|
||||
info.colorButton = colorButton;
|
||||
colorButton.active = false;
|
||||
@@ -390,7 +390,7 @@ public abstract class MidnightConfig {
|
||||
return new ButtonEntry(buttons, text, info);
|
||||
}
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
buttons.forEach(b -> { b.y = y; b.render(matrices, mouseX, mouseY, tickDelta); });
|
||||
buttons.forEach(b -> { b.method_46419(y); b.render(matrices, mouseX, mouseY, tickDelta); });
|
||||
if (text != null && (!text.getString().contains("spacer") || !buttons.isEmpty())) {
|
||||
if (info.centered) textRenderer.drawWithShadow(matrices, text, MinecraftClient.getInstance().getWindow().getScaledWidth() / 2f - (textRenderer.getWidth(text) / 2f), y + 5, 0xFFFFFF);
|
||||
else DrawableHelper.drawTextWithShadow(matrices, textRenderer, text, 12, y + 5, 0xFFFFFF);
|
||||
|
||||
@@ -32,8 +32,8 @@ public class TexturedOverlayButtonWidget extends TexturedButtonWidget {
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableDepthTest();
|
||||
this.drawTexture(matrices, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
|
||||
this.drawTexture(matrices, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
||||
this.drawTexture(matrices, this.method_46426(), this.method_46427(), 0, 46 + i * 20, this.width / 2, this.height);
|
||||
this.drawTexture(matrices, this.method_46426() + this.width / 2, this.method_46427(), 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
||||
|
||||
super.renderButton(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user