Skip to content

Commit 3561716

Browse files
committed
Avoid checking count when validating type
1 parent 602b1c7 commit 3561716

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 2.0.0-beta.21
44

55
- Increased interaction interval limit to 1000ms
6+
- Fixed item type validator also checking stack size
67

78
## 2.0.0-beta.20
89

common/src/main/java/dev/terminalmc/clientsort/network/handler/PayloadHandler.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,10 @@ public static void validate(
132132
}
133133

134134
if (log || serverOptions().validateItemType) {
135-
boolean mismatchedTypes = notEqual(expected, actual);
136-
if (mismatchedTypes)
137-
invalid = true;
135+
if (!expected.isEmpty() && !actual.isEmpty()) {
136+
if (!ItemStack.isSameItemSameComponents(expected, actual))
137+
invalid = true;
138+
}
138139
}
139140

140141
if (log || serverOptions().validateStackSize) {
@@ -193,9 +194,4 @@ public static void validate(
193194

194195
return menu;
195196
}
196-
197-
public static boolean notEqual(ItemStack a, ItemStack b) {
198-
return !ItemStack.isSameItemSameComponents(a, b)
199-
|| a.getCount() != b.getCount();
200-
}
201197
}

0 commit comments

Comments
 (0)