From c3eedb8bdd2a38770ee31e00dfd942e78e3bfae8 Mon Sep 17 00:00:00 2001 From: OrekiWoof Date: Thu, 19 Mar 2026 00:06:28 +0100 Subject: [PATCH] adjust offsets and size --- .timetracker | 7 +++- .../BlockEntityButterflyPinBoard.cs | 34 ++++++++++++------- .../butterflypins/blocktypes/pinboard2x2.json | 5 +++ .../butterflypins/blocktypes/pinboard3x3.json | 7 +++- 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/.timetracker b/.timetracker index 06142b9..75b6a72 100644 --- a/.timetracker +++ b/.timetracker @@ -1,5 +1,5 @@ { - "total": 11122, + "total": 14216, "sessions": [ { "begin": "2026-03-17T23:54:43+01:00", @@ -20,6 +20,11 @@ "begin": "2026-03-18T22:54:14+01:00", "end": "2026-03-18T23:14:49+01:00", "duration": 1234 + }, + { + "begin": "2026-03-18T23:14:52+01:00", + "end": "2026-03-19T00:06:26+01:00", + "duration": 3094 } ] } \ No newline at end of file diff --git a/ButterflyPins/ButterflyPins/BlockEntities/BlockEntityButterflyPinBoard.cs b/ButterflyPins/ButterflyPins/BlockEntities/BlockEntityButterflyPinBoard.cs index 87dd8d3..be6f2a2 100644 --- a/ButterflyPins/ButterflyPins/BlockEntities/BlockEntityButterflyPinBoard.cs +++ b/ButterflyPins/ButterflyPins/BlockEntities/BlockEntityButterflyPinBoard.cs @@ -28,6 +28,16 @@ public class BlockEntityButterflyPinBoard : BlockEntityDisplay 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; 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() { 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 itemRotationY = boardRotationY - GameMath.PIHALF; @@ -164,19 +174,19 @@ public class BlockEntityButterflyPinBoard : BlockEntityDisplay int row = slotIndex / Columns; int column = slotIndex % Columns; - float x = (float)(1 - BoardMargin - (0.5 * cellWidth) - (column * stepX)); - float y = (float)(BoardMargin + (0.5 * cellHeight) + ((Rows - 1 - row) * stepY)); - float z = Columns == 2 ? -0/1f : -1/48f; - float xOffset = Columns == 2 ? 0.465f : 0.475f; - Vec3f off = new(x - xOffset, y - yOffset, z + 0.5f); + Vec3f off = new( + DisplayOriginX + (column * DisplayStepX), + DisplayOriginY + (row * DisplayStepY), + DisplayOriginZ + ); off = new Matrixf().RotateY(boardRotationY).TransformVector(off.ToVec4f(0)).XYZ; matrices[slotIndex] = new Matrixf() .Translate(off.X, off.Y, off.Z) - .Translate(0.5f, 0f, 0.5f) + .Translate(0.5f, 0.5f, 0.5f) .RotateY(itemRotationY) .Scale(RenderScale, RenderScale, RenderScale) - .Translate(-0.5f, 0f, -0.5f) + .Translate(-0.5f, -0.5f, -0.5f) .Values; } diff --git a/ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard2x2.json b/ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard2x2.json index 0323535..10dff5a 100644 --- a/ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard2x2.json +++ b/ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard2x2.json @@ -13,6 +13,11 @@ "rows": 2, "columns": 2, "renderScale": 0.85, + "displayOriginX": 0.25375, + "displayOriginY": -0.5075, + "displayOriginZ": 0.5, + "displayStepX": -0.375, + "displayStepY": -0.375, "reinforcable": true }, "creativeinventory": { diff --git a/ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard3x3.json b/ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard3x3.json index fce72ae..6f9912c 100644 --- a/ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard3x3.json +++ b/ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard3x3.json @@ -12,7 +12,12 @@ "attributes": { "rows": 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 }, "creativeinventory": {