Skip to content

Allow anything with the right NBT to shift-scroll - #1329

Merged
Robotgiggle merged 5 commits into
mainfrom
modular-spellbook
Oct 13, 2026
Merged

Robotgiggle merged 5 commits into
mainfrom
modular-spellbook

Conversation

@Robotgiggle

@Robotgiggle Robotgiggle commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

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_idx and page_names NBT 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.

2026-10-11_15 48 50

@s5bug s5bug left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

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);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep!

@Robotgiggle
Robotgiggle added this pull request to the merge queue Oct 13, 2026
Merged via the queue into main with commit 6ebfa70 Oct 13, 2026
9 checks passed
@Robotgiggle
Robotgiggle deleted the modular-spellbook branch October 13, 2026 02:26
@github-project-automation github-project-automation Bot moved this from 📋 Backlog to ✅ Done in Hex Casting Oct 13, 2026
@s5bug s5bug mentioned this pull request Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants