Modify gui to fit new backgrounds 修改GUI以匹配新的背景#3398
Modify gui to fit new backgrounds 修改GUI以匹配新的背景#3398Vo1dExr wants to merge 7 commits intoAnvil-Dev:dev/1.21/1.6from
Conversation
# Conflicts: # src/main/java/dev/dubhe/anvilcraft/client/gui/screen/BaseMachineScreen.java
There was a problem hiding this comment.
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 = 3and customrenderLabels) 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
ScreenLangand regenerateden_us/en_udoutputs.
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) { |
There was a problem hiding this comment.
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).
| 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"); |
There was a problem hiding this comment.
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.
| 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"); |
There was a problem hiding this comment.
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.
| Component removedText = Component.translatable( | ||
| "screen.anvilcraft.royal_grindstone.will_remove", | ||
| this.menu.removedCurseCount, this.menu.totalCurseCount | ||
| ); |
There was a problem hiding this comment.
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).
| 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"); |
There was a problem hiding this comment.
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.
|
|
||
| @Override | ||
| protected void init() { | ||
| super.init(); |
There was a problem hiding this comment.
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.
| super.init(); | |
| super.init(); | |
| this.titleLabelX = (this.imageWidth - this.font.width(this.title)) / 2; |
Adapt to #3388