You can achieve this with something like: (active_hotbar_slot - 1 + 9) % 9.
- Let's test with
active_hotbar_slot = 0: (0 - 1 + 9) % 9 = 8 % 9 = 8
- Let's test with
active_hotbar_slot = 1: (1 - 1 + 9) % 9 = 9 % 9 = 0
This kind of calculation ensures the numbers wrap around correctly. You would apply similar logic, adjusting the -1 for -2, -3, etc., for each of your "previous" slots. Don't forget that for positive "next" slots, you'd use (active_hotbar_slot + 1) % 9.
So, for each [HUD] Slot element, its slot parameter would look something like this (using the active hotbar slot placeholder nested inside the calculation):
{"placeholder":"slot_item","values":{"slot":"{"placeholder":"calc","values":{"decimal":"false","expression":"({\"placeholder\":\"active_hotbar_slot\"} + (9 - [OFFSET_VALUE])) % 9"}}"}}
Replace [OFFSET_VALUE] with 1 for the slot one before, 2 for two before, and so on. For example, for the slot representing active_hotbar_slot - 1, the [OFFSET_VALUE] would be 1.
This placeholder allows you to provide a dynamically calculated slot ID to the slot_item placeholder, which will then display the item from that calculated slot.
It's a bit complex with the nested placeholders, but it achieves the wrapping hotbar effect you're looking for.
I also recommend checking out FancyMenu's documentation for placeholders, especially the calc placeholder, as SpiffyHUD uses FancyMenu's core functionality:
Let me know if you need more specific help with the calc expressions for each slot! ✨