Using that block, in the 1st slot put a variable that will tell you the bites (you can do 7-the bites to get the remaining slices), and in the 2nd slot put the cake location, you can put a
Game Value: Event Block Location to detect the right-clicked block, and in the 3rd slot put a text called
bites
. This will return the cake eating
before the eating, so if you right click a full cake, it will give you 0 then it will be eaten so you might want to
Control: Wait 0 ticks (putting the number 0 in the Wait will make the code run in the same tick but it will happen after the event occurs, so you can check the new block state)
(I got the image from the DiamondFire Discord server)...