rewrite code to use EventHandler

this makes the code compatible with forge 9.11.1.964