Move creative pagination buttons (#639)

* Move creative pagination buttons

* Bump module version + Update Texture

* Remove Krita Autogenerated File

* Add Hover and Update Texture

* Fix button positions

* Fix checkstyle
This commit is contained in:
Geometrically 2020-06-12 11:10:04 +01:00 committed by modmuss50
parent e7a4edb35e
commit 0121bd9039
4 changed files with 11 additions and 7 deletions

View file

@ -1,5 +1,5 @@
archivesBaseName = "fabric-item-groups-v0"
version = getSubprojectVersion(project, "0.1.6")
version = getSubprojectVersion(project, "0.2.0")
dependencies {
compile project(path: ':fabric-api-base', configuration: 'dev')

View file

@ -45,7 +45,7 @@ public class FabricCreativeGuiComponents {
Type type;
public ItemGroupButtonWidget(int x, int y, Type type, CreativeGuiExtensions extensions) {
super(x, y, 10, 11, type.text, (bw) -> type.clickConsumer.accept(extensions));
super(x, y, 11, 10, type.text, (bw) -> type.clickConsumer.accept(extensions));
this.extensions = extensions;
this.type = type;
this.gui = (CreativeInventoryScreen) extensions;
@ -53,17 +53,21 @@ public class FabricCreativeGuiComponents {
@Override
public void render(int mouseX, int mouseY, float float_1) {
this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
this.visible = extensions.fabric_isButtonVisible(type);
this.active = extensions.fabric_isButtonEnabled(type);
if (this.visible) {
int u = active && this.isHovered() ? 22 : 0;
int v = active ? 0 : 10;
MinecraftClient minecraftClient = MinecraftClient.getInstance();
minecraftClient.getTextureManager().bindTexture(BUTTON_TEX);
RenderSystem.disableLighting();
RenderSystem.color4f(1F, 1F, 1F, 1F);
this.blit(this.x, this.y, (type == Type.NEXT ? 12 : 0), (active ? 0 : 12), 12, 12);
this.blit(this.x, this.y, u + (type == Type.NEXT ? 11 : 0), v, 11, 10);
if (mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height) {
if (this.isHovered) {
gui.renderTooltip(I18n.translate("fabric.gui.creativeTabPage", extensions.fabric_currentPage() + 1, ((ItemGroup.GROUPS.length - 12) / 9) + 2), mouseX, mouseY);
}
}

View file

@ -119,10 +119,10 @@ public abstract class MixinCreativePlayerInventoryGui extends AbstractInventoryS
private void init(CallbackInfo info) {
fabric_updateSelection();
int xpos = x + 170;
int ypos = y + 4;
int xpos = x + 116;
int ypos = y - 10;
addButton(new FabricCreativeGuiComponents.ItemGroupButtonWidget(xpos + 10, ypos, FabricCreativeGuiComponents.Type.NEXT, this));
addButton(new FabricCreativeGuiComponents.ItemGroupButtonWidget(xpos + 11, ypos, FabricCreativeGuiComponents.Type.NEXT, this));
addButton(new FabricCreativeGuiComponents.ItemGroupButtonWidget(xpos, ypos, FabricCreativeGuiComponents.Type.PREVIOUS, this));
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 B

After

Width:  |  Height:  |  Size: 552 B