forked from Clones/Controlify
server support
This commit is contained in:
@ -96,7 +96,7 @@ public class ControllerCarouselScreen extends Screen implements ScreenController
|
||||
|
||||
public void refreshControllers() {
|
||||
Controller<?, ?> prevSelectedController;
|
||||
if (carouselEntries != null) {
|
||||
if (carouselEntries != null && !carouselEntries.isEmpty()) {
|
||||
carouselEntries.forEach(this::removeWidget);
|
||||
prevSelectedController = carouselEntries.get(carouselIndex).controller;
|
||||
} else {
|
||||
|
@ -2,6 +2,7 @@ package dev.isxander.controlify.gui.screen;
|
||||
|
||||
import dev.isxander.controlify.Controlify;
|
||||
import dev.isxander.controlify.controller.Controller;
|
||||
import dev.isxander.controlify.utils.Log;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
@ -124,7 +125,7 @@ public class ControllerDeadzoneCalibrationScreen extends Screen {
|
||||
var deadzone = (float)Mth.clamp(0.05 * Math.ceil(minDeadzone / 0.05), 0, 0.95);
|
||||
|
||||
if (Float.isNaN(deadzone)) {
|
||||
Controlify.LOGGER.warn("Deadzone for axis {} is NaN, using default deadzone.", i);
|
||||
Log.LOGGER.warn("Deadzone for axis {} is NaN, using default deadzone.", i);
|
||||
deadzone = controller.defaultConfig().getDeadzone(i);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
package dev.isxander.controlify.gui.screen;
|
||||
|
||||
import dev.isxander.controlify.Controlify;
|
||||
import dev.isxander.controlify.api.ControlifyApi;
|
||||
import dev.isxander.controlify.config.GlobalSettings;
|
||||
import dev.isxander.controlify.reacharound.ReachAroundHandler;
|
||||
import dev.isxander.controlify.reacharound.ReachAroundMode;
|
||||
import dev.isxander.yacl3.api.*;
|
||||
import dev.isxander.yacl3.api.controller.BooleanControllerBuilder;
|
||||
@ -37,9 +39,11 @@ public class GlobalSettingsScreenFactory {
|
||||
.text(Component.translatable("controlify.gui.reach_around.tooltip"))
|
||||
.text(Component.translatable("controlify.gui.reach_around.tooltip.parity").withStyle(ChatFormatting.GRAY))
|
||||
.text(state == ReachAroundMode.EVERYWHERE ? Component.translatable("controlify.gui.reach_around.tooltip.warning").withStyle(ChatFormatting.RED) : Component.empty())
|
||||
.text(!ReachAroundHandler.reachAroundPolicy ? Component.translatable("controlify.gui.reach_around.tooltip.server_disabled").withStyle(ChatFormatting.GOLD) : Component.empty())
|
||||
.build())
|
||||
.binding(GlobalSettings.DEFAULT.reachAround, () -> globalSettings.reachAround, v -> globalSettings.reachAround = v)
|
||||
.binding(GlobalSettings.DEFAULT.reachAround, () -> ReachAroundHandler.reachAroundPolicy ? globalSettings.reachAround : ReachAroundMode.OFF, v -> globalSettings.reachAround = v)
|
||||
.controller(opt -> EnumControllerBuilder.create(opt).enumClass(ReachAroundMode.class))
|
||||
.available(ReachAroundHandler.reachAroundPolicy)
|
||||
.build())
|
||||
.option(Option.<Boolean>createBuilder()
|
||||
.name(Component.translatable("controlify.gui.ui_sounds"))
|
||||
@ -49,6 +53,17 @@ public class GlobalSettingsScreenFactory {
|
||||
.binding(GlobalSettings.DEFAULT.uiSounds, () -> globalSettings.uiSounds, v -> globalSettings.uiSounds = v)
|
||||
.controller(TickBoxControllerBuilder::create)
|
||||
.build())
|
||||
.option(Option.<Boolean>createBuilder()
|
||||
.name(Component.translatable("controlify.gui.allow_server_rumble"))
|
||||
.description(OptionDescription.createBuilder()
|
||||
.text(Component.translatable("controlify.gui.allow_server_rumble.tooltip"))
|
||||
.build())
|
||||
.binding(GlobalSettings.DEFAULT.allowServerRumble, () -> globalSettings.allowServerRumble, v -> globalSettings.allowServerRumble = v)
|
||||
.controller(TickBoxControllerBuilder::create)
|
||||
.listener((opt, val) -> {
|
||||
if (!val) ControlifyApi.get().getCurrentController().ifPresent(c -> c.rumbleManager().clearEffects());
|
||||
})
|
||||
.build())
|
||||
.option(Option.<Boolean>createBuilder()
|
||||
.name(Component.translatable("controlify.gui.notify_low_battery"))
|
||||
.description(OptionDescription.createBuilder()
|
||||
|
Reference in New Issue
Block a user