Skip to content

feat: scrolling astral map screen#2003

Open
nanowuu wants to merge 1 commit intoamblelabs:mainfrom
nanowuu:feat/scrolling-astral-map
Open

feat: scrolling astral map screen#2003
nanowuu wants to merge 1 commit intoamblelabs:mainfrom
nanowuu:feat/scrolling-astral-map

Conversation

@nanowuu
Copy link
Copy Markdown
Contributor

@nanowuu nanowuu commented Apr 25, 2026

About the PR

  • Added a scrollable astral map list which can be searched by name or by mod ID (with @)
  • Added a separate translation key for biomes and structures not being found

Why / Balance

Better for usability

Technical details

  • Astral Map screen completely changed to use a scrollable and searchable list widget, no more IdentifierSwitcher
  • Removed biome synchronisation (that data is already available on the client, maybe because of the F3 screen)
  • Added CallbackCheckboxWidget which allows for a callback when the checkbox is checked

Media

image image

Requirements

Breaking changes

No more IdentifierSwitcher or AstralMapBlock.biomeIds but they weren't used by anything else anyway

Changelog

@nanowuu nanowuu requested review from a team as code owners April 25, 2026 15:58
@github-actions github-actions Bot added S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. size/M Denotes a PR that changes 100-999 lines. S: Needs Review Status: Requires additional reviews before being fully accepted. labels Apr 25, 2026
@GSMPBot GSMPBot requested review from drtheodor and duzos April 25, 2026 15:58
@github-actions github-actions Bot added C: Textures Changes: Might require knowledge of spriting or visual design. A: Datagen Area: Datagen implementation & API. labels Apr 25, 2026
@rapbattlegod32
Copy link
Copy Markdown
Member

ill test now

fix: removal of biome synchronisation (data is already available on the client)
fix: translation key for biome and structure not found
@nanowuu nanowuu force-pushed the feat/scrolling-astral-map branch from b5d8225 to 3f447d5 Compare April 25, 2026 16:08
@rapbattlegod32
Copy link
Copy Markdown
Member

my intellij is bugging out i cant test
@Addi3 you're going to have to review instead

@addi3phone
Copy link
Copy Markdown

my intellij is bugging out i cant test @Addi3 you're going to have to review instead

Will be in like 1hr or smth cus I'm not on my pc rn

Copy link
Copy Markdown
Collaborator

@Addi3 Addi3 left a comment

Choose a reason for hiding this comment

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

LGTM. Tested in game, locates structures and biomes fine, no noticeable issues with the GUI either and scales well with game window

@drtheodor drtheodor added T: New Feature Type: New feature or content, or extending existing content. T: UI / UX Improvement Type: UI and player facing interactive graphical interfaces. T: Visual Change Type: Deals with changes to art, sprites or other visuals in the mod. C: UI Changes: Might require knowledge of UI design or code. A: General Interactions Area: General in-game interactions that don't relate to another area. and removed S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. labels Apr 30, 2026
Comment thread src/main/java/dev/amble/ait/client/screens/AstralMapScreen.java

private DisplayedCategories shownCategory = DisplayedCategories.BOTH;
private final List<Entry> entries = new ArrayList<>();
private final Map<String, String> mods = new HashMap<>();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wouldn't it be better if this was static? This way it doesn't have to re-think what the mods' names are. It could be lazily initialized to avoid querying mods for no reason.

