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
### 1.5.14
- Fixed more crashes relating to scrollbar in GUIs (raoulvdberge)
### 1.5.13
- Fixed Wireless Fluid Grid not using up energy (raoulvdberge)
- Fixed Wireless Crafting Monitor remaining in network item list (raoulvdberge)

View File

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

View File

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

View File

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

View File

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

View File

@@ -218,8 +218,10 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
STACKS = stacks;
scrollbar.setEnabled(getRows() > getVisibleRows());
scrollbar.setMaxOffset(getRows() - getVisibleRows());
if (scrollbar != null) {
scrollbar.setEnabled(getRows() > getVisibleRows());
scrollbar.setMaxOffset(getRows() - getVisibleRows());
}
}
@Override