Fixed grid search box mode only changing after reopening gui
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
# Refined Storage Changelog
|
||||
|
||||
### 0.7.15
|
||||
**Bugfixes**
|
||||
- Fixed not being able to scroll with the scroll wheel using MouseTweaks
|
||||
- Fixed grid search box mode only changing after reopening gui
|
||||
|
||||
### 0.7.14
|
||||
**Bugfixes**
|
||||
- Updated Forge to build 1965
|
||||
|
||||
@@ -211,8 +211,6 @@ public abstract class GuiBase extends GuiContainer {
|
||||
GlStateManager.translate(x, y, 1);
|
||||
GL11.glScalef(0.5f, 0.5f, 1);
|
||||
|
||||
int stringWidth = fontRendererObj.getStringWidth(text);
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.depthMask(false);
|
||||
@@ -220,7 +218,7 @@ public abstract class GuiBase extends GuiContainer {
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
GlStateManager.disableDepth();
|
||||
|
||||
fontRendererObj.drawStringWithShadow(text, 30 - stringWidth, 22, 16777215);
|
||||
fontRendererObj.drawStringWithShadow(text, 30 - fontRendererObj.getStringWidth(text), 22, 16777215);
|
||||
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableTexture2D();
|
||||
|
||||
@@ -102,10 +102,9 @@ public class GuiController extends GuiBase {
|
||||
}
|
||||
|
||||
if (inBounds(barX, barY, barWidth, barHeight, mouseX, mouseY)) {
|
||||
String message = t("misc.refinedstorage:energy_usage", controller.getEnergyUsage());
|
||||
message += "\n" + t("misc.refinedstorage:energy_stored", controller.getEnergyStored(null), controller.getMaxEnergyStored(null));
|
||||
|
||||
drawTooltip(mouseX, mouseY, message);
|
||||
drawTooltip(mouseX, mouseY, t("misc.refinedstorage:energy_usage", controller.getEnergyUsage())
|
||||
+ "\n"
|
||||
+ t("misc.refinedstorage:energy_stored", controller.getEnergyStored(null), controller.getMaxEnergyStored(null)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,8 +97,8 @@ public class GuiGrid extends GuiBase {
|
||||
searchField.setEnableBackgroundDrawing(false);
|
||||
searchField.setVisible(true);
|
||||
searchField.setTextColor(16777215);
|
||||
searchField.setCanLoseFocus(!TileGrid.isSearchBoxModeWithAutoselection(grid.getSearchBoxMode()));
|
||||
searchField.setFocused(TileGrid.isSearchBoxModeWithAutoselection(grid.getSearchBoxMode()));
|
||||
|
||||
updateSearchBoxFocus(grid.getSearchBoxMode());
|
||||
} else {
|
||||
searchField.xPosition = sx;
|
||||
searchField.yPosition = sy;
|
||||
@@ -106,7 +106,7 @@ public class GuiGrid extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonGridSortingDirection(grid));
|
||||
addSideButton(new SideButtonGridSortingType(grid));
|
||||
addSideButton(new SideButtonGridSearchBoxMode(grid));
|
||||
addSideButton(new SideButtonGridSearchBoxMode(this));
|
||||
}
|
||||
|
||||
public IGrid getGrid() {
|
||||
@@ -247,7 +247,7 @@ public class GuiGrid extends GuiBase {
|
||||
|
||||
@Override
|
||||
public void drawForeground(int mouseX, int mouseY) {
|
||||
drawString(7, 7, t(grid instanceof WirelessGrid ? "gui.refinedstorage:wireless_grid" : "gui.refinedstorage:grid"));
|
||||
drawString(7, 8, t(grid instanceof WirelessGrid ? "gui.refinedstorage:wireless_grid" : "gui.refinedstorage:grid"));
|
||||
|
||||
if (grid.getType() == EnumGridType.CRAFTING) {
|
||||
drawString(7, 95, t("container.crafting"));
|
||||
@@ -407,4 +407,9 @@ public class GuiGrid extends GuiBase {
|
||||
RefinedStorageJEIPlugin.INSTANCE.getRuntime().getItemListOverlay().setFilterText(searchField.getText());
|
||||
}
|
||||
}
|
||||
|
||||
public void updateSearchBoxFocus(int mode) {
|
||||
searchField.setCanLoseFocus(!TileGrid.isSearchBoxModeWithAutoselection(mode));
|
||||
searchField.setFocused(TileGrid.isSearchBoxModeWithAutoselection(mode));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,19 @@ package refinedstorage.gui.sidebutton;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.gui.GuiBase;
|
||||
import refinedstorage.tile.grid.IGrid;
|
||||
import refinedstorage.gui.GuiGrid;
|
||||
import refinedstorage.tile.grid.TileGrid;
|
||||
|
||||
public class SideButtonGridSearchBoxMode extends SideButton {
|
||||
private IGrid grid;
|
||||
private GuiGrid gui;
|
||||
|
||||
public SideButtonGridSearchBoxMode(IGrid grid) {
|
||||
this.grid = grid;
|
||||
public SideButtonGridSearchBoxMode(GuiGrid gui) {
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip(GuiBase gui) {
|
||||
return TextFormatting.YELLOW + gui.t("sidebutton.refinedstorage:grid.search_box_mode") + TextFormatting.RESET + "\n" + gui.t("sidebutton.refinedstorage:grid.search_box_mode." + grid.getSearchBoxMode());
|
||||
return TextFormatting.YELLOW + gui.t("sidebutton.refinedstorage:grid.search_box_mode") + TextFormatting.RESET + "\n" + gui.t("sidebutton.refinedstorage:grid.search_box_mode." + this.gui.getGrid().getSearchBoxMode());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -26,7 +26,7 @@ public class SideButtonGridSearchBoxMode extends SideButton {
|
||||
|
||||
@Override
|
||||
public void actionPerformed() {
|
||||
int mode = grid.getSearchBoxMode();
|
||||
int mode = gui.getGrid().getSearchBoxMode();
|
||||
|
||||
if (mode == TileGrid.SEARCH_BOX_MODE_NORMAL) {
|
||||
mode = TileGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED;
|
||||
@@ -42,6 +42,8 @@ public class SideButtonGridSearchBoxMode extends SideButton {
|
||||
mode = TileGrid.SEARCH_BOX_MODE_NORMAL;
|
||||
}
|
||||
|
||||
grid.onSearchBoxModeChanged(mode);
|
||||
gui.getGrid().onSearchBoxModeChanged(mode);
|
||||
|
||||
gui.updateSearchBoxFocus(mode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user