Title: RFC: Entrypoint reworks · Issue #119 · PatchworkMC/patchwork-api · GitHub
Open Graph Title: RFC: Entrypoint reworks · Issue #119 · PatchworkMC/patchwork-api
X Title: RFC: Entrypoint reworks · Issue #119 · PatchworkMC/patchwork-api
Description: Patchwork's current entrypoint system needs a rework. I've drafted up some ideas on what that might look like. Please tell me what you think about them! Introduction One of the future refactors I have in mind for Patchwork Patcher is to ...
Open Graph Description: Patchwork's current entrypoint system needs a rework. I've drafted up some ideas on what that might look like. Please tell me what you think about them! Introduction One of the future refactors I h...
X Description: Patchwork's current entrypoint system needs a rework. I've drafted up some ideas on what that might look like. Please tell me what you think about them! Introduction One of the future refac...
Opengraph URL: https://github.com/PatchworkMC/patchwork-api/issues/119
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RFC: Entrypoint reworks","articleBody":"Patchwork's current entrypoint system needs a rework. I've drafted up some ideas on what that might look like. Please tell me what you think about them!\r\n\r\n## Introduction\r\n\r\nOne of the future refactors I have in mind for Patchwork Patcher is to rework the entrypoint system. However, Patchwork API (more specifically, patchwork-dispatcher) would need to be modified to support and use these entrypoints, which is why I'm posting this here. The current single, unsided entrypoint system introduced back in September 2019 is showing its age, and has a few definite limitations:\r\n\r\n* No support for getting the mod instance\r\n* No (proper) support for sided automatic event bus subscribers (excluding using something like DistExecutor, which is arguably a hack)\r\n* Classes containing `@ObjectHolder` and `@CapabilityInject` annotations are potentially loaded too early (during mod construction rather than after registry creation)\r\n\r\nWhen implementing these entrypoints in Patcher, I intend on adding the methods to existing classes, and then using method references, as opposed to generating separate entrypoint classes.\r\n\r\nAs such, I propose adding a few different entrypoints:\r\n\r\n## patchwork:mod_instance\r\n\r\nA marker entrypoint to denote classes originally annotated with `@Mod`. Used get the mod instance. This would be an alternate approach to solve the same problem as https://github.com/PatchworkMC/patchwork-patcher/issues/53. As a side effect, fabric-loader will construct the mod for us when we query the entrypoint, which is convenient.\r\n\r\n```java\r\npublic interface ModInstance {\r\n // Loader has a feature similar to this, but since it doesn't support having multiple modids for the same jar\r\n /// this is still needed. - Glitch\r\n String getModId();\r\n}\r\n```\r\n\r\n## patchwork:common_automatic_subscribers\r\n\r\nRegister unsided `@EventBusSubscriber`s. Uses `ModInitializer`. Method name used in method references: `patchwork$onInitialize`. TODO: Should the automatic subscriber entrypoints use a custom interface that e.g. provides the MOD / FORGE bus in the entrypoint method?\r\n\r\n## patchwork:client_automatic_subscribers\r\n\r\nRegister client-only `@EventBusSubscriber`s. Uses `ClientModInitializer`. Method name used in method references: `patchwork$onInitializeClient`.\r\n\r\n## patchwork:server_automatic_subscribers\r\n\r\nRegister dedicated-server-only `@EventBusSubscriber`s. Uses `DedicatedServerModInitializer`. Method name used in method references: `patchwork$onInitializeServer`.\r\n\r\n## patchwork:object_holders\r\n\r\nRegister all object holders with the ObjectHolderRegistry here. Fired after new registries have been created, but before registry events have been dispatched.\r\n\r\n```java\r\npublic interface ObjectHolderInitializer {\r\n\tvoid registerObjectHolders(ObjectHolderRegistry registry);\r\n}\r\n```\r\n\r\n## patchwork:capability_injections\r\n\r\nBasically the same thing as `patchwork:register_object_holders` (and fired right afterwards) but for `@CapabilityInject`.\r\n\r\n```java\r\npublic interface CapabilityInjectionInitializer {\r\n\tvoid registerCapabilityInjections(CapabilityManager manager);\r\n}\r\n```","author":{"url":"https://github.com/coderbot16","@type":"Person","name":"coderbot16"},"datePublished":"2020-07-11T04:24:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/119/patchwork-api/issues/119"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6d2b4e30-bf3c-8fd0-6705-eab0cb986185 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D6B4:10C25C:1EF8E1:28FDD3:698EBB35 |
| html-safe-nonce | ad6cccefc4d7fbda2c7becbf2946b57e9c74e6479dab4c8ec9b92dd6c5dfd895 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENkI0OjEwQzI1QzoxRUY4RTE6MjhGREQzOjY5OEVCQjM1IiwidmlzaXRvcl9pZCI6IjM3Nzg2OTY1Nzc5MzA5MzUwOTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1240f975bc498e7597698afb9766c32ac8d86d9b9c69cade5847f91eacab5cbe |
| hovercard-subject-tag | issue:655131400 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PatchworkMC/patchwork-api/119/issue_layout |
| twitter:image | https://opengraph.githubassets.com/84d10e3092cd8d1a6fb9c837cb30933d4f1d116bb6d9fc301a03ec279dbfe553/PatchworkMC/patchwork-api/issues/119 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/84d10e3092cd8d1a6fb9c837cb30933d4f1d116bb6d9fc301a03ec279dbfe553/PatchworkMC/patchwork-api/issues/119 |
| og:image:alt | Patchwork's current entrypoint system needs a rework. I've drafted up some ideas on what that might look like. Please tell me what you think about them! Introduction One of the future refactors I h... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | coderbot16 |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb2828a801ee6b7be618f3ac76fbf55def35bbc30f053a9c41bf90210b8b72ba |
| turbo-cache-control | no-preview |
| go-import | github.com/PatchworkMC/patchwork-api git https://github.com/PatchworkMC/patchwork-api.git |
| octolytics-dimension-user_id | 56008689 |
| octolytics-dimension-user_login | PatchworkMC |
| octolytics-dimension-repository_id | 227717133 |
| octolytics-dimension-repository_nwo | PatchworkMC/patchwork-api |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 227717133 |
| octolytics-dimension-repository_network_root_nwo | PatchworkMC/patchwork-api |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6b91a7e6e46287d26887e3fb7a4161657bab8f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width