mirror of
https://github.com/FabricMC/fabric.git
synced 2024-11-14 19:25:23 -05:00
fix creative menu off-by-one crash
This commit is contained in:
parent
31db2b6d1b
commit
5f3245b0fd
1 changed files with 3 additions and 3 deletions
|
@ -68,7 +68,7 @@ public abstract class MixinCreativePlayerInventoryGui extends AbstractPlayerInve
|
|||
|
||||
@Override
|
||||
public void fabric_nextPage() {
|
||||
if (fabric_getPageOffset(fabric_currentPage + 1) > ItemGroup.GROUPS.length) {
|
||||
if (fabric_getPageOffset(fabric_currentPage + 1) >= ItemGroup.GROUPS.length) {
|
||||
return;
|
||||
}
|
||||
fabric_currentPage++;
|
||||
|
@ -86,13 +86,13 @@ public abstract class MixinCreativePlayerInventoryGui extends AbstractPlayerInve
|
|||
|
||||
@Override
|
||||
public boolean fabric_isButtonVisible(FabricCreativeGuiComponents.Type type) {
|
||||
return ItemGroup.GROUPS.length != 12;
|
||||
return ItemGroup.GROUPS.length > 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fabric_isButtonEnabled(FabricCreativeGuiComponents.Type type) {
|
||||
if (type == FabricCreativeGuiComponents.Type.NEXT) {
|
||||
return !(fabric_getPageOffset(fabric_currentPage + 1) > ItemGroup.GROUPS.length);
|
||||
return !(fabric_getPageOffset(fabric_currentPage + 1) >= ItemGroup.GROUPS.length);
|
||||
}
|
||||
if (type == FabricCreativeGuiComponents.Type.PREVIOUS) {
|
||||
return fabric_currentPage != 0;
|
||||
|
|
Loading…
Reference in a new issue