Repository navigation
UserGuide.LocatePosCommand.en
简体中文 | English
A calculator-like command used to compute and output, in the chat box for the command executor, the exact corresponding position of a coordinate after repositioning, under floating-point precision loss conditions.
- Permission level required: 2
- Restrictions: None
In Ultimate Scaler's repositioning system, the relationship between world coordinates and worldgen coordinates is:
Worldgen Coordinate = World Coordinate × Scale + Shift
However, when the shift is large enough, floating-point precision loss causes the above mapping to no longer hold mathematically — the product of the world coordinate and the scale may be too small relative to the shift to have any actual effect on the worldgen coordinate, causing the position of terrain boundaries to move.
The core function of this command is: given a target worldgen coordinate, find the smallest integer world coordinate
that corresponds to that worldgen coordinate. This computation is implemented entirely using BigInteger-based binary
search, avoiding rounding errors introduced by double-precision floating-point numbers and ensuring the result is exact.
Use Cases:
- Locate the exact boundary of terrain features (such as the Far Lands) after applying reposition.
- Verify or predict the behavior of long-distance terrain generation.
- Particularly useful when coordinates are large enough that precision loss becomes significant.
Command Behavior:
This command is equivalent to solving the following problem in Java:
Given a double (non-Infinity, non-NaN) target value p, scale s, and shift o, find the unique BigInteger
integer i such that:
i.doubleValue() * s + o >= p && i.subtract(BigInteger.ONE).doubleValue() * s + o < p
That is: find the smallest integer coordinate i such that the value after repositioning just crosses the boundary
p.
Notes:
- For a complete introduction to the worldgen reposition features, see Worldgen Reposition Explanation.
- This command operates on a single-axis coordinate, not a full 3D coordinate tuple. In Ultimate Scaler's system, the reposition for each axis (X, Y, Z) are completely independent, with no correlation between them. Forcing the computation into a 3D tuple would introduce unnecessary redundancy and confusion. If you need results for multiple axes, execute the command separately for each axis.
- When High Precision Mode is enabled in the configuration, this command is no longer necessary, as world coordinates can then be computed directly using the formula
(Sample Coordinate - shift) / scale. This command is designed specifically for scenarios where that feature is not enabled.
locate pos <targetPos> <scale> <offset>-
<targetPos>: double- The target worldgen coordinate, i.e., the coordinate before repositioning
- Must be a finite number (not ±∞, not NaN).
-
<scale>: double- The scale multiplier on this axis.
- Must not be 0, and must be a finite number.
-
<offset>: double- The shift on this axis.
- Must be a finite number.
- The command is incomplete, or any argument is not specified correctly: Unparsable.
- Any argument is non-finite: Failed.
-
<scale>is 0: Failed. - None of the above conditions apply: Successful.
| Situation | Success Count | /execute store success ... |
/execute store result ... |
|---|---|---|---|
| Failure | 0 | 0 | 0 |
| Success | 1 | 1 | The found coordinate (clamped to int range) |
Scenario: It is known that, without repositioning, the boundary (where generation begins) of the Far Lands is
located at coordinate 1808764368955220359643137. Suppose we want to know: when the X-axis scale is 8 and the shift
is also 1808764368955220359643137, where does this boundary lie on the scaled world coordinate?
Command:
locate pos 1808764368955220359643137 8 1808764368955220359643137Output:
Found position at: -16777215
This means that, after repositioning, the Edge Far Lands begins generating at X-axis coordinate -16777215.
Licensed under CC BY-NC-SA 3.0 license otherwise stated
🧭 用户指南 | User Guide
- 配置全解 | Configuration Reference
- 世界重定位功能详解 | Worldgen Reposition
- 命令/locate pos | /locate pos
- 常见问题 | FAQ
📈 项目治理 | Project Management
📚 参考资料 | References