Autoselected mode for search box
This commit is contained in:
@@ -55,19 +55,16 @@ public class GuiGrid extends GuiBase {
|
|||||||
addSideButton(new SideButtonRedstoneMode(grid.getRedstoneModeSetting()));
|
addSideButton(new SideButtonRedstoneMode(grid.getRedstoneModeSetting()));
|
||||||
}
|
}
|
||||||
|
|
||||||
addSideButton(new SideButtonGridSortingDirection(grid));
|
|
||||||
addSideButton(new SideButtonGridSortingType(grid));
|
|
||||||
|
|
||||||
if (RefinedStorage.hasJei()) {
|
|
||||||
addSideButton(new SideButtonGridSearchBoxMode(grid));
|
|
||||||
}
|
|
||||||
|
|
||||||
searchField = new GuiTextField(0, fontRendererObj, x + 80 + 1, y + 6 + 1, 88 - 6, fontRendererObj.FONT_HEIGHT);
|
searchField = new GuiTextField(0, fontRendererObj, x + 80 + 1, y + 6 + 1, 88 - 6, fontRendererObj.FONT_HEIGHT);
|
||||||
searchField.setEnableBackgroundDrawing(false);
|
searchField.setEnableBackgroundDrawing(false);
|
||||||
searchField.setVisible(true);
|
searchField.setVisible(true);
|
||||||
searchField.setTextColor(16777215);
|
searchField.setTextColor(16777215);
|
||||||
searchField.setCanLoseFocus(false);
|
searchField.setCanLoseFocus(true);
|
||||||
searchField.setFocused(true);
|
searchField.setFocused(grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED || grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED);
|
||||||
|
|
||||||
|
addSideButton(new SideButtonGridSortingDirection(grid));
|
||||||
|
addSideButton(new SideButtonGridSortingType(grid));
|
||||||
|
addSideButton(new SideButtonGridSearchBoxMode(grid));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IGrid getGrid() {
|
public IGrid getGrid() {
|
||||||
@@ -296,14 +293,16 @@ public class GuiGrid extends GuiBase {
|
|||||||
public void mouseClicked(int mouseX, int mouseY, int clickedButton) throws IOException {
|
public void mouseClicked(int mouseX, int mouseY, int clickedButton) throws IOException {
|
||||||
super.mouseClicked(mouseX, mouseY, clickedButton);
|
super.mouseClicked(mouseX, mouseY, clickedButton);
|
||||||
|
|
||||||
|
searchField.mouseClicked(mouseX, mouseY, clickedButton);
|
||||||
|
|
||||||
boolean clickedClear = clickedButton == 0 && isHoveringOverClear(mouseX - guiLeft, mouseY - guiTop);
|
boolean clickedClear = clickedButton == 0 && isHoveringOverClear(mouseX - guiLeft, mouseY - guiTop);
|
||||||
boolean playClickSound = clickedClear;
|
boolean clickedCreatePattern = clickedButton == 0 && isHoveringOverCreatePattern(mouseX - guiLeft, mouseY - guiTop);
|
||||||
|
|
||||||
|
boolean playClickSound = clickedClear || clickedCreatePattern;
|
||||||
|
|
||||||
if (grid.isConnected()) {
|
if (grid.isConnected()) {
|
||||||
if (isHoveringOverCreatePattern(mouseX - guiLeft, mouseY - guiTop)) {
|
if (clickedCreatePattern) {
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageGridPatternCreate((TileGrid) grid));
|
RefinedStorage.NETWORK.sendToServer(new MessageGridPatternCreate((TileGrid) grid));
|
||||||
|
|
||||||
playClickSound = true;
|
|
||||||
} else if (isHoveringOverSlot() && container.getPlayer().inventory.getItemStack() != null && (clickedButton == 0 || clickedButton == 1)) {
|
} else if (isHoveringOverSlot() && container.getPlayer().inventory.getItemStack() != null && (clickedButton == 0 || clickedButton == 1)) {
|
||||||
grid.onItemPush(-1, clickedButton == 1);
|
grid.onItemPush(-1, clickedButton == 1);
|
||||||
} else if (isHoveringOverItemInSlot() && container.getPlayer().inventory.getItemStack() == null) {
|
} else if (isHoveringOverItemInSlot() && container.getPlayer().inventory.getItemStack() == null) {
|
||||||
@@ -326,7 +325,7 @@ public class GuiGrid extends GuiBase {
|
|||||||
|
|
||||||
grid.onItemPull(hoveringItemId, flags);
|
grid.onItemPull(hoveringItemId, flags);
|
||||||
}
|
}
|
||||||
} else if (clickedClear) {
|
} else if (clickedClear && grid.isConnected()) {
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageGridCraftingClear((TileGrid) grid));
|
RefinedStorage.NETWORK.sendToServer(new MessageGridCraftingClear((TileGrid) grid));
|
||||||
} else {
|
} else {
|
||||||
for (Slot slot : container.getPlayerInventorySlots()) {
|
for (Slot slot : container.getPlayerInventorySlots()) {
|
||||||
@@ -357,7 +356,7 @@ public class GuiGrid extends GuiBase {
|
|||||||
@Override
|
@Override
|
||||||
protected void keyTyped(char character, int keyCode) throws IOException {
|
protected void keyTyped(char character, int keyCode) throws IOException {
|
||||||
if (!checkHotbarKeys(keyCode) && searchField.textboxKeyTyped(character, keyCode)) {
|
if (!checkHotbarKeys(keyCode) && searchField.textboxKeyTyped(character, keyCode)) {
|
||||||
if (RefinedStorage.hasJei() && grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED) {
|
if (RefinedStorage.hasJei() && (grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED || grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED)) {
|
||||||
PluginRefinedStorage.INSTANCE.getRuntime().getItemListOverlay().setFilterText(searchField.getText());
|
PluginRefinedStorage.INSTANCE.getRuntime().getItemListOverlay().setFilterText(searchField.getText());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package refinedstorage.gui.sidebutton;
|
package refinedstorage.gui.sidebutton;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import refinedstorage.RefinedStorage;
|
||||||
import refinedstorage.gui.GuiBase;
|
import refinedstorage.gui.GuiBase;
|
||||||
import refinedstorage.tile.grid.IGrid;
|
import refinedstorage.tile.grid.IGrid;
|
||||||
import refinedstorage.tile.grid.TileGrid;
|
import refinedstorage.tile.grid.TileGrid;
|
||||||
@@ -28,8 +30,16 @@ public class SideButtonGridSearchBoxMode extends SideButton {
|
|||||||
int mode = grid.getSearchBoxMode();
|
int mode = grid.getSearchBoxMode();
|
||||||
|
|
||||||
if (mode == TileGrid.SEARCH_BOX_MODE_NORMAL) {
|
if (mode == TileGrid.SEARCH_BOX_MODE_NORMAL) {
|
||||||
mode = TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED;
|
mode = TileGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED;
|
||||||
|
} else if (mode == TileGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED) {
|
||||||
|
if (RefinedStorage.hasJei()) {
|
||||||
|
mode = TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED;
|
||||||
|
} else {
|
||||||
|
mode = TileGrid.SEARCH_BOX_MODE_NORMAL;
|
||||||
|
}
|
||||||
} else if (mode == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED) {
|
} else if (mode == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED) {
|
||||||
|
mode = TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED;
|
||||||
|
} else if (mode == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED) {
|
||||||
mode = TileGrid.SEARCH_BOX_MODE_NORMAL;
|
mode = TileGrid.SEARCH_BOX_MODE_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,10 @@ public class MessageGridSettingsUpdate extends MessageHandlerPlayerToServer<Mess
|
|||||||
((TileGrid) tile).setSortingType(message.sortingType);
|
((TileGrid) tile).setSortingType(message.sortingType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.searchBoxMode == TileGrid.SEARCH_BOX_MODE_NORMAL || message.searchBoxMode == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED) {
|
if (message.searchBoxMode == TileGrid.SEARCH_BOX_MODE_NORMAL ||
|
||||||
|
message.searchBoxMode == TileGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED ||
|
||||||
|
message.searchBoxMode == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED ||
|
||||||
|
message.searchBoxMode == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED) {
|
||||||
((TileGrid) tile).setSearchBoxMode(message.searchBoxMode);
|
((TileGrid) tile).setSearchBoxMode(message.searchBoxMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ public class TileGrid extends TileMachine implements IGrid {
|
|||||||
public static final int SORTING_TYPE_NAME = 1;
|
public static final int SORTING_TYPE_NAME = 1;
|
||||||
|
|
||||||
public static final int SEARCH_BOX_MODE_NORMAL = 0;
|
public static final int SEARCH_BOX_MODE_NORMAL = 0;
|
||||||
public static final int SEARCH_BOX_MODE_JEI_SYNCHRONIZED = 1;
|
public static final int SEARCH_BOX_MODE_NORMAL_AUTOSELECTED = 1;
|
||||||
|
public static final int SEARCH_BOX_MODE_JEI_SYNCHRONIZED = 2;
|
||||||
|
public static final int SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED = 3;
|
||||||
|
|
||||||
private Container craftingContainer = new Container() {
|
private Container craftingContainer = new Container() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -63,7 +63,9 @@ sidebutton.refinedstorage:grid.sorting.type.0=Quantity
|
|||||||
sidebutton.refinedstorage:grid.sorting.type.1=Name
|
sidebutton.refinedstorage:grid.sorting.type.1=Name
|
||||||
sidebutton.refinedstorage:grid.search_box_mode=Search Box Mode
|
sidebutton.refinedstorage:grid.search_box_mode=Search Box Mode
|
||||||
sidebutton.refinedstorage:grid.search_box_mode.0=Normal
|
sidebutton.refinedstorage:grid.search_box_mode.0=Normal
|
||||||
sidebutton.refinedstorage:grid.search_box_mode.1=JEI synchronized
|
sidebutton.refinedstorage:grid.search_box_mode.1=Normal (autoselected)
|
||||||
|
sidebutton.refinedstorage:grid.search_box_mode.2=JEI synchronized
|
||||||
|
sidebutton.refinedstorage:grid.search_box_mode.3=JEI synchronized (autoselected)
|
||||||
|
|
||||||
sidebutton.refinedstorage:mode=Mode
|
sidebutton.refinedstorage:mode=Mode
|
||||||
sidebutton.refinedstorage:mode.whitelist=Whitelist
|
sidebutton.refinedstorage:mode.whitelist=Whitelist
|
||||||
|
|||||||
@@ -63,7 +63,9 @@ sidebutton.refinedstorage:grid.sorting.type.0=Hoeveelheid
|
|||||||
sidebutton.refinedstorage:grid.sorting.type.1=Naam
|
sidebutton.refinedstorage:grid.sorting.type.1=Naam
|
||||||
sidebutton.refinedstorage:grid.search_box_mode=Zoekbalk Mode
|
sidebutton.refinedstorage:grid.search_box_mode=Zoekbalk Mode
|
||||||
sidebutton.refinedstorage:grid.search_box_mode.0=Normaal
|
sidebutton.refinedstorage:grid.search_box_mode.0=Normaal
|
||||||
sidebutton.refinedstorage:grid.search_box_mode.1=JEI gesynchroniseerd
|
sidebutton.refinedstorage:grid.search_box_mode.1=Normaal (autogeselecteerd)
|
||||||
|
sidebutton.refinedstorage:grid.search_box_mode.2=JEI gesynchronizeerd
|
||||||
|
sidebutton.refinedstorage:grid.search_box_mode.3=JEI gesynchronizeerd (autogeselecteerd)
|
||||||
|
|
||||||
sidebutton.refinedstorage:mode=Mode
|
sidebutton.refinedstorage:mode=Mode
|
||||||
sidebutton.refinedstorage:mode.whitelist=Whitelist
|
sidebutton.refinedstorage:mode.whitelist=Whitelist
|
||||||
|
|||||||
Reference in New Issue
Block a user