forked from Clones/Controlify
Merge branch 'feature/radial-menu' into 1.20.x/dev
# Conflicts: # src/main/java/dev/isxander/controlify/config/ControlifyConfig.java # src/main/java/dev/isxander/controlify/controller/ControllerConfig.java # src/main/resources/assets/controlify/lang/en_us.json
This commit is contained in:
@ -20,6 +20,8 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.ToggleKeyMapping;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.BooleanSupplier;
|
||||
@ -37,6 +39,7 @@ public class ControllerBindings<T extends ControllerState> {
|
||||
public static final Component VMOUSE_CATEGORY = Component.translatable("controlify.binding_category.vmouse");
|
||||
public static final Component GUI_CATEGORY = Component.translatable("controlify.binding_category.gui");
|
||||
public static final Component MISC_CATEGORY = Component.translatable("key.categories.misc");
|
||||
public static final Component RADIAL_CATEGORY = Component.translatable("controlify.gui.radial_menu");
|
||||
|
||||
public final ControllerBinding
|
||||
WALK_FORWARD, WALK_BACKWARD, WALK_LEFT, WALK_RIGHT,
|
||||
@ -59,6 +62,7 @@ public class ControllerBindings<T extends ControllerState> {
|
||||
PICK_BLOCK,
|
||||
TOGGLE_HUD_VISIBILITY,
|
||||
SHOW_PLAYER_LIST,
|
||||
RADIAL_MENU, RADIAL_AXIS_UP, RADIAL_AXIS_DOWN, RADIAL_AXIS_LEFT, RADIAL_AXIS_RIGHT,
|
||||
VMOUSE_MOVE_UP, VMOUSE_MOVE_DOWN, VMOUSE_MOVE_LEFT, VMOUSE_MOVE_RIGHT,
|
||||
VMOUSE_LCLICK, VMOUSE_RCLICK, VMOUSE_SHIFT_CLICK,
|
||||
VMOUSE_SCROLL_UP, VMOUSE_SCROLL_DOWN,
|
||||
@ -138,6 +142,7 @@ public class ControllerBindings<T extends ControllerState> {
|
||||
.defaultBind(GamepadBinds.A_BUTTON)
|
||||
.category(MOVEMENT_CATEGORY)
|
||||
.context(BindContexts.INGAME)
|
||||
.radialCandidate(RadialIcons.getEffect(MobEffects.JUMP))
|
||||
.build());
|
||||
register(SPRINT = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "sprint")
|
||||
@ -171,12 +176,14 @@ public class ControllerBindings<T extends ControllerState> {
|
||||
.defaultBind(GamepadBinds.DPAD_DOWN)
|
||||
.category(GAMEPLAY_CATEGORY)
|
||||
.context(BindContexts.INGAME, BindContexts.INVENTORY)
|
||||
.radialCandidate(RadialIcons.getItem(Items.BARRIER))
|
||||
.build());
|
||||
register(DROP_STACK = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "drop_stack")
|
||||
.defaultBind(new EmptyBind<>())
|
||||
.category(GAMEPLAY_CATEGORY)
|
||||
.context(BindContexts.INGAME)
|
||||
.radialCandidate(RadialIcons.getItem(Items.TNT))
|
||||
.build());
|
||||
register(NEXT_SLOT = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "next_slot")
|
||||
@ -195,30 +202,35 @@ public class ControllerBindings<T extends ControllerState> {
|
||||
.defaultBind(GamepadBinds.START)
|
||||
.category(GAMEPLAY_CATEGORY)
|
||||
.context(BindContexts.INGAME)
|
||||
.radialCandidate(RadialIcons.getItem(Items.STRUCTURE_VOID))
|
||||
.build());
|
||||
register(INVENTORY = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "inventory")
|
||||
.defaultBind(GamepadBinds.Y_BUTTON)
|
||||
.category(INVENTORY_CATEGORY)
|
||||
.context(BindContexts.INGAME)
|
||||
.radialCandidate(RadialIcons.getItem(Items.CHEST))
|
||||
.build());
|
||||
register(CHANGE_PERSPECTIVE = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "change_perspective")
|
||||
.defaultBind(GamepadBinds.BACK)
|
||||
.category(GAMEPLAY_CATEGORY)
|
||||
.context(BindContexts.INGAME)
|
||||
.radialCandidate(RadialIcons.getItem(Items.PAINTING))
|
||||
.build());
|
||||
register(SWAP_HANDS = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "swap_hands")
|
||||
.defaultBind(GamepadBinds.X_BUTTON)
|
||||
.category(INVENTORY_CATEGORY)
|
||||
.context(BindContexts.INGAME, BindContexts.INVENTORY)
|
||||
.context(BindContexts.INGAME)
|
||||
.radialCandidate(RadialIcons.getItem(Items.BONE))
|
||||
.build());
|
||||
register(OPEN_CHAT = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "open_chat")
|
||||
.defaultBind(GamepadBinds.DPAD_UP)
|
||||
.category(MISC_CATEGORY)
|
||||
.context(BindContexts.INGAME)
|
||||
.radialCandidate(RadialIcons.getItem(Items.WRITABLE_BOOK))
|
||||
.vanillaOverride(options.keyChat, () -> false)
|
||||
.build());
|
||||
register(GUI_PRESS = ControllerBindingBuilder.create(controller)
|
||||
@ -280,6 +292,7 @@ public class ControllerBindings<T extends ControllerState> {
|
||||
.defaultBind(GamepadBinds.DPAD_LEFT)
|
||||
.category(GAMEPLAY_CATEGORY)
|
||||
.context(BindContexts.INGAME)
|
||||
.radialCandidate(RadialIcons.getItem(Items.STICK))
|
||||
.vanillaOverride(options.keyPickItem, () -> false)
|
||||
.build());
|
||||
register(TOGGLE_HUD_VISIBILITY = ControllerBindingBuilder.create(controller)
|
||||
@ -287,12 +300,44 @@ public class ControllerBindings<T extends ControllerState> {
|
||||
.defaultBind(new EmptyBind<>())
|
||||
.category(MISC_CATEGORY)
|
||||
.context(BindContexts.INGAME)
|
||||
.radialCandidate(RadialIcons.getEffect(MobEffects.INVISIBILITY))
|
||||
.build());
|
||||
register(SHOW_PLAYER_LIST = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "show_player_list")
|
||||
.defaultBind(GamepadBinds.DPAD_RIGHT)
|
||||
.defaultBind(new EmptyBind<>())
|
||||
.category(MISC_CATEGORY)
|
||||
.context(BindContexts.INGAME)
|
||||
.radialCandidate(RadialIcons.getItem(Items.PLAYER_HEAD))
|
||||
.build());
|
||||
register(RADIAL_MENU = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "radial_menu")
|
||||
.defaultBind(GamepadBinds.DPAD_RIGHT)
|
||||
.category(RADIAL_CATEGORY)
|
||||
.context(BindContexts.INGAME)
|
||||
.build());
|
||||
register(RADIAL_AXIS_UP = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "radial_axis_up")
|
||||
.defaultBind(GamepadBinds.RIGHT_STICK_FORWARD)
|
||||
.category(RADIAL_CATEGORY)
|
||||
.context(BindContexts.GUI)
|
||||
.build());
|
||||
register(RADIAL_AXIS_DOWN = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "radial_axis_down")
|
||||
.defaultBind(GamepadBinds.RIGHT_STICK_BACKWARD)
|
||||
.category(RADIAL_CATEGORY)
|
||||
.context(BindContexts.GUI)
|
||||
.build());
|
||||
register(RADIAL_AXIS_LEFT = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "radial_axis_left")
|
||||
.defaultBind(GamepadBinds.RIGHT_STICK_LEFT)
|
||||
.category(RADIAL_CATEGORY)
|
||||
.context(BindContexts.GUI)
|
||||
.build());
|
||||
register(RADIAL_AXIS_RIGHT = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "radial_axis_right")
|
||||
.defaultBind(GamepadBinds.RIGHT_STICK_RIGHT)
|
||||
.category(RADIAL_CATEGORY)
|
||||
.context(BindContexts.GUI)
|
||||
.build());
|
||||
register(VMOUSE_MOVE_UP = ControllerBindingBuilder.create(controller)
|
||||
.identifier("controlify", "vmouse_move_up")
|
||||
@ -408,6 +453,9 @@ public class ControllerBindings<T extends ControllerState> {
|
||||
this.imitateVanillaClick();
|
||||
}
|
||||
});
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
registry().values().forEach(ControllerBinding::tick);
|
||||
});
|
||||
|
||||
ControlifyEvents.INPUT_MODE_CHANGED.register(mode -> KeyMapping.releaseAll());
|
||||
}
|
||||
@ -503,6 +551,7 @@ public class ControllerBindings<T extends ControllerState> {
|
||||
.name(Component.translatable(keyMapping.getName()))
|
||||
.description(Component.translatable("controlify.custom_binding.vanilla_description").withStyle(ChatFormatting.GRAY))
|
||||
.category(Component.translatable(keyMapping.getCategory()))
|
||||
.radialCandidate(RadialIcons.FABRIC_ICON)
|
||||
.vanillaOverride(keyMapping, toggleOverride)
|
||||
.build();
|
||||
|
||||
|
Reference in New Issue
Block a user