Skip to content

Commit

Permalink
feat: Update for Forge 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Jan 13, 2025
1 parent 91e2482 commit d86bd2e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
8 changes: 6 additions & 2 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ plugins {
}

mixin {
add(sourceSets.main, "${mod_id}.refmap.json")

config("${mod_id}.mixins.json")
config("${mod_id}.forge.mixins.json")
}
Expand Down Expand Up @@ -119,4 +117,10 @@ modrinth {
dependencies {
required.project "balm"
}
}

sourceSets.each {
def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
it.output.resourcesDir = dir
it.java.destinationDirectory = dir
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
package net.blay09.mods.defaultoptions.forge;

import net.blay09.mods.balm.api.Balm;
import net.blay09.mods.balm.api.EmptyLoadContext;
import net.blay09.mods.balm.api.client.BalmClient;
import net.blay09.mods.balm.api.client.keymappings.KeyModifier;
import net.blay09.mods.balm.forge.ForgeLoadContext;
import net.blay09.mods.defaultoptions.DefaultOptions;
import net.blay09.mods.defaultoptions.PlatformBindings;
import net.blay09.mods.defaultoptions.forge.mixin.ForgeKeyMappingAccessor;
import net.minecraft.client.KeyMapping;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.IExtensionPoint;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLEnvironment;

import java.util.Collections;
import java.util.Set;

@Mod(DefaultOptions.MOD_ID)
public class ForgeDefaultOptions {

public ForgeDefaultOptions() {
public ForgeDefaultOptions(FMLJavaModLoadingContext context) {
final var loadContext = new ForgeLoadContext(context.getModEventBus());
PlatformBindings.INSTANCE = new PlatformBindings() {
@Override
public void setDefaultKeyModifiers(KeyMapping keyMapping, Set<KeyModifier> keyModifiers) {
Expand Down Expand Up @@ -71,15 +71,13 @@ private static net.minecraftforge.client.settings.KeyModifier toForge(KeyModifie
}
};

DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
Balm.initialize(DefaultOptions.MOD_ID, EmptyLoadContext.INSTANCE, () -> {
if (FMLEnvironment.dist.isClient()) {
Balm.initialize(DefaultOptions.MOD_ID, loadContext, () -> {
});
BalmClient.initialize(DefaultOptions.MOD_ID, EmptyLoadContext.INSTANCE, DefaultOptions::initialize);
});
BalmClient.initialize(DefaultOptions.MOD_ID, loadContext, DefaultOptions::initialize);
}

ModLoadingContext.get()
.registerExtensionPoint(IExtensionPoint.DisplayTest.class,
() -> new IExtensionPoint.DisplayTest(() -> IExtensionPoint.DisplayTest.IGNORESERVERONLY, (a, b) -> true));
context.registerDisplayTest(IExtensionPoint.DisplayTest.IGNORE_ALL_VERSION);
}

}
1 change: 0 additions & 1 deletion forge/src/main/resources/defaultoptions.forge.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"minVersion": "0.8",
"package": "net.blay09.mods.defaultoptions.forge.mixin",
"compatibilityLevel": "JAVA_17",
"refmap": "${mod_id}.refmap.json",
"mixins": [
],
"client": [
Expand Down

0 comments on commit d86bd2e

Please sign in to comment.