Comment thread src/main/java/dev/amble/ait/client/screens/AstralMapScreen.java
Comment on lines +179 to +188
if (shownCategory != DisplayedCategories.STRUCTURES) {
for (Identifier id : client.world.getRegistryManager().get(RegistryKeys.BIOME).getIds()) {
this.entries.add(new Entry(id, true));
}
}
if (shownCategory != DisplayedCategories.BIOMES) {
for (Identifier id : AstralMapBlock.structureIds) {
this.entries.add(new Entry(id, false));
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is rather confusing and will become more complicated if more filters are added.
I suggest the following:

Suggested change
if (shownCategory != DisplayedCategories.STRUCTURES) {
for (Identifier id : client.world.getRegistryManager().get(RegistryKeys.BIOME).getIds()) {
this.entries.add(new Entry(id, true));
}
}
if (shownCategory != DisplayedCategories.BIOMES) {
for (Identifier id : AstralMapBlock.structureIds) {
this.entries.add(new Entry(id, false));
}
}
boolean both = DisplayedCategories.BOTH;
if (shownCategory == DisplayedCategories.BIOMES || both) {
for (Identifier id : client.world.getRegistryManager().get(RegistryKeys.BIOME).getIds()) {
this.entries.add(new Entry(id, true));
}
}
if (shownCategory == DisplayedCategories.STRUCTURES || both) {
for (Identifier id : AstralMapBlock.structureIds) {
this.entries.add(new Entry(id, false));
}
}

Alternatively, the enum could be replaced with a bitset (be it a normal int or BitSet, effectively allowing to combine values).

Alternatively no.2, you could add an abstract method to the enum that would supply the entries, something like this:

public enum DisplayedCategories {
    STRUCTURES {
        @Override
        public void getEntries(Consumer<AstralMapListWidget.Entry> consumer, MinecraftClient client) {
            for (Identifier id : AstralMapBlock.structureIds) {
                consumer.accept(new Entry(id, false));
            }
        }
    },
    BIOMES {
        @Override
        public void getEntries(Consumer<AstralMapListWidget.Entry> consumer, MinecraftClient client) {
            for (Identifier id : client.world.getRegistryManager().get(RegistryKeys.BIOME).getIds()) {
                consumer.accept(new Entry(id, true));
            }
        }
    },
    BOTH {
        @Override
        public void getEntries(Consumer<AstralMapListWidget.Entry> consumer, MinecraftClient client) {
            for (DisplayedCategories category : DisplayedCategories.VALUES) {
                category.getEntries(consumer, client);
            }
        }
    };

    private static final DisplayedCategories VALUES = values();

    public abstract void getEntries(Consumer<AstralMapListWidget.Entry> consumer, MinecraftClient client);
}

// ...

// in #refreshEntries:
this.shownCategory.getEntries(this.entries::add, client);

Comment thread src/main/java/dev/amble/ait/client/screens/AstralMapScreen.java
Comment on lines +277 to +283
public static String identifierToName(Identifier id) {
try {
return WorldUtil.fakeTranslate(id.getPath());
} catch (Exception e) {
return id.toString();
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

WorldUtil#fakeTranslate shouldn't throw exceptions. If it does, please wrap it in a try-catch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just left this bit as is from @duzos initial astral map commit

Comment thread src/main/java/dev/amble/ait/client/screens/AstralMapScreen.java
private final Text text;
private final String modName;

public Entry(Identifier identifier, boolean isBiome) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Having a hardcoded isBiome is kinda bad, since there could be other types added in future that could also have a translation.

In this scenario, I think the enum abstract method option I've mentioned previously would work the best, since then you could pass the Text directly to the Entry, instead of the Entry coming up with it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Generally I would agree with you but what other types? I feel like the enum abstract method complicates things a bit too much for a hypothetical

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unless you have something in mind?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It doesn't complicate stuff that much, plus it allows to add other categories more easily. For example, we could add the home location as a category. Or, perhaps, the waypoints stored in waypoint banks.

Obviously, out of scope for this PR, but doing the enum abstract method and passing Texts directly would make it implementable without many changes.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It doesn't complicate stuff that much, plus it allows to add other categories more easily. For example, we could add the home location as a category. Or, perhaps, the waypoints stored in waypoint banks.

never happening btw :al_clueless:

Comment on lines +78 to +83
boolean isStructure = buf.readBoolean();

if (isBiome) {
handleBiomeRequest(player, target);
} else {
if (isStructure) {
handleStructureRequest(player, target);
} else {
handleBiomeRequest(player, target);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be an enum, ideally.

Comment thread src/main/java/dev/amble/ait/core/blocks/AstralMapBlock.java
@duzos
Copy link
Copy Markdown
Member

duzos commented Apr 30, 2026

LARP final boss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A: Datagen Area: Datagen implementation & API. A: General Interactions Area: General in-game interactions that don't relate to another area. C: Textures Changes: Might require knowledge of spriting or visual design. C: UI Changes: Might require knowledge of UI design or code. S: Needs Review Status: Requires additional reviews before being fully accepted. size/M Denotes a PR that changes 100-999 lines. T: New Feature Type: New feature or content, or extending existing content. T: UI / UX Improvement Type: UI and player facing interactive graphical interfaces. T: Visual Change Type: Deals with changes to art, sprites or other visuals in the mod.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants