Skip to content

Conversation

@leonardvdj
Copy link

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 map has to be an image2map bundle
  • The map has to have the same input path as the bundle
  • The bundle has to be missing a map with the x/y tiling coordinates of the map that is being added.

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.

  • Maps aren't encoded with the width and height of the map tiling, which means if you generate 2 differently sized map tilings with the same input path, you will be able to mix the maps despite the added checks.
  • The input path is taken from the last line of the item lore, which could cause issues down the line if more lore is added after the path. Ideally it would be encoded in the item's custom data, however I'm not sure of the migration paths for such custom data changes.
  • When you're in creative mode, click packets aren't sent in the inventory if you're connected to an external server. Because of this, the checks for destroying empty bundles, as well as adding items to bundles, don't work unless you're in singleplayer. The one case where it does still work is the in-world right click, however for consistent behavior between singleplayer/multiplayer I've added a bypass for all the bundle checks when you're in creative.

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.

@leonardvdj leonardvdj changed the title Feat/map walls and bundle actions Feat: map walls and bundle actions Aug 11, 2025
@Patbox Patbox changed the base branch from 1.21.6 to main September 30, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant