Active control measures. 'Lock the liquor cabinet' with parental controls, or use apps for yourself like https://freedom.to
Part of this is not having something else to do in place of doing the old habit. Part of this is not getting a reward for doing the something else. Maybe make a list of things you (used to) enjoy and keep it somewhere visible, revisit it frequently, especially when you are about to hit a cue that sends you into an activity you want to avoid.