API for blocks to declare whether they're relocatable from a given area#3129
Open
Commoble wants to merge 12 commits into
Open
API for blocks to declare whether they're relocatable from a given area#3129Commoble wants to merge 12 commits into
Commoble wants to merge 12 commits into
Conversation
|
…ose to use boundingboxes instead
…gBox#isInside for cuboid regions
Member
|
It is possible, though rare, to obtain half blocks like beds without their corresponding halves (usually through update suppression shenanigins or wacky worldgen). This doesn't seem to consider that, is it something worth considering? |
Contributor
Author
That's a fair point, I can update the vanilla overrides so that they only deny relocations if the other half is a properly-connected other half |
Technici4n
reviewed
Apr 26, 2026
sciwhiz12
reviewed
May 26, 2026
XFactHD
reviewed
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The purpose of this is for multiblocks which can be relocated if and only if the whole multiblock is being relocated, to be able declare this behavior.
For example, half a door block shouldn't be relocated, but a whole door is perfectly fine to relocate.
This PR adds an overridable method IBlockExtension#getRelocability for declaring this behavior (and corresponding IBlockStateExtension API), and also patches doors, beds, double plants, and extended pistons to support it.
A mod which intends to relocate some region of blocks (meaning, to cut/copy a region of blocks and paste them somewhere else, including translation, rotation, and/or mirror) would call IBlockStateExtension#getRelocability on each blockstate in the area they are relocating blocks from, testing the returned BlockRelocability object for the region of blocks the relocator is attempting to move.
The default behavior of the extension is to just check the block tag
c:relocation_not_supported, and blocks which are not relocatable under any circumstances may continue to add themselves to that tag instead of overriding this method.Additionally, a relocation system which wants to know how big a multiblock is so they can expand the area being relocated to cover the multiblock, may switch over the BlockRelocability, which is a sealed interface; the Multiblock subclass declares a set of positions indicating the extent of the multiblock.