Fixed crashes relating to scrollbar in GUIs, fixes #1338
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
### 1.5.7
|
||||
- Exposed pattern inventory for Pattern Grid (raoulvdberge)
|
||||
- Fixed crashes relating to scrollbar in GUIs (raoulvdberge)
|
||||
- Added advancements (raoulvdberge)
|
||||
|
||||
### 1.5.6
|
||||
|
||||
@@ -57,7 +57,7 @@ public class GuiController extends GuiBase {
|
||||
int x = 33;
|
||||
int y = 26;
|
||||
|
||||
int slot = scrollbar.getOffset() * 2;
|
||||
int slot = scrollbar != null ? (scrollbar.getOffset() * 2) : 0;
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public class GuiCraftingMonitor extends GuiBase {
|
||||
drawString(7, 7, t(craftingMonitor.getGuiTitle()));
|
||||
drawString(7, 137, t("container.inventory"));
|
||||
|
||||
int item = scrollbar.getOffset();
|
||||
int item = scrollbar != null ? scrollbar.getOffset() : 0;
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
@@ -176,7 +176,7 @@ public class GuiCraftingMonitor extends GuiBase {
|
||||
itemSelected = -1;
|
||||
|
||||
if (mouseButton == 0 && inBounds(8, 20, 144, 90, mouseX - guiLeft, mouseY - guiTop)) {
|
||||
int item = scrollbar.getOffset();
|
||||
int item = scrollbar != null ? scrollbar.getOffset() : 0;
|
||||
|
||||
for (int i = 0; i < VISIBLE_ROWS; ++i) {
|
||||
int ix = 8;
|
||||
|
||||
@@ -113,7 +113,7 @@ public class GuiCraftingPreview extends GuiBase {
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
} else {
|
||||
int slot = scrollbar.getOffset() * 2;
|
||||
int slot = scrollbar != null ? (scrollbar.getOffset() * 2) : 0;
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.enableDepth();
|
||||
|
||||
@@ -95,7 +95,7 @@ public class GuiReaderWriter extends GuiBase {
|
||||
int x = 8;
|
||||
int y = 39;
|
||||
|
||||
int item = scrollbar.getOffset();
|
||||
int item = scrollbar != null ? scrollbar.getOffset() : 0;
|
||||
|
||||
for (int i = 0; i < VISIBLE_ROWS; ++i) {
|
||||
if (item < getChannels().size()) {
|
||||
@@ -128,7 +128,7 @@ public class GuiReaderWriter extends GuiBase {
|
||||
|
||||
if (inBounds(8, 39, 144, 73, mouseX - guiLeft, mouseY - guiTop)) {
|
||||
if (mouseButton == 0) {
|
||||
int item = scrollbar.getOffset();
|
||||
int item = scrollbar != null ? scrollbar.getOffset() : 0;
|
||||
|
||||
for (int i = 0; i < VISIBLE_ROWS; ++i) {
|
||||
int ix = 8;
|
||||
|
||||
@@ -459,7 +459,7 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
|
||||
|
||||
this.slotNumber = -1;
|
||||
|
||||
int slot = scrollbar.getOffset() * 9;
|
||||
int slot = scrollbar != null ? (scrollbar.getOffset() * 9) : 0;
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class GuiHandlerGrid implements IAdvancedGuiHandler<GuiGrid> {
|
||||
mouseX -= gui.getGuiLeft();
|
||||
mouseY -= gui.getGuiTop();
|
||||
|
||||
if (!gui.getSearchField().isFocused() && gui.isOverSlotArea(mouseX, mouseY)) {
|
||||
if (gui.getScrollbar() != null && !gui.getSearchField().isFocused() && gui.isOverSlotArea(mouseX, mouseY)) {
|
||||
mouseX -= 7;
|
||||
mouseY -= 19;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user