add mod count to the title screen
Some checks failed
Publish to snapshot maven / build (push) Failing after 30s

This commit is contained in:
moehreag 2024-06-11 16:56:53 +02:00
parent c8921d7cd7
commit 5140540cd1
6 changed files with 31 additions and 10 deletions

View file

@ -27,13 +27,17 @@ allprojects {
apply(plugin = "maven-publish")
apply(plugin = "io.freefair.lombok")
if (project.name != "core") {
dependencies {
api(project(":library:core"))
}
}
phytotelma {
loader(rootProject.libs.versions.frogloader)
minecraft(rootProject.libs.versions.minecraft)
}
tasks.processResources {
inputs.property("version", version)
inputs.property("game_version", libs.versions.minecraft.get())
@ -87,7 +91,7 @@ dependencies {
project.tasks.jar {
dependsOn(it.tasks.jar)
}
implementation(it)
api(it)
include(it)
}
}

View file

@ -0,0 +1,20 @@
package dev.frogmc.froglib.branding.impl.mixin.client;
import dev.frogmc.frogloader.api.FrogLoader;
import net.minecraft.client.gui.screens.TitleScreen;
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.Redirect;
@Mixin(TitleScreen.class)
public class TitleScreenMixin {
@Unique
private static final int MOD_COUNT = FrogLoader.getInstance().getMods().size();
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/resources/language/I18n;get(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;"))
private String addModCount(String translateKey, Object[] parameters){
return "/FrogLoader ("+MOD_COUNT+" Mods)";
}
}

View file

@ -9,6 +9,7 @@
"server": [
],
"client": [
"client.TitleScreenMixin",
"client.ClientBrandRetrieverMixin"
],
"injectors": {

View file

@ -1,4 +1,4 @@
package dev.frogmc.froglib.test;
package dev.frogmc.froglib.keybinds.test;
import com.mojang.blaze3d.platform.InputConstants;
import dev.frogmc.froglib.entrypoints.ClientExtension;

View file

@ -2,8 +2,8 @@
format_version = "1.0.0"
[frog.mod]
id = "frog_lib_test"
name = "Frog Lib Test Mod"
id = "frog_lib_keybinds_test"
name = "FrogLib Keybinds Test Mod"
version = "1.0.0"
license = "Apache-2.0"
credits = [
@ -16,4 +16,4 @@ depends = [
]
[frog.extensions]
client = "dev.frogmc.froglib.test.KeybindsTest"
client = "dev.frogmc.froglib.keybinds.test.KeybindsTest"

View file

@ -1,4 +0,0 @@
dependencies {
api(project(":library:core"))
}