Skip to content

Map splash potion IDs in 1.9->1.8 level event - #725

Open
roccodev wants to merge 2 commits into
ViaVersion:masterfrom
roccodev:feature/potion-splash-color
Open

roccodev wants to merge 2 commits into
ViaVersion:masterfrom
roccodev:feature/potion-splash-color

Conversation

@roccodev

Copy link
Copy Markdown
Contributor

Fixes potion splash colors in 1.8. If testing on a 1.19.4+ server you likely also need ViaVersion/ViaBackwards#1329

@Beaness

Beaness commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

I think something like this would be cleaner:

private static final Int2IntMap SPLASH_MAPPINGS = new Int2IntOpenHashMap();

static {
    SPLASH_MAPPINGS.defaultReturnValue(16384); // splash water
    for (Int2IntMap.Entry entry : PotionIdMappings1_9.POTION_INDEX.int2IntEntrySet()) {
        if (entry.getIntKey() >= 0) {
            SPLASH_MAPPINGS.put(entry.getIntValue(), entry.getIntKey() | 16384);
        }
    }
    SPLASH_MAPPINGS.put(36, POTION_NAME_TO_ID.get("luck") | 16384); // Added in 1.9
}

public static int getIdForSplash(final int id1_9) {
    return SPLASH_MAPPINGS.get(id1_9);
}

It reverses the preexisting viaver mappings for 1.9->1.8 so less maintenance work & fixes some edge cases too

@roccodev
roccodev force-pushed the feature/potion-splash-color branch from d38c41f to 38b6864 Compare November 23, 2026 21:26
@roccodev

Copy link
Copy Markdown
Contributor Author

I like that better, thanks

@roccodev
roccodev force-pushed the feature/potion-splash-color branch from 38b6864 to ab929d2 Compare November 23, 2026 21:53
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