Skip to content

Commit

Permalink
Change Creative Buttons Texture (#4221)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewperiut authored Feb 9, 2025
1 parent 1bdf666 commit a1daf24
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static class ItemGroupButtonWidget extends ButtonWidget {
final Type type;

public ItemGroupButtonWidget(int x, int y, Type type, CreativeInventoryScreen screen) {
super(x, y, 11, 12, type.text, (bw) -> type.clickConsumer.accept(screen), ButtonWidget.DEFAULT_NARRATION_SUPPLIER);
super(x, y, 10, 12, type.text, (bw) -> type.clickConsumer.accept(screen), ButtonWidget.DEFAULT_NARRATION_SUPPLIER);
this.type = type;
this.screen = screen;
}
Expand All @@ -64,9 +64,9 @@ protected void renderWidget(DrawContext drawContext, int mouseX, int mouseY, flo
return;
}

int u = active && this.isHovered() ? 22 : 0;
int u = active && this.isHovered() ? 20 : 0;
int v = active ? 0 : 12;
drawContext.drawTexture(RenderLayer::getGuiTextured, BUTTON_TEX, this.getX(), this.getY(), u + (type == Type.NEXT ? 11 : 0), v, 11, 12, 256, 256);
drawContext.drawTexture(RenderLayer::getGuiTextured, BUTTON_TEX, this.getX(), this.getY(), u + (type == Type.NEXT ? 10 : 0), v, 10, 12, 256, 256);

if (this.isHovered()) {
drawContext.drawTooltip(MinecraftClient.getInstance().textRenderer, Text.translatable("fabric.gui.creativeTabPage", screen.getCurrentPage() + 1, getPageCount()), mouseX, mouseY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ private void updateSelection() {
}
}

@Inject(method = "init", at = @At("RETURN"))
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;setEditableColor(I)V", shift = At.Shift.AFTER))
private void init(CallbackInfo info) {
currentPage = getPage(selectedTab);

int xpos = x + 170;
int xpos = x + 171;
int ypos = y + 4;

CreativeInventoryScreen self = (CreativeInventoryScreen) (Object) this;
addDrawableChild(new FabricCreativeGuiComponents.ItemGroupButtonWidget(xpos + 11, ypos, FabricCreativeGuiComponents.Type.NEXT, self));
addDrawableChild(new FabricCreativeGuiComponents.ItemGroupButtonWidget(xpos + 10, ypos, FabricCreativeGuiComponents.Type.NEXT, self));
addDrawableChild(new FabricCreativeGuiComponents.ItemGroupButtonWidget(xpos, ypos, FabricCreativeGuiComponents.Type.PREVIOUS, self));
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a1daf24

Please sign in to comment.