mirror of
https://github.com/GTNewHorizons/WirelessCraftingTerminal.git
synced 2026-11-22 12:59:51 +00:00
escape drop to search string
This commit is contained in:
1 parent
e06f6a9e15
commit
d73eccc895
1 file changed
+7
-1
+7
-1
@@ -6,8 +6,14 @@ import net.minecraft.item.ItemStack;
|
||||
import codechicken.nei.api.INEIGuiAdapter;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
|
||||
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class NEIGUIHandler extends INEIGuiAdapter
|
||||
{
|
||||
|
||||
protected Pattern SPECIAL_REGEX_CHARS = Pattern.compile("[{}()\\[\\].+*?^$\\\\|]");
|
||||
|
||||
@Override
|
||||
public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button)
|
||||
{
|
||||
@@ -16,7 +22,7 @@ public class NEIGUIHandler extends INEIGuiAdapter
|
||||
GuiWirelessCraftingTerminal gmm = (GuiWirelessCraftingTerminal)gui;
|
||||
if (gmm.isOverSearchField(mousex, mousey))
|
||||
{
|
||||
gmm.setSearchString(draggedStack.getDisplayName());
|
||||
gmm.setSearchString(SPECIAL_REGEX_CHARS.matcher(draggedStack.getDisplayName()).replaceAll("\\\\$0"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user