{"action":"closed","issue":{"url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/4987","repository_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge","labels_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/4987/labels{/name}","comments_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/4987/comments","events_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/4987/events","html_url":"https://github.com/MinecraftForge/MinecraftForge/issues/4987","id":333771166,"node_id":"MDU6SXNzdWUzMzM3NzExNjY=","number":4987,"title":"[1.12] Allow (select) registries to operate before Blocks & Items","user":{"login":"dries007","id":1346725,"node_id":"MDQ6VXNlcjEzNDY3MjU=","avatar_url":"https://avatars2.githubusercontent.com/u/1346725?v=4","gravatar_id":"","url":"https://api.github.com/users/dries007","html_url":"https://github.com/dries007","followers_url":"https://api.github.com/users/dries007/followers","following_url":"https://api.github.com/users/dries007/following{/other_user}","gists_url":"https://api.github.com/users/dries007/gists{/gist_id}","starred_url":"https://api.github.com/users/dries007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dries007/subscriptions","organizations_url":"https://api.github.com/users/dries007/orgs","repos_url":"https://api.github.com/users/dries007/repos","events_url":"https://api.github.com/users/dries007/events{/privacy}","received_events_url":"https://api.github.com/users/dries007/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-06-19T17:38:31Z","updated_at":"2018-06-19T19:17:56Z","closed_at":"2018-06-19T19:17:55Z","author_association":"CONTRIBUTOR","body":"I'd like it if I could harness the power of registries for things a ends up registering blocks & items for.\r\n\r\nI'm willing to write the PR, I believe it would require about 10~20 lines of code over 4 files (RegistryBuilder, RegistryManager, ForgeRegistry, and finally GameData). Most of these would just be passing the boolean down to the registry.\r\n\r\nIn GameData, I'd change `fireRegistryEvents`:\r\n\r\n```java\r\n// Sorting unchanged\r\n\r\nfor (ResourceLocation rl : keys)\r\n{\r\n    if (!filter.test(rl)) continue;\r\n    if (rl == BLOCKS || rl == ITEMS) continue;\r\n    Registry reg = RegistryManager.ACTIVE.getRegistry(rl);\r\n    if (!reg.preBlocks) continue;\r\n    MinecraftForge.EVENT_BUS.post(reg.getRegisterEvent(rl));\r\n}\r\nObjectHolderRegistry.INSTANCE.applyObjectHolders(); // inject the preBlocks registries\r\n\r\n// Blocks & Items unchanged\r\n\r\nfor (ResourceLocation rl : keys)\r\n{\r\n    if (!filter.test(rl)) continue;\r\n    if (rl == BLOCKS || rl == ITEMS) continue;\r\n    Registry reg = RegistryManager.ACTIVE.getRegistry(rl);\r\n    if (reg.preBlocks) continue;\r\n    MinecraftForge.EVENT_BUS.post(reg.getRegisterEvent(rl));\r\n}\r\nObjectHolderRegistry.INSTANCE.applyObjectHolders(); // inject everything else\r\n\r\n```\r\n\r\n**The use case is as follows:**\r\n\r\nI'm updating [TerraFirmaCraft to 1.12.2](https://github.com/TerraFirmaCraft/TerraFirmaCraft#readme) and would like to make it easier to write addons that add functionality to the base mod. By letting an addon register for example rock types, it would not have to take care of registering close to 50 blocks and items and integrating them into worldgen and other systems. Same for ores, metals, alloys, tree types, etc.\r\n\r\nThe infrastructure is all there, I just can't harness it at the moment. It would be a shame to have to write a pile of boilerplate for something already there.\r\n\r\nThanks in advance."}}
{"actor":{"display_login":"LexManos"}}