mirror of
https://github.com/chylex/Better-Controls.git
synced 2025-05-25 13:34:04 +02:00
Minor refactoring
This commit is contained in:
parent
d7d0bf072a
commit
0d1dfdee87
src/main/java/chylex/bettercontrols
gui
input
mixin
AccessCameraFields.javaAccessClientPlayerFields.javaAccessControlsListCategory.javaAccessControlsListKeyBinding.javaAccessCycleButtonFields.javaAccessOptionFields.javaAccessPlayerFields.javaAccessScreenButtons.javaAccessStickyKeyBindingStateGetter.javaHookClientPlayerFOV.javaHookClientPlayerInputTick.javaHookClientPlayerTick.javaHookControlsListWidget.javaHookOpenScreen.javaHookPlayerFlightSpeed.java
player
util
@ -13,6 +13,7 @@ import chylex.bettercontrols.input.SprintMode;
|
|||||||
import com.mojang.blaze3d.platform.InputConstants;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.KeyMapping;
|
import net.minecraft.client.KeyMapping;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
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.OptionsSubScreen;
|
||||||
@ -20,6 +21,7 @@ import net.minecraft.client.gui.screens.Screen;
|
|||||||
import net.minecraft.network.chat.CommonComponents;
|
import net.minecraft.network.chat.CommonComponents;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -31,7 +33,6 @@ import static chylex.bettercontrols.gui.OptionListWidget.ROW_WIDTH;
|
|||||||
import static chylex.bettercontrols.gui.OptionListWidget.col2;
|
import static chylex.bettercontrols.gui.OptionListWidget.col2;
|
||||||
import static chylex.bettercontrols.gui.OptionListWidget.col4;
|
import static chylex.bettercontrols.gui.OptionListWidget.col4;
|
||||||
import static chylex.bettercontrols.gui.elements.TextWidget.CENTER;
|
import static chylex.bettercontrols.gui.elements.TextWidget.CENTER;
|
||||||
import static chylex.bettercontrols.util.Statics.OPTIONS;
|
|
||||||
|
|
||||||
public class BetterControlsScreen extends OptionsSubScreen {
|
public class BetterControlsScreen extends OptionsSubScreen {
|
||||||
private static TextComponent text(final String text) {
|
private static TextComponent text(final String text) {
|
||||||
@ -229,7 +230,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
|||||||
private final List<KeyBindingWidget> allKeyBindings = new ArrayList<>();
|
private final List<KeyBindingWidget> allKeyBindings = new ArrayList<>();
|
||||||
|
|
||||||
public BetterControlsScreen(@Nullable final Screen parentScreen) {
|
public BetterControlsScreen(@Nullable final Screen parentScreen) {
|
||||||
super(parentScreen, OPTIONS, TITLE);
|
super(parentScreen, Minecraft.getInstance().options, TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -261,7 +262,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(final PoseStack matrices, final int mouseX, final int mouseY, final float delta) {
|
public void render(final @NotNull PoseStack matrices, final int mouseX, final int mouseY, final float delta) {
|
||||||
renderBackground(matrices);
|
renderBackground(matrices);
|
||||||
optionsWidget.render(matrices, mouseX, mouseY, delta);
|
optionsWidget.render(matrices, mouseX, mouseY, delta);
|
||||||
drawCenteredString(matrices, font, title, width / 2, 8, (255 << 16) | (255 << 8) | 255);
|
drawCenteredString(matrices, font, title, width / 2, 8, (255 << 16) | (255 << 8) | 255);
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
package chylex.bettercontrols.gui;
|
package chylex.bettercontrols.gui;
|
||||||
import chylex.bettercontrols.gui.OptionListWidget.Entry;
|
import chylex.bettercontrols.gui.OptionListWidget.Entry;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.components.AbstractWidget;
|
import net.minecraft.client.gui.components.AbstractWidget;
|
||||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
||||||
import net.minecraft.client.gui.components.Widget;
|
import net.minecraft.client.gui.components.Widget;
|
||||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
|
||||||
|
|
||||||
public final class OptionListWidget extends ContainerObjectSelectionList<Entry> {
|
public final class OptionListWidget extends ContainerObjectSelectionList<Entry> {
|
||||||
public static final int ROW_WIDTH = 408;
|
public static final int ROW_WIDTH = 408;
|
||||||
@ -30,11 +31,11 @@ public final class OptionListWidget extends ContainerObjectSelectionList<Entry>
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Offset getElementOffset(final GuiEventListener element) {
|
private static Offset getElementOffset(final GuiEventListener element) {
|
||||||
if (element instanceof OptionWidget) {
|
if (element instanceof final OptionWidget widget) {
|
||||||
return new Offset(((OptionWidget)element).getX(), ((OptionWidget)element).getY());
|
return new Offset(widget.getX(), widget.getY());
|
||||||
}
|
}
|
||||||
else if (element instanceof AbstractWidget) {
|
else if (element instanceof final AbstractWidget widget) {
|
||||||
return new Offset(((AbstractWidget)element).x, ((AbstractWidget)element).y);
|
return new Offset(widget.x, widget.y);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return new Offset(0, 0);
|
return new Offset(0, 0);
|
||||||
@ -48,18 +49,10 @@ public final class OptionListWidget extends ContainerObjectSelectionList<Entry>
|
|||||||
void setY(int y);
|
void setY(int y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class Offset {
|
private record Offset(int x, int y) {}
|
||||||
public final int x;
|
|
||||||
public final int y;
|
|
||||||
|
|
||||||
private Offset(final int x, final int y) {
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public OptionListWidget(final int top, final int bottom, final int width, final int height, final List<GuiEventListener> widgets, final int innerHeight) {
|
public OptionListWidget(final int top, final int bottom, final int width, final int height, final List<GuiEventListener> widgets, final int innerHeight) {
|
||||||
super(MINECRAFT, width, height, top, bottom, innerHeight);
|
super(Minecraft.getInstance(), width, height, top, bottom, innerHeight);
|
||||||
addEntry(new Entry(widgets));
|
addEntry(new Entry(widgets));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,33 +83,31 @@ public final class OptionListWidget extends ContainerObjectSelectionList<Entry>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends GuiEventListener> children() {
|
public @NotNull List<? extends GuiEventListener> children() {
|
||||||
return Collections.unmodifiableList(elements);
|
return Collections.unmodifiableList(elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends NarratableEntry> narratables() {
|
public @NotNull List<? extends NarratableEntry> narratables() {
|
||||||
return Collections.unmodifiableList(narratables);
|
return Collections.unmodifiableList(narratables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(final PoseStack 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) {
|
public void render(final @NotNull PoseStack 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 GuiEventListener element : elements) {
|
for (final GuiEventListener element : elements) {
|
||||||
final Offset offset = offsets.get(element);
|
final Offset offset = offsets.get(element);
|
||||||
|
|
||||||
if (element instanceof AbstractWidget) {
|
if (element instanceof final AbstractWidget widget) {
|
||||||
final AbstractWidget button = (AbstractWidget)element;
|
widget.x = x + offset.x;
|
||||||
button.x = x + offset.x;
|
widget.y = y + offset.y;
|
||||||
button.y = y + offset.y;
|
|
||||||
}
|
}
|
||||||
else if (element instanceof OptionWidget) {
|
else if (element instanceof final OptionWidget widget) {
|
||||||
final OptionWidget widget = (OptionWidget)element;
|
|
||||||
widget.setX(x + offset.x);
|
widget.setX(x + offset.x);
|
||||||
widget.setY(y + offset.y);
|
widget.setY(y + offset.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element instanceof Widget) {
|
if (element instanceof final Widget widget) {
|
||||||
((Widget)element).render(matrices, mouseX, mouseY, tickDelta);
|
widget.render(matrices, mouseX, mouseY, tickDelta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package chylex.bettercontrols.gui;
|
|||||||
import chylex.bettercontrols.mixin.AccessCycleButtonFields;
|
import chylex.bettercontrols.mixin.AccessCycleButtonFields;
|
||||||
import chylex.bettercontrols.mixin.AccessOptionFields;
|
import chylex.bettercontrols.mixin.AccessOptionFields;
|
||||||
import chylex.bettercontrols.mixin.AccessScreenButtons;
|
import chylex.bettercontrols.mixin.AccessScreenButtons;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.Option;
|
import net.minecraft.client.Option;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.client.gui.components.CycleButton;
|
import net.minecraft.client.gui.components.CycleButton;
|
||||||
@ -12,7 +13,6 @@ import net.minecraft.client.gui.screens.controls.ControlsScreen;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
|
||||||
|
|
||||||
public final class ScreenPatcher {
|
public final class ScreenPatcher {
|
||||||
private ScreenPatcher() {}
|
private ScreenPatcher() {}
|
||||||
@ -25,7 +25,7 @@ public final class ScreenPatcher {
|
|||||||
|
|
||||||
if (autoJump != null) {
|
if (autoJump != null) {
|
||||||
final Button widget = new Button(autoJump.x, autoJump.y, autoJump.getWidth(), autoJump.getHeight(), BetterControlsScreen.TITLE.plainCopy().append("..."), btn -> {
|
final Button widget = new Button(autoJump.x, autoJump.y, autoJump.getWidth(), autoJump.getHeight(), BetterControlsScreen.TITLE.plainCopy().append("..."), btn -> {
|
||||||
MINECRAFT.setScreen(new BetterControlsScreen(screen));
|
Minecraft.getInstance().setScreen(new BetterControlsScreen(screen));
|
||||||
});
|
});
|
||||||
|
|
||||||
accessor.callRemoveWidget(autoJump);
|
accessor.callRemoveWidget(autoJump);
|
||||||
@ -44,15 +44,15 @@ public final class ScreenPatcher {
|
|||||||
for (final GuiEventListener element : elements) {
|
for (final GuiEventListener element : elements) {
|
||||||
callback.accept(element);
|
callback.accept(element);
|
||||||
|
|
||||||
if (element instanceof ContainerEventHandler) {
|
if (element instanceof final ContainerEventHandler container) {
|
||||||
walkChildren(((ContainerEventHandler)element).children(), callback);
|
walkChildren(container.children(), callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Optional<CycleButton<?>> getOptionButton(final GuiEventListener element, final Option option) {
|
private static Optional<CycleButton<?>> getOptionButton(final GuiEventListener element, final Option option) {
|
||||||
if (element instanceof CycleButton<?> && ((AccessOptionFields)option).getCaption().equals(((AccessCycleButtonFields)element).getName())) {
|
if (element instanceof final CycleButton<?> button && ((AccessOptionFields)option).getCaption().equals(((AccessCycleButtonFields)button).getName())) {
|
||||||
return Optional.of((CycleButton<?>)element);
|
return Optional.of(button);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
@ -9,7 +9,7 @@ public class CycleButtonWidget<T> extends Button {
|
|||||||
private T selectedValue;
|
private T selectedValue;
|
||||||
|
|
||||||
public CycleButtonWidget(final int x, final int y, final int width, final int height, final List<Option<T>> options, final T selectedValue, final Consumer<T> onChanged) {
|
public CycleButtonWidget(final int x, final int y, final int width, final int height, final List<Option<T>> options, final T selectedValue, final Consumer<T> onChanged) {
|
||||||
super(x, y, width, height, Option.find(options, selectedValue).getText(), btn -> {});
|
super(x, y, width, height, Option.find(options, selectedValue).text(), btn -> {});
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.selectedValue = selectedValue;
|
this.selectedValue = selectedValue;
|
||||||
this.onChanged = onChanged;
|
this.onChanged = onChanged;
|
||||||
@ -29,8 +29,8 @@ public class CycleButtonWidget<T> extends Button {
|
|||||||
|
|
||||||
final Option<T> newSelectedOption = options.get(nextIndex);
|
final Option<T> newSelectedOption = options.get(nextIndex);
|
||||||
|
|
||||||
selectedValue = newSelectedOption.getValue();
|
selectedValue = newSelectedOption.value();
|
||||||
onChanged.accept(selectedValue);
|
onChanged.accept(selectedValue);
|
||||||
setMessage(newSelectedOption.getText());
|
setMessage(newSelectedOption.text());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ public final class DiscreteValueSliderWidget<T> extends AbstractSliderButton {
|
|||||||
private T selectedValue;
|
private T selectedValue;
|
||||||
|
|
||||||
public DiscreteValueSliderWidget(final int x, final int y, final int width, final int height, final List<Option<T>> options, final T selectedValue, final Consumer<T> onChanged) {
|
public DiscreteValueSliderWidget(final int x, final int y, final int width, final int height, final List<Option<T>> options, final T selectedValue, final Consumer<T> onChanged) {
|
||||||
super(x, y, width, height, Option.find(options, selectedValue).getText(), options.indexOf(Option.find(options, selectedValue)) / (options.size() - 1.0));
|
super(x, y, width, height, Option.find(options, selectedValue).text(), options.indexOf(Option.find(options, selectedValue)) / (options.size() - 1.0));
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.selectedValue = selectedValue;
|
this.selectedValue = selectedValue;
|
||||||
this.onChanged = onChanged;
|
this.onChanged = onChanged;
|
||||||
@ -26,12 +26,12 @@ public final class DiscreteValueSliderWidget<T> extends AbstractSliderButton {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateMessage() {
|
protected void updateMessage() {
|
||||||
setMessage(getSelectedOption().getText());
|
setMessage(getSelectedOption().text());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void applyValue() {
|
protected void applyValue() {
|
||||||
final T newSelectedValue = getSelectedOption().getValue();
|
final T newSelectedValue = getSelectedOption().value();
|
||||||
|
|
||||||
if (selectedValue != newSelectedValue) {
|
if (selectedValue != newSelectedValue) {
|
||||||
selectedValue = newSelectedValue;
|
selectedValue = newSelectedValue;
|
||||||
|
@ -2,16 +2,17 @@ package chylex.bettercontrols.gui.elements;
|
|||||||
import com.mojang.blaze3d.platform.InputConstants;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.KeyMapping;
|
import net.minecraft.client.KeyMapping;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.components.AbstractButton;
|
import net.minecraft.client.gui.components.AbstractButton;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
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 net.minecraft.network.chat.TextComponent;
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import static chylex.bettercontrols.util.Statics.OPTIONS;
|
|
||||||
|
|
||||||
public final class KeyBindingWidget extends Button {
|
public final class KeyBindingWidget extends Button {
|
||||||
private final KeyMapping binding;
|
private final KeyMapping binding;
|
||||||
@ -40,7 +41,7 @@ public final class KeyBindingWidget extends Button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MutableComponent createNarrationMessage() {
|
protected @NotNull MutableComponent createNarrationMessage() {
|
||||||
return binding.isUnbound() ? new TranslatableComponent("narrator.controls.unbound", bindingName) : new TranslatableComponent("narrator.controls.bound", bindingName, super.createNarrationMessage());
|
return binding.isUnbound() ? new TranslatableComponent("narrator.controls.unbound", bindingName) : new TranslatableComponent("narrator.controls.bound", bindingName, super.createNarrationMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ public final class KeyBindingWidget extends Button {
|
|||||||
boolean hasConflict = false;
|
boolean hasConflict = false;
|
||||||
|
|
||||||
if (!binding.isUnbound()) {
|
if (!binding.isUnbound()) {
|
||||||
for (final KeyMapping other : OPTIONS.keyMappings) {
|
for (final KeyMapping other : Minecraft.getInstance().options.keyMappings) {
|
||||||
if (binding != other && binding.same(other)) {
|
if (binding != other && binding.same(other)) {
|
||||||
hasConflict = true;
|
hasConflict = true;
|
||||||
break;
|
break;
|
||||||
|
@ -3,23 +3,7 @@ import net.minecraft.network.chat.Component;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public final class Option<T> {
|
public record Option<T>(T value, Component text) {
|
||||||
private final T value;
|
|
||||||
private final Component text;
|
|
||||||
|
|
||||||
public Option(final T value, final Component text) {
|
|
||||||
this.value = value;
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Component getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Option<T> find(final List<Option<T>> options, final T value) {
|
public static <T> Option<T> find(final List<Option<T>> options, final T value) {
|
||||||
return options.stream().filter(it -> Objects.equals(it.value, value)).findFirst().orElseGet(() -> options.get(0));
|
return options.stream().filter(it -> Objects.equals(it.value, value)).findFirst().orElseGet(() -> options.get(0));
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package chylex.bettercontrols.gui.elements;
|
package chylex.bettercontrols.gui.elements;
|
||||||
import chylex.bettercontrols.gui.OptionListWidget.OptionWidget;
|
import chylex.bettercontrols.gui.OptionListWidget.OptionWidget;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiComponent;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.util.FormattedCharSequence;
|
import net.minecraft.util.FormattedCharSequence;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
|
||||||
|
|
||||||
public final class TextWidget extends GuiComponent implements OptionWidget {
|
public final class TextWidget extends GuiComponent implements OptionWidget {
|
||||||
public static final int LEFT = 0;
|
public static final int LEFT = 0;
|
||||||
@ -57,8 +58,8 @@ public final class TextWidget extends GuiComponent implements OptionWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(final PoseStack matrices, final int mouseX, final int mouseY, final float delta) {
|
public void render(final @NotNull PoseStack matrices, final int mouseX, final int mouseY, final float delta) {
|
||||||
final Font textRenderer = MINECRAFT.font;
|
final Font textRenderer = Minecraft.getInstance().font;
|
||||||
final List<FormattedCharSequence> lines = textRenderer.split(text, width);
|
final List<FormattedCharSequence> lines = textRenderer.split(text, width);
|
||||||
final int lineHeight = textRenderer.lineHeight + 1;
|
final int lineHeight = textRenderer.lineHeight + 1;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ public class KeyBindingWithModifier extends KeyMapping {
|
|||||||
public static final String CATEGORY = "key.categories.bettercontrols";
|
public static final String CATEGORY = "key.categories.bettercontrols";
|
||||||
|
|
||||||
public static boolean checkCategoryMatches(final Component text) {
|
public static boolean checkCategoryMatches(final Component text) {
|
||||||
return text instanceof TranslatableComponent && CATEGORY.equals(((TranslatableComponent)text).getKey());
|
return text instanceof final TranslatableComponent t && CATEGORY.equals(t.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -5,6 +5,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||||||
|
|
||||||
@Mixin(Camera.class)
|
@Mixin(Camera.class)
|
||||||
public interface AccessCameraFields {
|
public interface AccessCameraFields {
|
||||||
@Accessor("eyeHeight")
|
@Accessor
|
||||||
void setCameraY(float y);
|
void setEyeHeight(float y);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||||||
|
|
||||||
@Mixin(LocalPlayer.class)
|
@Mixin(LocalPlayer.class)
|
||||||
public interface AccessClientPlayerFields {
|
public interface AccessClientPlayerFields {
|
||||||
@Accessor("sprintTriggerTime")
|
@Accessor
|
||||||
void setTicksLeftToDoubleTapSprint(int value);
|
void setSprintTriggerTime(int value);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||||||
|
|
||||||
@Mixin(CategoryEntry.class)
|
@Mixin(CategoryEntry.class)
|
||||||
public interface AccessControlsListCategory {
|
public interface AccessControlsListCategory {
|
||||||
@Accessor("name")
|
@Accessor
|
||||||
Component getText();
|
Component getName();
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||||||
|
|
||||||
@Mixin(KeyEntry.class)
|
@Mixin(KeyEntry.class)
|
||||||
public interface AccessControlsListKeyBinding {
|
public interface AccessControlsListKeyBinding {
|
||||||
@Accessor("key")
|
@Accessor
|
||||||
KeyMapping getBinding();
|
KeyMapping getKey();
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||||||
|
|
||||||
@Mixin(CycleButton.class)
|
@Mixin(CycleButton.class)
|
||||||
public interface AccessCycleButtonFields {
|
public interface AccessCycleButtonFields {
|
||||||
@Accessor("name")
|
@Accessor
|
||||||
Component getName();
|
Component getName();
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||||||
|
|
||||||
@Mixin(Option.class)
|
@Mixin(Option.class)
|
||||||
public interface AccessOptionFields {
|
public interface AccessOptionFields {
|
||||||
@Accessor("caption")
|
@Accessor
|
||||||
Component getCaption();
|
Component getCaption();
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||||||
|
|
||||||
@Mixin(Player.class)
|
@Mixin(Player.class)
|
||||||
public interface AccessPlayerFields {
|
public interface AccessPlayerFields {
|
||||||
@Accessor("jumpTriggerTime")
|
@Accessor
|
||||||
void setTicksLeftToDoubleTapFlight(int value);
|
void setJumpTriggerTime(int value);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import net.minecraft.client.gui.screens.Screen;
|
|||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
@SuppressWarnings("UnusedReturnValue")
|
||||||
@Mixin(Screen.class)
|
@Mixin(Screen.class)
|
||||||
public interface AccessScreenButtons {
|
public interface AccessScreenButtons {
|
||||||
@Invoker
|
@Invoker
|
||||||
|
@ -7,10 +7,10 @@ import java.util.function.BooleanSupplier;
|
|||||||
|
|
||||||
@Mixin(ToggleKeyMapping.class)
|
@Mixin(ToggleKeyMapping.class)
|
||||||
public interface AccessStickyKeyBindingStateGetter {
|
public interface AccessStickyKeyBindingStateGetter {
|
||||||
@Accessor("needsToggle")
|
@Accessor
|
||||||
BooleanSupplier getToggleGetter();
|
BooleanSupplier getNeedsToggle();
|
||||||
|
|
||||||
@Accessor("needsToggle")
|
@Accessor
|
||||||
@Mutable
|
@Mutable
|
||||||
void setToggleGetter(final BooleanSupplier toggleGetter);
|
void setNeedsToggle(final BooleanSupplier toggleGetter);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
package chylex.bettercontrols.mixin;
|
package chylex.bettercontrols.mixin;
|
||||||
|
|
||||||
import chylex.bettercontrols.player.PlayerTicker;
|
import chylex.bettercontrols.player.PlayerTicker;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.player.AbstractClientPlayer;
|
import net.minecraft.client.player.AbstractClientPlayer;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
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;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
import org.spongepowered.asm.mixin.injection.Slice;
|
import org.spongepowered.asm.mixin.injection.Slice;
|
||||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
|
||||||
|
|
||||||
@SuppressWarnings("MethodMayBeStatic")
|
|
||||||
@Mixin(AbstractClientPlayer.class)
|
@Mixin(AbstractClientPlayer.class)
|
||||||
public abstract class HookClientPlayerFOV {
|
public abstract class HookClientPlayerFOV {
|
||||||
@Redirect(
|
@Redirect(
|
||||||
@ -21,7 +20,7 @@ public abstract class HookClientPlayerFOV {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private boolean resetFOV(final float movementSpeed) {
|
private boolean resetFOV(final float movementSpeed) {
|
||||||
final LocalPlayer player = MINECRAFT.player;
|
final LocalPlayer player = Minecraft.getInstance().player;
|
||||||
return (player != null && PlayerTicker.get(player).shouldResetFOV(player)) || Float.isNaN(movementSpeed);
|
return (player != null && PlayerTicker.get(player).shouldResetFOV(player)) || Float.isNaN(movementSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package chylex.bettercontrols.mixin;
|
package chylex.bettercontrols.mixin;
|
||||||
import chylex.bettercontrols.player.PlayerTicker;
|
import chylex.bettercontrols.player.PlayerTicker;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.player.Input;
|
import net.minecraft.client.player.Input;
|
||||||
import net.minecraft.client.player.KeyboardInput;
|
import net.minecraft.client.player.KeyboardInput;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
@ -7,15 +8,15 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
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;
|
||||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
|
||||||
import static org.spongepowered.asm.mixin.injection.At.Shift.AFTER;
|
import static org.spongepowered.asm.mixin.injection.At.Shift.AFTER;
|
||||||
|
|
||||||
@Mixin(KeyboardInput.class)
|
@Mixin(KeyboardInput.class)
|
||||||
public abstract class HookClientPlayerInputTick {
|
public abstract class HookClientPlayerInputTick {
|
||||||
@Inject(method = "tick(Z)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/player/KeyboardInput;up:Z", ordinal = 0, shift = AFTER))
|
@Inject(method = "tick(Z)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/player/KeyboardInput;up:Z", ordinal = 0, shift = AFTER))
|
||||||
private void afterInputTick(final CallbackInfo info) {
|
private void afterInputTick(final CallbackInfo info) {
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
final Input input = (Input)(Object)this;
|
final Input input = (Input)(Object)this;
|
||||||
final LocalPlayer player = MINECRAFT.player;
|
final LocalPlayer player = Minecraft.getInstance().player;
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
PlayerTicker.get(player).afterInputAssignsPressingForward(input);
|
PlayerTicker.get(player).afterInputAssignsPressingForward(input);
|
||||||
|
@ -18,18 +18,21 @@ public abstract class HookClientPlayerTick extends AbstractClientPlayer {
|
|||||||
|
|
||||||
@Inject(method = "aiStep()V", at = @At("HEAD"))
|
@Inject(method = "aiStep()V", at = @At("HEAD"))
|
||||||
private void atHead(final CallbackInfo info) {
|
private void atHead(final CallbackInfo info) {
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
final LocalPlayer player = (LocalPlayer)(Object)this;
|
final LocalPlayer player = (LocalPlayer)(Object)this;
|
||||||
PlayerTicker.get(player).atHead(player);
|
PlayerTicker.get(player).atHead(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "aiStep()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/Input;tick(Z)V", ordinal = 0, shift = AFTER))
|
@Inject(method = "aiStep()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/Input;tick(Z)V", ordinal = 0, shift = AFTER))
|
||||||
private void afterInputTick(final CallbackInfo info) {
|
private void afterInputTick(final CallbackInfo info) {
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
final LocalPlayer player = (LocalPlayer)(Object)this;
|
final LocalPlayer player = (LocalPlayer)(Object)this;
|
||||||
PlayerTicker.get(player).afterInputTick(player);
|
PlayerTicker.get(player).afterInputTick(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "aiStep()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/AbstractClientPlayer;aiStep()V", ordinal = 0, shift = AFTER))
|
@Inject(method = "aiStep()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/AbstractClientPlayer;aiStep()V", ordinal = 0, shift = AFTER))
|
||||||
private void afterSuperCall(final CallbackInfo info) {
|
private void afterSuperCall(final CallbackInfo info) {
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
final LocalPlayer player = (LocalPlayer)(Object)this;
|
final LocalPlayer player = (LocalPlayer)(Object)this;
|
||||||
PlayerTicker.get(player).afterSuperCall(player);
|
PlayerTicker.get(player).afterSuperCall(player);
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,11 @@ public abstract class HookControlsListWidget extends ContainerObjectSelectionLis
|
|||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
public void init(final ControlsScreen parent, final Minecraft client, final CallbackInfo ci) {
|
public void init(final ControlsScreen parent, final Minecraft client, final CallbackInfo ci) {
|
||||||
children().removeIf(it -> {
|
children().removeIf(it -> {
|
||||||
if (it instanceof CategoryEntry && KeyBindingWithModifier.checkCategoryMatches(((AccessControlsListCategory)it).getText())) {
|
if (it instanceof final CategoryEntry entry && KeyBindingWithModifier.checkCategoryMatches(((AccessControlsListCategory)entry).getName())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it instanceof KeyEntry && ArrayUtils.contains(BetterControlsCommon.getConfig().getAllKeyBindings(), ((AccessControlsListKeyBinding)it).getBinding())) {
|
if (it instanceof final KeyEntry entry && ArrayUtils.contains(BetterControlsCommon.getConfig().getAllKeyBindings(), ((AccessControlsListKeyBinding)entry).getKey())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,14 +8,12 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
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;
|
||||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
|
||||||
|
|
||||||
@SuppressWarnings("MethodMayBeStatic")
|
|
||||||
@Mixin(value = Minecraft.class, priority = 100)
|
@Mixin(value = Minecraft.class, priority = 100)
|
||||||
public abstract class HookOpenScreen {
|
public abstract class HookOpenScreen {
|
||||||
@Inject(method = "setScreen", at = @At("TAIL"))
|
@Inject(method = "setScreen", at = @At("TAIL"))
|
||||||
private void openScreen(final Screen ignore, final CallbackInfo ci) {
|
private void openScreen(final Screen ignore, final CallbackInfo ci) {
|
||||||
final Screen screen = MINECRAFT.screen;
|
final Screen screen = Minecraft.getInstance().screen;
|
||||||
|
|
||||||
if (screen != null && !Screen.hasAltDown()) {
|
if (screen != null && !Screen.hasAltDown()) {
|
||||||
if (screen.getClass() == ControlsScreen.class) {
|
if (screen.getClass() == ControlsScreen.class) {
|
||||||
|
@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
import org.spongepowered.asm.mixin.injection.Slice;
|
import org.spongepowered.asm.mixin.injection.Slice;
|
||||||
|
|
||||||
@SuppressWarnings("MethodMayBeStatic")
|
@SuppressWarnings("SameReturnValue")
|
||||||
@Mixin(Player.class)
|
@Mixin(Player.class)
|
||||||
public abstract class HookPlayerFlightSpeed extends LivingEntity {
|
public abstract class HookPlayerFlightSpeed extends LivingEntity {
|
||||||
protected HookPlayerFlightSpeed(final EntityType<? extends LivingEntity> type, final Level world) {
|
protected HookPlayerFlightSpeed(final EntityType<? extends LivingEntity> type, final Level world) {
|
||||||
|
@ -10,18 +10,23 @@ import chylex.bettercontrols.mixin.AccessClientPlayerFields;
|
|||||||
import chylex.bettercontrols.mixin.AccessPlayerFields;
|
import chylex.bettercontrols.mixin.AccessPlayerFields;
|
||||||
import chylex.bettercontrols.mixin.AccessStickyKeyBindingStateGetter;
|
import chylex.bettercontrols.mixin.AccessStickyKeyBindingStateGetter;
|
||||||
import net.minecraft.client.Camera;
|
import net.minecraft.client.Camera;
|
||||||
|
import net.minecraft.client.KeyMapping;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.Options;
|
||||||
import net.minecraft.client.player.Input;
|
import net.minecraft.client.player.Input;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.function.BooleanSupplier;
|
import java.util.function.BooleanSupplier;
|
||||||
import static chylex.bettercontrols.util.Statics.KEY_FORWARD;
|
|
||||||
import static chylex.bettercontrols.util.Statics.KEY_JUMP;
|
|
||||||
import static chylex.bettercontrols.util.Statics.KEY_SNEAK;
|
|
||||||
import static chylex.bettercontrols.util.Statics.KEY_SPRINT;
|
|
||||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
|
||||||
import static chylex.bettercontrols.util.Statics.OPTIONS;
|
|
||||||
|
|
||||||
public final class PlayerTicker {
|
public final class PlayerTicker {
|
||||||
|
private static final Minecraft MINECRAFT = Minecraft.getInstance();
|
||||||
|
private static final Options OPTIONS = MINECRAFT.options;
|
||||||
|
|
||||||
|
private static final KeyMapping KEY_SPRINT = OPTIONS.keySprint;
|
||||||
|
private static final KeyMapping KEY_SNEAK = OPTIONS.keyShift;
|
||||||
|
private static final KeyMapping KEY_FORWARD = OPTIONS.keyUp;
|
||||||
|
private static final KeyMapping KEY_JUMP = OPTIONS.keyJump;
|
||||||
|
|
||||||
private static PlayerTicker ticker = new PlayerTicker(null);
|
private static PlayerTicker ticker = new PlayerTicker(null);
|
||||||
|
|
||||||
public static PlayerTicker get(final LocalPlayer player) {
|
public static PlayerTicker get(final LocalPlayer player) {
|
||||||
@ -63,13 +68,13 @@ public final class PlayerTicker {
|
|||||||
|
|
||||||
private void setup() {
|
private void setup() {
|
||||||
final AccessStickyKeyBindingStateGetter sprint = (AccessStickyKeyBindingStateGetter)KEY_SPRINT;
|
final AccessStickyKeyBindingStateGetter sprint = (AccessStickyKeyBindingStateGetter)KEY_SPRINT;
|
||||||
BooleanSupplier getter = sprint.getToggleGetter();
|
BooleanSupplier getter = sprint.getNeedsToggle();
|
||||||
|
|
||||||
if (getter instanceof SprintPressGetter) {
|
if (getter instanceof final SprintPressGetter g) {
|
||||||
getter = ((SprintPressGetter)getter).getWrapped();
|
getter = g.wrapped();
|
||||||
}
|
}
|
||||||
|
|
||||||
sprint.setToggleGetter(new SprintPressGetter(getter, () -> temporarySprintTimer > 0));
|
sprint.setNeedsToggle(new SprintPressGetter(getter, () -> temporarySprintTimer > 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void atHead(final LocalPlayer player) {
|
public void atHead(final LocalPlayer player) {
|
||||||
@ -78,11 +83,11 @@ public final class PlayerTicker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!cfg().doubleTapForwardToSprint) {
|
if (!cfg().doubleTapForwardToSprint) {
|
||||||
((AccessClientPlayerFields)player).setTicksLeftToDoubleTapSprint(0);
|
((AccessClientPlayerFields)player).setSprintTriggerTime(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cfg().doubleTapJumpToToggleFlight) {
|
if (!cfg().doubleTapJumpToToggleFlight) {
|
||||||
((AccessPlayerFields)player).setTicksLeftToDoubleTapFlight(0);
|
((AccessPlayerFields)player).setJumpTriggerTime(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
final SprintMode sprintMode = cfg().sprintMode;
|
final SprintMode sprintMode = cfg().sprintMode;
|
||||||
@ -282,7 +287,7 @@ public final class PlayerTicker {
|
|||||||
final Camera camera = MINECRAFT.gameRenderer.getMainCamera();
|
final Camera camera = MINECRAFT.gameRenderer.getMainCamera();
|
||||||
|
|
||||||
if (camera.getEntity() == player) {
|
if (camera.getEntity() == player) {
|
||||||
((AccessCameraFields)camera).setCameraY(player.getEyeHeight());
|
((AccessCameraFields)camera).setEyeHeight(player.getEyeHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,7 @@
|
|||||||
package chylex.bettercontrols.player;
|
package chylex.bettercontrols.player;
|
||||||
import java.util.function.BooleanSupplier;
|
import java.util.function.BooleanSupplier;
|
||||||
|
|
||||||
final class SprintPressGetter implements BooleanSupplier {
|
record SprintPressGetter(BooleanSupplier wrapped, BooleanSupplier or) implements BooleanSupplier {
|
||||||
private final BooleanSupplier wrapped;
|
|
||||||
private final BooleanSupplier or;
|
|
||||||
|
|
||||||
public SprintPressGetter(final BooleanSupplier wrapped, final BooleanSupplier or) {
|
|
||||||
this.wrapped = wrapped;
|
|
||||||
this.or = or;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BooleanSupplier getWrapped() {
|
|
||||||
return wrapped;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getAsBoolean() {
|
public boolean getAsBoolean() {
|
||||||
return wrapped.getAsBoolean() || or.getAsBoolean();
|
return wrapped.getAsBoolean() || or.getAsBoolean();
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
package chylex.bettercontrols.util;
|
|
||||||
import net.minecraft.client.KeyMapping;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.Options;
|
|
||||||
|
|
||||||
public final class Statics {
|
|
||||||
private Statics() {}
|
|
||||||
|
|
||||||
public static final Minecraft MINECRAFT = Minecraft.getInstance();
|
|
||||||
public static final Options OPTIONS = MINECRAFT.options;
|
|
||||||
|
|
||||||
public static final KeyMapping KEY_SPRINT = OPTIONS.keySprint;
|
|
||||||
public static final KeyMapping KEY_SNEAK = OPTIONS.keyShift;
|
|
||||||
public static final KeyMapping KEY_FORWARD = OPTIONS.keyUp;
|
|
||||||
public static final KeyMapping KEY_JUMP = OPTIONS.keyJump;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user