Feat: map walls and bundle actions #73
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to improve some instances where loss of maps is possible, as well as add some bundle functionality.
Currently when breaking quick-placed maps, the items are destroyed. This can lead to losing images from e.g. accidental hits, or when attempting to move them. These changes fix that by dropping the maps again when destroyed, so they can be re-used.
Loss of maps is also possible if you try to place a bundle somewhere that doesn't have enough item frames for all the maps, as it will do a partial placement. This PR adds a check for whether the wall is large enough and cancels placement if not, as well as notifying the user of the required size in the chat.
For bundle functionality it re-adds the ability to add items to/from image2map bundles, with a few restrictions put in place to avoid abuse such as essentially generating free bundles.
When removing maps from the image2map bundle, if the bundle ends up empty it will be destroyed.
When adding a map to an image2map bundle, a few conditions have to be filled:
The motivation behind re-adding this bundle functionality is that it can be useful in situations where you want a wall of tiled maps with an atypical shape, such as a circle, and don't mind having to manually place the maps.
There are however some caveats with the way the bundle changes are implemented. I don't think they are blockers, but if there are better ways of doing it please let me know.
If there's an easy way to add more properties to the ImageData codec that can dynamically update by pulling data from the ItemStack it's associated with, this would be ideal.
Alternatively, if it was added and the data was set in toSingleStack, that would cover new tiled maps as well as eventually quick placed ones taken off walls.
Some migration logic could also be added to the logic of taking maps out of image2map bundles (as well as placing them inside), setting their width/height/path to those of the parent bundle.
It's not an ideal solution though, so I've held off on making any changes to that stuff so I can hear some potential thoughts, or whether it's even needed.