mirror of
https://github.com/chylex/Better-Controls.git
synced 2025-05-13 07:34:02 +02:00
Merge Fabric & Forge codebases
This commit is contained in:
parent
a875ae2255
commit
6c2bf71472
Fabric
Forge
build.gradle.kts
build.gradlebuild.gradle.ktsgradle.propertiessrc/main
gradle/wrapper
gradlewsettings.gradlesettings.gradle.ktssrc/main
41
Fabric/build.gradle.kts
Normal file
41
Fabric/build.gradle.kts
Normal file
@ -0,0 +1,41 @@
|
||||
plugins {
|
||||
idea
|
||||
id("fabric-loom") version "0.9-SNAPSHOT"
|
||||
}
|
||||
|
||||
val minecraftVersion: String by project
|
||||
val fabricVersion: String by project
|
||||
|
||||
dependencies {
|
||||
minecraft("com.mojang:minecraft:$minecraftVersion")
|
||||
modImplementation("net.fabricmc:fabric-loader:$fabricVersion")
|
||||
mappings(loom.officialMojangMappings())
|
||||
}
|
||||
|
||||
loom {
|
||||
runs {
|
||||
named("client") {
|
||||
configName = "Fabric Client"
|
||||
client()
|
||||
runDir("run")
|
||||
ideConfigGenerated(true)
|
||||
}
|
||||
|
||||
named("server") {
|
||||
configName = "Fabric Server"
|
||||
server()
|
||||
runDir("run")
|
||||
ideConfigGenerated(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand(inputs.properties)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
exclude("io/github/prospector/")
|
||||
}
|
@ -4,8 +4,8 @@ import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
public final class BetterControlsMod implements ClientModInitializer {
|
||||
public static final BetterControlsConfig config = BetterControlsConfig.load(FabricLoader.getInstance().getConfigDir().resolve("BetterControls.json"));
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {}
|
||||
public void onInitializeClient() {
|
||||
BetterControlsCommon.setConfig(BetterControlsConfig.load(FabricLoader.getInstance().getConfigDir().resolve("BetterControls.json")));
|
||||
}
|
||||
}
|
Before ![]() (image error) Size: 21 KiB After ![]() (image error) Size: 21 KiB ![]() ![]() |
@ -3,7 +3,7 @@
|
||||
"id": "bettercontrols",
|
||||
"version": "${version}",
|
||||
|
||||
"name": "Better Controls",
|
||||
"name": "${name}",
|
||||
"description": "Adds many powerful key bindings and options to control your movement.\nThe features complement vanilla mechanics without giving unfair advantages, so server use should be fine.",
|
||||
"icon": "assets/bettercontrols/icon.png",
|
||||
"license": "MPL-2.0",
|
95
Forge/build.gradle.kts
Normal file
95
Forge/build.gradle.kts
Normal file
@ -0,0 +1,95 @@
|
||||
import net.minecraftforge.gradle.userdev.UserDevExtension
|
||||
import org.gradle.api.file.DuplicatesStrategy.INCLUDE
|
||||
import org.spongepowered.asm.gradle.plugins.MixinExtension
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven("https://maven.minecraftforge.net")
|
||||
maven("https://repo.spongepowered.org/maven")
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath(group = "net.minecraftforge.gradle", name = "ForgeGradle", version = "5.1.+") { isChanging = true }
|
||||
classpath(group = "org.spongepowered", name = "mixingradle", version = "0.7-SNAPSHOT")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
java
|
||||
eclipse
|
||||
}
|
||||
|
||||
apply {
|
||||
plugin("net.minecraftforge.gradle")
|
||||
plugin("org.spongepowered.mixin")
|
||||
}
|
||||
|
||||
val modId: String by project
|
||||
val minecraftVersion: String by project
|
||||
val forgeVersion: String by project
|
||||
val mixinVersion: String by project
|
||||
|
||||
dependencies {
|
||||
"minecraft"("net.minecraftforge:forge:$minecraftVersion-$forgeVersion")
|
||||
|
||||
if (System.getProperty("idea.sync.active") != "true") {
|
||||
annotationProcessor("org.spongepowered:mixin:$mixinVersion:processor")
|
||||
}
|
||||
}
|
||||
|
||||
configure<UserDevExtension> {
|
||||
mappings("official", minecraftVersion)
|
||||
|
||||
runs {
|
||||
create("client") {
|
||||
taskName = "Client"
|
||||
workingDirectory(rootProject.file("run"))
|
||||
ideaModule("${rootProject.name}.${project.name}.main")
|
||||
|
||||
property("mixin.env.remapRefMap", "true")
|
||||
property("mixin.env.refMapRemappingFile", "$projectDir/build/createSrgToMcp/output.srg")
|
||||
arg("-mixin.config=$modId.mixins.json")
|
||||
|
||||
mods {
|
||||
create(modId) {
|
||||
source(sourceSets.main.get())
|
||||
source(rootProject.sourceSets.main.get())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
create("server") {
|
||||
taskName = "Server"
|
||||
workingDirectory(rootProject.file("run"))
|
||||
ideaModule("${rootProject.name}.${project.name}.main")
|
||||
|
||||
property("mixin.env.remapRefMap", "true")
|
||||
property("mixin.env.refMapRemappingFile", "$projectDir/build/createSrgToMcp/output.srg")
|
||||
arg("-mixin.config=$modId.mixins.json")
|
||||
|
||||
mods {
|
||||
create(modId) {
|
||||
source(sourceSets.main.get())
|
||||
source(rootProject.sourceSets.main.get())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configure<MixinExtension> {
|
||||
add(sourceSets.main.get(), "$modId.refmap.json")
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
from(sourceSets.main.get().resources.srcDirs) {
|
||||
include("META-INF/mods.toml")
|
||||
expand(inputs.properties)
|
||||
duplicatesStrategy = INCLUDE
|
||||
}
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
finalizedBy("reobfJar")
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package chylex.bettercontrols;
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
import chylex.bettercontrols.gui.BetterControlsScreen;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.IExtensionPoint.DisplayTest;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
import net.minecraftforge.fmlclient.ConfigGuiHandler.ConfigGuiFactory;
|
||||
import net.minecraftforge.fmllegacy.network.FMLNetworkConstants;
|
||||
|
||||
@Mod("bettercontrols")
|
||||
public final class BetterControlsMod {
|
||||
public BetterControlsMod() {
|
||||
BetterControlsCommon.setConfig(DistExecutor.safeCallWhenOn(Dist.CLIENT, () -> ClientLoader::loadConfig));
|
||||
ModLoadingContext.get().registerExtensionPoint(ConfigGuiFactory.class, () -> new ConfigGuiFactory(ClientLoader::createScreen));
|
||||
ModLoadingContext.get().registerExtensionPoint(DisplayTest.class, () -> new DisplayTest(() -> 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);
|
||||
}
|
||||
}
|
||||
}
|
30
Forge/src/main/resources/META-INF/mods.toml
Normal file
30
Forge/src/main/resources/META-INF/mods.toml
Normal file
@ -0,0 +1,30 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[37,)"
|
||||
|
||||
authors = "chylex"
|
||||
license = "MPL-2.0"
|
||||
issueTrackerURL = "https://github.com/chylex/Better-Controls/issues"
|
||||
|
||||
[[mods]]
|
||||
modId = "bettercontrols"
|
||||
version = "${version}"
|
||||
displayName = "${name}"
|
||||
logoFile = "icon.png"
|
||||
description = '''
|
||||
Adds many powerful key bindings and options to control your movement.
|
||||
The features complement vanilla mechanics without giving unfair advantages, so server use should be fine.
|
||||
'''
|
||||
|
||||
[[dependencies.bettercontrols]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "[1.17.1,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.bettercontrols]]
|
||||
modId = "forge"
|
||||
mandatory = true
|
||||
versionRange = "[37,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
BIN
Forge/src/main/resources/icon.png
Normal file
BIN
Forge/src/main/resources/icon.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 21 KiB |
36
build.gradle
36
build.gradle
@ -1,36 +0,0 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '0.9-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_16
|
||||
targetCompatibility = JavaVersion.VERSION_16
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = 'v' + project.mod_version
|
||||
group = project.maven_group
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
mappings minecraft.officialMojangMappings()
|
||||
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.mod_version
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.mod_version
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = 16
|
||||
}
|
||||
|
||||
jar {
|
||||
from "LICENSE"
|
||||
exclude "io/github/prospector/"
|
||||
}
|
124
build.gradle.kts
Normal file
124
build.gradle.kts
Normal file
@ -0,0 +1,124 @@
|
||||
import org.gradle.api.file.DuplicatesStrategy.EXCLUDE
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven("https://repo.spongepowered.org/maven")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
idea
|
||||
id("org.spongepowered.gradle.vanilla") version "0.2.1-SNAPSHOT"
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
excludeDirs.add(project.file("run"))
|
||||
}
|
||||
}
|
||||
|
||||
val modId: String by project
|
||||
val modName: String by project
|
||||
val modAuthor: String by project
|
||||
val modVersion: String by project
|
||||
val minecraftVersion: String by project
|
||||
val mixinVersion: String by project
|
||||
|
||||
repositories {
|
||||
maven("https://repo.spongepowered.org/maven")
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.spongepowered:mixin:$mixinVersion")
|
||||
api("com.google.code.findbugs:jsr305:3.0.2")
|
||||
}
|
||||
|
||||
base {
|
||||
archivesName.set("${modName.replace(" ", "")}-Common-$minecraftVersion")
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version(minecraftVersion)
|
||||
runs.clear()
|
||||
}
|
||||
|
||||
allprojects {
|
||||
group = "com.$modAuthor.$modId"
|
||||
version = modVersion
|
||||
|
||||
apply(plugin = "java")
|
||||
|
||||
dependencies {
|
||||
implementation("org.jetbrains:annotations:22.0.0")
|
||||
}
|
||||
|
||||
extensions.getByType<JavaPluginExtension>().apply {
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(16))
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = "UTF-8"
|
||||
options.release.set(16)
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
repositories {
|
||||
maven("https://repo.spongepowered.org/maven")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(rootProject)
|
||||
}
|
||||
|
||||
base {
|
||||
archivesName.set("${modName.replace(" ", "")}-${project.name}-$minecraftVersion")
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
source({ rootProject.sourceSets.main.get().allSource })
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
from(rootProject.sourceSets.main.get().resources)
|
||||
|
||||
inputs.property("name", modName)
|
||||
inputs.property("version", modVersion)
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
from(rootProject.file("LICENSE"))
|
||||
|
||||
manifest {
|
||||
attributes(
|
||||
"Specification-Title" to modName,
|
||||
"Specification-Vendor" to modAuthor,
|
||||
"Specification-Version" to "1",
|
||||
"Implementation-Title" to "$modName-${project.name}",
|
||||
"Implementation-Version" to modVersion,
|
||||
"Implementation-Vendor" to modAuthor,
|
||||
"Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()),
|
||||
"MixinConfigs" to "$modId.mixin.json"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val copyJars = tasks.register<Copy>("copyJars") {
|
||||
duplicatesStrategy = EXCLUDE
|
||||
|
||||
for (subproject in subprojects) {
|
||||
dependsOn(subproject.tasks.build)
|
||||
from(subproject.base.libsDirectory.file("${subproject.base.archivesName.get()}-$modVersion.jar"))
|
||||
}
|
||||
|
||||
into(file("${project.buildDir}/dist"))
|
||||
}
|
||||
|
||||
tasks.build {
|
||||
finalizedBy(copyJars)
|
||||
}
|
@ -1,13 +1,15 @@
|
||||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
# Mod
|
||||
modId=bettercontrols
|
||||
modName=Better Controls
|
||||
modAuthor=chylex
|
||||
modVersion=1.2.0a
|
||||
|
||||
# Fabric Properties
|
||||
minecraft_version=1.17
|
||||
loader_version=0.11.3
|
||||
# Dependencies
|
||||
minecraftVersion=1.17.1
|
||||
forgeVersion=37.0.75
|
||||
fabricVersion=0.11.7
|
||||
mixinVersion=0.8.4
|
||||
|
||||
# Mod Properties
|
||||
mod_version=1.2.0
|
||||
maven_group=chylex.bettercontrols
|
||||
archives_base_name=BetterControls-1.17+
|
||||
|
||||
# https://modmuss50.me/fabric.html
|
||||
# Gradle
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
20
gradlew
vendored
20
gradlew
vendored
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
@ -72,7 +72,7 @@ case "`uname`" in
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
MSYS* | MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
@ -172,14 +172,12 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
ARGV=("$@")
|
||||
eval set -- $DEFAULT_JVM_OPTS
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
IFS=$'
|
||||
' read -rd '' -a JAVA_OPTS_ARR <<< "$(echo $JAVA_OPTS | xargs -n1)"
|
||||
IFS=$'
|
||||
' read -rd '' -a GRADLE_OPTS_ARR <<< "$(echo $GRADLE_OPTS | xargs -n1)"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
exec "$JAVACMD" "$@" "${JAVA_OPTS_ARR[@]}" "${GRADLE_OPTS_ARR[@]}" "-Dorg.gradle.appname=$APP_BASE_NAME" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "${ARGV[@]}"
|
||||
|
@ -1,9 +0,0 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
17
settings.gradle.kts
Normal file
17
settings.gradle.kts
Normal file
@ -0,0 +1,17 @@
|
||||
rootProject.name = "Better-Controls"
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven(url = "https://maven.fabricmc.net/") { name = "Fabric" }
|
||||
maven(url = "https://repo.spongepowered.org/repository/maven-public/") { name = "Sponge Snapshots" }
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.extra.has("forgeVersion")) {
|
||||
include("Forge")
|
||||
}
|
||||
|
||||
if (settings.extra.has("fabricVersion")) {
|
||||
include("Fabric")
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package chylex.bettercontrols;
|
||||
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
|
||||
public final class BetterControlsCommon {
|
||||
private static BetterControlsConfig config;
|
||||
|
||||
public static BetterControlsConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
static void setConfig(final BetterControlsConfig config) {
|
||||
BetterControlsCommon.config = config;
|
||||
}
|
||||
|
||||
private BetterControlsCommon() {}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
package chylex.bettercontrols.gui;
|
||||
import chylex.bettercontrols.BetterControlsMod;
|
||||
import chylex.bettercontrols.BetterControlsCommon;
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
import chylex.bettercontrols.gui.elements.BooleanValueWidget;
|
||||
import chylex.bettercontrols.gui.elements.CycleButtonWidget;
|
||||
@ -20,8 +20,8 @@ import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -54,7 +54,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
||||
// Options
|
||||
|
||||
private int generateSprintingOptions(int y, final List<GuiEventListener> elements) {
|
||||
final BetterControlsConfig cfg = BetterControlsMod.config;
|
||||
final BetterControlsConfig cfg = BetterControlsCommon.getConfig();
|
||||
|
||||
generateKeyBindingWithModifierOption(y, elements, text("Toggle Sprint"), cfg.keyToggleSprint);
|
||||
|
||||
@ -78,7 +78,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
||||
}
|
||||
|
||||
private int generateSneakingOptions(int y, final List<GuiEventListener> elements) {
|
||||
final BetterControlsConfig cfg = BetterControlsMod.config;
|
||||
final BetterControlsConfig cfg = BetterControlsCommon.getConfig();
|
||||
|
||||
generateKeyBindingWithModifierOption(y, elements, text("Toggle Sneak"), cfg.keyToggleSneak);
|
||||
|
||||
@ -93,7 +93,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
||||
|
||||
@SuppressWarnings({ "AutoBoxing", "AutoUnboxing" })
|
||||
private int generateFlightOptions(int y, final List<GuiEventListener> elements) {
|
||||
final BetterControlsConfig cfg = BetterControlsMod.config;
|
||||
final BetterControlsConfig cfg = BetterControlsCommon.getConfig();
|
||||
|
||||
final List<Option<Float>> flightSpeedOptions = Arrays.asList(
|
||||
new Option<>(Float.valueOf(0.25F), text("0.25x")),
|
||||
@ -178,7 +178,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
||||
}
|
||||
|
||||
private int generateMiscellaneousOptions(int y, final List<GuiEventListener> elements) {
|
||||
final BetterControlsConfig cfg = BetterControlsMod.config;
|
||||
final BetterControlsConfig cfg = BetterControlsCommon.getConfig();
|
||||
|
||||
generateKeyBindingWithModifierOption(y, elements, text("Toggle Walk Forwards"), cfg.keyToggleWalkForward);
|
||||
|
||||
@ -257,7 +257,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
||||
|
||||
@Override
|
||||
public void removed() {
|
||||
BetterControlsMod.config.save();
|
||||
BetterControlsCommon.getConfig().save();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,7 +3,7 @@ import com.mojang.blaze3d.platform.InputConstants.Type;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import javax.annotation.Nullable;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class KeyBindingWithModifier extends KeyMapping {
|
||||
public static final String CATEGORY = "key.categories.bettercontrols";
|
||||
|
@ -1,5 +1,5 @@
|
||||
package chylex.bettercontrols.mixin;
|
||||
import chylex.bettercontrols.BetterControlsMod;
|
||||
import chylex.bettercontrols.BetterControlsCommon;
|
||||
import chylex.bettercontrols.input.KeyBindingWithModifier;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
||||
@ -27,7 +27,7 @@ public abstract class HookControlsListWidget extends ContainerObjectSelectionLis
|
||||
return true;
|
||||
}
|
||||
|
||||
if (it instanceof KeyEntry && ArrayUtils.contains(BetterControlsMod.config.getAllKeyBindings(), ((AccessControlsListKeyBinding)it).getBinding())) {
|
||||
if (it instanceof KeyEntry && ArrayUtils.contains(BetterControlsCommon.getConfig().getAllKeyBindings(), ((AccessControlsListKeyBinding)it).getBinding())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package chylex.bettercontrols.mixin;
|
||||
import chylex.bettercontrols.BetterControlsMod;
|
||||
import chylex.bettercontrols.BetterControlsCommon;
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
import chylex.bettercontrols.input.KeyBindingWithModifier;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Options;
|
||||
@ -27,8 +28,13 @@ public abstract class HookLoadGameOptions {
|
||||
return;
|
||||
}
|
||||
|
||||
final BetterControlsConfig config = BetterControlsCommon.getConfig();
|
||||
if (config == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
hasLoaded = true;
|
||||
keyMappings = ArrayUtils.addAll(keyMappings, BetterControlsMod.config.getAllKeyBindings());
|
||||
keyMappings = ArrayUtils.addAll(keyMappings, config.getAllKeyBindings());
|
||||
AccessKeyBindingFields.getCategoryOrderMap().put(KeyBindingWithModifier.CATEGORY, Integer.valueOf(Integer.MAX_VALUE));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
package chylex.bettercontrols.player;
|
||||
import chylex.bettercontrols.BetterControlsMod;
|
||||
import chylex.bettercontrols.BetterControlsCommon;
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
|
||||
@ -10,7 +10,7 @@ final class FlightHelper {
|
||||
private static final float BASE_VERTICAL_VELOCITY = 3F;
|
||||
|
||||
private static BetterControlsConfig cfg() {
|
||||
return BetterControlsMod.config;
|
||||
return BetterControlsCommon.getConfig();
|
||||
}
|
||||
|
||||
static boolean isFlyingCreativeOrSpectator(final LocalPlayer player) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
package chylex.bettercontrols.player;
|
||||
import chylex.bettercontrols.BetterControlsMod;
|
||||
import chylex.bettercontrols.BetterControlsCommon;
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
import chylex.bettercontrols.gui.BetterControlsScreen;
|
||||
import chylex.bettercontrols.input.SprintMode;
|
||||
@ -33,7 +33,7 @@ public final class PlayerTicker {
|
||||
}
|
||||
|
||||
private static BetterControlsConfig cfg() {
|
||||
return BetterControlsMod.config;
|
||||
return BetterControlsCommon.getConfig();
|
||||
}
|
||||
|
||||
private final WeakReference<LocalPlayer> ref;
|
||||
|
7
src/main/resources/pack.mcmeta
Normal file
7
src/main/resources/pack.mcmeta
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "Better Controls",
|
||||
"pack_format": 7,
|
||||
"_comment": ""
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user