Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ default boolean isLeftHandSidePanel() {
ModifierKeyCode getExportImageKeybind();

ModifierKeyCode getPreviousScreenKeybind();

ModifierKeyCode getCollapseGroupKeybind();

double getEntrySize();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public static <T> long hash(EntryStack<T> stack, ComparisonContext context) {
*
* @param stack the stack to hash code
* @param <T> the type of the stack
* @return the hash code of the {@link ComparisonContext#EXACT} context
* @return the hash code of ofCondensedEntrythe {@link ComparisonContext#EXACT} context
* @see #hash(EntryStack, ComparisonContext)
*/
public static <T> long hashExact(EntryStack<T> stack) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,11 @@ public ModifierKeyCode getExportImageKeybind() {
public ModifierKeyCode getPreviousScreenKeybind() {
return basics.keyBindings.previousScreenKeybind == null ? ModifierKeyCode.unknown() : basics.keyBindings.previousScreenKeybind;
}

@Override
public ModifierKeyCode getCollapseGroupKeybind() {
return basics.keyBindings.collapseGroupKeybind == null ? ModifierKeyCode.unknown() : basics.keyBindings.collapseGroupKeybind;
}

@Override
public double getEntrySize() {
Expand Down Expand Up @@ -613,6 +618,7 @@ public static class KeyBindings {
public ModifierKeyCode favoriteKeybind = ModifierKeyCode.of(InputConstants.Type.KEYSYM.getOrCreate(InputConstants.KEY_A), Modifier.none());
public ModifierKeyCode exportImageKeybind = ModifierKeyCode.of(InputConstants.Type.KEYSYM.getOrCreate(InputConstants.KEY_F8), Modifier.none());
public ModifierKeyCode previousScreenKeybind = ModifierKeyCode.of(InputConstants.Type.KEYSYM.getOrCreate(InputConstants.KEY_BACKSPACE), Modifier.none());
public ModifierKeyCode collapseGroupKeybind = ModifierKeyCode.of(InputConstants.Type.KEYSYM.getOrCreate(InputConstants.KEY_LALT), Modifier.none());
}

public static class Appearance {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ static <T> OptionGroup make(String id) {
.add(COPY_RECIPE_ID_KEYBIND)
.add(FAVORITE_KEYBIND)
/*.add(EXPORT_IMAGE_KEYBIND)*/
.add(BACK_KEYBIND);
.add(BACK_KEYBIND)
.add(COLLAPSE_KEYBIND);
OptionGroup INPUT_ADVANCED = make("input.advanced")
.add(USE_NATIVE_KEYBINDS);
OptionGroup LAYOUT_WIDGETS = make("layout.widgets")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ static ComparableValue<Double>[] doubleRange(double start, double end, double st
.keybind();
CompositeOption<ModifierKeyCode> BACK_KEYBIND = make("input.back", i -> i.basics.keyBindings.previousScreenKeybind.copy(), (i, v) -> i.basics.keyBindings.previousScreenKeybind = v)
.keybind();
CompositeOption<ModifierKeyCode> COLLAPSE_KEYBIND = make("input.collapse", i -> i.basics.keyBindings.collapseGroupKeybind.copy(), (i, v) -> i.basics.keyBindings.collapseGroupKeybind = v)
.keybind();
// TODO: NATIVE KEYBINDS
CompositeOption<Boolean> USE_NATIVE_KEYBINDS = make("input.use_native_keybinds", i -> i.basics.keyBindings.useNativeKeybinds, (i, v) -> i.basics.keyBindings.useNativeKeybinds = v)
.enabledDisabled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@

package me.shedaniel.rei.impl.client.gui.widget.entrylist;

import com.mojang.blaze3d.platform.InputConstants;
import me.shedaniel.clothconfig2.api.animator.NumberAnimator;
import me.shedaniel.clothconfig2.api.animator.ValueAnimator;
import me.shedaniel.math.FloatingRectangle;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.math.impl.PointHelper;
import me.shedaniel.rei.api.client.ClientHelper;
import me.shedaniel.rei.api.client.config.ConfigObject;
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
import me.shedaniel.rei.api.client.gui.widgets.TooltipContext;
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
Expand All @@ -40,7 +42,6 @@
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -160,7 +161,11 @@ protected void drawCurrentEntry(GuiGraphics graphics, int mouseX, int mouseY, fl

@Override
protected boolean doAction(double mouseX, double mouseY, int button) {
if (collapsedStack != null && button == 0 && Screen.hasAltDown()) {
if (collapsedStack != null && button == 0 &&
InputConstants.isKeyDown(
Minecraft.getInstance().getWindow().getWindow(),
ConfigObject.getInstance().getCollapseGroupKeybind().getKeyCode().getValue()
)) {
parent.updatedCount++;
collapsedStack.setExpanded(!collapsedStack.isExpanded());
parent.updateStacks();
Expand Down Expand Up @@ -209,7 +214,7 @@ public Tooltip getCurrentTooltip(TooltipContext context) {
if (!this.collapsedStack.isExpanded()) {
Tooltip tooltip = Tooltip.create(context.getPoint(), Component.translatable("text.rei.collapsed.entry", collapsedStack.getName()));
tooltip.add(new CollapsedEntriesTooltip(collapsedStack));
tooltip.add(Component.translatable(Minecraft.ON_OSX ? "text.rei.collapsed.entry.hint.expand.macos" : "text.rei.collapsed.entry.hint.expand", collapsedStack.getName(), collapsedStack.getIngredient().size())
tooltip.add(Component.translatable(Minecraft.ON_OSX ? "text.rei.collapsed.entry.hint.expand.macos" : "text.rei.collapsed.entry.hint.expand", ConfigObject.getInstance().getCollapseGroupKeybind().getLocalizedName(), collapsedStack.getName(), collapsedStack.getIngredient().size())
.withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC));
ClientHelper.getInstance().appendModIdToTooltips(tooltip, collapsedStack.getModId());
return tooltip;
Expand All @@ -218,7 +223,7 @@ public Tooltip getCurrentTooltip(TooltipContext context) {

Tooltip tooltip = super.getCurrentTooltip(context);
if (tooltip != null && this.collapsedStack != null) {
tooltip.entries().add(Mth.clamp(tooltip.entries().size() - 1, 0, tooltip.entries().size() - 1), Tooltip.entry(Component.translatable(Minecraft.ON_OSX ? "text.rei.collapsed.entry.hint.collapse.macos" : "text.rei.collapsed.entry.hint.collapse", collapsedStack.getName(), collapsedStack.getIngredient().size())
tooltip.entries().add(Mth.clamp(tooltip.entries().size() - 1, 0, tooltip.entries().size() - 1), Tooltip.entry(Component.translatable(Minecraft.ON_OSX ? "text.rei.collapsed.entry.hint.collapse.macos" : "text.rei.collapsed.entry.hint.collapse", ConfigObject.getInstance().getCollapseGroupKeybind().getLocalizedName(), collapsedStack.getName(), collapsedStack.getIngredient().size())
.withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC)));
}
return tooltip;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@
"text.rei.changelog.error.missingChangelogFile": "Missing changelog File!",
"text.rei.changelog.error.failedToReadChangelogFile": "Failed to read changelog File!",
"text.rei.collapsed.entry": "Collapsed Entry: %s",
"text.rei.collapsed.entry.hint.expand": "Alt-Click to expand all %s (%d entries)",
"text.rei.collapsed.entry.hint.expand.macos": "Option-Click to expand all %s (%d entries)",
"text.rei.collapsed.entry.hint.collapse": "Alt-Click to collapse all %s (%d entries)",
"text.rei.collapsed.entry.hint.collapse.macos": "Option-Click to collapse all %s (%d entries)",
"text.rei.collapsed.entry.hint.expand": "Hold %s+Click to expand all %s (%d entries)",
"text.rei.collapsed.entry.hint.expand.macos": "Hold %s+Click to expand all %s (%d entries)",
"text.rei.collapsed.entry.hint.collapse": "Hold %s+Click to collapse all %s (%d entries)",
"text.rei.collapsed.entry.hint.collapse.macos": "Hold %s+Click to collapse all %s (%d entries)",
"text.rei.collapsible.entries": "Collapsible Entries...",
"text.rei.collapsible.entries.title": "Collapsible Entries",
"text.rei.collapsible.entries.count": "%s entries",
Expand Down Expand Up @@ -295,6 +295,7 @@
"config.rei.options.input.export_image.desc": "Export a recipe as an image by pressing the keybind, while hovering over a recipe.",
"config.rei.options.input.back": "Back",
"config.rei.options.input.back.desc": "Quickly navigate back to the previous recipes by pressing the keybind.",
"config.rei.options.input.collapse": "Collapse/expand collapsible groups",
"config.rei.options.groups.input.advanced": "Advanced",
"config.rei.options.input.use_native_keybinds": "Use Native Keybinds",
"config.rei.options.input.use_native_keybinds.desc": "Instead of listing the keybindings in this configuration menu, create vanilla Minecraft-like keybinds in the Controls screen. Restarting Minecraft is required to disable this option.\nNote that Minecraft-like keybinds suffer from conflicts and lack of support for modifier keys (Fabric).",
Expand Down