fix wrong horizontal selection for north/south variants
This commit is contained in:
@@ -120,6 +120,9 @@ public class BlockEntityButterflyPinBoard : BlockEntityDisplay
|
|||||||
double height = (1 - (BoardMargin * 2)) / Rows;
|
double height = (1 - (BoardMargin * 2)) / Rows;
|
||||||
|
|
||||||
int column = GameMath.Clamp((int)((local.X - BoardMargin) / width), 0, Columns - 1);
|
int column = GameMath.Clamp((int)((local.X - BoardMargin) / width), 0, Columns - 1);
|
||||||
|
if (IsNorthSouthVariant())
|
||||||
|
column = (Columns - 1) - column;
|
||||||
|
|
||||||
int rowFromBottom = GameMath.Clamp((int)((local.Y - BoardMargin) / height), 0, Rows - 1);
|
int rowFromBottom = GameMath.Clamp((int)((local.Y - BoardMargin) / height), 0, Rows - 1);
|
||||||
int rowFromTop = Rows - 1 - rowFromBottom;
|
int rowFromTop = Rows - 1 - rowFromBottom;
|
||||||
|
|
||||||
@@ -205,6 +208,12 @@ public class BlockEntityButterflyPinBoard : BlockEntityDisplay
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool IsNorthSouthVariant()
|
||||||
|
{
|
||||||
|
string side = Block?.Variant?["side"] ?? "south";
|
||||||
|
return side is "north" or "south";
|
||||||
|
}
|
||||||
|
|
||||||
public float GetRenderScale()
|
public float GetRenderScale()
|
||||||
{
|
{
|
||||||
return RenderScale;
|
return RenderScale;
|
||||||
|
|||||||
Reference in New Issue
Block a user