This is a terrible example, sorry. Why does it have a cast of localPlayer? Why does it involve LocalPlayer at all - should just use an entity. The example wouldn't even compile because you forgot the .class at the end of LocationComponent.