Repository navigation
Conversation
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
force-pushed
the
feature/potion-splash-color
branch
from
November 23, 2026 21:26
d38c41f to
38b6864
Compare
Contributor
Author
|
I like that better, thanks |
Beaness
reviewed
Nov 23, 2026
roccodev
force-pushed
the
feature/potion-splash-color
branch
from
November 23, 2026 21:53
38b6864 to
ab929d2
Compare
Beaness
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes potion splash colors in 1.8. If testing on a 1.19.4+ server you likely also need ViaVersion/ViaBackwards#1329