Skip to content

Commit

Permalink
feat: focus spell search on open
Browse files Browse the repository at this point in the history
  • Loading branch information
baileyholl committed Sep 17, 2023
1 parent 72cdef9 commit 4d2db3e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public class GuiSpellBook extends BaseBook {

public int maxManaCache = 0;
int currentCostCache = 0;
public boolean setFocusOnLoad = true;

@Deprecated(forRemoval = true) // TODO: remove in 1.20
public GuiSpellBook(ItemStack bookStack, int tier, List<AbstractSpellPart> unlockedSpells) {
Expand Down Expand Up @@ -635,6 +636,10 @@ private void validateGlyphButton(List<AbstractSpellPart> recipe, GlyphButton gly
@Override
public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
super.render(ms, mouseX, mouseY, partialTicks);
if(this.setFocusOnLoad){
this.setFocusOnLoad = false;
this.setInitialFocus(searchBar);
}
spell_name.setSuggestion(spell_name.getValue().isEmpty() ? Component.translatable("ars_nouveau.spell_book_gui.spell_name").getString() : "");
}

Expand Down

0 comments on commit 4d2db3e

Please sign in to comment.