|
10 | 10 | using Vintagestory.API.MathTools; |
11 | 11 | using Vintagestory.API.Server; |
12 | 12 | using Vintagestory.API.Util; |
13 | | -using Vintagestory.Server; |
14 | 13 |
|
15 | 14 | namespace DurableBetterProspecting.Items; |
16 | 15 |
|
@@ -47,7 +46,7 @@ public ItemProspectingPick() |
47 | 46 | public override int GetToolMode(ItemSlot slot, IPlayer byPlayer, BlockSelection blockSel) |
48 | 47 | { |
49 | 48 | var skillItemsLength = _modeManager.GetSkillItems().Length; |
50 | | - return Math.Clamp(slot.Itemstack.Attributes.GetInt("toolMode"), 0, skillItemsLength - 1); |
| 49 | + return Math.Clamp(slot.Itemstack?.Attributes.GetInt("toolMode") ?? 0, 0, skillItemsLength - 1); |
51 | 50 | } |
52 | 51 |
|
53 | 52 | public override SkillItem[] GetToolModes(ItemSlot slot, IClientPlayer forPlayer, BlockSelection blockSel) |
@@ -117,7 +116,8 @@ public override bool OnBlockBrokenWith(IWorldAccessor world, Entity byEntity, It |
117 | 116 | SampleArea(world, player, blockSel, mode); |
118 | 117 | } |
119 | 118 |
|
120 | | - if (DamagedBy is not null && DamagedBy.Contains(EnumItemDamageSource.BlockBreaking)) |
| 119 | + var damagedBy = GetDamagedBy(itemSlot); |
| 120 | + if (damagedBy is not null && damagedBy.Contains(EnumItemDamageSource.BlockBreaking)) |
121 | 121 | { |
122 | 122 | DamageItem(world, byEntity, itemSlot, damage); |
123 | 123 | } |
|
0 commit comments