mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-13 15:25:08 +01:00
✨ Add HUD and other improvements.
This commit is contained in:
@@ -9,9 +9,10 @@
|
||||
|
||||
package me.lambdaurora.lambdacontrols;
|
||||
|
||||
import me.lambdaurora.lambdacontrols.util.LambdaKeyBinding;
|
||||
import me.lambdaurora.lambdacontrols.util.KeyBindingAccessor;
|
||||
import net.minecraft.client.options.GameOptions;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@@ -25,9 +26,10 @@ import java.util.Optional;
|
||||
*
|
||||
* @author LambdAurora
|
||||
*/
|
||||
public class ButtonBinding
|
||||
public class ButtonBinding implements Nameable
|
||||
{
|
||||
private static final List<ButtonBinding> BINDINGS = new ArrayList<>();
|
||||
public static final ButtonBinding ATTACK = new ButtonBinding(axis_as_button(GLFW.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER, true), "attack");
|
||||
public static final ButtonBinding BACK = new ButtonBinding(axis_as_button(GLFW.GLFW_GAMEPAD_AXIS_LEFT_Y, false), "back");
|
||||
public static final ButtonBinding DROP_ITEM = new ButtonBinding(GLFW.GLFW_GAMEPAD_BUTTON_B, "drop_item");
|
||||
public static final ButtonBinding FORWARD = new ButtonBinding(axis_as_button(GLFW.GLFW_GAMEPAD_AXIS_LEFT_Y, true), "forward");
|
||||
@@ -86,6 +88,22 @@ public class ButtonBinding
|
||||
return this.pressed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String get_name()
|
||||
{
|
||||
return this.key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the translation key of this button binding.
|
||||
*
|
||||
* @return The translation key.
|
||||
*/
|
||||
public @NotNull String get_translation_key()
|
||||
{
|
||||
return "lambdacontrols.action." + this.get_name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key binding equivalent of this button binding.
|
||||
*
|
||||
@@ -105,7 +123,18 @@ public class ButtonBinding
|
||||
*/
|
||||
public static int axis_as_button(int axis, boolean positive)
|
||||
{
|
||||
return positive ? GLFW.GLFW_GAMEPAD_BUTTON_LAST + GLFW.GLFW_GAMEPAD_AXIS_LAST + axis : GLFW.GLFW_GAMEPAD_BUTTON_LAST + GLFW.GLFW_GAMEPAD_AXIS_LAST * 2 + axis;
|
||||
return positive ? 100 + axis : 200 + axis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the second Joycon's specified button code.
|
||||
*
|
||||
* @param button The raw button code.
|
||||
* @return The second Joycon's button code.
|
||||
*/
|
||||
public static int joycon2_button(int button)
|
||||
{
|
||||
return 300 + button;
|
||||
}
|
||||
|
||||
public static void init(@NotNull GameOptions options)
|
||||
@@ -129,6 +158,6 @@ public class ButtonBinding
|
||||
{
|
||||
BINDINGS.parallelStream().filter(binding -> binding.button == button)
|
||||
.map(ButtonBinding::as_key_binding)
|
||||
.forEach(binding -> binding.ifPresent(key_binding -> ((LambdaKeyBinding) key_binding).handle_press_state(state)));
|
||||
.forEach(binding -> binding.ifPresent(key_binding -> ((KeyBindingAccessor) key_binding).handle_press_state(state)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ package me.lambdaurora.lambdacontrols;
|
||||
|
||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWGamepadState;
|
||||
|
||||
@@ -131,14 +130,6 @@ public class Controller implements Nameable
|
||||
.max(Comparator.comparingInt(Controller::get_id));
|
||||
}
|
||||
|
||||
private static ByteBuffer resizeBuffer(ByteBuffer buffer, int new_capacity)
|
||||
{
|
||||
ByteBuffer newBuffer = BufferUtils.createByteBuffer(new_capacity);
|
||||
buffer.flip();
|
||||
newBuffer.put(buffer);
|
||||
return newBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the specified resource and returns the raw data as a ByteBuffer.
|
||||
*
|
||||
|
||||
@@ -11,7 +11,7 @@ package me.lambdaurora.lambdacontrols;
|
||||
|
||||
import me.lambdaurora.lambdacontrols.util.AbstractContainerScreenAccessor;
|
||||
import me.lambdaurora.lambdacontrols.util.CreativeInventoryScreenAccessor;
|
||||
import me.lambdaurora.lambdacontrols.util.LambdaKeyBinding;
|
||||
import me.lambdaurora.lambdacontrols.util.KeyBindingAccessor;
|
||||
import me.lambdaurora.lambdacontrols.util.MouseAccessor;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.Element;
|
||||
@@ -23,7 +23,6 @@ import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||
import net.minecraft.client.gui.screen.world.WorldListWidget;
|
||||
import net.minecraft.client.gui.widget.AbstractPressableButtonWidget;
|
||||
import net.minecraft.client.gui.widget.SliderWidget;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.container.Slot;
|
||||
import net.minecraft.container.SlotActionType;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
@@ -57,7 +56,6 @@ public class ControllerInput
|
||||
private static final Map<Integer, Integer> AXIS_COOLDOWNS = new HashMap<>();
|
||||
private final LambdaControlsConfig config;
|
||||
private int action_gui_cooldown = 0;
|
||||
private boolean continuous_sneak = false;
|
||||
private int ignore_next_a = 0;
|
||||
private int last_sneak = 0;
|
||||
private double prev_target_yaw = 0.0;
|
||||
@@ -238,25 +236,11 @@ public class ControllerInput
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handles sneak button and continuous sneak.
|
||||
if (SNEAK.is_button(button) && client.player != null) {
|
||||
if (action == 0) {
|
||||
if (this.continuous_sneak) {
|
||||
this.set_sneaking(client, this.continuous_sneak = false);
|
||||
} else if (this.last_sneak > 3) {
|
||||
this.set_sneaking(client, this.continuous_sneak = true);
|
||||
} else {
|
||||
this.set_sneaking(client, true);
|
||||
this.last_sneak = 15;
|
||||
}
|
||||
} else if (action == 1) {
|
||||
if (this.continuous_sneak)
|
||||
return;
|
||||
this.set_sneaking(client, false);
|
||||
// Handles sneak button.
|
||||
if (SNEAK.is_button(button) && client.player != null) {
|
||||
this.toggle_sneaking(client);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (button == GLFW.GLFW_GAMEPAD_BUTTON_A && client.currentScreen != null && !this.is_screen_interactive(client.currentScreen) && this.action_gui_cooldown == 0 && this.ignore_next_a == 0) {
|
||||
@@ -273,8 +257,6 @@ public class ControllerInput
|
||||
|
||||
if (client.currentScreen == null && action != 2) {
|
||||
ButtonBinding.handle_button(button, state);
|
||||
//Optional<KeyBinding> key_binding = this.config.get_keybind("button_" + button);
|
||||
//key_binding.ifPresent(keyBinding -> ((LambdaKeyBinding) keyBinding).handle_press_state(action != 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +273,7 @@ public class ControllerInput
|
||||
boolean previous_minus_state = AXIS_STATES.getOrDefault(axis_minus, false);
|
||||
|
||||
if (current_plus_state != previous_plus_state) {
|
||||
this.config.get_keybind("axis_" + axis + "+").ifPresent(key_binding -> ((LambdaKeyBinding) key_binding).handle_press_state(current_plus_state));
|
||||
this.config.get_keybind("axis_" + axis + "+").ifPresent(key_binding -> ((KeyBindingAccessor) key_binding).handle_press_state(current_plus_state));
|
||||
if (current_plus_state)
|
||||
AXIS_COOLDOWNS.put(axis, 5);
|
||||
} else if (current_plus_state) {
|
||||
@@ -301,7 +283,7 @@ public class ControllerInput
|
||||
}
|
||||
|
||||
if (current_minus_state != previous_minus_state) {
|
||||
this.config.get_keybind("axis_" + axis + "-").ifPresent(key_binding -> ((LambdaKeyBinding) key_binding).handle_press_state(current_minus_state));
|
||||
this.config.get_keybind("axis_" + axis + "-").ifPresent(key_binding -> ((KeyBindingAccessor) key_binding).handle_press_state(current_minus_state));
|
||||
if (current_minus_state)
|
||||
AXIS_COOLDOWNS.put(axis_minus, 5);
|
||||
} else if (current_minus_state) {
|
||||
@@ -481,14 +463,13 @@ public class ControllerInput
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if the player is sneaking.
|
||||
* Toggles whether the player is sneaking.
|
||||
*
|
||||
* @param client The client's instance.
|
||||
* @param sneaking True if the player is sneaking, else false.
|
||||
* @param client The client's instance.
|
||||
*/
|
||||
private void set_sneaking(@NotNull MinecraftClient client, boolean sneaking)
|
||||
private void toggle_sneaking(@NotNull MinecraftClient client)
|
||||
{
|
||||
((LambdaKeyBinding) client.options.keySneak).handle_press_state(sneaking);
|
||||
((KeyBindingAccessor) client.options.keySneak).handle_press_state(!client.options.keySneak.isPressed());
|
||||
}
|
||||
|
||||
private boolean change_focus(@NotNull Screen screen, boolean down)
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright © 2019 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of LambdaControls.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package me.lambdaurora.lambdacontrols;
|
||||
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Represents a controller type.
|
||||
*/
|
||||
public enum ControllerType implements Nameable
|
||||
{
|
||||
DEFAULT(0),
|
||||
PLAYSTATION(1),
|
||||
SWITCH(2),
|
||||
XBOX(3),
|
||||
STEAM(4),
|
||||
OUYA(5);
|
||||
|
||||
private final int id;
|
||||
|
||||
ControllerType(int id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the controller type's identifier.
|
||||
*
|
||||
* @return The controller type's identifier.
|
||||
*/
|
||||
public int get_id()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next controller type available.
|
||||
*
|
||||
* @return The next available controller type.
|
||||
*/
|
||||
public ControllerType next()
|
||||
{
|
||||
ControllerType[] v = values();
|
||||
if (v.length == this.ordinal() + 1)
|
||||
return v[0];
|
||||
return v[this.ordinal() + 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the translated name of this controller type.
|
||||
*
|
||||
* @return The translated name of this controller type.
|
||||
*/
|
||||
public String get_translated_name()
|
||||
{
|
||||
return I18n.translate("lambdacontrols.controller_type." + this.get_name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String get_name()
|
||||
{
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the controller type from its identifier.
|
||||
*
|
||||
* @param id The identifier of the controller type.
|
||||
* @return The controller type if found, else empty.
|
||||
*/
|
||||
public static Optional<ControllerType> by_id(@NotNull String id)
|
||||
{
|
||||
return Arrays.stream(values()).filter(mode -> mode.get_name().equalsIgnoreCase(id)).findFirst();
|
||||
}
|
||||
}
|
||||
@@ -9,26 +9,31 @@
|
||||
|
||||
package me.lambdaurora.lambdacontrols;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.client.toast.SystemToast;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
|
||||
/**
|
||||
* Represents the LambdaControls mod.
|
||||
*/
|
||||
public class LambdaControls implements ClientModInitializer
|
||||
{
|
||||
private static LambdaControls INSTANCE;
|
||||
public final Logger logger = LogManager.getLogger("LambdaControls");
|
||||
public final LambdaControlsConfig config = new LambdaControlsConfig(this);
|
||||
public final ControllerInput controller_input = new ControllerInput(this);
|
||||
private static LambdaControls INSTANCE;
|
||||
public static final Identifier CONTROLLER_BUTTONS = new Identifier("lambdacontrols", "textures/gui/controller_buttons.png");
|
||||
public final Logger logger = LogManager.getLogger("LambdaControls");
|
||||
public final LambdaControlsConfig config = new LambdaControlsConfig(this);
|
||||
public final ControllerInput controller_input = new ControllerInput(this);
|
||||
|
||||
@Override
|
||||
public void onInitializeClient()
|
||||
@@ -93,4 +98,52 @@ public class LambdaControls implements ClientModInitializer
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public static int draw_button_tip(int x, int y, @NotNull ButtonBinding button, boolean display, @NotNull MinecraftClient client)
|
||||
{
|
||||
return draw_button_tip(x, y, button.get_button(), button.get_translation_key(), display, client);
|
||||
}
|
||||
|
||||
public static int draw_button_tip(int x, int y, int button, @NotNull String action, boolean display, @NotNull MinecraftClient client)
|
||||
{
|
||||
int controller_type = get().config.get_controller_type().get_id();
|
||||
String translated_action = I18n.translate(action);
|
||||
|
||||
if (display) {
|
||||
int button_offset = button * 15;
|
||||
switch (button) {
|
||||
case GLFW.GLFW_GAMEPAD_BUTTON_LEFT_THUMB:
|
||||
button_offset = 15 * 15;
|
||||
break;
|
||||
case GLFW.GLFW_GAMEPAD_BUTTON_RIGHT_THUMB:
|
||||
button_offset = 16 * 15;
|
||||
break;
|
||||
case GLFW.GLFW_GAMEPAD_AXIS_LEFT_TRIGGER + 100:
|
||||
case GLFW.GLFW_GAMEPAD_AXIS_LEFT_TRIGGER + 200:
|
||||
button_offset = 9 * 15;
|
||||
break;
|
||||
case GLFW.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER + 100:
|
||||
case GLFW.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER + 200:
|
||||
button_offset = 10 * 15;
|
||||
break;
|
||||
}
|
||||
|
||||
client.getTextureManager().bindTexture(LambdaControls.CONTROLLER_BUTTONS);
|
||||
GlStateManager.disableDepthTest();
|
||||
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
DrawableHelper.blit(x, y, (float) button_offset, (float) (controller_type * 15), 15, 15, 256, 256);
|
||||
GlStateManager.enableDepthTest();
|
||||
|
||||
int text_y = (15 - client.textRenderer.fontHeight) / 2;
|
||||
client.textRenderer.drawWithShadow(translated_action, (float) (x + 15 + 5), (float) (y + text_y), 14737632);
|
||||
}
|
||||
|
||||
return display ? get_button_tip_width(translated_action, client.textRenderer) : -10;
|
||||
}
|
||||
|
||||
private static int get_button_tip_width(@NotNull String action, @NotNull TextRenderer text_renderer)
|
||||
{
|
||||
return 15 + 5 + text_renderer.getStringWidth(action);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@ public class LambdaControlsConfig
|
||||
private final Map<String, KeyBinding> keybinding_mappings = new HashMap<>();
|
||||
private final LambdaControls mod;
|
||||
private ControlsMode controls_mode;
|
||||
private ControllerType controller_type;
|
||||
// HUD settings.
|
||||
private boolean hud_enable;
|
||||
private HudSide hud_side;
|
||||
// Controller settings
|
||||
private double dead_zone;
|
||||
@@ -52,12 +55,15 @@ public class LambdaControlsConfig
|
||||
this.config.load();
|
||||
this.mod.log("Configuration loaded.");
|
||||
this.controls_mode = ControlsMode.by_id(this.config.getOrElse("controls", "default")).orElse(ControlsMode.DEFAULT);
|
||||
// HUD settings.
|
||||
this.hud_enable = this.config.getOrElse("hud.enable", true);
|
||||
this.hud_side = HudSide.by_id(this.config.getOrElse("hud.side", "left")).orElse(HudSide.LEFT);
|
||||
// Controller settings
|
||||
// Controller settings.
|
||||
this.controller_type = ControllerType.by_id(this.config.getOrElse("controller.type", "default")).orElse(ControllerType.DEFAULT);
|
||||
this.dead_zone = this.config.getOrElse("controller.dead_zone", 0.25);
|
||||
this.rotation_speed = this.config.getOrElse("controller.rotation_speed", 40.0);
|
||||
this.mouse_speed = this.config.getOrElse("controller.mouse_speed", 25.0);
|
||||
// Controller controls
|
||||
// Controller controls.
|
||||
this.back_button = this.config.getOrElse("controller.controls.back", "none").toLowerCase();
|
||||
this.forward_button = this.config.getOrElse("controller.controls.forward", "none").toLowerCase();
|
||||
this.left_button = this.config.getOrElse("controller.controls.left", "none").toLowerCase();
|
||||
@@ -113,6 +119,27 @@ public class LambdaControlsConfig
|
||||
this.config.set("controls", controls_mode.get_name());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the HUD is enabled.
|
||||
*
|
||||
* @return True if the HUD is enabled, else false.
|
||||
*/
|
||||
public boolean is_hud_enabled()
|
||||
{
|
||||
return this.hud_enable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the HUD is enabled.
|
||||
*
|
||||
* @param enable True if the HUD is enabled, else false.
|
||||
*/
|
||||
public void set_hud_enabled(boolean enable)
|
||||
{
|
||||
this.hud_enable = enable;
|
||||
this.config.set("hud.enable", this.hud_enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HUD side from the configuration.
|
||||
*
|
||||
@@ -160,6 +187,27 @@ public class LambdaControlsConfig
|
||||
this.config.set("controller.id", controller.get_id());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the controller's type.
|
||||
*
|
||||
* @return The controller's type.
|
||||
*/
|
||||
public @NotNull ControllerType get_controller_type()
|
||||
{
|
||||
return this.controller_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the controller's type.
|
||||
*
|
||||
* @param controller_type The controller's type.
|
||||
*/
|
||||
public void set_controller_type(@NotNull ControllerType controller_type)
|
||||
{
|
||||
this.controller_type = controller_type;
|
||||
this.config.set("controller.type", controller_type.get_name());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the controller's dead zone from the configuration.
|
||||
*
|
||||
|
||||
@@ -9,45 +9,57 @@
|
||||
|
||||
package me.lambdaurora.lambdacontrols.gui;
|
||||
|
||||
import me.lambdaurora.lambdacontrols.ButtonBinding;
|
||||
import me.lambdaurora.lambdacontrols.ControlsMode;
|
||||
import me.lambdaurora.lambdacontrols.LambdaControls;
|
||||
import me.lambdaurora.lambdacontrols.util.LambdaKeyBinding;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
/**
|
||||
* Represents the LambdaControls HUD.
|
||||
*/
|
||||
public class LambdaControlsHud
|
||||
public class LambdaControlsHud extends DrawableHelper
|
||||
{
|
||||
private final MinecraftClient client;
|
||||
private final LambdaControls mod;
|
||||
private ButtonWidget jump_button;
|
||||
|
||||
public LambdaControlsHud(@NotNull MinecraftClient client, @NotNull LambdaControls mod)
|
||||
{
|
||||
this.client = client;
|
||||
this.mod = mod;
|
||||
this.jump_button = new ButtonWidget(50, 50, 20, 20, "J", button-> {});
|
||||
}
|
||||
|
||||
public void render(float delta)
|
||||
/**
|
||||
* Renders the LambdaControls' HUD.
|
||||
*/
|
||||
public void render()
|
||||
{
|
||||
if (this.mod.config.get_controls_mode() == ControlsMode.TOUCHSCREEN)
|
||||
this.render_touchscreen(delta);
|
||||
}
|
||||
|
||||
public void render_touchscreen(float delta)
|
||||
{
|
||||
//this.jump_button.render((int) this.client.mouse.getX(), (int) this.client.mouse.getY(), delta);
|
||||
}
|
||||
|
||||
public void on_input(double x, double y, int button, int action)
|
||||
{
|
||||
if (this.jump_button.mouseClicked(x, y, button)) {
|
||||
((LambdaKeyBinding) this.client.options.keyJump).handle_press_state(action != GLFW.GLFW_RELEASE);
|
||||
if (this.mod.config.get_controls_mode() == ControlsMode.CONTROLLER && this.mod.config.is_hud_enabled() && this.client.currentScreen == null) {
|
||||
int x = 10, y = bottom(10);
|
||||
x += this.draw_button_tip(x, y, ButtonBinding.INVENTORY, true) + 10;
|
||||
this.draw_button_tip(x, y, ButtonBinding.SWAP_HANDS, true);
|
||||
x = 10;
|
||||
x += this.draw_button_tip(x, (y -= 20), ButtonBinding.DROP_ITEM, !client.player.getMainHandStack().isEmpty()) + 10;
|
||||
this.draw_button_tip(x, y, ButtonBinding.ATTACK.get_button(),
|
||||
client.hitResult.getType() == HitResult.Type.BLOCK ? "lambdacontrols.action.hit" : ButtonBinding.ATTACK.get_translation_key(),
|
||||
client.hitResult.getType() != HitResult.Type.MISS);
|
||||
}
|
||||
}
|
||||
|
||||
private int bottom(int y)
|
||||
{
|
||||
return this.client.window.getScaledHeight() - y - 15;
|
||||
}
|
||||
|
||||
private int draw_button_tip(int x, int y, @NotNull ButtonBinding button, boolean display)
|
||||
{
|
||||
return LambdaControls.draw_button_tip(x, y, button, display, this.client);
|
||||
}
|
||||
|
||||
private int draw_button_tip(int x, int y, int button, @NotNull String action, boolean display)
|
||||
{
|
||||
return LambdaControls.draw_button_tip(x, y, button, action, display, this.client);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ package me.lambdaurora.lambdacontrols.gui;
|
||||
|
||||
import me.lambdaurora.lambdacontrols.Controller;
|
||||
import me.lambdaurora.lambdacontrols.ControlsMode;
|
||||
import me.lambdaurora.lambdacontrols.HudSide;
|
||||
import me.lambdaurora.lambdacontrols.LambdaControls;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.controls.ControlsOptionsScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonListWidget;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.options.*;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
@@ -27,16 +27,19 @@ import org.lwjgl.glfw.GLFW;
|
||||
*/
|
||||
public class LambdaControlsSettingsScreen extends Screen
|
||||
{
|
||||
private final LambdaControls mod;
|
||||
private final Screen parent;
|
||||
private final GameOptions options;
|
||||
private final Option controller_option;
|
||||
private final Option dead_zone_option;
|
||||
private final Option rotation_speed_option;
|
||||
private final Option mouse_speed_option;
|
||||
private final Option inverts_right_x_axis;
|
||||
private final Option inverts_right_y_axis;
|
||||
private int buttons_y = 18;
|
||||
private final LambdaControls mod;
|
||||
private final Screen parent;
|
||||
private final GameOptions options;
|
||||
private final Option controller_option;
|
||||
private final Option controller_type_option;
|
||||
private final Option hud_enable_option;
|
||||
private final Option hud_side_option;
|
||||
private final Option dead_zone_option;
|
||||
private final Option rotation_speed_option;
|
||||
private final Option mouse_speed_option;
|
||||
private final Option inverts_right_x_axis;
|
||||
private final Option inverts_right_y_axis;
|
||||
private ButtonListWidget list;
|
||||
|
||||
public LambdaControlsSettingsScreen(Screen parent, @NotNull GameOptions options)
|
||||
{
|
||||
@@ -51,6 +54,14 @@ public class LambdaControlsSettingsScreen extends Screen
|
||||
current_id = GLFW.GLFW_JOYSTICK_1;
|
||||
this.mod.config.set_controller(Controller.by_id(current_id));
|
||||
}, (game_options, option) -> option.getDisplayPrefix() + this.mod.config.get_controller().get_name());
|
||||
this.controller_type_option = new CyclingOption("lambdacontrols.menu.controller_type",
|
||||
(game_options, amount) -> this.mod.config.set_controller_type(this.mod.config.get_controller_type().next()),
|
||||
(game_options, option) -> option.getDisplayPrefix() + this.mod.config.get_controller_type().get_translated_name());
|
||||
this.hud_enable_option = new BooleanOption("lambdacontrols.menu.hud_enable", (game_options) -> this.mod.config.is_hud_enabled(),
|
||||
(game_options, new_value) -> this.mod.config.set_hud_enabled(new_value));
|
||||
this.hud_side_option = new CyclingOption("lambdacontrols.menu.hud_side",
|
||||
(game_options, amount) -> this.mod.config.set_hud_side(this.mod.config.get_hud_side().next()),
|
||||
(game_options, option) -> option.getDisplayPrefix() + this.mod.config.get_hud_side().get_translated_name());
|
||||
this.dead_zone_option = new DoubleOption("lambdacontrols.menu.dead_zone", 0.05, 1.0, 0.05F, game_options -> this.mod.config.get_dead_zone(),
|
||||
(game_options, new_value) -> {
|
||||
synchronized (this.mod.config) {
|
||||
@@ -100,46 +111,47 @@ public class LambdaControlsSettingsScreen extends Screen
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
private int get_text_height()
|
||||
{
|
||||
return (5 + this.font.fontHeight) * 3 + 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init()
|
||||
{
|
||||
super.init();
|
||||
int button_height = 20, spacing = 5;
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 155, this.buttons_y, 150, button_height, I18n.translate("lambdacontrols.menu.controls_mode") + ": " + this.mod.config.get_controls_mode().get_translated_name(),
|
||||
int button_height = 20;
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 155, 18, 150, button_height, I18n.translate("lambdacontrols.menu.controls_mode") + ": " + this.mod.config.get_controls_mode().get_translated_name(),
|
||||
btn -> {
|
||||
ControlsMode next = this.mod.config.get_controls_mode().next();
|
||||
btn.setMessage(I18n.translate("lambdacontrols.menu.controls_mode") + ": " + next.get_translated_name());
|
||||
this.mod.config.set_controls_mode(next);
|
||||
this.mod.config.save();
|
||||
}));
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 155 + 160, this.buttons_y, 150, button_height, I18n.translate("options.controls"),
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 155 + 160, 18, 150, button_height, I18n.translate("options.controls"),
|
||||
btn -> this.minecraft.openScreen(new ControlsOptionsScreen(this, this.options))));
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 155, (this.buttons_y += spacing + button_height), 150, button_height, I18n.translate("lambdacontrols.menu.hud_side") + ": " + this.mod.config.get_hud_side().get_translated_name(),
|
||||
btn -> {
|
||||
HudSide next = this.mod.config.get_hud_side().next();
|
||||
btn.setMessage(I18n.translate("lambdacontrols.menu.hud_side") + ": " + next.get_translated_name());
|
||||
this.mod.config.set_hud_side(next);
|
||||
this.mod.config.save();
|
||||
}));
|
||||
this.addButton(this.controller_option.createButton(this.options, this.width / 2 - 155, (this.buttons_y += spacing + button_height), 150));
|
||||
this.addButton(this.dead_zone_option.createButton(this.options, this.width / 2 - 155 + 160, this.buttons_y, 150));
|
||||
this.addButton(this.rotation_speed_option.createButton(this.options, this.width / 2 - 155, (this.buttons_y += spacing + button_height), 150));
|
||||
this.addButton(this.mouse_speed_option.createButton(this.options, this.width / 2 - 155 + 160, this.buttons_y, 150));
|
||||
this.addButton(this.inverts_right_x_axis.createButton(this.options, this.width / 2 - 155, (this.buttons_y += spacing + button_height), 150));
|
||||
this.addButton(this.inverts_right_y_axis.createButton(this.options, this.width / 2 - 155 + 160, this.buttons_y, 150));
|
||||
|
||||
this.list = new ButtonListWidget(this.minecraft, this.width, this.height, 43, this.height - 29 - this.get_text_height(), 25);
|
||||
this.list.addSingleOptionEntry(this.controller_option);
|
||||
this.list.addOptionEntry(this.controller_type_option, this.dead_zone_option);
|
||||
this.list.addOptionEntry(this.hud_enable_option, this.hud_side_option);
|
||||
this.list.addOptionEntry(this.rotation_speed_option, this.mouse_speed_option);
|
||||
this.list.addOptionEntry(this.inverts_right_x_axis, this.inverts_right_y_axis);
|
||||
this.children.add(this.list);
|
||||
|
||||
this.addButton(new ButtonWidget(this.width / 2 - 155, this.height - 29, 300, button_height, I18n.translate("gui.done"),
|
||||
(buttonWidget) -> this.minecraft.openScreen(this.parent)));
|
||||
|
||||
this.buttons_y += spacing + button_height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float delta)
|
||||
{
|
||||
this.renderBackground();
|
||||
this.list.render(mouseX, mouseY, delta);
|
||||
super.render(mouseX, mouseY, delta);
|
||||
this.drawCenteredString(this.font, I18n.translate("lambdacontrols.controller.mappings.1"), this.width / 2, this.buttons_y + (20 - 8) / 2, 10526880);
|
||||
this.drawCenteredString(this.font, I18n.translate("lambdacontrols.controller.mappings.2"), this.width / 2, this.buttons_y + (20 - 8) / 2 + font.fontHeight + 5, 10526880);
|
||||
this.drawCenteredString(this.font, I18n.translate("lambdacontrols.controller.mappings.3"), this.width / 2, this.buttons_y + (20 - 8) / 2 + font.fontHeight * 2 + 10, 10526880);
|
||||
this.drawCenteredString(this.font, I18n.translate("lambdacontrols.menu.title"), this.width / 2, 8, 16777215);
|
||||
this.drawCenteredString(this.font, I18n.translate("lambdacontrols.controller.mappings.1"), this.width / 2, this.height - 29 - (5 + this.font.fontHeight) * 3, 10526880);
|
||||
this.drawCenteredString(this.font, I18n.translate("lambdacontrols.controller.mappings.2"), this.width / 2, this.height - 29 - (5 + this.font.fontHeight) * 2, 10526880);
|
||||
this.drawCenteredString(this.font, I18n.translate("lambdacontrols.controller.mappings.3"), this.width / 2, this.height - 29 - (5 + this.font.fontHeight), 10526880);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ package me.lambdaurora.lambdacontrols.gui;
|
||||
|
||||
import me.lambdaurora.lambdacontrols.HudSide;
|
||||
import me.lambdaurora.lambdacontrols.LambdaControls;
|
||||
import me.lambdaurora.lambdacontrols.util.LambdaKeyBinding;
|
||||
import me.lambdaurora.lambdacontrols.util.KeyBindingAccessor;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.screen.GameMenuScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
@@ -122,7 +122,7 @@ public class TouchscreenOverlay extends Screen
|
||||
*/
|
||||
private void handle_jump(boolean state)
|
||||
{
|
||||
((LambdaKeyBinding) this.minecraft.options.keyJump).handle_press_state(state);
|
||||
((KeyBindingAccessor) this.minecraft.options.keyJump).handle_press_state(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,7 +187,7 @@ public class TouchscreenOverlay extends Screen
|
||||
}));
|
||||
// Drop
|
||||
this.addButton(new TouchscreenButtonWidget(swap_hands_x, sneak_button_y + 5 + 20, 20, 20, 20, 160, 20, WIDGETS_LOCATION,
|
||||
state -> ((LambdaKeyBinding) this.minecraft.options.keyDrop).handle_press_state(state)));
|
||||
state -> ((KeyBindingAccessor) this.minecraft.options.keyDrop).handle_press_state(state)));
|
||||
// Jump keys
|
||||
this.addButton(this.jump_button = new TouchscreenButtonWidget(jump_button_x, sneak_button_y, 20, 20, 0, 40, 20, WIDGETS_LOCATION,
|
||||
this::handle_jump));
|
||||
@@ -198,13 +198,13 @@ public class TouchscreenOverlay extends Screen
|
||||
this.addButton(this.fly_up_button = new TouchscreenButtonWidget(jump_button_x, sneak_button_y - 5 - 20, 20, 20, 40, 40, 20, WIDGETS_LOCATION,
|
||||
this::handle_jump));
|
||||
this.addButton(this.fly_down_button = new TouchscreenButtonWidget(jump_button_x, sneak_button_y + 20 + 5, 20, 20, 60, 40, 20, WIDGETS_LOCATION,
|
||||
state -> ((LambdaKeyBinding) this.minecraft.options.keySneak).handle_press_state(state)));
|
||||
state -> ((KeyBindingAccessor) this.minecraft.options.keySneak).handle_press_state(state)));
|
||||
this.update_jump_buttons();
|
||||
// Movements keys
|
||||
this.addButton((this.start_sneak_button = new TouchscreenButtonWidget(sneak_button_x, sneak_button_y, 20, 20, 0, 120, 20, WIDGETS_LOCATION,
|
||||
state -> {
|
||||
if (state) {
|
||||
((LambdaKeyBinding) this.minecraft.options.keySneak).handle_press_state(true);
|
||||
((KeyBindingAccessor) this.minecraft.options.keySneak).handle_press_state(true);
|
||||
this.start_sneak_button.visible = false;
|
||||
this.end_sneak_button.visible = true;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ public class TouchscreenOverlay extends Screen
|
||||
this.addButton((this.end_sneak_button = new TouchscreenButtonWidget(sneak_button_x, sneak_button_y, 20, 20, 20, 120, 20, WIDGETS_LOCATION,
|
||||
state -> {
|
||||
if (state) {
|
||||
((LambdaKeyBinding) this.minecraft.options.keySneak).handle_press_state(false);
|
||||
((KeyBindingAccessor) this.minecraft.options.keySneak).handle_press_state(false);
|
||||
this.end_sneak_button.visible = false;
|
||||
this.start_sneak_button.visible = true;
|
||||
}
|
||||
@@ -220,31 +220,31 @@ public class TouchscreenOverlay extends Screen
|
||||
this.end_sneak_button.visible = false;
|
||||
this.addButton(this.forward_left_button = new TouchscreenButtonWidget(sneak_button_x - 20 - 5, sneak_button_y - 5 - 20, 20, 20, 80, 80, 20, WIDGETS_LOCATION,
|
||||
state -> {
|
||||
((LambdaKeyBinding) this.minecraft.options.keyForward).handle_press_state(state);
|
||||
((LambdaKeyBinding) this.minecraft.options.keyLeft).handle_press_state(state);
|
||||
((KeyBindingAccessor) this.minecraft.options.keyForward).handle_press_state(state);
|
||||
((KeyBindingAccessor) this.minecraft.options.keyLeft).handle_press_state(state);
|
||||
this.update_forward_buttons_state(state);
|
||||
}));
|
||||
this.forward_left_button.visible = false;
|
||||
this.addButton(new TouchscreenButtonWidget(sneak_button_x, sneak_button_y - 5 - 20, 20, 20, 0, 80, 20, WIDGETS_LOCATION,
|
||||
state -> {
|
||||
((LambdaKeyBinding) this.minecraft.options.keyForward).handle_press_state(state);
|
||||
((KeyBindingAccessor) this.minecraft.options.keyForward).handle_press_state(state);
|
||||
this.update_forward_buttons_state(state);
|
||||
this.forward_left_button.visible = true;
|
||||
this.forward_right_button.visible = true;
|
||||
}));
|
||||
this.addButton(this.forward_right_button = new TouchscreenButtonWidget(sneak_button_x + 20 + 5, sneak_button_y - 5 - 20, 20, 20, 100, 80, 20, WIDGETS_LOCATION,
|
||||
state -> {
|
||||
((LambdaKeyBinding) this.minecraft.options.keyForward).handle_press_state(state);
|
||||
((LambdaKeyBinding) this.minecraft.options.keyRight).handle_press_state(state);
|
||||
((KeyBindingAccessor) this.minecraft.options.keyForward).handle_press_state(state);
|
||||
((KeyBindingAccessor) this.minecraft.options.keyRight).handle_press_state(state);
|
||||
this.update_forward_buttons_state(state);
|
||||
}));
|
||||
this.forward_right_button.visible = true;
|
||||
this.addButton(new TouchscreenButtonWidget(sneak_button_x + 20 + 5, sneak_button_y, 20, 20, 20, 80, 20, WIDGETS_LOCATION,
|
||||
state -> ((LambdaKeyBinding) this.minecraft.options.keyRight).handle_press_state(state)));
|
||||
state -> ((KeyBindingAccessor) this.minecraft.options.keyRight).handle_press_state(state)));
|
||||
this.addButton(new TouchscreenButtonWidget(sneak_button_x, sneak_button_y + 20 + 5, 20, 20, 40, 80, 20, WIDGETS_LOCATION,
|
||||
state -> ((LambdaKeyBinding) this.minecraft.options.keyBack).handle_press_state(state)));
|
||||
state -> ((KeyBindingAccessor) this.minecraft.options.keyBack).handle_press_state(state)));
|
||||
this.addButton(new TouchscreenButtonWidget(sneak_button_x - 20 - 5, sneak_button_y, 20, 20, 60, 80, 20, WIDGETS_LOCATION,
|
||||
state -> ((LambdaKeyBinding) this.minecraft.options.keyLeft).handle_press_state(state)));
|
||||
state -> ((KeyBindingAccessor) this.minecraft.options.keyLeft).handle_press_state(state)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,11 +9,18 @@
|
||||
|
||||
package me.lambdaurora.lambdacontrols.mixin;
|
||||
|
||||
import me.lambdaurora.lambdacontrols.ControlsMode;
|
||||
import me.lambdaurora.lambdacontrols.LambdaControls;
|
||||
import me.lambdaurora.lambdacontrols.util.AbstractContainerScreenAccessor;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
|
||||
import net.minecraft.container.Slot;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
/**
|
||||
* Represents the mixin for the class AbstractContainerScreen.
|
||||
@@ -47,4 +54,18 @@ public abstract class AbstractContainerScreenMixin implements AbstractContainerS
|
||||
{
|
||||
return this.getSlotAt(pos_x, pos_y);
|
||||
}
|
||||
|
||||
@Inject(method = "render", at = @At("RETURN"))
|
||||
public void render(int mouseX, int mouseY, float delta, CallbackInfo ci)
|
||||
{
|
||||
if (LambdaControls.get().config.get_controls_mode() == ControlsMode.CONTROLLER) {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
int x = 10, y = client.window.getScaledHeight() - 10 - 15;
|
||||
|
||||
x += LambdaControls.draw_button_tip(x, y, GLFW.GLFW_GAMEPAD_BUTTON_A, "lambdacontrols.action.pickup_all", true, client) + 10;
|
||||
x += LambdaControls.draw_button_tip(x, y, GLFW.GLFW_GAMEPAD_BUTTON_B, "lambdacontrols.action.exit", true, client) + 10;
|
||||
x += LambdaControls.draw_button_tip(x, y, GLFW.GLFW_GAMEPAD_BUTTON_X, "lambdacontrols.action.pickup", true, client) + 10;
|
||||
LambdaControls.draw_button_tip(x, y, GLFW.GLFW_GAMEPAD_BUTTON_Y, "lambdacontrols.action.quick_move", true, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,17 +11,15 @@ package me.lambdaurora.lambdacontrols.mixin;
|
||||
|
||||
import me.lambdaurora.lambdacontrols.LambdaControls;
|
||||
import me.lambdaurora.lambdacontrols.gui.LambdaControlsHud;
|
||||
import me.lambdaurora.lambdacontrols.util.CustomInGameHud;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(InGameHud.class)
|
||||
public class InGameHudMixin implements CustomInGameHud
|
||||
public class InGameHudMixin
|
||||
{
|
||||
private LambdaControlsHud lambdacontrols_hud;
|
||||
|
||||
@@ -32,14 +30,8 @@ public class InGameHudMixin implements CustomInGameHud
|
||||
}
|
||||
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderMountHealth()V"))
|
||||
public void on_render(float tick_delta, CallbackInfo ci)
|
||||
public void on_render(CallbackInfo ci)
|
||||
{
|
||||
lambdacontrols_hud.render(tick_delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LambdaControlsHud get_lambdacontrols_hud()
|
||||
{
|
||||
return this.lambdacontrols_hud;
|
||||
lambdacontrols_hud.render();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
package me.lambdaurora.lambdacontrols.mixin;
|
||||
|
||||
import me.lambdaurora.lambdacontrols.util.LambdaKeyBinding;
|
||||
import me.lambdaurora.lambdacontrols.util.KeyBindingAccessor;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -17,7 +17,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(KeyBinding.class)
|
||||
public class KeyBindingMixin implements LambdaKeyBinding
|
||||
public class KeyBindingMixin implements KeyBindingAccessor
|
||||
{
|
||||
@Shadow
|
||||
private InputUtil.KeyCode keyCode;
|
||||
|
||||
@@ -12,15 +12,16 @@ package me.lambdaurora.lambdacontrols.mixin;
|
||||
import me.lambdaurora.lambdacontrols.ControlsMode;
|
||||
import me.lambdaurora.lambdacontrols.LambdaControls;
|
||||
import me.lambdaurora.lambdacontrols.util.MouseAccessor;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.Mouse;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
/**
|
||||
* Adds extra access to the mouse.
|
||||
*/
|
||||
@Mixin(Mouse.class)
|
||||
public abstract class MouseMixin implements MouseAccessor
|
||||
{
|
||||
|
||||
@@ -23,6 +23,9 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
/**
|
||||
* Injects the new controls settings button.
|
||||
*/
|
||||
@Mixin(SettingsScreen.class)
|
||||
public class SettingsScreenMixin extends Screen
|
||||
{
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
package me.lambdaurora.lambdacontrols.util;
|
||||
|
||||
import net.minecraft.container.Slot;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
/**
|
||||
* Represents an accessor to AbstractContainerScreen.
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2019 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of LambdaControls.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package me.lambdaurora.lambdacontrols.util;
|
||||
|
||||
import me.lambdaurora.lambdacontrols.gui.LambdaControlsHud;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents a custom ingame hud with an accessor to an added hud.
|
||||
*/
|
||||
public interface CustomInGameHud
|
||||
{
|
||||
@NotNull LambdaControlsHud get_lambdacontrols_hud();
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a Minecraft keybinding with extra access.
|
||||
*/
|
||||
public interface LambdaKeyBinding
|
||||
public interface KeyBindingAccessor
|
||||
{
|
||||
@NotNull InputUtil.KeyCode get_key_code();
|
||||
|
||||
@@ -1,20 +1,44 @@
|
||||
{
|
||||
"lambdacontrols.action.attack": "Attack",
|
||||
"lambdacontrols.action.back": "Back",
|
||||
"lambdacontrols.action.drop_item": "Drop item",
|
||||
"lambdacontrols.action.exit": "Exit",
|
||||
"lambdacontrols.action.forward": "Forward",
|
||||
"lambdacontrols.action.hit": "Hit",
|
||||
"lambdacontrols.action.inventory": "Inventory",
|
||||
"lambdacontrols.action.jump": "Jump",
|
||||
"lambdacontrols.action.pickup": "Pickup",
|
||||
"lambdacontrols.action.pickup_all": "Pickup all",
|
||||
"lambdacontrols.action.quick_move": "Quick move",
|
||||
"lambdacontrols.action.sneak": "Sneak",
|
||||
"lambdacontrols.action.sprint": "Sprint",
|
||||
"lambdacontrols.action.swap_hands": "Swap hands",
|
||||
"lambdacontrols.action.use": "Use",
|
||||
"lambdacontrols.controller.connected": "Controller %d connected.",
|
||||
"lambdacontrols.controller.disconnected": "Controller %d disconnected.",
|
||||
"lambdacontrols.controller.mappings.1": "To configure the controller mappings, please use SDL2 Gamepad Tool",
|
||||
"lambdacontrols.controller.mappings.2": "(http://generalarcade.com/gamepadtool/),",
|
||||
"lambdacontrols.controller.mappings.3": "and put the mapping in `config/gamecontrollerdb.txt`.",
|
||||
"lambdacontrols.controller_type.default": "default",
|
||||
"lambdacontrols.controller_type.playstation": "PlayStation",
|
||||
"lambdacontrols.controller_type.switch": "Switch",
|
||||
"lambdacontrols.controller_type.xbox": "Xbox",
|
||||
"lambdacontrols.controller_type.steam": "Steam",
|
||||
"lambdacontrols.controller_type.ouya": "OUYA",
|
||||
"lambdacontrols.controls_mode.default": "Keyboard/Mouse",
|
||||
"lambdacontrols.controls_mode.controller": "Controller",
|
||||
"lambdacontrols.controls_mode.touchscreen": "Touchscreen",
|
||||
"lambdacontrols.hud_side.left": "left",
|
||||
"lambdacontrols.hud_side.right": "right",
|
||||
"lambdacontrols.menu.controller": "Controller",
|
||||
"lambdacontrols.menu.controller_type": "Controller type",
|
||||
"lambdacontrols.menu.controls_mode": "Controls mode",
|
||||
"lambdacontrols.menu.dead_zone": "Dead zone",
|
||||
"lambdacontrols.menu.hud_enable": "Enable HUD",
|
||||
"lambdacontrols.menu.hud_side": "HUD side",
|
||||
"lambdacontrols.menu.invert_right_x_axis": "Invert right X",
|
||||
"lambdacontrols.menu.invert_right_y_axis": "Invert right Y",
|
||||
"lambdacontrols.menu.mouse_speed": "Mouse speed",
|
||||
"lambdacontrols.menu.rotation_speed": "Rotation speed"
|
||||
"lambdacontrols.menu.rotation_speed": "Rotation speed",
|
||||
"lambdacontrols.menu.title": "LambdaControls - Settings"
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 8.6 KiB |
@@ -4,6 +4,8 @@
|
||||
controls = "default"
|
||||
|
||||
[hud]
|
||||
# Enables the HUD.
|
||||
enable = true
|
||||
# Dertermines where the movements buttons are.
|
||||
side = "left"
|
||||
|
||||
@@ -11,6 +13,8 @@ controls = "default"
|
||||
[controller]
|
||||
# Controller to use.
|
||||
id = 0
|
||||
# Controller's type.
|
||||
type = "default"
|
||||
# Controller's dead zone.
|
||||
dead_zone = 0.20
|
||||
# Rotation speed for look directions.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"issues": "https://github.com/LambdAurora/LambdaControls/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"icon": "assets/aurora_keystrokes/icon.png",
|
||||
"icon": "assets/lambdacontrols/icon.png",
|
||||
"environment": "client",
|
||||
"entrypoints": {
|
||||
"client": [
|
||||
|
||||
Reference in New Issue
Block a user