Skip to content

Add FlatteningMap and EntityFlatteningMap#1635

Open
Eclipse-Sol wants to merge 4 commits intomasterfrom
feature/modern-block-map
Open

Add FlatteningMap and EntityFlatteningMap#1635
Eclipse-Sol wants to merge 4 commits intomasterfrom
feature/modern-block-map

Conversation

@Eclipse-Sol
Copy link
Copy Markdown
Collaborator

Adds a 1:1 (for the most part) link between modern blocks and our legacy meta blocks values. Includes entities as well.

}
}
}
if (isModernPack) break;
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.

you could use a labeled break to avoid this

for (BlockEntry entry : entries) {
if ("minecraft".equals(entry.getId().getNamespace())) {
String name = entry.getId().getName();
if ("grass_block".equals(name) || "short_grass".equals(name)) {
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.

nit: prefer constants to inline strings

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This will be taken out when #1626 is merged, that should have a better detection module to rely on.

result.add(new BlockEntry(entryA.getId(), metasA));
} else {
// Both have specific metas -> intersect
Set<Integer> intersection = new HashSet<>(metasA);
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.

Prefer fastutils... even in areas that aren't hotspots Integer boxing drives me nuts

* Only blocks present in both lists survive. Empty meta set = wildcard (all metas).
*/
private static List<BlockEntry> intersectBlockEntries(List<BlockEntry> a, List<BlockEntry> b) {
List<BlockEntry> result = new ArrayList<>();
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.

nit: what's the size of things coming here? worth presizing the array?

@Eclipse-Sol Eclipse-Sol marked this pull request as ready for review April 14, 2026 01:36
@Eclipse-Sol
Copy link
Copy Markdown
Collaborator Author

@mitchej123 this one is ready for review now

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