https://docs.minecraftforge.net/en/latest/concepts/registries/
or https://forge.gemwire.uk/wiki/Registration#DeferredRegister
You can't register objects directly with the registries, except during the RegisterEvent when the registries are unfrozen.
You are trying to do it during classloading/static initialisation which occurs at an "unknown time", almost certainly when the registries are frozen.
A RegistryObject (which is the recommended mechanism) will do the registration for you at the correct time.
In future if you want help, put a minimal project on github that reproduces your problem so we can see everything you are doing.
Posting badly formatted and incomplete code in the forums will likely just mean your question gets ignored. Unless it is obvious what the problem is from what little information you post.