@@ -530,13 +530,15 @@ public class GridScreen extends BaseScreen<GridContainerMenu> implements IScreen
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int clickedButton) {
|
||||
if (tabs.mouseClicked()) {
|
||||
setFocused(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (scrollbar.mouseClicked(mouseX, mouseY, clickedButton)) {
|
||||
setFocused(null);
|
||||
return true;
|
||||
}
|
||||
if (grid.getGridType() == GridType.PATTERN && patternScrollbar.mouseClicked(mouseX, mouseY, clickedButton)) {
|
||||
setFocused(null);
|
||||
return true;
|
||||
}
|
||||
if (RS.CLIENT_CONFIG.getGrid().getPreventSortingWhileShiftIsDown()) {
|
||||
@@ -551,12 +553,16 @@ public class GridScreen extends BaseScreen<GridContainerMenu> implements IScreen
|
||||
|
||||
RS.NETWORK_HANDLER.sendToServer(new GridPatternCreateMessage(((GridNetworkNode) grid).getPos()));
|
||||
|
||||
setFocused(null);
|
||||
|
||||
return true;
|
||||
} else if (clickedClear) {
|
||||
minecraft.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||
|
||||
RS.NETWORK_HANDLER.sendToServer(new GridClearMessage());
|
||||
|
||||
setFocused(null);
|
||||
|
||||
return true;
|
||||
} else if (grid.isGridActive()) {
|
||||
ItemStack held = menu.getCarried();
|
||||
@@ -567,6 +573,7 @@ public class GridScreen extends BaseScreen<GridContainerMenu> implements IScreen
|
||||
} else {
|
||||
RS.NETWORK_HANDLER.sendToServer(new GridItemInsertHeldMessage(clickedButton == 1));
|
||||
}
|
||||
setFocused(null);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -596,6 +603,7 @@ public class GridScreen extends BaseScreen<GridContainerMenu> implements IScreen
|
||||
}
|
||||
}
|
||||
|
||||
setFocused(null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -47,17 +47,22 @@ public class SearchWidget extends EditBox {
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
|
||||
boolean wasFocused = isFocused();
|
||||
|
||||
boolean result = super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
boolean clickedWidget = mouseX >= this.getX() && mouseX < this.getX() + this.width && mouseY >= this.getY() && mouseY < this.getY() + this.height;
|
||||
|
||||
if (clickedWidget && mouseButton == 1) {
|
||||
// On right click, clear the widget and focus, save history if necessary.
|
||||
if (isFocused()) {
|
||||
saveHistory();
|
||||
}
|
||||
setValue("");
|
||||
setFocused(true);
|
||||
} else if (wasFocused != isFocused()) {
|
||||
}
|
||||
|
||||
if (!clickedWidget && isFocused()) {
|
||||
// If we are focused, and we click outside the search box, lose focus.
|
||||
saveHistory();
|
||||
setFocused(false);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user