add modmenu configs

This commit is contained in:
Christoph J. Scherr 2023-11-08 19:25:32 +01:00
parent eeb881c972
commit c14dcc16dd
5 changed files with 78 additions and 9 deletions

BIN
assets/mcpht/icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View file

@ -16,6 +16,8 @@ repositories {
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases/" }
}
loom {
@ -39,6 +41,11 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modApi("me.shedaniel.cloth:cloth-config-fabric:10.1.105") {
exclude(group: "net.fabricmc.fabric-api")
}
modApi "com.terraformersmc:modmenu:6.2.1"
// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.

View file

@ -0,0 +1,11 @@
package de.cscherr.mcpht.config;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
public class MenuAPI implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return OptionsScreen::new;
}
}

View file

@ -0,0 +1,40 @@
package de.cscherr.mcpht.config;
import de.cscherr.mcpht.McphtClient;
import me.shedaniel.clothconfig2.api.ConfigBuilder;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.MultilineText;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.tooltip.Tooltip;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
public class OptionsScreen extends Screen {
public ButtonWidget dummyButton;
private final Screen parent;
protected OptionsScreen(Screen parent) {
super(Text.literal("MCPHT Options"));
this.parent = parent;
}
@Override
protected void init() {
dummyButton = ButtonWidget.builder(Text.literal("Dummy"), button -> {
McphtClient.LOGGER.info("Dummy click");
})
.dimensions(width / 2 - 205, 20, 200, 20)
.tooltip(Tooltip.of(Text.literal("Tooltip of button1")))
.build();
addDrawableChild(dummyButton);
}
@Override
public void close() {
client.setScreen(parent);
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
super.render(matrices, mouseX, mouseY, delta);
final MultilineText multilineText = MultilineText.create(textRenderer,
Text.literal("This is Text\nother line"), width - 20);
multilineText.drawWithShadow(matrices, 10, height / 2, 16, 0xffffff);
}
}

View file

@ -1,17 +1,22 @@
{
"schemaVersion": 1,
"id": "mcpht",
"version": "${version}",
"name": "mcpht",
"description": "This is an example description! Tell everyone what your mod is about!",
"version": "0.0.1",
"name": "MCPHT",
"description": "Plex Hack Tools",
"authors": [
"Me!"
{
"name": "Christoph J. Scherr",
"email": "software@cscherr.de"
}
],
"contact": {
"homepage": "https://fabricmc.net/",
"sources": "https://github.com/FabricMC/fabric-example-mod"
"email": "software@cscherr.de",
"homepage": "https://www.cscherr.de",
"sources": "https://git.cscherr.de/PlexSheep/mcpht",
"issues": "https://git.cscherr.de/PlexSheep/mcpht/issues"
},
"license": "CC0-1.0",
"license": "MIT",
"icon": "assets/mcpht/icon.png",
"environment": "*",
"entrypoints": {
@ -33,9 +38,15 @@
"fabricloader": ">=0.14.24",
"minecraft": "~1.19.4",
"java": ">=17",
"fabric-api": "*"
"fabric-api": "*",
"modmenu": ">=6.0.0"
},
"suggests": {
"another-mod": "*"
},
"custom": {
"modmenu": {
"update_checker": true
}
}
}