Change Creative Buttons Texture () ()

Co-authored-by: Matthew Periut <matthewperiut@gmail.com>
This commit is contained in:
Cassian Godsted 2025-03-16 09:32:39 -04:00 committed by GitHub
parent cb2ae4691b
commit def88e3a72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 6 deletions
fabric-item-group-api-v1/src
client/java/net/fabricmc/fabric
main/resources
assets/fabric/textures/gui
programmer_art/assets/fabric/textures/gui

View file

@ -49,7 +49,7 @@ public class FabricCreativeGuiComponents {
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;
}
@ -63,9 +63,9 @@ public class FabricCreativeGuiComponents {
return;
}
int u = active && this.isHovered() ? 22 : 0;
int u = active && this.isHovered() ? 20 : 0;
int v = active ? 0 : 12;
drawContext.drawTexture(BUTTON_TEX, this.getX(), this.getY(), u + (type == Type.NEXT ? 11 : 0), v, 11, 12);
drawContext.drawTexture(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);

View file

@ -68,15 +68,15 @@ public abstract class CreativeInventoryScreenMixin<T extends ScreenHandler> exte
}
}
@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));
}

Binary file not shown.

Before

(image error) Size: 5.4 KiB

After

(image error) Size: 345 B

Before After
Before After