protected override CodeCompileUnit CreateTargetCodeUnit() { CodeTypeDeclaration clas = NewClassWithMembers(SourceCodeLocator.RegistryHandler(Modname, Organization).ClassName, GetRegisterMethod(SourceCodeLocator.Items(Modname, Organization).ClassName, SourceCodeLocator.Items(Modname, Organization).InitFieldName, "Item"), GetRegisterMethod(SourceCodeLocator.Blocks(Modname, Organization).ClassName, SourceCodeLocator.Blocks(Modname, Organization).InitFieldName, "Block"), GetRegisterMethod(SourceCodeLocator.SoundEvents(Modname, Organization).ClassName, SourceCodeLocator.SoundEvents(Modname, Organization).InitFieldName, "SoundEvent")); clas.CustomAttributes.Add(NewEventBusSubscriberAnnotation()); CodeMemberMethod modelRegister = NewMethod("onModelRegister", typeof(void).FullName, MemberAttributes.Public | JavaAttributes.StaticOnly, new Parameter("ModelRegistryEvent", "event")); modelRegister.CustomAttributes.Add(NewSubscribeEventAnnotation()); modelRegister.Statements.Add(CreateRegisterModelForeach(SourceCodeLocator.Items(Modname, Organization).ClassName, "Item")); modelRegister.Statements.Add(CreateRegisterModelForeach(SourceCodeLocator.Blocks(Modname, Organization).ClassName, "Block")); clas.Members.Add(modelRegister); return(NewCodeUnit(SourceCodeLocator.RegistryHandler(Modname, Organization).PackageName, clas, $"{SourceRootPackageName}.{SourceCodeLocator.Blocks(Modname, Organization).ImportRelativeName}", $"{SourceRootPackageName}.{SourceCodeLocator.Items(Modname, Organization).ImportRelativeName}", $"{SourceRootPackageName}.{SourceCodeLocator.SoundEvents(Modname, Organization).ImportRelativeName}", $"{SourceRootPackageName}.{SourceCodeLocator.ModelInterface(Modname, Organization).ImportRelativeName}", "net.minecraft.block.Block", "net.minecraft.item.Item", "net.minecraft.util.SoundEvent", "net.minecraftforge.client.event.ModelRegistryEvent", "net.minecraftforge.event.RegistryEvent", "net.minecraftforge.fml.common.Mod.EventBusSubscriber", "net.minecraftforge.fml.common.eventhandler.SubscribeEvent")); }