From 6655e603e3a49b4c957446e8b6a8c0584d9392c0 Mon Sep 17 00:00:00 2001 From: OrekiWoof Date: Thu, 19 Mar 2026 01:18:24 +0100 Subject: [PATCH] flatten folder structure, fix collision boxes and gui/fp/tp transforms --- .timetracker | 8 ++--- .vscode/launch.json | 2 +- .vscode/tasks.json | 2 +- ButterflyPins.slnx | 4 +-- .../BlockEntityButterflyPinBoard.cs | 0 .../Blocks/BlockButterflyPinBoard.cs | 31 +++++++++++++++++++ .../{ButterflyPins => }/ButterflyPins.csproj | 0 .../recipes/grid/pinboard2x2.json | 10 ------ .../recipes/grid/pinboard3x3.json | 10 ------ .../Properties/launchSettings.json | 0 .../Systems/ButterflyPinsModSystem.cs | 0 .../butterflypins/blocktypes/pinboard2x2.json | 14 ++++++--- .../butterflypins/blocktypes/pinboard3x3.json | 14 ++++++--- .../assets/butterflypins/lang/en.json | 0 .../recipes/grid/pinboard2x2.json | 13 ++++++++ .../recipes/grid/pinboard3x3.json | 13 ++++++++ .../shapes/block/pinboard-2x2.json | 0 .../shapes/block/pinboard-3x3.json | 0 .../{ButterflyPins => }/modinfo.json | 0 .../CakeBuild.csproj | 0 .../ZZCakeBuild => ZZCakeBuild}/Program.cs | 0 ButterflyPins/build.ps1 => build.ps1 | 0 ButterflyPins/build.sh => build.sh | 0 23 files changed, 85 insertions(+), 36 deletions(-) rename ButterflyPins/{ButterflyPins => }/BlockEntities/BlockEntityButterflyPinBoard.cs (100%) rename ButterflyPins/{ButterflyPins => }/Blocks/BlockButterflyPinBoard.cs (65%) rename ButterflyPins/{ButterflyPins => }/ButterflyPins.csproj (100%) delete mode 100644 ButterflyPins/ButterflyPins/assets/butterflypins/recipes/grid/pinboard2x2.json delete mode 100644 ButterflyPins/ButterflyPins/assets/butterflypins/recipes/grid/pinboard3x3.json rename ButterflyPins/{ButterflyPins => }/Properties/launchSettings.json (100%) rename ButterflyPins/{ButterflyPins => }/Systems/ButterflyPinsModSystem.cs (100%) rename ButterflyPins/{ButterflyPins => }/assets/butterflypins/blocktypes/pinboard2x2.json (88%) rename ButterflyPins/{ButterflyPins => }/assets/butterflypins/blocktypes/pinboard3x3.json (88%) rename ButterflyPins/{ButterflyPins => }/assets/butterflypins/lang/en.json (100%) create mode 100644 ButterflyPins/assets/butterflypins/recipes/grid/pinboard2x2.json create mode 100644 ButterflyPins/assets/butterflypins/recipes/grid/pinboard3x3.json rename ButterflyPins/{ButterflyPins => }/assets/butterflypins/shapes/block/pinboard-2x2.json (100%) rename ButterflyPins/{ButterflyPins => }/assets/butterflypins/shapes/block/pinboard-3x3.json (100%) rename ButterflyPins/{ButterflyPins => }/modinfo.json (100%) rename {ButterflyPins/ZZCakeBuild => ZZCakeBuild}/CakeBuild.csproj (100%) rename {ButterflyPins/ZZCakeBuild => ZZCakeBuild}/Program.cs (100%) rename ButterflyPins/build.ps1 => build.ps1 (100%) rename ButterflyPins/build.sh => build.sh (100%) mode change 100644 => 100755 diff --git a/.timetracker b/.timetracker index 75b6a72..5deb8dc 100644 --- a/.timetracker +++ b/.timetracker @@ -1,5 +1,5 @@ { - "total": 14216, + "total": 18477, "sessions": [ { "begin": "2026-03-17T23:54:43+01:00", @@ -19,12 +19,12 @@ { "begin": "2026-03-18T22:54:14+01:00", "end": "2026-03-18T23:14:49+01:00", - "duration": 1234 + "duration": 1235 }, { "begin": "2026-03-18T23:14:52+01:00", - "end": "2026-03-19T00:06:26+01:00", - "duration": 3094 + "end": "2026-03-19T01:17:26+01:00", + "duration": 7354 } ] } \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 03c01b0..34aa302 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "Vintage Story Client", "type": "dotnet", "request": "launch", - "projectPath": "${workspaceFolder}/ButterflyPins/ButterflyPins/ButterflyPins.csproj" + "projectPath": "${workspaceFolder}/ButterflyPins/ButterflyPins.csproj" } ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 8a7610e..f4767cf 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -18,7 +18,7 @@ "dependsOrder": "sequence", "args": [ "build", - "${workspaceFolder}/ButterflyPins/ButterflyPins/ButterflyPins.csproj", + "${workspaceFolder}/ButterflyPins/ButterflyPins.csproj", "-c", "${input:buildConfig}", "/property:GenerateFullPaths=true", diff --git a/ButterflyPins.slnx b/ButterflyPins.slnx index c96646c..9d89ef1 100644 --- a/ButterflyPins.slnx +++ b/ButterflyPins.slnx @@ -4,6 +4,6 @@ - - + + diff --git a/ButterflyPins/ButterflyPins/BlockEntities/BlockEntityButterflyPinBoard.cs b/ButterflyPins/BlockEntities/BlockEntityButterflyPinBoard.cs similarity index 100% rename from ButterflyPins/ButterflyPins/BlockEntities/BlockEntityButterflyPinBoard.cs rename to ButterflyPins/BlockEntities/BlockEntityButterflyPinBoard.cs diff --git a/ButterflyPins/ButterflyPins/Blocks/BlockButterflyPinBoard.cs b/ButterflyPins/Blocks/BlockButterflyPinBoard.cs similarity index 65% rename from ButterflyPins/ButterflyPins/Blocks/BlockButterflyPinBoard.cs rename to ButterflyPins/Blocks/BlockButterflyPinBoard.cs index dbc1bee..51e8a8d 100644 --- a/ButterflyPins/ButterflyPins/Blocks/BlockButterflyPinBoard.cs +++ b/ButterflyPins/Blocks/BlockButterflyPinBoard.cs @@ -1,4 +1,5 @@ using ButterflyPins.BlockEntities; +using System; using Vintagestory.API.Common; using Vintagestory.API.MathTools; @@ -6,6 +7,8 @@ namespace ButterflyPins.Blocks; public class BlockButterflyPinBoard : Block { + private const string ButterflyPinPrefix = "clothes-butterflypin-"; + public override bool OnBlockInteractStart(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel) { if (blockSel == null) @@ -35,4 +38,32 @@ public class BlockButterflyPinBoard : Block base.OnBlockBroken(world, pos, byPlayer, dropQuantityMultiplier); } + + public override bool ConsumeCraftingIngredients(ItemSlot[] slots, ItemSlot outputSlot, GridRecipe matchingRecipe) + { + bool preservedPin = false; + + foreach (ItemSlot slot in slots) + { + if (slot.Empty) + continue; + + if (!preservedPin && IsButterflyPin(slot.Itemstack)) + { + preservedPin = true; + continue; + } + + slot.TakeOut(1); + slot.MarkDirty(); + } + + return true; + } + + private static bool IsButterflyPin(ItemStack stack) + { + AssetLocation? code = stack.Collectible?.Code; + return code != null && code.Path.StartsWith(ButterflyPinPrefix, StringComparison.Ordinal); + } } \ No newline at end of file diff --git a/ButterflyPins/ButterflyPins/ButterflyPins.csproj b/ButterflyPins/ButterflyPins.csproj similarity index 100% rename from ButterflyPins/ButterflyPins/ButterflyPins.csproj rename to ButterflyPins/ButterflyPins.csproj diff --git a/ButterflyPins/ButterflyPins/assets/butterflypins/recipes/grid/pinboard2x2.json b/ButterflyPins/ButterflyPins/assets/butterflypins/recipes/grid/pinboard2x2.json deleted file mode 100644 index c902a33..0000000 --- a/ButterflyPins/ButterflyPins/assets/butterflypins/recipes/grid/pinboard2x2.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "ingredientPattern": "PPP\tS_S\tPPP", - "ingredients": { - "P": { "type": "item", "code": "plank-*" }, - "S": { "type": "item", "code": "stick" } - }, - "width": 3, - "height": 3, - "output": { "type": "block", "code": "pinboard2x2-south" } -} \ No newline at end of file diff --git a/ButterflyPins/ButterflyPins/assets/butterflypins/recipes/grid/pinboard3x3.json b/ButterflyPins/ButterflyPins/assets/butterflypins/recipes/grid/pinboard3x3.json deleted file mode 100644 index aeff790..0000000 --- a/ButterflyPins/ButterflyPins/assets/butterflypins/recipes/grid/pinboard3x3.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "ingredientPattern": "PPP\tPSP\tPPP", - "ingredients": { - "P": { "type": "item", "code": "plank-*" }, - "S": { "type": "item", "code": "stick" } - }, - "width": 3, - "height": 3, - "output": { "type": "block", "code": "pinboard3x3-south" } -} \ No newline at end of file diff --git a/ButterflyPins/ButterflyPins/Properties/launchSettings.json b/ButterflyPins/Properties/launchSettings.json similarity index 100% rename from ButterflyPins/ButterflyPins/Properties/launchSettings.json rename to ButterflyPins/Properties/launchSettings.json diff --git a/ButterflyPins/ButterflyPins/Systems/ButterflyPinsModSystem.cs b/ButterflyPins/Systems/ButterflyPinsModSystem.cs similarity index 100% rename from ButterflyPins/ButterflyPins/Systems/ButterflyPinsModSystem.cs rename to ButterflyPins/Systems/ButterflyPinsModSystem.cs diff --git a/ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard2x2.json b/ButterflyPins/assets/butterflypins/blocktypes/pinboard2x2.json similarity index 88% rename from ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard2x2.json rename to ButterflyPins/assets/butterflypins/blocktypes/pinboard2x2.json index 10dff5a..c00517e 100644 --- a/ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard2x2.json +++ b/ButterflyPins/assets/butterflypins/blocktypes/pinboard2x2.json @@ -42,7 +42,7 @@ "collisionbox": { "x1": 0.0625, "y1": 0.0625, - "z1": 0.9375, + "z1": 0.90625, "x2": 0.9375, "y2": 0.9375, "z2": 1.0, @@ -56,7 +56,7 @@ "selectionbox": { "x1": 0.0625, "y1": 0.0625, - "z1": 0.9375, + "z1": 0.90625, "x2": 0.9375, "y2": 0.9375, "z2": 1.0, @@ -80,7 +80,7 @@ "guiTransform": { "rotation": { "x": -19, "y": 136, "z": 0 }, "origin": { "x": 0.5, "y": 0.5, "z": 0.5 }, - "scale": 1.9 + "scale": 1.0 }, "groundTransform": { "translation": { "x": 0, "y": 0, "z": 0 }, @@ -90,7 +90,13 @@ }, "tpHandTransform": { "translation": { "x": -0.45, "y": -0.8, "z": 0.04 }, - "rotation": { "x": 0, "y": 0, "z": -10 }, + "rotation": { "x": 0, "y": 180, "z": -10 }, + "origin": { "x": 0.5, "y": 0.5, "z": 0.5 }, + "scale": 0.95 + }, + "fpHandTransform": { + "translation": { "x": -0.45, "y": -0.8, "z": 0.04 }, + "rotation": { "x": 0, "y": 180, "z": -10 }, "origin": { "x": 0.5, "y": 0.5, "z": 0.5 }, "scale": 0.95 } diff --git a/ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard3x3.json b/ButterflyPins/assets/butterflypins/blocktypes/pinboard3x3.json similarity index 88% rename from ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard3x3.json rename to ButterflyPins/assets/butterflypins/blocktypes/pinboard3x3.json index 6f9912c..9978f78 100644 --- a/ButterflyPins/ButterflyPins/assets/butterflypins/blocktypes/pinboard3x3.json +++ b/ButterflyPins/assets/butterflypins/blocktypes/pinboard3x3.json @@ -42,7 +42,7 @@ "collisionbox": { "x1": 0.0625, "y1": 0.0625, - "z1": 0.9375, + "z1": 0.90625, "x2": 0.9375, "y2": 0.9375, "z2": 1.0, @@ -56,7 +56,7 @@ "selectionbox": { "x1": 0.0625, "y1": 0.0625, - "z1": 0.9375, + "z1": 0.90625, "x2": 0.9375, "y2": 0.9375, "z2": 1.0, @@ -80,7 +80,7 @@ "guiTransform": { "rotation": { "x": -19, "y": 136, "z": 0 }, "origin": { "x": 0.5, "y": 0.5, "z": 0.5 }, - "scale": 1.9 + "scale": 1.0 }, "groundTransform": { "translation": { "x": 0, "y": 0, "z": 0 }, @@ -90,7 +90,13 @@ }, "tpHandTransform": { "translation": { "x": -0.45, "y": -0.8, "z": 0.04 }, - "rotation": { "x": 0, "y": 0, "z": -10 }, + "rotation": { "x": 0, "y": 180, "z": -10 }, + "origin": { "x": 0.5, "y": 0.5, "z": 0.5 }, + "scale": 0.95 + }, + "fpHandTransform": { + "translation": { "x": -0.45, "y": -0.8, "z": 0.04 }, + "rotation": { "x": 0, "y": 180, "z": -10 }, "origin": { "x": 0.5, "y": 0.5, "z": 0.5 }, "scale": 0.95 } diff --git a/ButterflyPins/ButterflyPins/assets/butterflypins/lang/en.json b/ButterflyPins/assets/butterflypins/lang/en.json similarity index 100% rename from ButterflyPins/ButterflyPins/assets/butterflypins/lang/en.json rename to ButterflyPins/assets/butterflypins/lang/en.json diff --git a/ButterflyPins/assets/butterflypins/recipes/grid/pinboard2x2.json b/ButterflyPins/assets/butterflypins/recipes/grid/pinboard2x2.json new file mode 100644 index 0000000..e2715b0 --- /dev/null +++ b/ButterflyPins/assets/butterflypins/recipes/grid/pinboard2x2.json @@ -0,0 +1,13 @@ +{ + "ingredientPattern": "_S_\tSBS\t_S_", + "ingredients": { + "S": { "type": "item", "code": "game:stick" }, + "B": { + "type": "item", + "code": "game:*-butterflypin-*" + } + }, + "width": 3, + "height": 3, + "output": { "type": "block", "code": "pinboard2x2-north" } +} \ No newline at end of file diff --git a/ButterflyPins/assets/butterflypins/recipes/grid/pinboard3x3.json b/ButterflyPins/assets/butterflypins/recipes/grid/pinboard3x3.json new file mode 100644 index 0000000..fc7ceef --- /dev/null +++ b/ButterflyPins/assets/butterflypins/recipes/grid/pinboard3x3.json @@ -0,0 +1,13 @@ +{ + "ingredientPattern": "S_S\t_B_\tS_S", + "ingredients": { + "S": { "type": "item", "code": "game:stick" }, + "B": { + "type": "item", + "code": "game:*-butterflypin-*" + } + }, + "width": 3, + "height": 3, + "output": { "type": "block", "code": "pinboard3x3-north" } +} \ No newline at end of file diff --git a/ButterflyPins/ButterflyPins/assets/butterflypins/shapes/block/pinboard-2x2.json b/ButterflyPins/assets/butterflypins/shapes/block/pinboard-2x2.json similarity index 100% rename from ButterflyPins/ButterflyPins/assets/butterflypins/shapes/block/pinboard-2x2.json rename to ButterflyPins/assets/butterflypins/shapes/block/pinboard-2x2.json diff --git a/ButterflyPins/ButterflyPins/assets/butterflypins/shapes/block/pinboard-3x3.json b/ButterflyPins/assets/butterflypins/shapes/block/pinboard-3x3.json similarity index 100% rename from ButterflyPins/ButterflyPins/assets/butterflypins/shapes/block/pinboard-3x3.json rename to ButterflyPins/assets/butterflypins/shapes/block/pinboard-3x3.json diff --git a/ButterflyPins/ButterflyPins/modinfo.json b/ButterflyPins/modinfo.json similarity index 100% rename from ButterflyPins/ButterflyPins/modinfo.json rename to ButterflyPins/modinfo.json diff --git a/ButterflyPins/ZZCakeBuild/CakeBuild.csproj b/ZZCakeBuild/CakeBuild.csproj similarity index 100% rename from ButterflyPins/ZZCakeBuild/CakeBuild.csproj rename to ZZCakeBuild/CakeBuild.csproj diff --git a/ButterflyPins/ZZCakeBuild/Program.cs b/ZZCakeBuild/Program.cs similarity index 100% rename from ButterflyPins/ZZCakeBuild/Program.cs rename to ZZCakeBuild/Program.cs diff --git a/ButterflyPins/build.ps1 b/build.ps1 similarity index 100% rename from ButterflyPins/build.ps1 rename to build.ps1 diff --git a/ButterflyPins/build.sh b/build.sh old mode 100644 new mode 100755 similarity index 100% rename from ButterflyPins/build.sh rename to build.sh