I want to initialize things to DeferredRegisters, but not statically.
public static final RegistryObject<Block> bonzanium_casing=register.register(BonzaniumCasing.class.getAnnotation(Register.class).id(),()->new BonzaniumCasing());
↑ This is what I don't want
I want something like this ↓
public static final RegistryObject<Block> bonzanium_casing=register(new BonzaniumCasing());
protected static final RegistryObject<Block> register(Block block){
if(block.getClass().isAnnotationPresent(Register.class)){
Register reg = block.getClass().getAnnotation(Register.class);
String id=reg.id();
return register.register(id,()->block);
}else {
Internal.LOGGER.warn("Block {} has no @Register annotation",block.getClass().getName());
return null;
}
}
Whenever I try to do something like that i get the following error?
Caused by: java.lang.IllegalStateException: Registry is already frozen
Why does that happen? When do the registries freeze?