mirror of
https://github.com/chylex/Better-Controls.git
synced 2024-11-25 01:42:45 +01:00
Compare commits
No commits in common. "73a6571f205a3b145e6bd75e977eb90a042332c8" and "ead8c8454944b8d2d75430294889a1fe5ed7ce2f" have entirely different histories.
73a6571f20
...
ead8c84549
@ -18,7 +18,7 @@ runs {
|
|||||||
jvmArguments(runJvmArgs)
|
jvmArguments(runJvmArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
removeIf { it.name != "client" }
|
create("client")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.processResources {
|
tasks.processResources {
|
||||||
|
@ -24,7 +24,7 @@ val jarVersion = "$minecraftVersion+v$modVersion"
|
|||||||
plugins {
|
plugins {
|
||||||
idea
|
idea
|
||||||
`java-library`
|
`java-library`
|
||||||
id("fabric-loom")
|
id("net.neoforged.gradle.vanilla")
|
||||||
}
|
}
|
||||||
|
|
||||||
idea {
|
idea {
|
||||||
@ -46,16 +46,18 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("net.minecraft:client:$minecraftVersion")
|
||||||
|
compileOnly("net.fabricmc:sponge-mixin:$mixinVersion")
|
||||||
|
api("com.google.code.findbugs:jsr305:3.0.2")
|
||||||
|
}
|
||||||
|
|
||||||
base {
|
base {
|
||||||
archivesName.set("$modNameStripped-Common")
|
archivesName.set("$modNameStripped-Common")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
runs {
|
||||||
minecraft("com.mojang:minecraft:$minecraftVersion")
|
clear()
|
||||||
mappings(loom.officialMojangMappings())
|
|
||||||
|
|
||||||
compileOnly("net.fabricmc:sponge-mixin:$mixinVersion")
|
|
||||||
api("com.google.code.findbugs:jsr305:3.0.2")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@ -64,6 +66,10 @@ allprojects {
|
|||||||
|
|
||||||
apply(plugin = "java-library")
|
apply(plugin = "java-library")
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("org.jetbrains:annotations:24.1.0")
|
||||||
|
}
|
||||||
|
|
||||||
extensions.getByType<JavaPluginExtension>().apply {
|
extensions.getByType<JavaPluginExtension>().apply {
|
||||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||||
}
|
}
|
||||||
@ -80,15 +86,11 @@ allprojects {
|
|||||||
if (project.javaToolchains.launcherFor(java.toolchain).map { it.metadata.vendor }.orNull == "JetBrains") {
|
if (project.javaToolchains.launcherFor(java.toolchain).map { it.metadata.vendor }.orNull == "JetBrains") {
|
||||||
runJvmArgs.add("-XX:+AllowEnhancedClassRedefinition")
|
runJvmArgs.add("-XX:+AllowEnhancedClassRedefinition")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation("org.jetbrains:annotations:24.1.0")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(rootProject.path, configuration = "namedElements"))
|
implementation(rootProject)
|
||||||
}
|
}
|
||||||
|
|
||||||
base {
|
base {
|
||||||
@ -141,25 +143,6 @@ subprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
|
||||||
runs {
|
|
||||||
val runJvmArgs: Set<String> by project
|
|
||||||
|
|
||||||
configureEach {
|
|
||||||
runDir("../run")
|
|
||||||
vmArgs(runJvmArgs)
|
|
||||||
ideConfigGenerated(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
named("client") {
|
|
||||||
configName = "Vanilla Client"
|
|
||||||
client()
|
|
||||||
}
|
|
||||||
|
|
||||||
findByName("server")?.let(::remove)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val copyJars = tasks.register<Copy>("copyJars") {
|
val copyJars = tasks.register<Copy>("copyJars") {
|
||||||
group = "build"
|
group = "build"
|
||||||
duplicatesStrategy = EXCLUDE
|
duplicatesStrategy = EXCLUDE
|
||||||
|
@ -9,20 +9,16 @@ modSourcesURL=https://github.com/chylex/Better-Controls
|
|||||||
modIssuesURL=https://github.com/chylex/Better-Controls/issues
|
modIssuesURL=https://github.com/chylex/Better-Controls/issues
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
minecraftVersion=1.21
|
minecraftVersion=1.20.5
|
||||||
neoForgeVersion=21.0.0-beta
|
neoForgeVersion=20.5.0-beta
|
||||||
neoGradleVersion=7.0.152
|
neoGradleVersion=7.0.120
|
||||||
fabricVersion=0.15.11
|
fabricVersion=0.15.11
|
||||||
loomVersion=1.7
|
loomVersion=1.3
|
||||||
mixinVersion=0.12.5+mixin.0.8.5
|
mixinVersion=0.12.5+mixin.0.8.5
|
||||||
|
|
||||||
# https://projects.neoforged.net/neoforged/neogradle/
|
|
||||||
# https://fabricmc.net/develop/
|
|
||||||
# https://github.com/FabricMC/fabric-loom/releases
|
|
||||||
|
|
||||||
# Constraints
|
# Constraints
|
||||||
minimumMinecraftVersion=1.21
|
minimumMinecraftVersion=1.20.5
|
||||||
minimumNeoForgeVersion=21.0.0-beta
|
minimumNeoForgeVersion=20.5.0-beta
|
||||||
minimumFabricVersion=0.12.3
|
minimumFabricVersion=0.12.3
|
||||||
|
|
||||||
# Gradle
|
# Gradle
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
2
gradlew
vendored
2
gradlew
vendored
@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
@ -10,6 +10,7 @@ pluginManagement {
|
|||||||
plugins {
|
plugins {
|
||||||
val neoGradleVersion = settings.extra.get("neoGradleVersion") as? String
|
val neoGradleVersion = settings.extra.get("neoGradleVersion") as? String
|
||||||
if (neoGradleVersion != null) {
|
if (neoGradleVersion != null) {
|
||||||
|
id("net.neoforged.gradle.vanilla") version neoGradleVersion
|
||||||
id("net.neoforged.gradle.userdev") version neoGradleVersion
|
id("net.neoforged.gradle.userdev") version neoGradleVersion
|
||||||
id("net.neoforged.gradle.mixin") version neoGradleVersion
|
id("net.neoforged.gradle.mixin") version neoGradleVersion
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ import net.minecraft.client.KeyMapping;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.components.CycleButton;
|
import net.minecraft.client.gui.components.CycleButton;
|
||||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||||
|
import net.minecraft.client.gui.screens.OptionsSubScreen;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.gui.screens.options.OptionsSubScreen;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
@ -211,7 +211,9 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContents() {
|
public void init() {
|
||||||
|
super.init();
|
||||||
|
|
||||||
allKeyBindings.clear();
|
allKeyBindings.clear();
|
||||||
|
|
||||||
final List<GuiEventListener> elements = new ArrayList<>();
|
final List<GuiEventListener> elements = new ArrayList<>();
|
||||||
@ -232,9 +234,6 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
|||||||
optionsWidget = addRenderableWidget(new OptionListWidget(width, layout.getContentHeight(), layout.getHeaderHeight(), y - TITLE_MARGIN_TOP + BOTTOM_PADDING, elements));
|
optionsWidget = addRenderableWidget(new OptionListWidget(width, layout.getContentHeight(), layout.getHeaderHeight(), y - TITLE_MARGIN_TOP + BOTTOM_PADDING, elements));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addOptions() {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void repositionElements() {
|
protected void repositionElements() {
|
||||||
super.repositionElements();
|
super.repositionElements();
|
||||||
|
@ -5,8 +5,8 @@ import net.minecraft.client.KeyMapping;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.Options;
|
import net.minecraft.client.Options;
|
||||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
||||||
import net.minecraft.client.gui.screens.options.controls.KeyBindsList;
|
import net.minecraft.client.gui.screens.controls.KeyBindsList;
|
||||||
import net.minecraft.client.gui.screens.options.controls.KeyBindsList.Entry;
|
import net.minecraft.client.gui.screens.controls.KeyBindsList.Entry;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
@ -4,13 +4,14 @@ import chylex.bettercontrols.gui.BetterControlsScreen;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.Options;
|
import net.minecraft.client.Options;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
|
import net.minecraft.client.gui.components.OptionsList;
|
||||||
|
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||||
|
import net.minecraft.client.gui.screens.OptionsSubScreen;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.gui.screens.options.OptionsSubScreen;
|
import net.minecraft.client.gui.screens.controls.ControlsScreen;
|
||||||
import net.minecraft.client.gui.screens.options.controls.ControlsScreen;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
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.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
@ -23,18 +24,20 @@ public abstract class HookControlsScreen extends OptionsSubScreen {
|
|||||||
super(parentScreen, options, title);
|
super(parentScreen, options, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "addOptions", at = @At("RETURN"))
|
@Inject(method = "init", at = @At("RETURN"))
|
||||||
public void afterAddOptions(final CallbackInfo ci) {
|
public void afterInit(final CallbackInfo ci) {
|
||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
final ControlsScreen screen = (ControlsScreen)(Object)this;
|
final ControlsScreen screen = (ControlsScreen)(Object)this;
|
||||||
|
|
||||||
if (list != null) {
|
for (final GuiEventListener child : children()) {
|
||||||
|
if (child instanceof final OptionsList optionsList) {
|
||||||
final MutableComponent buttonTitle = BetterControlsScreen.TITLE.plainCopy().append("...");
|
final MutableComponent buttonTitle = BetterControlsScreen.TITLE.plainCopy().append("...");
|
||||||
list.addSmall(List.of(Button.builder(buttonTitle, btn -> showOptionsScreen(screen)).build()));
|
optionsList.addSmall(List.of(Button.builder(buttonTitle, btn -> showOptionsScreen(screen)).build()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Unique
|
|
||||||
private static void showOptionsScreen(final ControlsScreen screen) {
|
private static void showOptionsScreen(final ControlsScreen screen) {
|
||||||
final Minecraft mc = Minecraft.getInstance();
|
final Minecraft mc = Minecraft.getInstance();
|
||||||
mc.setScreen(new BetterControlsScreen(mc, screen));
|
mc.setScreen(new BetterControlsScreen(mc, screen));
|
||||||
|
@ -10,14 +10,12 @@ import org.spongepowered.asm.mixin.Final;
|
|||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Mutable;
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(Options.class)
|
@Mixin(Options.class)
|
||||||
public abstract class HookLoadGameOptions {
|
public abstract class HookLoadGameOptions {
|
||||||
@Unique
|
|
||||||
private boolean hasLoaded = false;
|
private boolean hasLoaded = false;
|
||||||
|
|
||||||
@Mutable
|
@Mutable
|
||||||
|
Loading…
Reference in New Issue
Block a user