mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-17 19:15:13 +00:00
d&d to search input; fix giveStack; change grid size
This commit is contained in:
1 parent
5dde7cad8b
commit
98c9f03e74
4 files changed
+31
-49
No files matched your search
@@ -14,7 +14,10 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import static codechicken.nei.LayoutManager.searchField;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class ItemPanel extends Widget
|
||||
{
|
||||
@@ -38,6 +41,8 @@ public class ItemPanel extends Widget
|
||||
@Deprecated
|
||||
public ArrayList<ItemStack> realItems = new ArrayList<>();
|
||||
|
||||
protected Pattern SPECIAL_REGEX_CHARS = Pattern.compile("[{}()\\[\\].+*?^$\\\\|]");
|
||||
|
||||
public static class ItemPanelSlot
|
||||
{
|
||||
public ItemStack item;
|
||||
@@ -64,7 +69,6 @@ public class ItemPanel extends Widget
|
||||
public void setItems(ArrayList<ItemStack> items)
|
||||
{
|
||||
newItems = items;
|
||||
needRefresh = true;
|
||||
}
|
||||
|
||||
public void refresh(GuiContainer gui)
|
||||
@@ -320,6 +324,10 @@ public class ItemPanel extends Widget
|
||||
return true;
|
||||
}
|
||||
|
||||
if (handleSearchInputClick(mouseX, mouseY, button)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (handleGUIContainerClick(mouseX, mouseY, button)) {
|
||||
return true;
|
||||
}
|
||||
@@ -442,6 +450,24 @@ public class ItemPanel extends Widget
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean handleSearchInputClick(int mouseX, int mouseY, int button)
|
||||
{
|
||||
|
||||
if (searchField.contains(mouseX, mouseY)) {
|
||||
final FluidStack fluidStack = StackInfo.getFluid(draggedStack);
|
||||
|
||||
if (fluidStack != null) {
|
||||
searchField.setText(SPECIAL_REGEX_CHARS.matcher(fluidStack.getLocalizedName()).replaceAll("\\\\$0"));
|
||||
} else {
|
||||
searchField.setText(SPECIAL_REGEX_CHARS.matcher(draggedStack.getDisplayName()).replaceAll("\\\\$0"));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseUp(int mousex, int mousey, int button) {
|
||||
ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey);
|
||||
|
||||
Reference in new issue
Block a user