mirror of
https://github.com/chylex/Better-Controls.git
synced 2025-04-22 18:15:46 +02:00
Fix or suppress some IDEA inspections
This commit is contained in:
parent
76af39fb18
commit
5ce4f2a975
Forge/src/main/resources/META-INF
src/main/java/chylex/bettercontrols
config
gui
player
@ -1,15 +1,15 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[0,)"
|
||||
|
||||
authors = "${author}"
|
||||
license = "${license}"
|
||||
issueTrackerURL = "${issuesURL}"
|
||||
|
||||
[[mods]]
|
||||
modId = "${id}"
|
||||
version = "${version}"
|
||||
displayName = "${name}"
|
||||
description = "${description}"
|
||||
authors = "${author}"
|
||||
version = "${version}"
|
||||
logoFile = "icon.png"
|
||||
|
||||
[[dependencies.${id}]]
|
||||
|
@ -24,10 +24,12 @@ final class Json {
|
||||
return obj.has(key) ? obj.get(key).getAsBoolean() : defaultValue;
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
static <T extends Enum<T>> void setEnum(final JsonObject obj, final String key, final T value) {
|
||||
obj.addProperty(key, value.name());
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
static <T extends Enum<T>> T getEnum(final JsonObject obj, final String key, final T defaultValue, final Class<T> enumClass) {
|
||||
if (!obj.has(key)) {
|
||||
return defaultValue;
|
||||
|
@ -8,6 +8,7 @@ import chylex.bettercontrols.gui.elements.TextWidget;
|
||||
import chylex.bettercontrols.input.KeyBindingWithModifier;
|
||||
import chylex.bettercontrols.input.ModifierKey;
|
||||
import chylex.bettercontrols.input.SprintMode;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import it.unimi.dsi.fastutil.booleans.BooleanConsumer;
|
||||
@ -88,7 +89,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
||||
private int generateFlightOptions(int y, final List<GuiEventListener> elements) {
|
||||
final BetterControlsConfig cfg = BetterControlsCommon.getConfig();
|
||||
|
||||
final List<Option<Float>> flightSpeedOptions = Arrays.asList(
|
||||
final ImmutableList<Option<Float>> flightSpeedOptions = ImmutableList.of(
|
||||
new Option<>(Float.valueOf(0.25F), text("0.25x")),
|
||||
new Option<>(Float.valueOf(0.50F), text("0.5x")),
|
||||
new Option<>(Float.valueOf(0.75F), text("0.75x")),
|
||||
@ -103,7 +104,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
||||
new Option<>(Float.valueOf(8.00F), text("8x"))
|
||||
);
|
||||
|
||||
final List<Option<Float>> flightVerticalBoostOptions = Arrays.asList(
|
||||
final ImmutableList<Option<Float>> flightVerticalBoostOptions = ImmutableList.of(
|
||||
new Option<>(Float.valueOf(0.00F), text("None")),
|
||||
new Option<>(Float.valueOf(0.25F), text("+25%")),
|
||||
new Option<>(Float.valueOf(0.50F), text("+50%")),
|
||||
@ -219,6 +220,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
||||
private KeyBindingWidget editingKeyBinding;
|
||||
private final List<KeyBindingWidget> allKeyBindings = new ArrayList<>();
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
public BetterControlsScreen(@Nullable final Screen parentScreen) {
|
||||
super(parentScreen, Minecraft.getInstance().options, TITLE);
|
||||
}
|
||||
@ -242,7 +244,9 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
||||
elements.add(new TextWidget(0, y, ROW_WIDTH, ROW_HEIGHT, text("Miscellaneous"), CENTER));
|
||||
y = generateMiscellaneousOptions(y + ROW_HEIGHT, elements) + TITLE_MARGIN_TOP;
|
||||
|
||||
//noinspection DataFlowIssue
|
||||
addRenderableWidget(Button.builder(CommonComponents.GUI_DONE, btn -> minecraft.setScreen(lastScreen)).pos(width / 2 - 99, height - 29).size(200, 20).build());
|
||||
|
||||
addWidget(optionsWidget = new OptionListWidget(21, height - 32, width, height, elements, y - TITLE_MARGIN_TOP + BOTTOM_PADDING));
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
package chylex.bettercontrols.gui.elements;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.client.gui.components.AbstractSliderButton;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.util.Mth;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public final class DiscreteValueSliderWidget<T> extends AbstractSliderButton {
|
||||
private final Component narration;
|
||||
private final List<Option<T>> options;
|
||||
private final ImmutableList<Option<T>> options;
|
||||
private final Consumer<T> onChanged;
|
||||
private T selectedValue;
|
||||
|
||||
public DiscreteValueSliderWidget(final int x, final int y, final int width, final int height, final Component narration, 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 Component narration, final ImmutableList<Option<T>> options, final T selectedValue, final Consumer<T> onChanged) {
|
||||
super(x, y, width, height, Option.find(options, selectedValue).text(), options.indexOf(Option.find(options, selectedValue)) / (options.size() - 1.0));
|
||||
this.narration = narration;
|
||||
this.options = options;
|
||||
@ -21,7 +21,7 @@ public final class DiscreteValueSliderWidget<T> extends AbstractSliderButton {
|
||||
this.onChanged = onChanged;
|
||||
}
|
||||
|
||||
public DiscreteValueSliderWidget(final int x, final int y, final int width, final Component narration, final List<Option<T>> options, final T selectedValue, final Consumer<T> onChanged) {
|
||||
public DiscreteValueSliderWidget(final int x, final int y, final int width, final Component narration, final ImmutableList<Option<T>> options, final T selectedValue, final Consumer<T> onChanged) {
|
||||
this(x, y, width, 20, narration, options, selectedValue, onChanged);
|
||||
}
|
||||
|
||||
|
@ -149,6 +149,7 @@ public final class PlayerTicker {
|
||||
|
||||
public void afterInputAssignsPressingForward(final Input input) {
|
||||
if (MINECRAFT.screen == null) {
|
||||
//noinspection NonShortCircuitBooleanExpression
|
||||
input.up |= toggleWalkForward.tick();
|
||||
}
|
||||
}
|
||||
@ -157,6 +158,7 @@ public final class PlayerTicker {
|
||||
final Input input = player.input;
|
||||
|
||||
if (MINECRAFT.screen == null && !player.getAbilities().flying) {
|
||||
//noinspection NonShortCircuitBooleanExpression
|
||||
input.jumping |= toggleJump.tick();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user