Lilium Backpacks V2.0.0.mcaddon
What's new
Changelog - Lilium Backpacks
[2.0.0]
Added
- Worn Mode: A backpack in the off hand is worn: it cannot be opened. Its entity stays at the player's eyes, out of the line of sight, so the player can still break and use blocks without sneaking.
- Lock Slot (Public / Private): A new slot takes a Backpack Lock (4 iron nuggets + 1 iron ingot). With the lock in the slot the backpack is private; with the slot empty it is public. Picking up a placed backpack is owner-only whether or not it is public.
- Sort Button: A button in the interface sorts the backpack contents, merging stacks and ordering items.
- Backup and Recovery: Stored backpacks are backed up, and a lost backpack is recovered. If its last known location is in an unloaded chunk, recovery waits instead of acting, and the player is shown a hint with the coordinates and dimension to go back to. Once the location loads, the backpack is restored from its backup, or rebound empty with a notice if no backup can be found. A held backpack is also stowed as soon as its holder changes dimension, so a portal trip never leaves it behind.
- Migration From 1.3.x: Existing backpacks are upgraded in place the first time they load: a lock is placed in the lock slot (so they stay private, as before) and the sort button in its slot, and nothing already inside is lost.
- Creator API: Other addons can add backpacks that use one of the six Lilium Backpacks tiers, through script events or declarative item tags, and listen to
lb:opened,lb:closed,lb:upgraded,lb:dyed,lb:placedandlb:picked_up. - Custom Backpacks (Creator Protocol 2): Through
lb:register_backpack, a creator can register a backpack with its own storage size (1 to 255 slots), its own choice of special slots (upgrade, dye, lock, sort), and its own entity, placed block and screen. Lilium Backpacks runs all of its logic: opening, saving, carrying, wearing, placing, picking up, locking, sorting, upgrading and dyeing. Upgrading or dyeing into a backpack with a different size or entity moves the contents over, and anything that no longer fits drops at the player's feet. - Sneak to Place: A backpack is only placed on the ground while its holder is sneaking, so a plain right-click on a block no longer drops it by accident.
Changed
- TypeScript Rewrite: All scripts were ported to strict TypeScript and reorganised into
core/(pure rules),framework/(scheduler, controllers, vault, state),features/(one file per behaviour) andcreators/(the creator protocol and events), withmain.tsas the entry point. - Event-Driven Scheduler: Backpacks join an active index through entity spawn, load and remove events and are processed on their own cadence: a held backpack every tick, a placed one once every 20 ticks, spread over distinct ticks. A 200-tick reconciliation adopts anything no event announced.
- Event-Driven Player Controller: The player's backpack is resolved when the slot, hotbar or inventory changes, instead of on every tick.
- Upgrades Move Every Special Slot: Upgrading or dyeing carries each special slot (upgrade, dye, lock and sort) over to the new layout without overwriting anything. A special slot the new backpack doesn't have is cleared, and the upgrade kit is only used up once the backpack has actually changed.
- Versions: Built against
@minecraft/server2.11.0 and Minecraft 1.26.60.
Optimized
- No Per-Tick Entity Queries: The 1.3.x scheduler ran one
getEntitiesquery per player on every tick. The scheduler now makes none: in the scheduler test, 20 idle players over 100 ticks go from 2000 entity queries to 0, with no container reads either. - Bounded Placed-Backpack Work: With 40 placed backpacks, no more than 2 are processed per tick and each is processed once every 20 ticks (covered by a test).
Fixed
- Unusable Backpack Item: A bound backpack whose entity and saved structure were both gone stayed in the inventory forever, unable to open or be placed. It is now recovered from its backup, or rebound empty with a notice when no backup exists.
- Kit and Dye Lost While Upgrading: The kit and dye were taken out of their slots and put back one tick later, so they vanished if the backpack unloaded in between. Special slots now stay in place until the larger inventory exists and are then moved in a single step.
- Backpack Stuck After a Failed Save: A save that threw left the backpack flagged as saving, so it never followed or saved again until the world was reloaded. The flag is now released whether the save succeeds or fails.
- Owner Missing From the Lore: Breaking a placed backpack while its owner was offline wrote an empty "Owner:" line. The owner's name is now stored on the backpack and used when they are not online.
- Script Events From Other Addons: Every script event in the world was dispatched to the backpack controllers. Only the
lbnamespace is listened to now.
Compatibility
- The frozen 1.3.x contract is unchanged: item, entity and block identifiers, events, component groups, the
lb:in_blockproperty, block states, the structure identifier format and the existing dynamic properties (backpack_id,owner,id,current_backpack,original_item_type,custom_name). - New entity dynamic properties:
schema(migration version),gen(backup generation),locked(cached privacy),owner_name,tier, andpending_specials(special-slot items waiting to be placed after a tier change). New player dynamic property:current_mode(held or worn). - New world dynamic properties:
lb:last_seen:<backpack_id>(last known location) andlb:recovered:<backpack_id>(recovery generation record). The recovery record lives in the world rather than on the player, so a stale-backup check does not depend on the owner being online. - Backpacks from 1.3.x load without any manual step.
- Creator protocol:
lb:readyannounces{"version":"2.0.0","protocol":2}. Entries registered with atierand backpacks declared through item tags work exactly as in protocol 1. Custom backpacks need Lilium Backpacks installed, because their block uses itslb:before_placeandlb:on_breakcomponents.
All Relations
- All Relations
- Embedded Library
- Optional Dependency
- Required Dependency
- Tool
- Incompatible
- Include
This mod has no related projects