mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-13 15:25:08 +01:00
🔖 LambdaControls v1.4.0: Analog movements, 1.16.2 compat, better API, etc.
This commit is contained in:
15
CHANGELOG.md
15
CHANGELOG.md
@@ -74,3 +74,18 @@ This update also has a backport 1.14.4 version ([#9](https://github.com/LambdAur
|
||||
- Improved reacharound API.
|
||||
- Improved [REI](https://www.curseforge.com/minecraft/mc-mods/roughly-enough-items) compatibility.
|
||||
|
||||
## v1.4.0
|
||||
|
||||
- Added analog movements ([#10](https://github.com/LambdAurora/LambdaControls/issues/10)).
|
||||
- Improved Ok Zoomer compability.
|
||||
- Updated [SpruceUI](https://github.com/LambdAurora/SpruceUI) to 1.5.8 to ensure 1.16.2 compability.
|
||||
- Internal changes:
|
||||
- Added analog input value to button bindings.
|
||||
- Replace lot of strings with Texts.
|
||||
- Improved block outline rendering injection.
|
||||
- Shadow library jars instead of Jar-in-Jar.
|
||||
- Fixed crash in inventory ([#16](https://github.com/LambdAurora/LambdaControls/issues/16))
|
||||
- WIP:
|
||||
- Started to work on action ring.
|
||||
- Will allow for better compability with other mods.
|
||||
- Might be interesting for keyboard users too.
|
||||
|
||||
@@ -7,13 +7,15 @@
|
||||

|
||||
[](https://www.curseforge.com/minecraft/mc-mods/lambdacontrols)
|
||||
|
||||
A Fabric Minecraft mod which adds better controls like controller support.
|
||||
A Fabric Minecraft mod which adds better controls, reach-around and controller support.
|
||||
|
||||
## What's this mod?
|
||||
|
||||
This mod adds better controls, reach-around features, etc.
|
||||
|
||||
Haven't you dreamed to travel in your modded Minecraft world with your controller? Yes? Then this mod is made for you!
|
||||
|
||||
This mod adds a controller support (and an experimental touchscreen support).
|
||||
This mod also adds controller support.
|
||||
|
||||
## ✅ Features:
|
||||
|
||||
@@ -21,7 +23,7 @@ This mod adds a controller support (and an experimental touchscreen support).
|
||||
- Touchscreen support (very experimental and buggy).
|
||||
- Keyboard controls to look around.
|
||||
- Toggleable on screen button indicator (like in Bedrock Edition).
|
||||
- Vertical reacharound.
|
||||
- Vertical reach-around.
|
||||
- Many Bedrock Edition features:
|
||||
- Toggleable fly drifting
|
||||
- Front block placing (be careful with this one)
|
||||
|
||||
@@ -20,14 +20,6 @@ allprojects {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this task, sources will not be generated.
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = "sources"
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
@@ -15,6 +15,8 @@ dependencies {
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
publishing {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import net.fabricmc.loom.task.RemapJarTask
|
||||
|
||||
plugins {
|
||||
id 'fabric-loom' version '0.4-SNAPSHOT'
|
||||
id 'java-library'
|
||||
@@ -38,28 +40,27 @@ dependencies {
|
||||
//to change the versions see the gradle.properties file
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}"
|
||||
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
|
||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||
modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
modCompile "io.github.prospector:modmenu:${project.modmenu_version}"
|
||||
modCompile "com.github.lambdaurora:spruceui:${project.spruceui_version}"
|
||||
modImplementation "io.github.prospector:modmenu:${project.modmenu_version}"
|
||||
modImplementation "com.github.lambdaurora:spruceui:${project.spruceui_version}"
|
||||
include "com.github.lambdaurora:spruceui:${project.spruceui_version}"
|
||||
|
||||
// Compatibility mods
|
||||
modCompile "io.github.joaoh1:okzoomer:4.0.0-alpha.3.1.16.pre5"
|
||||
modCompile "me.shedaniel:RoughlyEnoughItems:4.5.5"
|
||||
modImplementation "io.github.joaoh1:okzoomer:4.0.0-alpha.4.1.16.1"
|
||||
modImplementation "me.shedaniel:RoughlyEnoughItems:4.5.5"
|
||||
|
||||
api project(":core")
|
||||
shadow project(":core")
|
||||
include "org.jetbrains:annotations:17.0.0"
|
||||
include("org.aperlambda:lambdajcommon:1.8.0") {
|
||||
shadow("org.aperlambda:lambdajcommon:1.8.0") {
|
||||
exclude group: 'com.google.code.gson'
|
||||
exclude group: 'com.google.guava'
|
||||
}
|
||||
include "com.electronwill.night-config:core:3.5.3"
|
||||
include "com.electronwill.night-config:toml:3.5.3"
|
||||
shadow "com.electronwill.night-config:core:3.5.3"
|
||||
shadow "com.electronwill.night-config:toml:3.5.3"
|
||||
}
|
||||
|
||||
processResources {
|
||||
@@ -78,6 +79,8 @@ processResources {
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
jar {
|
||||
@@ -92,6 +95,26 @@ jar {
|
||||
}
|
||||
}
|
||||
|
||||
task shadowJar(type: Jar) {
|
||||
archiveClassifier.set("dev")
|
||||
|
||||
from sourceSets.main.output
|
||||
|
||||
from {
|
||||
configurations.shadow.collect {
|
||||
it.isDirectory() ? it : zipTree(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task shadowRemapJar(type: RemapJarTask) {
|
||||
dependsOn shadowJar
|
||||
|
||||
input = file("${project.buildDir}/libs/$archivesBaseName-$version-dev.jar")
|
||||
archiveName = "${archivesBaseName}-${version}.jar"
|
||||
addNestedDependencies = true
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
publishing {
|
||||
publications {
|
||||
@@ -107,5 +130,6 @@ publishing {
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar.dependsOn(":core:jar")
|
||||
build.dependsOn(":core:build")
|
||||
publish.dependsOn(":core:publish")
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
|
||||
package me.lambdaurora.lambdacontrols.client;
|
||||
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -20,7 +21,7 @@ import java.util.Optional;
|
||||
* Represents a controller type.
|
||||
*
|
||||
* @author LambdAurora
|
||||
* @version 1.0.0
|
||||
* @version 1.4.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public enum ControllerType implements Nameable
|
||||
@@ -33,10 +34,12 @@ public enum ControllerType implements Nameable
|
||||
OUYA(5);
|
||||
|
||||
private final int id;
|
||||
private final Text text;
|
||||
|
||||
ControllerType(int id)
|
||||
{
|
||||
this.id = id;
|
||||
this.text = new TranslatableText(this.getTranslationKey());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +57,7 @@ public enum ControllerType implements Nameable
|
||||
*
|
||||
* @return The next available controller type.
|
||||
*/
|
||||
public ControllerType next()
|
||||
public @NotNull ControllerType next()
|
||||
{
|
||||
ControllerType[] v = values();
|
||||
if (v.length == this.ordinal() + 1)
|
||||
@@ -63,13 +66,23 @@ public enum ControllerType implements Nameable
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the translated name of this controller type.
|
||||
* Returns the translation key of this controller type.
|
||||
*
|
||||
* @return The translated name of this controller type.
|
||||
* @return The translation key.
|
||||
*/
|
||||
public String getTranslatedName()
|
||||
public @NotNull String getTranslationKey()
|
||||
{
|
||||
return I18n.translate("lambdacontrols.controller_type." + this.getName());
|
||||
return "lambdacontrols.controller_type." + this.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the translated text of this controller type.
|
||||
*
|
||||
* @return The translated text of this controller type.
|
||||
*/
|
||||
public @NotNull Text getTranslatedText()
|
||||
{
|
||||
return this.text;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,7 +97,7 @@ public enum ControllerType implements Nameable
|
||||
* @param id The identifier of the controller type.
|
||||
* @return The controller type if found, else empty.
|
||||
*/
|
||||
public static Optional<ControllerType> byId(@NotNull String id)
|
||||
public static @NotNull Optional<ControllerType> byId(@NotNull String id)
|
||||
{
|
||||
return Arrays.stream(values()).filter(mode -> mode.getName().equalsIgnoreCase(id)).findFirst();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
package me.lambdaurora.lambdacontrols.client;
|
||||
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -20,7 +22,7 @@ import java.util.Optional;
|
||||
* Represents the hud side which is the side where the movements buttons are.
|
||||
*
|
||||
* @author LambdAurora
|
||||
* @version 1.0.0
|
||||
* @version 1.4.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public enum HudSide implements Nameable
|
||||
@@ -28,12 +30,19 @@ public enum HudSide implements Nameable
|
||||
LEFT,
|
||||
RIGHT;
|
||||
|
||||
private final Text text;
|
||||
|
||||
HudSide()
|
||||
{
|
||||
this.text = new TranslatableText(this.getTranslationKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next side available.
|
||||
*
|
||||
* @return The next available side.
|
||||
*/
|
||||
public HudSide next()
|
||||
public @NotNull HudSide next()
|
||||
{
|
||||
HudSide[] v = values();
|
||||
if (v.length == this.ordinal() + 1)
|
||||
@@ -42,13 +51,23 @@ public enum HudSide implements Nameable
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the translated name of this hud side.
|
||||
* Returns the translation key of this hud side.
|
||||
*
|
||||
* @return The translated name of this hud side.
|
||||
* @return The translation key of this hude side.
|
||||
*/
|
||||
public String getTranslatedName()
|
||||
public @NotNull String getTranslationKey()
|
||||
{
|
||||
return I18n.translate("lambdacontrols.hud_side." + this.getName());
|
||||
return "lambdacontrols.hud_side." + this.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the translated text of this hud side.
|
||||
*
|
||||
* @return The translated text of this hud side.
|
||||
*/
|
||||
public @NotNull Text getTranslatedText()
|
||||
{
|
||||
return this.text;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,7 +82,7 @@ public enum HudSide implements Nameable
|
||||
* @param id The identifier of the hud side.
|
||||
* @return The hud side if found, else empty.
|
||||
*/
|
||||
public static Optional<HudSide> byId(@NotNull String id)
|
||||
public static @NotNull Optional<HudSide> byId(@NotNull String id)
|
||||
{
|
||||
return Arrays.stream(values()).filter(mode -> mode.getName().equalsIgnoreCase(id)).findFirst();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
|
||||
package me.lambdaurora.lambdacontrols.client;
|
||||
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -19,7 +20,7 @@ import java.util.Optional;
|
||||
/**
|
||||
* Represents the virtual mouse skins.
|
||||
*
|
||||
* @version 1.2.0
|
||||
* @version 1.4.0
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public enum VirtualMouseSkin implements Nameable
|
||||
@@ -29,11 +30,13 @@ public enum VirtualMouseSkin implements Nameable
|
||||
SECOND_LIGHT("second_light"),
|
||||
SECOND_DARK("second_dark");
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
private final Text text;
|
||||
|
||||
VirtualMouseSkin(String name)
|
||||
{
|
||||
this.name = name;
|
||||
this.text = new TranslatableText(this.getTranslationKey());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,7 +44,7 @@ public enum VirtualMouseSkin implements Nameable
|
||||
*
|
||||
* @return The next available virtual mouse skin.
|
||||
*/
|
||||
public VirtualMouseSkin next()
|
||||
public @NotNull VirtualMouseSkin next()
|
||||
{
|
||||
VirtualMouseSkin[] v = values();
|
||||
if (v.length == this.ordinal() + 1)
|
||||
@@ -50,13 +53,23 @@ public enum VirtualMouseSkin implements Nameable
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the translated name of this controller type.
|
||||
* Returns the translation key of this virtual mouse skin.
|
||||
*
|
||||
* @return The translated name of this controller type.
|
||||
* @return The virtual mouse skin's translation key.
|
||||
*/
|
||||
public String getTranslatedName()
|
||||
public @NotNull String getTranslationKey()
|
||||
{
|
||||
return I18n.translate("lambdacontrols.virtual_mouse.skin." + this.getName());
|
||||
return "lambdacontrols.virtual_mouse.skin." + this.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the translated text of this virtual mouse skin.
|
||||
*
|
||||
* @return The translated text of this virtual mouse skin.
|
||||
*/
|
||||
public @NotNull Text getTranslatedText()
|
||||
{
|
||||
return this.text;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,12 +79,12 @@ public enum VirtualMouseSkin implements Nameable
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the controller type from its identifier.
|
||||
* Gets the virtual mouse skin from its identifier.
|
||||
*
|
||||
* @param id The identifier of the controller type.
|
||||
* @return The controller type if found, else empty.
|
||||
* @param id The identifier of the virtual mouse skin.
|
||||
* @return The virtual mouse skin if found, else empty.
|
||||
*/
|
||||
public static Optional<VirtualMouseSkin> byId(@NotNull String id)
|
||||
public static @NotNull Optional<VirtualMouseSkin> byId(@NotNull String id)
|
||||
{
|
||||
return Arrays.stream(values()).filter(mode -> mode.getName().equalsIgnoreCase(id)).findFirst();
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class LambdaControlsCompat
|
||||
*/
|
||||
public static void init(@NotNull LambdaControlsClient mod)
|
||||
{
|
||||
if (FabricLoader.getInstance().isModLoaded("okzoomer") && LambdaReflection.doesClassExist(OkZoomerCompat.OKZOOMER_CLASS_PATH)) {
|
||||
if (FabricLoader.getInstance().isModLoaded("okzoomer")) {
|
||||
mod.log("Adding okzoomer compatibility...");
|
||||
HANDLERS.add(new OkZoomerCompat());
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
package me.lambdaurora.lambdacontrols.client.compat;
|
||||
|
||||
import io.github.joaoh1.okzoomer.client.OkZoomerClientMod;
|
||||
import io.github.joaoh1.okzoomer.main.OkZoomerMod;
|
||||
import me.lambdaurora.lambdacontrols.client.LambdaControlsClient;
|
||||
import me.lambdaurora.lambdacontrols.client.controller.ButtonBinding;
|
||||
import org.aperlambda.lambdacommon.Identifier;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@@ -37,6 +39,25 @@ public class OkZoomerCompat implements CompatHandler
|
||||
.linkKeybind(OkZoomerClientMod.zoomKeyBinding)
|
||||
.register();
|
||||
|
||||
// @TODO Zoom in and out
|
||||
new ButtonBinding.Builder("zoom.in")
|
||||
.buttons(GLFW.GLFW_GAMEPAD_BUTTON_DPAD_UP, ButtonBinding.axisAsButton(GLFW.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER, true))
|
||||
.onlyInGame()
|
||||
.cooldown(true)
|
||||
.category(ButtonBinding.MISC_CATEGORY)
|
||||
.linkKeybind(OkZoomerClientMod.increaseZoomKeyBinding)
|
||||
.register();
|
||||
new ButtonBinding.Builder("zoom.out")
|
||||
.buttons(GLFW.GLFW_GAMEPAD_BUTTON_DPAD_UP, ButtonBinding.axisAsButton(GLFW.GLFW_GAMEPAD_AXIS_LEFT_TRIGGER, true))
|
||||
.onlyInGame()
|
||||
.cooldown(true)
|
||||
.category(ButtonBinding.MISC_CATEGORY)
|
||||
.linkKeybind(OkZoomerClientMod.decreaseZoomKeyBinding)
|
||||
.register();
|
||||
new ButtonBinding.Builder("zoom.reset")
|
||||
.onlyInGame()
|
||||
.cooldown(true)
|
||||
.category(ButtonBinding.MISC_CATEGORY)
|
||||
.linkKeybind(OkZoomerClientMod.resetZoomKeyBinding)
|
||||
.register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
* @version 1.3.0
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@Mixin(RecipeViewingScreen.class)
|
||||
@Mixin(value = RecipeViewingScreen.class, remap = false)
|
||||
public interface RecipeViewingScreenAccessor
|
||||
{
|
||||
@Accessor("categoryBack")
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
* @version 1.2.0
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@Mixin(VillagerRecipeViewingScreen.class)
|
||||
@Mixin(value = VillagerRecipeViewingScreen.class, remap = false)
|
||||
public interface VillagerRecipeViewingScreenAccessor
|
||||
{
|
||||
@Accessor("categories")
|
||||
|
||||
@@ -13,6 +13,7 @@ import me.lambdaurora.lambdacontrols.client.LambdaControlsClient;
|
||||
import me.lambdaurora.lambdacontrols.client.controller.ButtonBinding;
|
||||
import me.lambdaurora.lambdacontrols.client.controller.InputManager;
|
||||
import me.lambdaurora.spruceui.SpruceButtonWidget;
|
||||
import me.lambdaurora.spruceui.SpruceTexts;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.options.ControlsOptionsScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
@@ -61,7 +62,7 @@ public class ControllerControlsScreen extends Screen
|
||||
btn -> this.client.openScreen(new ControlsOptionsScreen(this, this.client.options))));
|
||||
if (!this.hideSettings)
|
||||
this.addButton(new SpruceButtonWidget(this.width / 2 - 155 + 160, 18, 150, 20,
|
||||
new TranslatableText("menu.options"),
|
||||
SpruceTexts.MENU_OPTIONS,
|
||||
btn -> this.client.openScreen(new LambdaControlsSettingsScreen(this, true))));
|
||||
this.bindingsListWidget = new ControlsListWidget(this, this.client);
|
||||
this.children.add(this.bindingsListWidget);
|
||||
@@ -69,7 +70,7 @@ public class ControllerControlsScreen extends Screen
|
||||
new TranslatableText("controls.resetAll"),
|
||||
btn -> InputManager.streamBindings().forEach(binding -> this.mod.config.setButtonBinding(binding, binding.getDefaultButton()))));
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 155 + 160, this.height - 29, 150, 20,
|
||||
new TranslatableText("gui.done"),
|
||||
SpruceTexts.GUI_DONE,
|
||||
btn -> this.client.openScreen(this.parent)));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ package me.lambdaurora.lambdacontrols.client.gui;
|
||||
import me.lambdaurora.lambdacontrols.client.controller.ButtonBinding;
|
||||
import me.lambdaurora.lambdacontrols.client.controller.ButtonCategory;
|
||||
import me.lambdaurora.lambdacontrols.client.controller.InputManager;
|
||||
import me.lambdaurora.spruceui.SpruceTexts;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@@ -105,7 +106,7 @@ public class ControlsListWidget extends ElementListWidget<ControlsListWidget.Ent
|
||||
return new TranslatableText("narrator.controls.reset", bindingName);
|
||||
}
|
||||
};
|
||||
this.unboundButton = new ButtonWidget(0, 0, 50, 20, new TranslatableText("lambdacontrols.menu.unbound"),
|
||||
this.unboundButton = new ButtonWidget(0, 0, 50, 20, SpruceTexts.OPTIONS_GENERIC_UNBOUND,
|
||||
btn -> {
|
||||
gui.mod.config.setButtonBinding(binding, UNBOUND);
|
||||
gui.focusedBinding = null;
|
||||
|
||||
@@ -15,6 +15,7 @@ import me.lambdaurora.lambdacontrols.client.LambdaControlsClient;
|
||||
import me.lambdaurora.lambdacontrols.client.controller.Controller;
|
||||
import me.lambdaurora.spruceui.SpruceButtonWidget;
|
||||
import me.lambdaurora.spruceui.SpruceLabelWidget;
|
||||
import me.lambdaurora.spruceui.SpruceTexts;
|
||||
import me.lambdaurora.spruceui.Tooltip;
|
||||
import me.lambdaurora.spruceui.option.*;
|
||||
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
|
||||
@@ -87,14 +88,14 @@ public class LambdaControlsSettingsScreen extends Screen
|
||||
synchronized (this.mod.config) {
|
||||
this.mod.config.setRotationSpeed(newValue);
|
||||
}
|
||||
}, option -> option.getDisplayPrefix().append(String.valueOf(option.get())),
|
||||
}, option -> option.getDisplayText(new LiteralText(String.valueOf(option.get()))),
|
||||
new TranslatableText("lambdacontrols.tooltip.rotation_speed"));
|
||||
this.mouseSpeedOption = new SpruceDoubleOption("lambdacontrols.menu.mouse_speed", 0.0, 150.0, 0.5F, this.mod.config::getMouseSpeed,
|
||||
newValue -> {
|
||||
synchronized (this.mod.config) {
|
||||
this.mod.config.setMouseSpeed(newValue);
|
||||
}
|
||||
}, option -> option.getDisplayPrefix().append(String.valueOf(option.get())),
|
||||
}, option -> option.getDisplayText(new LiteralText(String.valueOf(option.get()))),
|
||||
new TranslatableText("lambdacontrols.tooltip.mouse_speed"));
|
||||
this.resetOption = new SpruceResetOption(btn -> {
|
||||
this.mod.config.reset();
|
||||
@@ -123,11 +124,11 @@ public class LambdaControlsSettingsScreen extends Screen
|
||||
}, option -> {
|
||||
String controllerName = this.mod.config.getController().getName();
|
||||
if (!this.mod.config.getController().isConnected())
|
||||
return option.getDisplayPrefix().append(new LiteralText(controllerName).formatted(Formatting.RED));
|
||||
return option.getDisplayText(new LiteralText(controllerName).formatted(Formatting.RED));
|
||||
else if (!this.mod.config.getController().isGamepad())
|
||||
return option.getDisplayPrefix().append(new LiteralText(controllerName).formatted(Formatting.GOLD));
|
||||
return option.getDisplayText(new LiteralText(controllerName).formatted(Formatting.GOLD));
|
||||
else
|
||||
return option.getDisplayPrefix().append(controllerName);
|
||||
return option.getDisplayText(new LiteralText(controllerName));
|
||||
}, null);
|
||||
this.secondControllerOption = new SpruceCyclingOption("lambdacontrols.menu.controller2",
|
||||
amount -> {
|
||||
@@ -139,16 +140,16 @@ public class LambdaControlsSettingsScreen extends Screen
|
||||
}, option -> this.mod.config.getSecondController().map(controller -> {
|
||||
String controllerName = controller.getName();
|
||||
if (!controller.isConnected())
|
||||
return option.getDisplayPrefix().append(new LiteralText(controllerName).formatted(Formatting.RED));
|
||||
return option.getDisplayText(new LiteralText(controllerName).formatted(Formatting.RED));
|
||||
else if (!controller.isGamepad())
|
||||
return option.getDisplayPrefix().append(new LiteralText(controllerName).formatted(Formatting.GOLD));
|
||||
return option.getDisplayText(new LiteralText(controllerName).formatted(Formatting.GOLD));
|
||||
else
|
||||
return option.getDisplayPrefix().append(controllerName);
|
||||
}).orElse(option.getDisplayPrefix().append(new TranslatableText("options.off").formatted(Formatting.RED))),
|
||||
return option.getDisplayText(new LiteralText(controllerName));
|
||||
}).orElse(option.getDisplayText(SpruceTexts.OPTIONS_OFF.shallowCopy().formatted(Formatting.RED))),
|
||||
new TranslatableText("lambdacontrols.tooltip.controller2"));
|
||||
this.controllerTypeOption = new SpruceCyclingOption("lambdacontrols.menu.controller_type",
|
||||
amount -> this.mod.config.setControllerType(this.mod.config.getControllerType().next()),
|
||||
option -> option.getDisplayPrefix().append(this.mod.config.getControllerType().getTranslatedName()),
|
||||
option -> option.getDisplayText(this.mod.config.getControllerType().getTranslatedText()),
|
||||
new TranslatableText("lambdacontrols.tooltip.controller_type"));
|
||||
this.deadZoneOption = new SpruceDoubleOption("lambdacontrols.menu.dead_zone", 0.05, 1.0, 0.05F, this.mod.config::getDeadZone,
|
||||
newValue -> {
|
||||
@@ -157,7 +158,7 @@ public class LambdaControlsSettingsScreen extends Screen
|
||||
}
|
||||
}, option -> {
|
||||
String value = String.valueOf(option.get());
|
||||
return option.getDisplayPrefix().append(value.substring(0, Math.min(value.length(), 5)));
|
||||
return option.getDisplayText(new LiteralText(value.substring(0, Math.min(value.length(), 5))));
|
||||
}, new TranslatableText("lambdacontrols.tooltip.dead_zone"));
|
||||
this.invertsRightXAxis = new SpruceBooleanOption("lambdacontrols.menu.invert_right_x_axis", this.mod.config::doesInvertRightXAxis,
|
||||
newValue -> {
|
||||
@@ -177,14 +178,14 @@ public class LambdaControlsSettingsScreen extends Screen
|
||||
this.mod.config::setVirtualMouse, new TranslatableText("lambdacontrols.tooltip.virtual_mouse"), true);
|
||||
this.virtualMouseSkinOption = new SpruceCyclingOption("lambdacontrols.menu.virtual_mouse.skin",
|
||||
amount -> this.mod.config.setVirtualMouseSkin(this.mod.config.getVirtualMouseSkin().next()),
|
||||
option -> option.getDisplayPrefix().append(this.mod.config.getVirtualMouseSkin().getTranslatedName()),
|
||||
option -> option.getDisplayText(this.mod.config.getVirtualMouseSkin().getTranslatedText()),
|
||||
null);
|
||||
// HUD options
|
||||
this.hudEnableOption = new SpruceBooleanOption("lambdacontrols.menu.hud_enable", this.mod.config::isHudEnabled,
|
||||
this.mod::setHudEnabled, new TranslatableText("lambdacontrols.tooltip.hud_enable"), true);
|
||||
this.hudSideOption = new SpruceCyclingOption("lambdacontrols.menu.hud_side",
|
||||
amount -> this.mod.config.setHudSide(this.mod.config.getHudSide().next()),
|
||||
option -> option.getDisplayPrefix().append(this.mod.config.getHudSide().getTranslatedName()),
|
||||
option -> option.getDisplayText(this.mod.config.getHudSide().getTranslatedText()),
|
||||
new TranslatableText("lambdacontrols.tooltip.hud_side"));
|
||||
}
|
||||
|
||||
@@ -266,7 +267,7 @@ public class LambdaControlsSettingsScreen extends Screen
|
||||
this.children.add(this.gamepadToolUrlLabel);
|
||||
|
||||
this.addButton(this.resetOption.createButton(this.client.options, this.width / 2 - 155, this.height - 29, 150));
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 155 + 160, this.height - 29, 150, buttonHeight, new TranslatableText("gui.done"),
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 155 + 160, this.height - 29, 150, buttonHeight, SpruceTexts.GUI_DONE,
|
||||
(buttonWidget) -> this.client.openScreen(this.parent)));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
|
||||
package me.lambdaurora.lambdacontrols.client.ring;
|
||||
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -26,11 +27,13 @@ public enum RingButtonMode implements Nameable
|
||||
HOLD("hold"),
|
||||
TOGGLE("toggle");
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
private final Text text;
|
||||
|
||||
RingButtonMode(@NotNull String name)
|
||||
{
|
||||
this.name = name;
|
||||
this.text = new TranslatableText(this.getTranslationKey());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,7 +41,7 @@ public enum RingButtonMode implements Nameable
|
||||
*
|
||||
* @return The next ring button mode.
|
||||
*/
|
||||
public RingButtonMode next()
|
||||
public @NotNull RingButtonMode next()
|
||||
{
|
||||
RingButtonMode[] v = values();
|
||||
if (v.length == this.ordinal() + 1)
|
||||
@@ -46,14 +49,24 @@ public enum RingButtonMode implements Nameable
|
||||
return v[this.ordinal() + 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the translation key of this ring button mode.
|
||||
*
|
||||
* @return The translation key of this ring button mode.
|
||||
*/
|
||||
public @NotNull String getTranslationKey()
|
||||
{
|
||||
return "lambdacontrols.ring.button_mode." + this.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the translated name of this ring button mode.
|
||||
*
|
||||
* @return The translated name of this ring button mode.
|
||||
*/
|
||||
public String getTranslatedName()
|
||||
public @NotNull Text getTranslatedText()
|
||||
{
|
||||
return I18n.translate("lambdacontrols.ring.button_mode." + this.getName());
|
||||
return this.text;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
"lambdacontrols.action.toggle_smooth_camera": "Toggle Cinematic Camera",
|
||||
"lambdacontrols.action.use": "Use",
|
||||
"lambdacontrols.action.zoom": "Zoom",
|
||||
"lambdacontrols.action.zoom.in": "Increase Zoom",
|
||||
"lambdacontrols.action.zoom.out": "Decrease Zoom",
|
||||
"lambdacontrols.action.zoom.reset": "Reset Zoom",
|
||||
"lambdacontrols.button.a": "A",
|
||||
"lambdacontrols.button.b": "B",
|
||||
"lambdacontrols.button.x": "X",
|
||||
@@ -98,7 +101,6 @@
|
||||
"lambdacontrols.menu.title.gameplay": "Gameplay Options",
|
||||
"lambdacontrols.menu.title.general": "General Options",
|
||||
"lambdacontrols.menu.title.hud": "HUD Options",
|
||||
"lambdacontrols.menu.unbound": "Unbound",
|
||||
"lambdacontrols.menu.unfocused_input": "Unfocused Input",
|
||||
"lambdacontrols.menu.virtual_mouse": "Virtual Mouse",
|
||||
"lambdacontrols.menu.virtual_mouse.skin": "Virtual Mouse Skin",
|
||||
|
||||
@@ -97,7 +97,6 @@
|
||||
"lambdacontrols.menu.title.gameplay": "Options de Gameplay",
|
||||
"lambdacontrols.menu.title.general": "Options générales",
|
||||
"lambdacontrols.menu.title.hud": "Options du HUD",
|
||||
"lambdacontrols.menu.unbound": "Délier",
|
||||
"lambdacontrols.menu.unfocused_input": "Entrée en fond",
|
||||
"lambdacontrols.menu.virtual_mouse": "Souris virtuelle",
|
||||
"lambdacontrols.menu.virtual_mouse.skin": "Apparence souris virtuelle",
|
||||
|
||||
@@ -97,7 +97,6 @@
|
||||
"lambdacontrols.menu.title.gameplay": "Options de Gameplay",
|
||||
"lambdacontrols.menu.title.general": "Options générales",
|
||||
"lambdacontrols.menu.title.hud": "Options du HUD",
|
||||
"lambdacontrols.menu.unbound": "Délier",
|
||||
"lambdacontrols.menu.unfocused_input": "Entrée en fond",
|
||||
"lambdacontrols.menu.virtual_mouse": "Souris virtuelle",
|
||||
"lambdacontrols.menu.virtual_mouse.skin": "Apparence souris virtuelle",
|
||||
|
||||
@@ -4,8 +4,8 @@ org.gradle.jvmargs=-Xmx1G
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.16.1
|
||||
yarn_mappings=1.16.1+build.18:v2
|
||||
loader_version=0.8.8+build.202
|
||||
yarn_mappings=1.16.1+build.21:v2
|
||||
loader_version=0.9.0+build.204
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.4.0
|
||||
@@ -14,6 +14,6 @@ org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# Dependencies
|
||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||
fabric_version=0.14.0+build.371-1.16
|
||||
spruceui_version=1.5.2
|
||||
fabric_version=0.15.0+build.379-1.16.1
|
||||
spruceui_version=1.5.9
|
||||
modmenu_version=1.12.2+build.17
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,5 @@
|
||||
#Mon Oct 28 18:23:18 CET 2019
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
|
||||
|
||||
35
gradlew
vendored
35
gradlew
vendored
@@ -82,6 +82,7 @@ esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
@@ -125,10 +126,11 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
@@ -154,19 +156,19 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -175,14 +177,9 @@ save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
4
gradlew.bat
vendored
4
gradlew.bat
vendored
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@@ -81,6 +84,7 @@ set CMD_LINE_ARGS=%*
|
||||
|
||||
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%
|
||||
|
||||
|
||||
Reference in New Issue
Block a user