Skip to content

Modify gui to fit new backgrounds 修改GUI以匹配新的背景#3398

Open
Vo1dExr wants to merge 7 commits intoAnvil-Dev:dev/1.21/1.6from
Vo1dExr:ui/1.21/1.6
Open

Modify gui to fit new backgrounds 修改GUI以匹配新的背景#3398
Vo1dExr wants to merge 7 commits intoAnvil-Dev:dev/1.21/1.6from
Vo1dExr:ui/1.21/1.6

Conversation

@Vo1dExr
Copy link
Copy Markdown
Contributor

@Vo1dExr Vo1dExr commented Apr 10, 2026

Adapt to #3388

Vo1dExr added 3 commits April 11, 2026 01:25
# Conflicts:
#	src/main/java/dev/dubhe/anvilcraft/client/gui/screen/BaseMachineScreen.java
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates multiple container screens to better align titles/slot positions with the new GUI background art (per #3388), plus adjusts Royal Grindstone tooltip strings.

Changes:

  • Repositions title rendering (mostly titleLabelY = 3 and custom renderLabels) across many screens to match new background layouts.
  • Updates Jewel Crafting background resource id and adjusts several screen init/title alignment behaviors.
  • Renames/extends Royal Grindstone translation keys in ScreenLang and regenerated en_us/en_ud outputs.

Reviewed changes

Copilot reviewed 22 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/main/java/dev/dubhe/anvilcraft/inventory/RoyalGrindstoneMenu.java Moves Royal Grindstone slot coordinates to match new background.
src/main/java/dev/dubhe/anvilcraft/data/lang/ScreenLang.java Renames/adds Royal Grindstone UI translation keys.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/TranscendenceAnvilScreen.java Moves title Y and custom-draws title label.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/TeslaTowerScreen.java Centers title X and moves title Y.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/SliderScreen.java Moves title Y to fit new background.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/RoyalSmithingScreen.java Custom title rendering + moves title Y.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/RoyalAnvilScreen.java Moves title Y and custom-draws title label.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/PulseGeneratorScreen.java Centers title and moves title Y.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/JewelCraftingScreen.java Switches background resource id + adjusts title placement/rendering.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/ItemDetectorScreen.java Custom title rendering + moves title Y.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/ItemCollectorScreen.java Custom title rendering + moves title Y.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/FrostSmithingScreen.java Custom title rendering + moves title Y.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/FrostGrindstoneScreen.java Custom title rendering + moves title Y.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/FrostAnvilScreen.java Moves title Y and custom-draws title label.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/FilterScreen.java Custom title rendering + moves title Y.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/EnergyWeaponMakeScreen.java Custom title rendering + adjusts title Y usage.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/EmberSmithingScreen.java Custom title rendering + moves title Y.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/EmberGrindstoneScreen.java Moves title Y and custom-draws title label.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/EmberAnvilScreen.java Moves title Y and custom-draws title label.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/BaseMachineScreen.java Moves title Y to align with new background style.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/AdvancedComparatorScreen.java Centers title and moves title Y.
src/main/java/dev/dubhe/anvilcraft/client/gui/screen/ActiveSilencerScreen.java Centers title and moves title Y; minor alignment edits.
src/generated/resources/assets/anvilcraft/lang/en_us.json Regenerates/updates Royal Grindstone translation keys.
src/generated/resources/assets/anvilcraft/lang/en_ud.json Regenerates/updates Royal Grindstone translation keys.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
});
this.addSlot(new Slot(this.resultToolSlots, 2, 145, 34) {
this.addSlot(new Slot(this.resultToolSlots, 2, 152, 51) {
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This result Slot is constructed against resultToolSlots (a ResultContainer) using container index 2. ResultContainer is a single-slot container (index 0), and this class also mixes indices (e.g., createResult() reads resultMaterialSlots.getItem(0) while onTake() writes resultMaterialSlots.setItem(2, ...)). Using index 2 will desync UI/state and can cause updates to be ignored. Use container index 0 consistently for both resultToolSlots/resultMaterialSlots (Slot construction + getItem/setItem).

Copilot uses AI. Check for mistakes.
Comment on lines +44 to +45
provider.add("screen.anvilcraft.royal_grindstone.curse_count", "Curses: %1$s / %2$s");
provider.add("screen.anvilcraft.royal_grindstone.repair_cost", "Repair cost: %1$s / %2$s");
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR removes the screen.anvilcraft.royal_grindstone.remove_curse_count / remove_repair_cost translation keys, but RoyalGrindstoneScreen still uses those keys in Component.translatable(...). This will display raw translation keys in-game (and breaks any existing locale files). Either keep the old keys as aliases, or update the screen code to use the new will_remove/curse_count/repair_cost/gold_cost keys consistently.

Suggested change
provider.add("screen.anvilcraft.royal_grindstone.curse_count", "Curses: %1$s / %2$s");
provider.add("screen.anvilcraft.royal_grindstone.repair_cost", "Repair cost: %1$s / %2$s");
provider.add("screen.anvilcraft.royal_grindstone.curse_count", "Curses: %1$s / %2$s");
provider.add("screen.anvilcraft.royal_grindstone.remove_curse_count", "Curses: %1$s / %2$s");
provider.add("screen.anvilcraft.royal_grindstone.repair_cost", "Repair cost: %1$s / %2$s");
provider.add("screen.anvilcraft.royal_grindstone.remove_repair_cost", "Repair cost: %1$s / %2$s");

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 25 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +34 to +37
Component removedText = Component.translatable(
"screen.anvilcraft.royal_grindstone.will_remove",
this.menu.removedCurseCount, this.menu.totalCurseCount
);
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screen.anvilcraft.royal_grindstone.will_remove is defined as a static label ("Will remove:") with no format placeholders, but it’s being constructed with extra arguments (removedCurseCount, totalCurseCount). Those args will be ignored and make the call misleading; pass no args here (the counts are already shown via curse_count).

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +46
provider.add("screen.anvilcraft.royal_grindstone.will_remove", "Will remove:");
provider.add("screen.anvilcraft.royal_grindstone.curse_count", "Curses: %1$s / %2$s");
provider.add("screen.anvilcraft.royal_grindstone.repair_cost", "Repair cost: %1$s / %2$s");
provider.add("screen.anvilcraft.royal_grindstone.gold_cost", "Gold cost: %1$s");
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces new Royal Grindstone translation keys (will_remove, curse_count, repair_cost, gold_cost) and removes the previous ones. The non-English lang files under src/main/resources/assets/anvilcraft/lang/ still only define the old keys, so those locales will fall back to en_us / show untranslated keys for these new labels. Please add the new keys (or keep the old keys as aliases) in the other lang JSONs to avoid regressions for translated languages.

Copilot uses AI. Check for mistakes.

@Override
protected void init() {
super.init();
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renderLabels() now draws the title at titleLabelX/titleLabelY, but init() only updates titleLabelY. If the new background expects centered titles (as in ItemDetectorScreen and BaseMachineScreen), also recompute titleLabelX = (imageWidth - font.width(title)) / 2 here; otherwise the title will remain at the default left-aligned position.

Suggested change
super.init();
super.init();
this.titleLabelX = (this.imageWidth - this.font.width(this.title)) / 2;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants