Skip to content

Commit

Permalink
Search immutable array fix
Browse files Browse the repository at this point in the history
  • Loading branch information
samolego committed Oct 25, 2022
1 parent 875aa7d commit a822f3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void onInitializeClient() {
ClientLoginConnectionEvents.INIT.register(evtHandler::onLogin);

UseBlockCallback.EVENT.register(ContainerDiscovery::onUseBlock);
WorldRenderEvents.LAST.register(context -> ESPRender.onRender(context));
WorldRenderEvents.LAST.register(ESPRender::onRender);

if (config.allowSyncServer()) {
ClientPlayNetworking.registerGlobalReceiver(SERVER_CONFIG_CHANNEL, (client, handler, buf, responseSender) -> config.unpack(buf));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public void refreshSearchResults(String value) {
value = value.substring(1);

String finalValue = value;
this.searchStacks = (filtered.stream().filter(stackPair -> stackPair.getFirst().getItemHolder().tags().anyMatch(tagKey -> {
this.searchStacks = new ArrayList<>(filtered.stream().filter(stackPair -> stackPair.getFirst().getItemHolder().tags().anyMatch(tagKey -> {
ResourceLocation location = tagKey.location();
String tagName;
if (finalValue.contains(":")) {
Expand All @@ -231,17 +231,17 @@ public void refreshSearchResults(String value) {
value = value.substring(1);

String finalValue = value;
this.searchStacks = filtered.stream().filter(stackPair -> {
this.searchStacks = new ArrayList<>(filtered.stream().filter(stackPair -> {
CompoundTag tag = stackPair.getFirst().getTag();
if (tag == null) {
return false;
}
return tag.toString().toLowerCase(Locale.ROOT).contains(finalValue);

}).toList();
}).toList());
} else if (value.startsWith("@")) {
String finalValue = value;
this.searchStacks = filtered.stream().filter(stackPair -> {
this.searchStacks = new ArrayList<>(filtered.stream().filter(stackPair -> {
var search = finalValue.substring(1).split(" ");
String namespace = search[0];
final var item = stackPair.getFirst();
Expand All @@ -253,15 +253,15 @@ public void refreshSearchResults(String value) {
}

return namespaceFltr;
}).toList();
}).toList());
} else {
String finalValue = value;
this.searchStacks = filtered.stream()
this.searchStacks = new ArrayList<>(filtered.stream()
.filter(stack ->
stack.getFirst().getDisplayName()
.getString().toLowerCase(Locale.ROOT)
.contains(finalValue.toLowerCase(Locale.ROOT)))
.toList();
.toList());
}
}

Expand Down

0 comments on commit a822f3a

Please sign in to comment.