diff --git a/src/main/java/draylar/identity/screen/IdentityScreen.java b/src/main/java/draylar/identity/screen/IdentityScreen.java index bccc0f9..9e26338 100644 --- a/src/main/java/draylar/identity/screen/IdentityScreen.java +++ b/src/main/java/draylar/identity/screen/IdentityScreen.java @@ -157,19 +157,20 @@ public void renderEntityWidgets(MatrixStack matrices, int mouseX, int mouseY, fl @Override public boolean mouseScrolled(double mouseX, double mouseY, double amount) { - float firstPos = entityWidgets.get(0).y; + if(entityWidgets.size() > 0) { + float firstPos = entityWidgets.get(0).y; - // Top section should always have mobs, prevent scrolling the entire list down the screen - if(amount == 1 && firstPos >= 35) { - return false; - } - - ((ScreenAccessor) this).getSelectables().forEach(button -> { - if(button instanceof EntityWidget widget) { - widget.y = (int) (widget.y + amount * 10); + // Top section should always have mobs, prevent scrolling the entire list down the screen + if(amount == 1 && firstPos >= 35) { + return false; } - }); + ((ScreenAccessor) this).getSelectables().forEach(button -> { + if(button instanceof EntityWidget widget) { + widget.y = (int) (widget.y + amount * 10); + } + }); + } return false; }