mirror of
https://github.com/chylex/Better-Controls.git
synced 2025-05-09 22:34:04 +02:00
Fix crash when installed on a server
This commit is contained in:
parent
fa92d958b7
commit
b74818fc4c
build.gradle
src/main
16
build.gradle
16
build.gradle
@ -1,8 +1,7 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url = 'https://files.minecraftforge.net/maven' }
|
||||
maven { url = 'https://dist.creeper.host/Sponge/maven' }
|
||||
jcenter()
|
||||
maven { url = "https://repo.spongepowered.org/maven" }
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
@ -54,6 +53,19 @@ minecraft {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
workingDirectory file('run')
|
||||
|
||||
property 'mixin.env.disableRefMap', 'true'
|
||||
arg '-mixin.config=bettercontrols.mixins.json'
|
||||
|
||||
mods {
|
||||
bettercontrols {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
package chylex.bettercontrols;
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
import chylex.bettercontrols.gui.BetterControlsScreen;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.ExtensionPoint;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@ -10,10 +14,20 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@Mod("bettercontrols")
|
||||
public final class BetterControlsMod{
|
||||
public static final BetterControlsConfig config = BetterControlsConfig.load(FMLPaths.CONFIGDIR.get().resolve("BetterControls.json"));
|
||||
public static final BetterControlsConfig config = DistExecutor.safeCallWhenOn(Dist.CLIENT, () -> ClientLoader::loadConfig);
|
||||
|
||||
public BetterControlsMod(){
|
||||
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, () -> (mc, parentScreen) -> new BetterControlsScreen(parentScreen));
|
||||
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, () -> ClientLoader::createScreen);
|
||||
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -> Pair.of(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true));
|
||||
}
|
||||
|
||||
private static final class ClientLoader {
|
||||
public static BetterControlsConfig loadConfig() {
|
||||
return BetterControlsConfig.load(FMLPaths.CONFIGDIR.get().resolve("BetterControls.json"));
|
||||
}
|
||||
|
||||
public static BetterControlsScreen createScreen(final Minecraft mc, final Screen parentScreen) {
|
||||
return new BetterControlsScreen(parentScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
"minVersion": "0.8",
|
||||
"package": "chylex.bettercontrols.mixin",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixins": [
|
||||
"client": [
|
||||
"AccessCameraFields",
|
||||
"AccessClientPlayerFields",
|
||||
"AccessControlsListCategory",
|
||||
|
Loading…
Reference in New Issue
Block a user