Lilium Iron Chests V2.0.0.mcaddon
What's new
Changelog - Lilium Iron Chests
[2.0.0]
Added
- Material-Themed Chest Screens: Every chest screen now has its own background and slot colors, built the same way as the Lilium Backpacks screens: a 16×16 nine-slice panel (
RP/textures/lilium_iron_chests/ui/<material>_panel.png) behind the window and a 5×5 nine-slice cell (<material>_cell.png) behind every slot. Iron, copper, gold and diamond use the Lilium Backpacks palettes, and obsidian (dark purple) and dirt (brown) follow the same pattern. Obsidian shares the 108-slot diamond screen and switches to its own textures through avariablescondition on$display_title, so the sharedRP/ui/chest_screen.jsonis unchanged. The pocket layout still uses the vanilla container panel.
Changed
- Chest Entities Repair Themselves: Every chest is still made of two entities: an invisible
lic:chest_inventorythat holds the items, the collision and the title the chest screen needs, and alic:chest_visualthat draws the model, texture, rotation and lid and holds nothing. Their consistency used to depend on the 15-second maintenance scan; it is now checked whenever one of them loads. If an inventory entity loads without its visual, the visual is respawned from the block one tick later, once a visual in the same chunk has had the chance to load, so no duplicate is created. A visual that loads onto a chest that already has one is removed, a visual whose block is gone is removed (it never holds items), one whose chunk is not readable yet is left alone, and a lid that was saved open is closed.ensureChestEntitiesingame/chestEntity.tsfinds or spawns both and, if one spawn fails, removes only what that call spawned. - Upgrades Reuse the Same Entity (Major Change): Upgrading no longer removes the old inventory entity and spawns a new one while copying items between them. The kit now changes the block, resizes the existing inventory entity and updates the visual entity in place, so items never move out of their slots. Going from diamond to obsidian does not resize anything because both hold 108 slots. When the size does change,
upgradeCustominfeatures/upgrade.tstakes a snapshot of every slot before firing thelic:set_size_*event, and on the following ticks (up to 40) it checks the resized container: if the engine came back with an emptied inventory, every slot that held an item and is now empty gets its stack back in the same slot, and anything that cannot fit is dropped at the chest. Slots that still hold their items are never touched, so nothing is ever duplicated. A vanilla chest is still converted by moving its items into a freshly spawned entity. - Upgrade Input: To upgrade a custom chest, sneak and use the kit on the chest itself. The interaction is now read from
playerInteractWithEntityinstead of a block interaction. An upgrade is refused while anyone has the chest open, because a container cannot be swapped under an open screen, and the kit is only consumed when the upgrade succeeds and never in Creative. - Vanilla Upgrades Survive a Chunk Unload: When a vanilla chest is converted, its items wait in memory until the new entity's inventory is ready. If the chunk unloads during that wait,
populateno longer drops the items into the unloaded chunk, where they would be lost. As in 1.4.1, it checks again every 20 ticks without spending its 40-tick budget, and once the chunk is back it finds or respawns the chest entity and fills it. If the block is no longer the upgraded chest by then, the items are dropped at its location. - Lid Follows Each Viewer: The lid is driven by the inventory entity's open and close events, written on the visual entity, and remembers every player looking inside. It stays open until the last viewer closes the chest, and it closes by itself when a viewer disconnects.
- Explosion Handling: When TNT or a creeper destroys a chest block, the
blockExplodeevent drops everything inside the chest, removes its inventory entity once every item has dropped, and removes its visual entity, the same as when a player breaks it. Obsidian chests still survive explosions. - Safer Drops: When a chest's contents are dropped, each stack is cleared from its slot before it is spawned and is put back if spawning fails, so a stack never exists both in the slot and on the ground. The entity is only removed once every item has been dropped.
- Sneaking No Longer Turns Off the Chest Hitbox (Breaking Change): The inventory entity's hitbox is now always on. Sneaking next to a chest no longer disables it, so placing blocks directly against a chest may no longer work. This is still to be confirmed in game.
Optimized
- No Periodic Script Loops: The 2-tick sneak collision loop and the 15-second orphan scan are gone, and
BP/scriptscontains nosystem.runIntervalat all. Idle chests cost no script time. Orphaned inventory entities are cleaned up only when something happens to them: when the entity loads, when its block is broken, and when its block explodes. A chest whose block sits in an unloaded chunk is never treated as an orphan, and an inventory entity with no bound block position is left alone with a[lic]warning in the content log, because it may still hold items.
Removed
- Sneak Collision Loop: The loop that turned the chest collision off while a player was sneaking next to a chest is removed together with the
chestCollisionandchestMaintenancemodules. The collision events and component groups remain in the entity definition so existing entities load unchanged.
All Relations
- All Relations
- Embedded Library
- Optional Dependency
- Required Dependency
- Tool
- Incompatible
- Include
This mod has no related projects