mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-21 03:10:54 -04:00
Fix creative inventory buttons showing without any modded item groups.
Also, a minor code cleanup from the port.
This commit is contained in:
parent
6f7ba8f277
commit
7feff5da3e
2 changed files with 10 additions and 13 deletions
fabric-item-group-api-v1/src/client/java/net/fabricmc/fabric/impl/client/itemgroup
gradle.properties
|
@ -53,14 +53,19 @@ public class FabricCreativeGuiComponents {
|
|||
|
||||
@Override
|
||||
protected void renderButton(DrawContext drawContext, int mouseX, int mouseY, float delta) {
|
||||
int pageCount = (int) Math.ceil((ItemGroups.getGroupsToDisplay().size() - COMMON_GROUPS.size()) / TABS_PER_PAGE);
|
||||
this.active = type.isActive(extensions.fabric_currentPage(), pageCount);
|
||||
this.active = extensions.fabric_isButtonEnabled(type);
|
||||
this.visible = extensions.fabric_isButtonVisible(type);
|
||||
|
||||
if (!this.visible) {
|
||||
return;
|
||||
}
|
||||
|
||||
int u = active && this.isHovered() ? 22 : 0;
|
||||
int v = active ? 0 : 12;
|
||||
drawContext.drawTexture(BUTTON_TEX, this.getX(), this.getY(), u + (type == Type.NEXT ? 11 : 0), v, 11, 12);
|
||||
|
||||
if (this.isHovered()) {
|
||||
int pageCount = (int) Math.ceil((ItemGroups.getGroupsToDisplay().size() - COMMON_GROUPS.size()) / TABS_PER_PAGE);
|
||||
drawContext.drawTooltip(MinecraftClient.getInstance().textRenderer, Text.translatable("fabric.gui.creativeTabPage", extensions.fabric_currentPage() + 1, pageCount), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
@ -77,13 +82,5 @@ public class FabricCreativeGuiComponents {
|
|||
this.text = text;
|
||||
this.clickConsumer = clickConsumer;
|
||||
}
|
||||
|
||||
private boolean isActive(int currentPage, int pageCount) {
|
||||
if (this == NEXT) {
|
||||
return currentPage < pageCount -1;
|
||||
}
|
||||
|
||||
return currentPage > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx2560M
|
|||
org.gradle.parallel=true
|
||||
fabric.loom.multiProjectOptimisation=true
|
||||
|
||||
version=0.90.9
|
||||
version=0.90.10
|
||||
minecraft_version=23w46a
|
||||
yarn_version=+build.1
|
||||
loader_version=0.14.23
|
||||
|
@ -24,7 +24,7 @@ fabric-commands-v0-version=0.2.56
|
|||
fabric-containers-v0-version=0.1.77
|
||||
fabric-content-registries-v0-version=5.0.8
|
||||
fabric-crash-report-info-v1-version=0.2.21
|
||||
fabric-data-generation-api-v1-version=13.1.11
|
||||
fabric-data-generation-api-v1-version=13.1.12
|
||||
fabric-dimensions-v1-version=2.1.59
|
||||
fabric-entity-events-v1-version=1.5.26
|
||||
fabric-events-interaction-v0-version=0.6.13
|
||||
|
@ -32,7 +32,7 @@ fabric-events-lifecycle-v0-version=0.2.70
|
|||
fabric-game-rule-api-v1-version=1.0.44
|
||||
fabric-gametest-api-v1-version=1.2.18
|
||||
fabric-item-api-v1-version=2.1.33
|
||||
fabric-item-group-api-v1-version=4.0.18
|
||||
fabric-item-group-api-v1-version=4.0.19
|
||||
fabric-key-binding-api-v1-version=1.0.39
|
||||
fabric-keybindings-v0-version=0.2.37
|
||||
fabric-lifecycle-events-v1-version=2.2.28
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue