add 1.22 compat - use pin as tool in recipes
This commit is contained in:
17
.timetracker
17
.timetracker
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"total": 20766,
|
"total": 22680,
|
||||||
"sessions": [
|
"sessions": [
|
||||||
{
|
{
|
||||||
"begin": "2026-03-17T23:54:43+01:00",
|
"begin": "2026-03-17T23:54:43+01:00",
|
||||||
@@ -40,6 +40,21 @@
|
|||||||
"begin": "2026-05-31T01:52:40+02:00",
|
"begin": "2026-05-31T01:52:40+02:00",
|
||||||
"end": "2026-05-31T02:00:30+02:00",
|
"end": "2026-05-31T02:00:30+02:00",
|
||||||
"duration": 470
|
"duration": 470
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"begin": "2026-05-31T02:24:20+02:00",
|
||||||
|
"end": "2026-05-31T02:49:01+02:00",
|
||||||
|
"duration": 1481
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"begin": "2026-05-31T03:09:33+02:00",
|
||||||
|
"end": "2026-05-31T03:10:03+02:00",
|
||||||
|
"duration": 29
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"begin": "2026-05-31T03:10:07+02:00",
|
||||||
|
"end": "2026-05-31T03:16:52+02:00",
|
||||||
|
"duration": 404
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using ButterflyPins.BlockEntities;
|
using ButterflyPins.BlockEntities;
|
||||||
using System;
|
|
||||||
using Vintagestory.API.Common;
|
using Vintagestory.API.Common;
|
||||||
using Vintagestory.API.MathTools;
|
using Vintagestory.API.MathTools;
|
||||||
|
|
||||||
@@ -7,8 +6,6 @@ namespace ButterflyPins.Blocks;
|
|||||||
|
|
||||||
public class BlockButterflyPinBoard : Block
|
public class BlockButterflyPinBoard : Block
|
||||||
{
|
{
|
||||||
private const string ButterflyPinPrefix = "clothes-butterflypin-";
|
|
||||||
|
|
||||||
public override bool OnBlockInteractStart(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel)
|
public override bool OnBlockInteractStart(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel)
|
||||||
{
|
{
|
||||||
if (blockSel == null)
|
if (blockSel == null)
|
||||||
@@ -38,32 +35,4 @@ public class BlockButterflyPinBoard : Block
|
|||||||
|
|
||||||
base.OnBlockBroken(world, pos, byPlayer, dropQuantityMultiplier);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,9 @@
|
|||||||
"S": { "type": "item", "code": "game:plank-*", "name": "wood", "skipVariants": ["aged"] },
|
"S": { "type": "item", "code": "game:plank-*", "name": "wood", "skipVariants": ["aged"] },
|
||||||
"B": {
|
"B": {
|
||||||
"type": "item",
|
"type": "item",
|
||||||
"code": "game:*-butterflypin-*"
|
"code": "game:clothes-butterflypin-*",
|
||||||
|
"isTool": true,
|
||||||
|
"toolDurabilityCost": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"width": 3,
|
"width": 3,
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
"S": { "type": "item", "code": "game:plank-*", "name": "wood", "skipVariants": ["aged"] },
|
"S": { "type": "item", "code": "game:plank-*", "name": "wood", "skipVariants": ["aged"] },
|
||||||
"B": {
|
"B": {
|
||||||
"type": "item",
|
"type": "item",
|
||||||
"code": "game:*-butterflypin-*"
|
"code": "game:clothes-butterflypin-*",
|
||||||
|
"isTool": true,
|
||||||
|
"toolDurabilityCost": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"width": 3,
|
"width": 3,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"OrekiWoof"
|
"OrekiWoof"
|
||||||
],
|
],
|
||||||
"description": "ButterflyPins mod.",
|
"description": "ButterflyPins mod.",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"game": "1.21.0"
|
"game": "1.21.0"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user