I want to attach a capability to a tileentity if this tileentity has a specific capability, but when I invoke hasCapability on the tileentity during the AttachCapabilitiesEvent, it crashes with some tileentities from other mods with a NullPointerException. Is there another way to do this?