Conversation
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.
Fix deployer placement orientation on rotated sub-levels
Summary
Fix Create Deployer placement orientation when a deployer operates inside a rotated Sable SubLevel.
Create deployers already calculate their FakePlayer position and rotation in the local coordinate system used by the current contraption or block entity. Sable then projects that synthetic player into the target SubLevel once again, causing the orientation to be transformed twice.
This affects both stationary deployers and deployers mounted on moving Create contraptions.
Root cause
Create's
DeployerBlockEntityandDeployerMovementBehaviourinitializeDeployerFakePlayerusing the deployer's current local facing.Sable's block-placement compatibility layer assumes that every interacting player is expressed in world space and calls
SubLevelHelper.pushEntityLocal(...)before reading:UseOnContext#getHorizontalDirection();UseOnContext#getRotation();Direction.getFacingAxis(...);Direction.orderedByNearest(...).For a Create
DeployerFakePlayeroperating inside the same SubLevel, this applies the same SubLevel inverse transform a second time.If
Qis the SubLevel rotation anddis the Create-provided local direction, the previous behavior is effectively:The FakePlayer is therefore interpreted in the wrong coordinate system. This produces the original-direction or perpendicular-direction behavior reported in:
Fix
Add a small interaction-space marker for synthetic entities and implement it for Create's
DeployerFakePlayer.Before Sable localizes an entity, it checks whether:
When this condition is true, the FakePlayer is already expressed in the target SubLevel's local coordinate system, so Sable leaves it unchanged.
The existing Sable transformation remains active for:
The fix also applies the same rule to
BlockPlaceContextdirection selection, preventing player-derived placement calculations from being localized twice.Why this approach
The fix preserves Create's existing Deployer logic instead of duplicating or replacing
DeployerHandler.This is important because Create has separate execution paths for:
DeployerBlockEntity;DeployerMovementBehaviour.Both paths already calculate the correct current local orientation, including contraption rotation. Modifying Sable's shared localization decision allows both paths to use the same compatibility rule.
The patch does not disable Sable's SubLevel transformation globally. It only skips the transformation when the synthetic player and target are already in the same local coordinate system.
Normal world Deployer behavior is unchanged because no Sable SubLevel is involved.
Testing
The following cases should be tested:
The most important regression cases are:
The standalone compatibility mod uses the same coordinate-space rule and was used as the local implementation reference. No separate behavioral divergence is expected between the standalone version and this upstream patch.
Compatibility
This patch does not change Create's public API and does not add a dependency on Create to Sable's common module.
The Create-specific implementation remains in the NeoForge compatibility source set. The generic interaction marker is exposed from Sable's API so that other synthetic interaction entities can use the same mechanism.
The patch is intended for Minecraft 1.21.1 and the corresponding Sable/Create compatibility layer.
Related issues
Fixes #681
Related: Creators-of-Aeronautics/Simulated-Project#1145