fix: Fixes zero height spawners and normalizes spawn bounds before use. (#2301)
This commit is contained in:
parent
723e1a836d
commit
ec287d7691
2 changed files with 23 additions and 8 deletions
|
|
@ -81,6 +81,16 @@ public struct Rectangle3D : IEquatable<Rectangle3D>, ISpanFormattable
|
|||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public int Depth => _end.Z - _start.Z;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a normalized rectangle where Start contains the minimum coordinates
|
||||
/// and End contains the maximum coordinates in all dimensions.
|
||||
/// Use this when Start/End ordering matters (e.g., Contains checks, Z range calculations).
|
||||
/// </summary>
|
||||
public Rectangle3D Normalized => new(
|
||||
new Point3D(Math.Min(_start.X, _end.X), Math.Min(_start.Y, _end.Y), Math.Min(_start.Z, _end.Z)),
|
||||
new Point3D(Math.Max(_start.X, _end.X), Math.Max(_start.Y, _end.Y), Math.Max(_start.Z, _end.Z))
|
||||
);
|
||||
|
||||
public bool Equals(Rectangle3D other) => _start == other._start && _end == other._end;
|
||||
|
||||
public override bool Equals(object obj) => obj is Rectangle3D other && Equals(other);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue