Fixed not being able to move inventory items in Grid GUI's to hotbar via the number keys, fixes #235
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
- Slight performance improvement in GUI's
|
- Slight performance improvement in GUI's
|
||||||
- Fixed not being able to change some configs in blocks
|
- Fixed not being able to change some configs in blocks
|
||||||
- Fixed serverside configs not syncing up with clientside
|
- Fixed serverside configs not syncing up with clientside
|
||||||
|
- Fixed not being able to move inventory items in Grid GUI's to hotbar via the number keys
|
||||||
|
|
||||||
**Features**
|
**Features**
|
||||||
- Added German translation by ChillUpX
|
- Added German translation by ChillUpX
|
||||||
|
@@ -16,7 +16,7 @@ public class GuiStorage extends GuiBase {
|
|||||||
private IStorageGui gui;
|
private IStorageGui gui;
|
||||||
private String texture;
|
private String texture;
|
||||||
|
|
||||||
public static GuiTextField PRIORITY;
|
private GuiTextField priorityField;
|
||||||
|
|
||||||
private int barX = 8;
|
private int barX = 8;
|
||||||
private int barY = 54;
|
private int barY = 54;
|
||||||
@@ -49,13 +49,14 @@ public class GuiStorage extends GuiBase {
|
|||||||
addSideButton(new SideButtonCompare(gui.getCompareParameter(), CompareUtils.COMPARE_NBT));
|
addSideButton(new SideButtonCompare(gui.getCompareParameter(), CompareUtils.COMPARE_NBT));
|
||||||
}
|
}
|
||||||
|
|
||||||
PRIORITY = new GuiTextField(0, fontRendererObj, x + 98 + 1, y + 54 + 1, 25, fontRendererObj.FONT_HEIGHT);
|
priorityField = new GuiTextField(0, fontRendererObj, x + 98 + 1, y + 54 + 1, 25, fontRendererObj.FONT_HEIGHT);
|
||||||
PRIORITY.setText(String.valueOf(gui.getPriorityParameter().getValue()));
|
priorityField.setEnableBackgroundDrawing(false);
|
||||||
PRIORITY.setEnableBackgroundDrawing(false);
|
priorityField.setVisible(true);
|
||||||
PRIORITY.setVisible(true);
|
priorityField.setTextColor(16777215);
|
||||||
PRIORITY.setTextColor(16777215);
|
priorityField.setCanLoseFocus(true);
|
||||||
PRIORITY.setCanLoseFocus(true);
|
priorityField.setFocused(false);
|
||||||
PRIORITY.setFocused(false);
|
|
||||||
|
updatePriority(gui.getPriorityParameter().getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -72,7 +73,7 @@ public class GuiStorage extends GuiBase {
|
|||||||
|
|
||||||
drawTexture(x + barX, y + barY + barHeight - barHeightNew, 179, barHeight - barHeightNew, barWidth, barHeightNew);
|
drawTexture(x + barX, y + barY + barHeight - barHeightNew, 179, barHeight - barHeightNew, barWidth, barHeightNew);
|
||||||
|
|
||||||
PRIORITY.drawTextBox();
|
priorityField.drawTextBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -97,13 +98,15 @@ public class GuiStorage extends GuiBase {
|
|||||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
|
||||||
PRIORITY.mouseClicked(mouseX, mouseY, mouseButton);
|
priorityField.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void keyTyped(char character, int keyCode) throws IOException {
|
protected void keyTyped(char character, int keyCode) throws IOException {
|
||||||
if (!checkHotbarKeys(keyCode) && PRIORITY.textboxKeyTyped(character, keyCode)) {
|
if (checkHotbarKeys(keyCode)) {
|
||||||
Integer result = Ints.tryParse(PRIORITY.getText());
|
// NO OP
|
||||||
|
} else if (priorityField.textboxKeyTyped(character, keyCode)) {
|
||||||
|
Integer result = Ints.tryParse(priorityField.getText());
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
TileDataManager.setParameter(gui.getPriorityParameter(), result);
|
TileDataManager.setParameter(gui.getPriorityParameter(), result);
|
||||||
@@ -112,4 +115,8 @@ public class GuiStorage extends GuiBase {
|
|||||||
super.keyTyped(character, keyCode);
|
super.keyTyped(character, keyCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updatePriority(int priority) {
|
||||||
|
priorityField.setText(String.valueOf(priority));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,7 @@ public class GuiGrid extends GuiBase {
|
|||||||
private GridSortingQuantity quantitySorting = new GridSortingQuantity();
|
private GridSortingQuantity quantitySorting = new GridSortingQuantity();
|
||||||
private GridSortingName nameSorting = new GridSortingName();
|
private GridSortingName nameSorting = new GridSortingName();
|
||||||
|
|
||||||
public static GuiTextField SEARCH_FIELD;
|
private GuiTextField searchField;
|
||||||
|
|
||||||
private ContainerGrid container;
|
private ContainerGrid container;
|
||||||
private List<ClientStack> items = new ArrayList<>();
|
private List<ClientStack> items = new ArrayList<>();
|
||||||
@@ -64,15 +64,16 @@ public class GuiGrid extends GuiBase {
|
|||||||
int sx = x + 80 + 1;
|
int sx = x + 80 + 1;
|
||||||
int sy = y + 6 + 1;
|
int sy = y + 6 + 1;
|
||||||
|
|
||||||
if (SEARCH_FIELD == null) {
|
if (searchField == null) {
|
||||||
SEARCH_FIELD = new GuiTextField(0, fontRendererObj, sx, sy, 88 - 6, fontRendererObj.FONT_HEIGHT);
|
searchField = new GuiTextField(0, fontRendererObj, sx, sy, 88 - 6, fontRendererObj.FONT_HEIGHT);
|
||||||
SEARCH_FIELD.setEnableBackgroundDrawing(false);
|
searchField.setEnableBackgroundDrawing(false);
|
||||||
SEARCH_FIELD.setVisible(true);
|
searchField.setVisible(true);
|
||||||
SEARCH_FIELD.setTextColor(16777215);
|
searchField.setTextColor(16777215);
|
||||||
|
|
||||||
updateSearchFieldFocus(grid.getSearchBoxMode());
|
updateSearchFieldFocus(grid.getSearchBoxMode());
|
||||||
} else {
|
} else {
|
||||||
SEARCH_FIELD.xPosition = sx;
|
searchField.xPosition = sx;
|
||||||
SEARCH_FIELD.yPosition = sy;
|
searchField.yPosition = sy;
|
||||||
}
|
}
|
||||||
|
|
||||||
addSideButton(new SideButtonGridViewType(grid));
|
addSideButton(new SideButtonGridViewType(grid));
|
||||||
@@ -92,7 +93,7 @@ public class GuiGrid extends GuiBase {
|
|||||||
if (grid.isConnected()) {
|
if (grid.isConnected()) {
|
||||||
items.addAll(RefinedStorage.INSTANCE.items);
|
items.addAll(RefinedStorage.INSTANCE.items);
|
||||||
|
|
||||||
String query = SEARCH_FIELD.getText().trim().toLowerCase();
|
String query = searchField.getText().trim().toLowerCase();
|
||||||
|
|
||||||
Iterator<ClientStack> t = items.iterator();
|
Iterator<ClientStack> t = items.iterator();
|
||||||
|
|
||||||
@@ -243,7 +244,7 @@ public class GuiGrid extends GuiBase {
|
|||||||
drawTexture(x + 152, y + 114, 240, ty * 16, 16, 16);
|
drawTexture(x + 152, y + 114, 240, ty * 16, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
SEARCH_FIELD.drawTextBox();
|
searchField.drawTextBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -328,11 +329,11 @@ 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);
|
||||||
|
|
||||||
SEARCH_FIELD.mouseClicked(mouseX, mouseY, clickedButton);
|
searchField.mouseClicked(mouseX, mouseY, clickedButton);
|
||||||
|
|
||||||
if (clickedButton == 1 && inBounds(79, 5, 90, 12, mouseX - guiLeft, mouseY - guiTop)) {
|
if (clickedButton == 1 && inBounds(79, 5, 90, 12, mouseX - guiLeft, mouseY - guiTop)) {
|
||||||
SEARCH_FIELD.setText("");
|
searchField.setText("");
|
||||||
SEARCH_FIELD.setFocused(true);
|
searchField.setFocused(true);
|
||||||
|
|
||||||
updateJEI();
|
updateJEI();
|
||||||
}
|
}
|
||||||
@@ -385,7 +386,9 @@ 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) && SEARCH_FIELD.textboxKeyTyped(character, keyCode)) {
|
if (checkHotbarKeys(keyCode)) {
|
||||||
|
// NO OP
|
||||||
|
} else if (searchField.textboxKeyTyped(character, keyCode)) {
|
||||||
updateJEI();
|
updateJEI();
|
||||||
} else {
|
} else {
|
||||||
super.keyTyped(character, keyCode);
|
super.keyTyped(character, keyCode);
|
||||||
@@ -394,13 +397,12 @@ public class GuiGrid extends GuiBase {
|
|||||||
|
|
||||||
private void updateJEI() {
|
private void updateJEI() {
|
||||||
if (IntegrationJEI.isLoaded() && (grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED || grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED)) {
|
if (IntegrationJEI.isLoaded() && (grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED || grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED)) {
|
||||||
IntegrationJEI.INSTANCE.getRuntime().getItemListOverlay().setFilterText(SEARCH_FIELD.getText());
|
IntegrationJEI.INSTANCE.getRuntime().getItemListOverlay().setFilterText(searchField.getText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: This is buggy...
|
public void updateSearchFieldFocus(int mode) {
|
||||||
public static void updateSearchFieldFocus(int mode) {
|
searchField.setCanLoseFocus(!TileGrid.isSearchBoxModeWithAutoselection(mode));
|
||||||
SEARCH_FIELD.setCanLoseFocus(!TileGrid.isSearchBoxModeWithAutoselection(mode));
|
searchField.setFocused(TileGrid.isSearchBoxModeWithAutoselection(mode));
|
||||||
SEARCH_FIELD.setFocused(TileGrid.isSearchBoxModeWithAutoselection(mode));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -43,5 +43,7 @@ public class SideButtonGridSearchBoxMode extends SideButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gui.getGrid().onSearchBoxModeChanged(mode);
|
gui.getGrid().onSearchBoxModeChanged(mode);
|
||||||
|
|
||||||
|
gui.updateSearchFieldFocus(mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package refinedstorage.tile.config;
|
package refinedstorage.tile.config;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
|
||||||
import net.minecraft.network.datasync.DataSerializers;
|
import net.minecraft.network.datasync.DataSerializers;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
@@ -25,12 +24,8 @@ public interface IPrioritizable {
|
|||||||
((IPrioritizable) tile).setPriority(value);
|
((IPrioritizable) tile).setPriority(value);
|
||||||
}
|
}
|
||||||
}, parameter -> {
|
}, parameter -> {
|
||||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT && Minecraft.getMinecraft().currentScreen instanceof GuiStorage) {
|
||||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
((GuiStorage) Minecraft.getMinecraft().currentScreen).updatePriority(parameter.getValue());
|
||||||
|
|
||||||
if (gui instanceof GuiStorage) {
|
|
||||||
((GuiStorage) gui).PRIORITY.setText(String.valueOf(parameter.getValue()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package refinedstorage.tile.grid;
|
package refinedstorage.tile.grid;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.inventory.*;
|
import net.minecraft.inventory.*;
|
||||||
@@ -101,8 +102,8 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, parameter -> {
|
}, parameter -> {
|
||||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT && Minecraft.getMinecraft().currentScreen instanceof GuiGrid) {
|
||||||
GuiGrid.updateSearchFieldFocus(parameter.getValue());
|
((GuiGrid) Minecraft.getMinecraft().currentScreen).updateSearchFieldFocus(parameter.getValue());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -10,7 +10,6 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.api.network.IGridHandler;
|
import refinedstorage.api.network.IGridHandler;
|
||||||
import refinedstorage.block.EnumGridType;
|
import refinedstorage.block.EnumGridType;
|
||||||
import refinedstorage.gui.grid.GridFilteredItem;
|
import refinedstorage.gui.grid.GridFilteredItem;
|
||||||
import refinedstorage.gui.grid.GuiGrid;
|
|
||||||
import refinedstorage.inventory.ItemHandlerBasic;
|
import refinedstorage.inventory.ItemHandlerBasic;
|
||||||
import refinedstorage.inventory.ItemHandlerGridFilterInGrid;
|
import refinedstorage.inventory.ItemHandlerGridFilterInGrid;
|
||||||
import refinedstorage.item.ItemWirelessGrid;
|
import refinedstorage.item.ItemWirelessGrid;
|
||||||
@@ -136,8 +135,6 @@ public class WirelessGrid implements IGrid {
|
|||||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), searchBoxMode));
|
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), searchBoxMode));
|
||||||
|
|
||||||
this.searchBoxMode = searchBoxMode;
|
this.searchBoxMode = searchBoxMode;
|
||||||
|
|
||||||
GuiGrid.updateSearchFieldFocus(searchBoxMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user