public override void OnHeldInteractStart(ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel, bool firstEvent, ref EnumHandHandling handling) { if (byEntity.World.Side == EnumAppSide.Client) { handling = EnumHandHandling.PreventDefaultAction; return; } if (blockSel == null) { return; } ModSystemBlockReinforcement bre = byEntity.Api.ModLoader.GetModSystem <ModSystemBlockReinforcement>(); IPlayer player = (byEntity as EntityPlayer).Player; if (player == null) { return; } ItemSlot resSlot = bre.FindResourceForReinforcing(player); if (resSlot == null) { return; } int strength = resSlot.Itemstack.ItemAttributes["reinforcementStrength"].AsInt(0); if (!bre.StrengthenBlock(blockSel.Position, player, strength)) { (player as IServerPlayer).SendIngameError("alreadyreinforced", "Cannot reinforce block, it's already reinforced!"); return; } resSlot.TakeOut(1); resSlot.MarkDirty(); BlockPos pos = blockSel.Position; byEntity.World.PlaySoundAt(new AssetLocation("sounds/tool/reinforce"), pos.X, pos.Y, pos.Z, null); handling = EnumHandHandling.PreventDefaultAction; if (byEntity.World.Side == EnumAppSide.Client) { ((byEntity as EntityPlayer)?.Player as IClientPlayer).TriggerFpAnimation(EnumHandInteract.HeldItemInteract); } }