Fix ME Interface Terminal input search not checking beyond first input (#364)

This commit is contained in:
Serenibyss
2024-01-12 23:57:54 -06:00
committed by GitHub
parent f7aa4c92bc
commit d128b0c228
@@ -50,6 +50,7 @@ import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
@@ -567,15 +568,15 @@ public class GuiInterfaceTerminal extends AEBaseGui {
return searchTerm.matches(GuiText.InvalidPattern.getLocal()); return searchTerm.matches(GuiText.InvalidPattern.getLocal());
} }
NBTTagList tag = new NBTTagList(); final NBTTagList tag;
if (pass == 0) { if (pass == 0) {
tag = encodedValue.getTagList("in", 10); tag = encodedValue.getTagList("in", Constants.NBT.TAG_COMPOUND);
} else { } else {
tag = encodedValue.getTagList("out", 10); tag = encodedValue.getTagList("out", Constants.NBT.TAG_COMPOUND);
} }
boolean foundMatchingItemStack = false; boolean foundMatchingItemStack = false;
final String[] splitTerm = searchTerm.split(" ");
for (int i = 0; i < tag.tagCount(); i++) { for (int i = 0; i < tag.tagCount(); i++) {
final ItemStack parsedItemStack = new ItemStack(tag.getCompoundTagAt(i)); final ItemStack parsedItemStack = new ItemStack(tag.getCompoundTagAt(i));
@@ -584,7 +585,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
.getItemDisplayName(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(parsedItemStack)) .getItemDisplayName(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(parsedItemStack))
.toLowerCase(); .toLowerCase();
for (String term : searchTerm.split(" ")) { for (String term : splitTerm) {
if (term.length() > 1 && (term.startsWith("-") || term.startsWith("!"))) { if (term.length() > 1 && (term.startsWith("-") || term.startsWith("!"))) {
term = term.substring(1); term = term.substring(1);
if (displayName.contains(term)) { if (displayName.contains(term)) {
@@ -592,8 +593,6 @@ public class GuiInterfaceTerminal extends AEBaseGui {
} }
} else if (displayName.contains(term)) { } else if (displayName.contains(term)) {
foundMatchingItemStack = true; foundMatchingItemStack = true;
} else {
return false;
} }
} }
} }