Hex Casting

Hex Casting

6M Downloads

Registry-ize Scrollable Items

SamsTheNerd opened this issue ยท 0 comments

commented

Currently the scrolling that the abacus and spellbook use are very hardcoded and you need to mixin to add more. Shouldn't be hard to add a Map<Item, ScrollHandlerFunction> registry and a convenience IScrollable interface.

Current: https://github.com/gamma-delta/HexMod/blob/e77b4017cf728058299ff72b45700edefb892b6b/Common/src/main/java/at/petrak/hexcasting/common/msgs/MsgShiftScrollC2S.java#L61C6-L61C6

The function should probably look something like void scroll(ItemStack stack, int delta, boolean modified, Hand hand, @Nullable Entity holder) and maybe something for invertAbacus and invertSpellbook ? I assume those are some config thing but idk. modified is used in place of the current isCtrl, since this would be a good time to address #179, maybe switching over to a 'Hex Modifier' keybind that works for this and toggling the pattern gradient view ?

One big change is that this doesn't assume that the scrollable item is being held by the player, so it can be scrolled as an item entity or in an inventory, if an addon wants to use that for whatever reason.

Not only will this make it easier to add Scrollable Items, but it adds a standardized way to actually scroll them (serverside atleast, you can already fake the packet from the client like I do for the gloop [ and ] scroll keybinds) that would be helpful for a general scroll pattern I want to add to gloop.

I'll probably do this myself, just wanted to put it here while it's on my mind.