Compare commits

..

4 commits

Author SHA1 Message Date
moehreag 798fc26fe4 add example mixin 2024-05-24 19:15:03 +02:00
moehreag df66596b5e example mod pre_launch working 2024-05-24 19:14:45 +02:00
moehreag c42681f445 Merge remote-tracking branch 'refs/remotes/origin/main' into TheKodeToad/loading-fixes
# Conflicts:
#	src/main/java/org/ecorous/esnesnon/nonsense/loader/impl/launch/MixinClassloader.java
2024-05-24 19:11:35 +02:00
moehreag 287214acba rename example mixin config 2024-05-20 15:30:58 +02:00
5 changed files with 35 additions and 6 deletions

View file

@ -24,9 +24,9 @@ repositories {
dependencies { dependencies {
implementation(libs.remapper) implementation(libs.remapper)
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:3.0.0-beta2") compileOnly("org.apache.logging.log4j:log4j-slf4j2-impl:3.0.0-beta2")
implementation("org.apache.logging.log4j:log4j-api:3.0.0-beta2") compileOnly("org.apache.logging.log4j:log4j-api:3.0.0-beta2")
implementation("org.apache.logging.log4j:log4j-core:3.0.0-beta2") compileOnly("org.apache.logging.log4j:log4j-core:3.0.0-beta2")
api(libs.mixin) api(libs.mixin)
api(libs.nightconfig) api(libs.nightconfig)

View file

@ -0,0 +1,25 @@
package org.ecorous.esnesnon.nonsense.loader.example.mixin;
import net.minecraft.client.gui.components.FocusableTextWidget;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(TitleScreen.class)
public abstract class TitleScreenMixin extends Screen {
protected TitleScreenMixin(Component title) {
super(title);
}
@Inject(method = "createNormalMenuOptions", at = @At("TAIL"), remap = false)
private void showExample(int y, int rowHeight, CallbackInfo ci) {
var widget = new FocusableTextWidget(200, Component.literal("<insert frog here!>"), this.font);
widget.setPosition(width / 2 - widget.getWidth(), 20);
addRenderableOnly(widget);
}
}

View file

@ -4,7 +4,9 @@
"package": "org.ecorous.esnesnon.nonsense.loader.example.mixin", "package": "org.ecorous.esnesnon.nonsense.loader.example.mixin",
"compatibilityLevel": "JAVA_21", "compatibilityLevel": "JAVA_21",
"mixins": [], "mixins": [],
"client": [], "client": [
"TitleScreenMixin"
],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1
} }

View file

@ -16,6 +16,6 @@ breaks = [
] ]
[nonsense.extensions] [nonsense.extensions]
pre_launch = "org/ecorous/esnesnon/nonsense/loader/example/ExamplePreLaunchExtension" pre_launch = "org.ecorous.esnesnon.nonsense.loader.example.ExamplePreLaunchExtension"
mixin_config = "example_mod.mixin.config" mixin_config = "example_mod.mixins.json"

View file

@ -37,6 +37,8 @@ public class Launcher {
instance = this; instance = this;
this.env = env; this.env = env;
targetClassLoader = new MixinClassLoader(); targetClassLoader = new MixinClassLoader();
targetClassLoader.excludePackage("org.slf4j");
targetClassLoader.excludePackage("org.spongepowered");
targetClassLoader.excludePackage("org.apache.logging"); targetClassLoader.excludePackage("org.apache.logging");
targetClassLoader.excludePackage("org.ecorous.esnesnon.nonsense.loader.impl.launch"); targetClassLoader.excludePackage("org.ecorous.esnesnon.nonsense.loader.impl.launch");
targetClassLoader.excludePackage("org.ecorous.esnesnon.nonsense.loader.api.env"); targetClassLoader.excludePackage("org.ecorous.esnesnon.nonsense.loader.api.env");