Fixed more crashes relating to scrollbar in GUIs, fixes #1377

This commit is contained in:
raoulvdberge
2017-07-22 19:36:40 +02:00
parent a59d3cdaeb
commit ec8a82dd56
6 changed files with 31 additions and 13 deletions

View File

@@ -1,5 +1,8 @@
# Refined Storage Changelog # Refined Storage Changelog
### 1.5.14
- Fixed more crashes relating to scrollbar in GUIs (raoulvdberge)
### 1.5.13 ### 1.5.13
- Fixed Wireless Fluid Grid not using up energy (raoulvdberge) - Fixed Wireless Fluid Grid not using up energy (raoulvdberge)
- Fixed Wireless Crafting Monitor remaining in network item list (raoulvdberge) - Fixed Wireless Crafting Monitor remaining in network item list (raoulvdberge)

View File

@@ -35,9 +35,11 @@ public class GuiController extends GuiBase {
@Override @Override
public void update(int x, int y) { public void update(int x, int y) {
if (scrollbar != null) {
scrollbar.setEnabled(getRows() > VISIBLE_ROWS); scrollbar.setEnabled(getRows() > VISIBLE_ROWS);
scrollbar.setMaxOffset(getRows() - VISIBLE_ROWS); scrollbar.setMaxOffset(getRows() - VISIBLE_ROWS);
} }
}
@Override @Override
public void drawBackground(int x, int y, int mouseX, int mouseY) { public void drawBackground(int x, int y, int mouseX, int mouseY) {

View File

@@ -82,16 +82,23 @@ public class GuiCraftingMonitor extends GuiBase {
@Override @Override
public void update(int x, int y) { public void update(int x, int y) {
if (scrollbar != null) {
scrollbar.setEnabled(getRows() > VISIBLE_ROWS); scrollbar.setEnabled(getRows() > VISIBLE_ROWS);
scrollbar.setMaxOffset(getRows() - VISIBLE_ROWS); scrollbar.setMaxOffset(getRows() - VISIBLE_ROWS);
}
if (itemSelected >= getElements().size()) { if (itemSelected >= getElements().size()) {
itemSelected = -1; itemSelected = -1;
} }
if (cancelButton != null) {
cancelButton.enabled = itemSelected != -1 && getElements().get(itemSelected).getTaskId() != -1; cancelButton.enabled = itemSelected != -1 && getElements().get(itemSelected).getTaskId() != -1;
}
if (cancelAllButton != null) {
cancelAllButton.enabled = getElements().size() > 0; cancelAllButton.enabled = getElements().size() > 0;
} }
}
@Override @Override
public void drawBackground(int x, int y, int mouseX, int mouseY) { public void drawBackground(int x, int y, int mouseX, int mouseY) {

View File

@@ -78,10 +78,12 @@ public class GuiCraftingPreview extends GuiBase {
@Override @Override
public void update(int x, int y) { public void update(int x, int y) {
if (scrollbar != null) {
scrollbar.setEnabled(getRows() > VISIBLE_ROWS); scrollbar.setEnabled(getRows() > VISIBLE_ROWS);
scrollbar.setMaxOffset(getRows() - VISIBLE_ROWS); scrollbar.setMaxOffset(getRows() - VISIBLE_ROWS);
}
if (!startButton.enabled && isCtrlKeyDown() && isShiftKeyDown()) { if (startButton != null && !startButton.enabled && isCtrlKeyDown() && isShiftKeyDown()) {
startButton.enabled = true; startButton.enabled = true;
} }
} }

View File

@@ -60,8 +60,10 @@ public class GuiReaderWriter extends GuiBase {
@Override @Override
public void update(int x, int y) { public void update(int x, int y) {
if (scrollbar != null) {
scrollbar.setEnabled(getRows() > VISIBLE_ROWS); scrollbar.setEnabled(getRows() > VISIBLE_ROWS);
scrollbar.setMaxOffset(getRows() - VISIBLE_ROWS); scrollbar.setMaxOffset(getRows() - VISIBLE_ROWS);
}
if (itemSelected >= getChannels().size()) { if (itemSelected >= getChannels().size()) {
itemSelected = -1; itemSelected = -1;

View File

@@ -218,9 +218,11 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
STACKS = stacks; STACKS = stacks;
if (scrollbar != null) {
scrollbar.setEnabled(getRows() > getVisibleRows()); scrollbar.setEnabled(getRows() > getVisibleRows());
scrollbar.setMaxOffset(getRows() - getVisibleRows()); scrollbar.setMaxOffset(getRows() - getVisibleRows());
} }
}
@Override @Override
public void update(int x, int y) { public void update(int x, int y) {