Repository navigation
Allow anything with the right NBT to shift-scroll - #1329
Merged
Merged
Conversation
s5bug
approved these changes
Oct 11, 2026
Comment on lines
+173
to
+176
| public static boolean supportsPageScrolling(ItemStack stack) { | ||
| return NBTHelper.hasNumber(stack, ItemSpellbook.TAG_SELECTED_PAGE) | ||
| && NBTHelper.hasCompound(stack, ItemSpellbook.TAG_PAGE_NAMES); | ||
| } |
Contributor
There was a problem hiding this comment.
In 1.21 components are namespaced meaning this won't conflict with other mods that have a component of the same name, right? I'm fine with the 1.20 behavior being "incompatible" tbh.
6 tasks
Open
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.
A slightly more robust solution to the problem described in #1328, namely that the shift-scrolling mechanics currently do not work on anything other than spellbooks even if the item in question provides all the right NBT (or even if it directly extends ItemSpellbook).
#1328 resolved the problem by adding a new item tag - here, I've simply changed the code that previously checked "is this item a spellbook" to instead check "does this item have the
page_idxandpage_namesNBT tags". This means you can simply apply those NBT tags to any item to allow shift-scrolling it.This is also in line with the general idea of 1.21's item components, where simply attaching the component to an item is enough to apply the relevant functionality to that item, without having to manually implement it.