adjust offsets and size

This commit is contained in:
2026-03-19 00:06:28 +01:00
parent 56b9a0d209
commit c3eedb8bdd
4 changed files with 39 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
{ {
"total": 11122, "total": 14216,
"sessions": [ "sessions": [
{ {
"begin": "2026-03-17T23:54:43+01:00", "begin": "2026-03-17T23:54:43+01:00",
@@ -20,6 +20,11 @@
"begin": "2026-03-18T22:54:14+01:00", "begin": "2026-03-18T22:54:14+01:00",
"end": "2026-03-18T23:14:49+01:00", "end": "2026-03-18T23:14:49+01:00",
"duration": 1234 "duration": 1234
},
{
"begin": "2026-03-18T23:14:52+01:00",
"end": "2026-03-19T00:06:26+01:00",
"duration": 3094
} }
] ]
} }

View File

@@ -28,6 +28,16 @@ public class BlockEntityButterflyPinBoard : BlockEntityDisplay
private float RenderScale => Block?.Attributes?["renderScale"].AsFloat(0.18f) ?? 0.18f; private float RenderScale => Block?.Attributes?["renderScale"].AsFloat(0.18f) ?? 0.18f;
private float DisplayOriginX => GetDisplayFloat("displayOriginX", 0.31666666f);
private float DisplayOriginY => GetDisplayFloat("displayOriginY", 0.01333332f);
private float DisplayOriginZ => GetDisplayFloat("displayOriginZ", 0.47916666f);
private float DisplayStepX => GetDisplayFloat("displayStepX", -0.25f);
private float DisplayStepY => GetDisplayFloat("displayStepY", -0.25f);
private int ActiveSlotCount => Rows * Columns; private int ActiveSlotCount => Rows * Columns;
public BlockEntityButterflyPinBoard() public BlockEntityButterflyPinBoard()
@@ -148,14 +158,14 @@ public class BlockEntityButterflyPinBoard : BlockEntityDisplay
); );
} }
private float GetDisplayFloat(string key, float defaultValue)
{
return Block?.Attributes?[key].AsFloat(defaultValue) ?? defaultValue;
}
protected override float[][] genTransformationMatrices() protected override float[][] genTransformationMatrices()
{ {
float[][] matrices = new float[DisplayedItems][]; float[][] matrices = new float[DisplayedItems][];
double cellWidth = (1 - (BoardMargin * 2)) / Columns;
double cellHeight = (1 - (BoardMargin * 2)) / Rows;
float stepX = 0.75f / Columns;
float stepY = 0.75f / Rows;
float yOffset = (Rows == 2 && Columns == 2 ? 1.0f : 0.75f) + 0.07f;
float boardRotationY = GetRotationY(); float boardRotationY = GetRotationY();
float itemRotationY = boardRotationY - GameMath.PIHALF; float itemRotationY = boardRotationY - GameMath.PIHALF;
@@ -164,19 +174,19 @@ public class BlockEntityButterflyPinBoard : BlockEntityDisplay
int row = slotIndex / Columns; int row = slotIndex / Columns;
int column = slotIndex % Columns; int column = slotIndex % Columns;
float x = (float)(1 - BoardMargin - (0.5 * cellWidth) - (column * stepX)); Vec3f off = new(
float y = (float)(BoardMargin + (0.5 * cellHeight) + ((Rows - 1 - row) * stepY)); DisplayOriginX + (column * DisplayStepX),
float z = Columns == 2 ? -0/1f : -1/48f; DisplayOriginY + (row * DisplayStepY),
float xOffset = Columns == 2 ? 0.465f : 0.475f; DisplayOriginZ
Vec3f off = new(x - xOffset, y - yOffset, z + 0.5f); );
off = new Matrixf().RotateY(boardRotationY).TransformVector(off.ToVec4f(0)).XYZ; off = new Matrixf().RotateY(boardRotationY).TransformVector(off.ToVec4f(0)).XYZ;
matrices[slotIndex] = new Matrixf() matrices[slotIndex] = new Matrixf()
.Translate(off.X, off.Y, off.Z) .Translate(off.X, off.Y, off.Z)
.Translate(0.5f, 0f, 0.5f) .Translate(0.5f, 0.5f, 0.5f)
.RotateY(itemRotationY) .RotateY(itemRotationY)
.Scale(RenderScale, RenderScale, RenderScale) .Scale(RenderScale, RenderScale, RenderScale)
.Translate(-0.5f, 0f, -0.5f) .Translate(-0.5f, -0.5f, -0.5f)
.Values; .Values;
} }

View File

@@ -13,6 +13,11 @@
"rows": 2, "rows": 2,
"columns": 2, "columns": 2,
"renderScale": 0.85, "renderScale": 0.85,
"displayOriginX": 0.25375,
"displayOriginY": -0.5075,
"displayOriginZ": 0.5,
"displayStepX": -0.375,
"displayStepY": -0.375,
"reinforcable": true "reinforcable": true
}, },
"creativeinventory": { "creativeinventory": {

View File

@@ -12,7 +12,12 @@
"attributes": { "attributes": {
"rows": 3, "rows": 3,
"columns": 3, "columns": 3,
"renderScale": 0.675, "renderScale": 0.85,
"displayOriginX": 0.33229166,
"displayOriginY": -0.40541668,
"displayOriginZ": 0.5,
"displayStepX": -0.25,
"displayStepY": -0.25,
"reinforcable": true "reinforcable": true
}, },
"creativeinventory": { "creativeinventory": {