{"action":"created","issue":{"url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/4666","repository_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge","labels_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/4666/labels{/name}","comments_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/4666/comments","events_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/4666/events","html_url":"https://github.com/MinecraftForge/MinecraftForge/pull/4666","id":286611917,"number":4666,"title":"[1.13] Dimension Registry","user":{"login":"temp1011","id":34900092,"avatar_url":"https://avatars0.githubusercontent.com/u/34900092?v=4","gravatar_id":"","url":"https://api.github.com/users/temp1011","html_url":"https://github.com/temp1011","followers_url":"https://api.github.com/users/temp1011/followers","following_url":"https://api.github.com/users/temp1011/following{/other_user}","gists_url":"https://api.github.com/users/temp1011/gists{/gist_id}","starred_url":"https://api.github.com/users/temp1011/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/temp1011/subscriptions","organizations_url":"https://api.github.com/users/temp1011/orgs","repos_url":"https://api.github.com/users/temp1011/repos","events_url":"https://api.github.com/users/temp1011/events{/privacy}","received_events_url":"https://api.github.com/users/temp1011/received_events","type":"User","site_admin":false},"labels":[{"id":780786571,"url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/labels/1.13","name":"1.13","color":"dc4aef","default":false},{"id":306653555,"url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/labels/Feature","name":"Feature","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":41,"created_at":"2018-01-07T23:37:31Z","updated_at":"2018-02-05T15:39:37Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/pulls/4666","html_url":"https://github.com/MinecraftForge/MinecraftForge/pull/4666","diff_url":"https://github.com/MinecraftForge/MinecraftForge/pull/4666.diff","patch_url":"https://github.com/MinecraftForge/MinecraftForge/pull/4666.patch"},"body":"Continued from https://github.com/ForestryMC/ForestryMC/pull/1939\r\n\r\n### Problems\r\n- If a mod wants to  blacklist dimensions by mod (e.g-no gen in Mystcraft ages or Rftools dimensions) they have no easy way to do this. Only blacklisting dimensions induvidually is realistically possible. a\r\nAt the moment, blacklisting by mod would involve something like `world.getWorldInfo.getWorldName()` but I suspect quite a few mods will use useless names (`miningWorld` or something) and this doesn't seem a good way to code things anyway.\r\n\r\n- Furthermore, dimension IDs can't be guaranteed if a player adds/removes mods or mods creating dimensions on the fly. (I'm betting some mods use the ID `DimensionManager.getNextFreeDimId()` for their ID).\r\n\r\n- Even if mods create their dimensions at startup it's possible they will try to use the same ID. While a correctly coded mod won't cause weird behaviour/crashes because of this it means the dimensions will be registered on different IDs to what might normally occur. This is then annoying because the pack maker/user/other mods may have to change their configs/mods.\r\n\r\n- From what I can see, the current system makes it quite hard for other mods to keep track of which dimension is which because their main source of easily accessible information is the dimension `int` ID.\r\n\r\n- Dimension IDs aren't very readable and don't provide much information in logs etc.\r\n\r\n### Proposal\r\n- Add a `BiHashMap<ResourceLocation, int>` to `DimensionManager` in Forge to act as a two way dictionary between the current dimension IDs (which I will call `dimensionIntID`s) and `ResourceLocation`s. **DONE**\r\n\r\n- Add methods in `DimensionManager` to allow dimensions to be solely handled through Strings from the perspective of a mod and allow `ResourceLocation`s to be accessed. **DONE**\r\n\r\n- `ResourceLocation`s will be constructed with arguments `modid` and `dimensionName` and `DimensionManager` will automatically assign `dimensionIntID`s to them. If a mod uses `dimensionIntID`s to register dimensions then they will be assigned `\"noModid:dimension\" + dimensionIntID` as a pair for the dictionary. **DONE**\r\n\r\n- Deprecate using `dimensionIntIDs` in methods and instead suggest `ResourceLocation`s. **DONE**\r\n\r\n- Add methods like `getDimensions(String modName)`, `isFromMod(String modName)` etc. which allow mods to blacklist their worldgen from others' dimensions. _Some added_\r\n\r\n### Advantages\r\n- Other mods can find dimensions even if not created at their usual dimension ID. \r\n\r\n- Any mod with their own worldgen (pretty much every mod) can control where it generates much more easily.\r\n\r\n- Dimensions abstracted away from meaningless numbers.\r\n\r\n- Easier to register dimensions (slightly, don't have to worry about which IDs are free).\r\n\r\n### Disadvantages\r\n- System where some use `int` and some `ResourceLocations` to register dimensions could be messy. However, mods should be able to keep using deprecated methods to deal with 'int' or this could be introduced as a breaking change.\r\n\r\n- Mods will have to update their dimensions for this to have any use (making this a breaking change would solve this).\r\n\r\n- Probably a bunch more I can't think of.\r\n\r\n### To do\r\n- Rewrite code of `DimensionManager` to use `ResourceLocation`s (at the moment using the new system will cause some performance lag. This means the dictionary will be the other way round by default and will be used to convert to IDs for Mojang's code.\r\n\r\n- Turn 'DimensionManager` into an actual registry (would be a bit weird as some mods would want to register dimensions not at startup).\r\n\r\n- Allow `\"modid:name:type\"` as an extra argument so mods can make clear what type of dimension they have (eg - void world, mining world, etc). _Would make things a bit more messy but doable_\r\n\r\n- Add to IMC to let mods tell others not to do worldgen in their dimension.\r\n\r\n- Test mod\r\n\r\n**TLDR:** Some kind of dimension registry.\r\n\r\nThis probably needs to wait for 1.13 because Mojang do this themselves. Also, to  make the methods effective mods actually have to use the new system. It could be implemented in 1.12 (from what I can tell) but others would have to adopt it for the new features to have a big impact.\r\n\r\nSorry for making you read so much, it's partly to help me try to make sure I haven't missed something. There could be something obvious I've missed in which case let me know and I can try and fix it or close the PR. This code isn't amazing because I'm not an amazing coder but it should work. Any suggestions/feedback/improvements would be appreciated. \r\n  \r\n  \r\n  \r\n  \r\n  \r\n  \r\n  "},"comment":{"url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/comments/363122278","html_url":"https://github.com/MinecraftForge/MinecraftForge/pull/4666#issuecomment-363122278","issue_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/4666","id":363122278,"user":{"login":"temp1011","id":34900092,"avatar_url":"https://avatars0.githubusercontent.com/u/34900092?v=4","gravatar_id":"","url":"https://api.github.com/users/temp1011","html_url":"https://github.com/temp1011","followers_url":"https://api.github.com/users/temp1011/followers","following_url":"https://api.github.com/users/temp1011/following{/other_user}","gists_url":"https://api.github.com/users/temp1011/gists{/gist_id}","starred_url":"https://api.github.com/users/temp1011/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/temp1011/subscriptions","organizations_url":"https://api.github.com/users/temp1011/orgs","repos_url":"https://api.github.com/users/temp1011/repos","events_url":"https://api.github.com/users/temp1011/events{/privacy}","received_events_url":"https://api.github.com/users/temp1011/received_events","type":"User","site_admin":false},"created_at":"2018-02-05T15:39:37Z","updated_at":"2018-02-05T15:39:37Z","author_association":"NONE","body":"I'm not sure when 1.13 will come out so I could add some stuff to 1.12. This would probably have to be opt in on the mod side. I think this has all the features I think it should at this point but maybe there are more suggestions."}}
{"actor":{"display_login":"temp1011"}}