Skip to content

Commit cf24f13

Browse files
committed
Improve auto dir config
1 parent 7b79642 commit cf24f13

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

common/src/main/java/dev/terminalmc/clientsort/client/config/ClassPolicy.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ public boolean autoTransfer() {
115115

116116
// Config data-string serialization
117117

118-
public static final String DATA_FORMAT = "%s,(%s),%s,%s,%s,%s,%d%s,(%s)";
118+
public static final String DATA_FORMAT = "%s,(%s),%s,%s,%s,%s,%d/%d,(%s)";
119119
public static final String DATA_PATTERN_STRING =
120-
"^(.+),\\((?:(-?\\d+),(-?\\d+))?\\),([012]),([012]),([012]),([012]),([01234])([NR]),\\(((?:\\d+(?:,\\d+)*)?)\\)$";
120+
"^(.+),\\((?:(-?\\d+),(-?\\d+))?\\),([012]),([012]),([012]),([012]),([01234])/([01]),\\(((?:\\d+(?:,\\d+)*)?)\\)$";
121121
public static final Pattern DATA_PATTERN = Pattern.compile(DATA_PATTERN_STRING);
122122

123123
public String toDataString() {
@@ -130,7 +130,7 @@ public String toDataString() {
130130
matchTransferPolicy.toSimpleString(),
131131
transferPolicy.toSimpleString(),
132132
autoOp == null ? 0 : List.of(Operation.values()).indexOf(autoOp) + 1,
133-
autoOpOther ? "R" : "N",
133+
autoOpOther ? 1 : 0,
134134
Strings.join(ignoredSlots.stream().map(String::valueOf).toList(), ",")
135135
);
136136
}
@@ -183,7 +183,7 @@ public static ClassPolicy fromDataString(
183183
matcher.group(8).equals("0")
184184
? null
185185
: Operation.values()[Integer.parseInt(matcher.group(8)) - 1],
186-
matcher.group(9).equals("R"),
186+
matcher.group(9).equals("1"),
187187
new TreeSet<>(Arrays.stream(matcher.group(10).split(","))
188188
.filter((s) -> !s.isBlank())
189189
.map(Integer::parseInt).sorted().toList())

common/src/main/java/dev/terminalmc/clientsort/client/gui/screen/edit/EditorScreen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ private void rebuildGui() {
250250

251251
// Change the auto trigger behavior
252252
CycleButton<Boolean> autoOpOtherButton = CycleButton.booleanBuilder(
253-
Component.literal("R").withStyle(ChatFormatting.RED),
254-
Component.literal("N").withStyle(ChatFormatting.GREEN)
253+
Component.literal("1").withStyle(ChatFormatting.RED),
254+
Component.literal("0").withStyle(ChatFormatting.GREEN)
255255
)
256256
.withTooltip((v) -> Tooltip.create(localized("editor", "autoOp.other.tooltip")))
257257
.displayOnlyValue()

common/src/main/resources/assets/clientsort/lang/en_us.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"editor.clientsort.autoOp": "Auto",
4646
"editor.clientsort.autoOp.none": "None",
4747
"editor.clientsort.autoOp.tooltip": "An operation to automatically trigger when opening this inventory. The operation must be enabled.",
48-
"editor.clientsort.autoOp.other.tooltip": "The direction, for bidirectional operations ('N' for normal, 'R' for reversed).",
48+
"editor.clientsort.autoOp.other.tooltip": "The direction, for transfer operations ('0' for out (normal), '1' for in (reversed)).",
4949
"editor.clientsort.unignoreSlots": "Unignore All Slots",
5050
"editor.clientsort.unignoreSlots.tooltip": "Unignore all ignored slots.",
5151
"editor.clientsort.moveToDefault": "Move to Default",
@@ -147,11 +147,11 @@
147147
"option.clientsort.policies.description.1": "The policy list below allows you to configure the keybind and trigger button operations for each inventory type.",
148148
"option.clientsort.policies.description.2": "This is provided as an alternative to the in-game editor, which can be opened using a keybind when viewing an inventory, or by right-clicking on a trigger button.",
149149
"option.clientsort.policies.description.3": "Data Format",
150-
"option.clientsort.policies.description.4": "<class>,(<offset>),<sort>,<fill stacks>,<transfer matching>,<transfer>,<auto>,(<ignored slots>)",
150+
"option.clientsort.policies.description.4": "<class>,(<offset>),<sort>,<fill stacks>,<transfer matching>,<transfer>,<auto>/<dir>,(<ignored slots>)",
151151
"option.clientsort.policies.description.5": " class: the full name of the inventory class or superclass.",
152152
"option.clientsort.policies.description.6": " offset: 'x,y', or empty to use the default.",
153153
"option.clientsort.policies.description.7": " status: '0' to disable the operation, '1' to only enable the keybind, '2' to enable both the keybind and the GUI button.",
154-
"option.clientsort.policies.description.8": " auto: '0' to disable, '1'-'4' to trigger an operation. 'N' for the normal direction (out), 'R' for reversed (in).",
154+
"option.clientsort.policies.description.8": " auto: '0' to disable, '1'-'4' to trigger an operation. dir: '0' for the normal direction (out), '1' for reversed (in).",
155155
"option.clientsort.policies.description.9": " ignored slots: a list of slots that should not be affected by operations.",
156156
"option.clientsort.policies.description.10": "Note: fill and transfer buttons are only shown if enabled on both the player inventory and the container.",
157157
"option.clientsort.classPolicies": "Class Policies",

0 commit comments

Comments
 (0)