Compare commits
2 Commits
a0dce54b00
...
de07ba881b
Author | SHA1 | Date |
---|---|---|
chylex | de07ba881b | |
chylex | 239a2a7494 |
|
@ -27,3 +27,4 @@ bin/
|
|||
# fabric
|
||||
|
||||
run/
|
||||
logs/
|
||||
|
|
22
build.gradle
22
build.gradle
|
@ -1,13 +1,13 @@
|
|||
plugins {
|
||||
id 'fabric-loom' version '0.5-SNAPSHOT'
|
||||
id 'fabric-loom' version '0.8-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_16
|
||||
targetCompatibility = JavaVersion.VERSION_16
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version
|
||||
version = 'v' + project.mod_version
|
||||
group = project.maven_group
|
||||
|
||||
dependencies {
|
||||
|
@ -17,24 +17,18 @@ dependencies {
|
|||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
inputs.property "version", project.mod_version
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include "fabric.mod.json"
|
||||
expand "version": project.version
|
||||
}
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude "fabric.mod.json"
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.mod_version
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = 16
|
||||
}
|
||||
|
||||
version = 'v' + version
|
||||
|
||||
jar {
|
||||
from "LICENSE"
|
||||
exclude "io/github/prospector/"
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# Fabric Properties
|
||||
minecraft_version=1.16.4
|
||||
yarn_mappings=1.16.4+build.1
|
||||
loader_version=0.10.6+build.214
|
||||
minecraft_version=1.17
|
||||
yarn_mappings=1.17+build.1
|
||||
loader_version=0.11.3
|
||||
|
||||
# Mod Properties
|
||||
mod_version=1.2.0
|
||||
maven_group=chylex.bettercontrols
|
||||
archives_base_name=BetterControls-1.16.2+
|
||||
archives_base_name=BetterControls-1.17+
|
||||
|
||||
# https://modmuss50.me/fabric.html
|
||||
|
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
@ -54,7 +54,7 @@ goto fail
|
|||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
|
@ -64,21 +64,6 @@ echo location of your Java installation.
|
|||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
|
|
|
@ -15,9 +15,9 @@ import chylex.bettercontrols.util.LiteralText;
|
|||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ScreenTexts;
|
||||
import net.minecraft.client.gui.screen.options.GameOptionsScreen;
|
||||
import net.minecraft.client.gui.screen.option.GameOptionsScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import java.util.ArrayList;
|
||||
|
@ -246,8 +246,8 @@ public class BetterControlsScreen extends GameOptionsScreen{
|
|||
elements.add(new TextWidget(0, y, ROW_WIDTH, ROW_HEIGHT, text("Miscellaneous"), CENTER));
|
||||
y = generateMiscellaneousOptions(y + ROW_HEIGHT, elements) + TITLE_MARGIN_TOP;
|
||||
|
||||
addButton(new ButtonWidget(width / 2 - 99, height - 29, 200, 20, ScreenTexts.DONE, btn -> client.openScreen(parent)));
|
||||
addChild(optionsWidget = new OptionListWidget(21, height - 32, width, height, elements, y - TITLE_MARGIN_TOP + BOTTOM_PADDING));
|
||||
addDrawableChild(new ButtonWidget(width / 2 - 99, height - 29, 200, 20, ScreenTexts.DONE, btn -> client.openScreen(parent)));
|
||||
addSelectableChild(optionsWidget = new OptionListWidget(21, height - 32, width, height, elements, y - TITLE_MARGIN_TOP + BOTTOM_PADDING));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,8 @@ package chylex.bettercontrols.gui;
|
|||
import chylex.bettercontrols.gui.OptionListWidget.Entry;
|
||||
import net.minecraft.client.gui.Drawable;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import net.minecraft.client.gui.Selectable;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.ElementListWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import java.util.ArrayList;
|
||||
|
@ -32,8 +33,8 @@ public final class OptionListWidget extends ElementListWidget<Entry>{
|
|||
if (element instanceof Widget) {
|
||||
return new Offset(((Widget)element).getX(), ((Widget)element).getY());
|
||||
}
|
||||
else if (element instanceof AbstractButtonWidget){
|
||||
return new Offset(((AbstractButtonWidget)element).x, ((AbstractButtonWidget)element).y);
|
||||
else if (element instanceof ClickableWidget) {
|
||||
return new Offset(((ClickableWidget)element).x, ((ClickableWidget)element).y);
|
||||
}
|
||||
else {
|
||||
return new Offset(0, 0);
|
||||
|
@ -79,10 +80,12 @@ public final class OptionListWidget extends ElementListWidget<Entry>{
|
|||
|
||||
protected static final class Entry extends ElementListWidget.Entry<Entry> {
|
||||
private final List<Element> elements;
|
||||
private final List<Selectable> selectables;
|
||||
private final Map<Element, Offset> offsets;
|
||||
|
||||
public Entry(final List<Element> elements) {
|
||||
this.elements = new ArrayList<>(elements);
|
||||
this.selectables = elements.stream().filter(e -> e instanceof Selectable).map(e -> (Selectable)e).toList();
|
||||
this.offsets = elements.stream().collect(Collectors.toMap(Function.identity(), OptionListWidget::getElementOffset));
|
||||
}
|
||||
|
||||
|
@ -91,24 +94,27 @@ public final class OptionListWidget extends ElementListWidget<Entry>{
|
|||
return Collections.unmodifiableList(elements);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Selectable> method_37025() {
|
||||
return Collections.unmodifiableList(selectables);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(final MatrixStack matrices, final int index, final int y, final int x, final int entryWidth, final int entryHeight, final int mouseX, final int mouseY, final boolean hovered, final float tickDelta) {
|
||||
for (final Element element : elements) {
|
||||
final Offset offset = offsets.get(element);
|
||||
|
||||
if (element instanceof AbstractButtonWidget){
|
||||
final AbstractButtonWidget button = (AbstractButtonWidget)element;
|
||||
if (element instanceof final ClickableWidget button) {
|
||||
button.x = x + offset.x;
|
||||
button.y = y + offset.y;
|
||||
}
|
||||
else if (element instanceof Widget){
|
||||
final Widget widget = (Widget)element;
|
||||
else if (element instanceof final Widget widget) {
|
||||
widget.setX(x + offset.x);
|
||||
widget.setY(y + offset.y);
|
||||
}
|
||||
|
||||
if (element instanceof Drawable){
|
||||
((Drawable)element).render(matrices, mouseX, mouseY, tickDelta);
|
||||
if (element instanceof final Drawable drawable) {
|
||||
drawable.render(matrices, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
package chylex.bettercontrols.gui;
|
||||
import chylex.bettercontrols.mixin.AccessCyclingButtonWidgetFields;
|
||||
import chylex.bettercontrols.mixin.AccessOptionFields;
|
||||
import chylex.bettercontrols.mixin.AccessScreenButtons;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.ParentElement;
|
||||
import net.minecraft.client.gui.screen.options.AccessibilityOptionsScreen;
|
||||
import net.minecraft.client.gui.screen.options.ControlsOptionsScreen;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import net.minecraft.client.gui.screen.option.AccessibilityOptionsScreen;
|
||||
import net.minecraft.client.gui.screen.option.ControlsOptionsScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.OptionButtonWidget;
|
||||
import net.minecraft.client.options.Option;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.CyclingButtonWidget;
|
||||
import net.minecraft.client.option.Option;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
||||
|
||||
|
@ -17,36 +20,26 @@ public final class ScreenPatcher{
|
|||
|
||||
public static void onControlsScreenOpened(final ControlsOptionsScreen screen) {
|
||||
final AccessScreenButtons accessor = (AccessScreenButtons)screen;
|
||||
|
||||
final List<? extends Element> children = screen.children();
|
||||
final List<AbstractButtonWidget> buttons = accessor.getButtons();
|
||||
|
||||
final AbstractButtonWidget autoJump = buttons
|
||||
.stream()
|
||||
.filter(it -> it instanceof OptionButtonWidget && ((OptionButtonWidget)it).getOption() == Option.AUTO_JUMP)
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
final ClickableWidget autoJump = children.stream().flatMap(it -> getOptionButton(it, Option.AUTO_JUMP).stream()).findAny().orElse(null);
|
||||
|
||||
if (autoJump != null) {
|
||||
children.remove(autoJump);
|
||||
buttons.remove(autoJump);
|
||||
|
||||
accessor.callAddButton(new ButtonWidget(autoJump.x, autoJump.y, autoJump.getWidth(), autoJump.getHeight(), BetterControlsScreen.TITLE.copy().append("..."), btn -> {
|
||||
final ButtonWidget widget = new ButtonWidget(autoJump.x, autoJump.y, autoJump.getWidth(), autoJump.getHeight(), BetterControlsScreen.TITLE.copy().append("..."), btn -> {
|
||||
MINECRAFT.openScreen(new BetterControlsScreen(screen));
|
||||
}));
|
||||
});
|
||||
|
||||
accessor.callRemove(autoJump);
|
||||
accessor.getChildren().add(widget);
|
||||
accessor.getSelectables().add(widget);
|
||||
accessor.getDrawables().add(widget);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onAccessibilityScreenOpened(final AccessibilityOptionsScreen screen) {
|
||||
walkChildren(screen.children(), it -> {
|
||||
if (it instanceof OptionButtonWidget){
|
||||
final OptionButtonWidget button = (OptionButtonWidget)it;
|
||||
final Option option = button.getOption();
|
||||
|
||||
if (option == Option.SPRINT_TOGGLED || option == Option.SNEAK_TOGGLED){
|
||||
button.active = false;
|
||||
}
|
||||
}
|
||||
getOptionButton(it, Option.SPRINT_TOGGLED).ifPresent(button -> button.active = false);
|
||||
getOptionButton(it, Option.SNEAK_TOGGLED).ifPresent(button -> button.active = false);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -59,4 +52,13 @@ public final class ScreenPatcher{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Optional<CyclingButtonWidget<?>> getOptionButton(final Element element, final Option option) {
|
||||
if (element instanceof CyclingButtonWidget<?> && ((AccessOptionFields)option).getKey().equals(((AccessCyclingButtonWidgetFields)element).getOptionText())) {
|
||||
return Optional.of((CyclingButtonWidget<?>)element);
|
||||
}
|
||||
else {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package chylex.bettercontrols.gui.elements;
|
||||
import chylex.bettercontrols.util.Key;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.MutableText;
|
||||
|
@ -18,7 +18,7 @@ public final class KeyBindingWidget extends ButtonWidget{
|
|||
private final KeyBinding binding;
|
||||
private final Text bindingName;
|
||||
|
||||
private final List<AbstractButtonWidget> linkedButtons = new ArrayList<>(1);
|
||||
private final List<ClickableWidget> linkedButtons = new ArrayList<>(1);
|
||||
|
||||
private final Consumer<KeyBindingWidget> onEditingStarted;
|
||||
private boolean isEditing;
|
||||
|
@ -35,7 +35,7 @@ public final class KeyBindingWidget extends ButtonWidget{
|
|||
this(x, y, width, 20, binding, onEditingStarted);
|
||||
}
|
||||
|
||||
public void linkButtonToBoundState(final AbstractButtonWidget button){
|
||||
public void linkButtonToBoundState(final ClickableWidget button) {
|
||||
linkedButtons.add(button);
|
||||
button.active = !Key.isUnbound(binding);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public final class KeyBindingWidget extends ButtonWidget{
|
|||
Key.bind(binding, key);
|
||||
stopEditing();
|
||||
|
||||
for(final AbstractButtonWidget button : linkedButtons){
|
||||
for (final ClickableWidget button : linkedButtons) {
|
||||
button.active = !Key.isUnbound(binding);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package chylex.bettercontrols.input;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.util.InputUtil.Type;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
|
|
|
@ -32,11 +32,11 @@ public enum ModifierKey{
|
|||
public abstract boolean isPressed();
|
||||
|
||||
public static ModifierKey getById(final int id) {
|
||||
switch(id){
|
||||
case 0: return CONTROL;
|
||||
case 1: return SHIFT;
|
||||
case 2: return ALT;
|
||||
default: return null;
|
||||
}
|
||||
return switch (id) {
|
||||
case 0 -> CONTROL;
|
||||
case 1 -> SHIFT;
|
||||
case 2 -> ALT;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package chylex.bettercontrols.input;
|
||||
import chylex.bettercontrols.util.Key;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
|
||||
public class ToggleTracker {
|
||||
protected final KeyBinding bindingToggle;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package chylex.bettercontrols.input;
|
||||
import chylex.bettercontrols.mixin.AccessKeyBindingFields;
|
||||
import it.unimi.dsi.fastutil.booleans.BooleanConsumer;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import net.minecraft.client.gui.screen.options.ControlsListWidget.CategoryEntry;
|
||||
import net.minecraft.client.gui.screen.option.ControlsListWidget.CategoryEntry;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import net.minecraft.client.gui.screen.options.ControlsListWidget.KeyBindingEntry;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.gui.screen.option.ControlsListWidget.KeyBindingEntry;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
|
||||
import net.minecraft.client.gui.widget.CyclingButtonWidget;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(CyclingButtonWidget.class)
|
||||
public interface AccessCyclingButtonWidgetFields {
|
||||
@Accessor
|
||||
Text getOptionText();
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
|
||||
import net.minecraft.client.option.Option;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(Option.class)
|
||||
public interface AccessOptionFields {
|
||||
@Accessor
|
||||
Text getKey();
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import net.minecraft.client.gui.Drawable;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.Selectable;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
@ -9,8 +11,14 @@ import java.util.List;
|
|||
@Mixin(Screen.class)
|
||||
public interface AccessScreenButtons {
|
||||
@Accessor
|
||||
List<AbstractButtonWidget> getButtons();
|
||||
List<Element> getChildren();
|
||||
|
||||
@Accessor
|
||||
List<Selectable> getSelectables();
|
||||
|
||||
@Accessor
|
||||
List<Drawable> getDrawables();
|
||||
|
||||
@Invoker
|
||||
<T extends AbstractButtonWidget> T callAddButton(T button);
|
||||
void callRemove(Element child);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import net.minecraft.client.options.StickyKeyBinding;
|
||||
import net.minecraft.client.option.StickyKeyBinding;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
|
|
@ -2,11 +2,11 @@ package chylex.bettercontrols.mixin;
|
|||
import chylex.bettercontrols.BetterControlsMod;
|
||||
import chylex.bettercontrols.input.KeyBindingWithModifier;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.options.ControlsListWidget;
|
||||
import net.minecraft.client.gui.screen.options.ControlsListWidget.CategoryEntry;
|
||||
import net.minecraft.client.gui.screen.options.ControlsListWidget.Entry;
|
||||
import net.minecraft.client.gui.screen.options.ControlsListWidget.KeyBindingEntry;
|
||||
import net.minecraft.client.gui.screen.options.ControlsOptionsScreen;
|
||||
import net.minecraft.client.gui.screen.option.ControlsListWidget;
|
||||
import net.minecraft.client.gui.screen.option.ControlsListWidget.CategoryEntry;
|
||||
import net.minecraft.client.gui.screen.option.ControlsListWidget.Entry;
|
||||
import net.minecraft.client.gui.screen.option.ControlsListWidget.KeyBindingEntry;
|
||||
import net.minecraft.client.gui.screen.option.ControlsOptionsScreen;
|
||||
import net.minecraft.client.gui.widget.ElementListWidget;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import chylex.bettercontrols.BetterControlsMod;
|
||||
import chylex.bettercontrols.input.KeyBindingWithModifier;
|
||||
import net.minecraft.client.options.GameOptions;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.option.GameOptions;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
|
@ -2,8 +2,8 @@ package chylex.bettercontrols.mixin;
|
|||
import chylex.bettercontrols.gui.ScreenPatcher;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.options.AccessibilityOptionsScreen;
|
||||
import net.minecraft.client.gui.screen.options.ControlsOptionsScreen;
|
||||
import net.minecraft.client.gui.screen.option.AccessibilityOptionsScreen;
|
||||
import net.minecraft.client.gui.screen.option.ControlsOptionsScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import chylex.bettercontrols.input.ToggleTrackerForStickyKey;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.options.StickyKeyBinding;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.option.StickyKeyBinding;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
|
|
@ -14,11 +14,11 @@ final class FlightHelper{
|
|||
}
|
||||
|
||||
static boolean isFlyingCreativeOrSpectator(final ClientPlayerEntity player) {
|
||||
return player.abilities.flying && (player.isCreative() || player.isSpectator());
|
||||
return player.getAbilities().flying && (player.isCreative() || player.isSpectator());
|
||||
}
|
||||
|
||||
static boolean shouldFlyOnGround(final ClientPlayerEntity player) {
|
||||
return cfg().flyOnGroundInCreative && player.isCreative() && player.abilities.flying;
|
||||
return cfg().flyOnGroundInCreative && player.isCreative() && player.getAbilities().flying;
|
||||
}
|
||||
|
||||
static float getFlightSpeed(final ClientPlayerEntity player, final boolean boost) {
|
||||
|
|
|
@ -153,7 +153,7 @@ public final class PlayerTicker{
|
|||
public void afterInputTick(final ClientPlayerEntity player) {
|
||||
final Input input = player.input;
|
||||
|
||||
if (MINECRAFT.currentScreen == null && !player.abilities.flying){
|
||||
if (MINECRAFT.currentScreen == null && !player.getAbilities().flying) {
|
||||
input.jumping |= toggleJump.tick();
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ public final class PlayerTicker{
|
|||
final float verticalVelocity = FlightHelper.getExtraVerticalVelocity(player, boost);
|
||||
|
||||
if (flightSpeed > 0F) {
|
||||
player.abilities.setFlySpeed(flightSpeed);
|
||||
player.getAbilities().setFlySpeed(flightSpeed);
|
||||
}
|
||||
|
||||
if (Math.abs(verticalVelocity) > 1E-5F && player == MINECRAFT.getCameraEntity()) {
|
||||
|
@ -230,7 +230,7 @@ public final class PlayerTicker{
|
|||
holdingSneakWhileTouchingGround = true;
|
||||
}
|
||||
else if (holdingSneakWhileTouchingGround) {
|
||||
player.abilities.flying = false;
|
||||
player.getAbilities().flying = false;
|
||||
player.sendAbilitiesUpdate();
|
||||
cancelLanding = false;
|
||||
}
|
||||
|
@ -260,9 +260,9 @@ public final class PlayerTicker{
|
|||
|
||||
if (player.isCreative()) {
|
||||
if (Key.wasPressed(cfg().keyToggleFlight)) {
|
||||
final boolean isFlying = !player.abilities.flying;
|
||||
final boolean isFlying = !player.getAbilities().flying;
|
||||
|
||||
player.abilities.flying = isFlying;
|
||||
player.getAbilities().flying = isFlying;
|
||||
player.sendAbilitiesUpdate();
|
||||
|
||||
if (isFlying) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package chylex.bettercontrols.util;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package chylex.bettercontrols.util;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.options.GameOptions;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.option.GameOptions;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
|
||||
public final class Statics {
|
||||
private Statics() {}
|
||||
|
|
|
@ -2,14 +2,16 @@
|
|||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "chylex.bettercontrols.mixin",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"compatibilityLevel": "JAVA_16",
|
||||
"mixins": [
|
||||
"AccessCameraFields",
|
||||
"AccessClientPlayerFields",
|
||||
"AccessControlsListCategory",
|
||||
"AccessControlsListKeyBinding",
|
||||
"AccessCyclingButtonWidgetFields",
|
||||
"AccessGameRendererFields",
|
||||
"AccessKeyBindingFields",
|
||||
"AccessOptionFields",
|
||||
"AccessPlayerFields",
|
||||
"AccessScreenButtons",
|
||||
"AccessStickyKeyBindingStateGetter",
|
||||
|
|
|
@ -28,6 +28,6 @@
|
|||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.7.4",
|
||||
"minecraft": ">=1.16.2"
|
||||
"minecraft": ">=1.17"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue