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
|
@Override
|
||||||
public void fabric_nextPage() {
|
public void fabric_nextPage() {
|
||||||
if (fabric_getPageOffset(fabric_currentPage + 1) > ItemGroup.GROUPS.length) {
|
if (fabric_getPageOffset(fabric_currentPage + 1) >= ItemGroup.GROUPS.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fabric_currentPage++;
|
fabric_currentPage++;
|
||||||
|
@ -86,13 +86,13 @@ public abstract class MixinCreativePlayerInventoryGui extends AbstractPlayerInve
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean fabric_isButtonVisible(FabricCreativeGuiComponents.Type type) {
|
public boolean fabric_isButtonVisible(FabricCreativeGuiComponents.Type type) {
|
||||||
return ItemGroup.GROUPS.length != 12;
|
return ItemGroup.GROUPS.length > 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean fabric_isButtonEnabled(FabricCreativeGuiComponents.Type type) {
|
public boolean fabric_isButtonEnabled(FabricCreativeGuiComponents.Type type) {
|
||||||
if (type == FabricCreativeGuiComponents.Type.NEXT) {
|
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) {
|
if (type == FabricCreativeGuiComponents.Type.PREVIOUS) {
|
||||||
return fabric_currentPage != 0;
|
return fabric_currentPage != 0;
|
||||||
|
|
Loading…
Reference in a new issue