Jump to content

[Solved] [1.16] How do I access all registered dimensions?


xBigEllx

Recommended Posts

Hello. I'm creating a mod that needs to access all registered Vanilla and mod dimension Ids.

 

In 1.15, it was possible to use the following:

for (DimensionType type : DimensionType.getAll()) {}

From there, I could access each of their dimension Ids. This seems to have changed in 1.16 and I can't figure out another way to access these dimensions.

 

I have tried accessing the "WORLD_TYPES" Forge registry by using the following:

for (ForgeWorldType type : ForgeRegistries.WORLD_TYPES.getValues()) {}

Unfortunately, it appears that this is also not the correct way to do it as there are no values in here.

 

Any help is appreciated.

Edited by xBigEllx
Link to comment
Share on other sites

DimensionTypes are dynamic since they are now data driven. This means that the associated data can only be accessed whenever a world is loaded. You can get access to this through MinecraftServer#registryAccess which gives you an instance of DynamicRegistries. There is a convenient method there for grabbing the registry called DynamicRegistries#dimensionTypes. Registry is an instance of Iterable on the value.

  • Like 1
Link to comment
Share on other sites

Thank you, that's just what I needed. However, I needed to change the names of some of the methods I was calling, as it seems they were obfuscated (I think that's the correct term).

 

Here is the code I used to access all dimension types:

for (DimensionType type : world.getServer().func_244267_aX().func_230520_a_()) {}

 

Here is the code I used to access all dimension Ids:

for (ResourceLocation location : world.getServer().func_244267_aX().func_230520_a_().keySet()) {}

 

Link to comment
Share on other sites

  • xBigEllx changed the title to [Solved] [1.16] How do I access all registered dimensions?
  • 2 years later...

// Get all dimensions

MinecraftServer server = ...
Registry<DimensionType> dimensionRegistry = server.registryAccess().registryOrThrow(Registries.DIMENSION_TYPE);

for (Map.Entry<ResourceKey<DimensionType>, DimensionType> dimensionEntry : dimensionRegistry.entrySet()) {
  ResourceKey<DimensionType> dimensionKey = dimensionEntry.getKey();
  DimensionType dimension = dimensionEntry.getValue();
}

Working on 1.20.1, if someone is still interested in the latest version of Minecraft.

Link to comment
Share on other sites

  

On 4/8/2021 at 6:03 AM, xBigEllx said:

Hello. I'm creating a mod that needs to access all registered Vanilla and mod dimension Ids.

 

In 1.15, it was possible to use the following:

for (DimensionType type : DimensionType.getAll()) {}

From there, I could access each of their dimension Ids. This seems to have changed in 1.16 and I can't figure out another way to access these dimensions.

 

I have tried accessing the "WORLD_TYPES" Forge registry by using the following:

for (ForgeWorldType type : ForgeRegistries.WORLD_TYPES.getValues()) {}

Unfortunately, it appears that this is also not the correct way to do it as there are no values in here.

 

Any help is appreciated.

 

 

In Minecraft 1.16+, use `DimensionManager` to access dimension IDs. Iterate through registered dimensions with `DimensionManager.getRegistry().keySet()`, enabling access to both vanilla and mod-added dimensions.

Edit: All good?

Edited by NinaKunze
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Exception in thread "main" java.lang.IllegalStateException: Could not find forge-1.19-41.1.0 in classpath at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.targets.CommonDevLaunchHandler.lambda$findJarOnClasspath$3(CommonDevLaunchHandler.java:90) at java.base/java.util.Optional.orElseThrow(Optional.java:403) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.targets.CommonDevLaunchHandler.findJarOnClasspath(CommonDevLaunchHandler.java:90) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.targets.ForgeUserdevLaunchHandler.processStreams(ForgeUserdevLaunchHandler.java:17) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.targets.CommonUserdevLaunchHandler.getMinecraftPaths(CommonUserdevLaunchHandler.java:32) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator.scanMods(MinecraftLocator.java:36) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer.discoverMods(ModDiscoverer.java:74) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.FMLLoader.beginModScan(FMLLoader.java:166) at MC-BOOTSTRAP/fmlloader@1.19.2-43.3.5/net.minecraftforge.fml.loading.FMLServiceProvider.beginScanning(FMLServiceProvider.java:86) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServiceDecorator.runScan(TransformationServiceDecorator.java:112) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServicesHandler.lambda$runScanningTransformationServices$8(TransformationServicesHandler.java:100) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServicesHandler.runScanningTransformationServices(TransformationServicesHandler.java:102) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:55) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.Launcher.run(Launcher.java:88) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.Launcher.main(Launcher.java:78) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) at cpw.mods.bootstraplauncher@1.1.2/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) I tried to make a minecraft mod but this error appears every time I click on the RunClient button and it won't start. Does anyone know how to get rid of this? (btw. I'm using version 1.19.2-43.3.5) https://pastebin.com/mQ3q4SwW
    • I've been following the discussion on automatically downloading mods from server to client, and I thought I'd share a helpful resource I stumbled upon. If you're looking for high-quality images for your mods or any other project, Depositphotos offers a fantastic collection for free download: free download images. In the spirit of collaboration, I believe that access to free, high-resolution visuals can greatly enhance the overall modding experience. Feel free to explore the link, and let me know what you think. Looking forward to hearing your thoughts and ideas on how we can collectively improve mod development efficiency.
    • Indian & Pakistani Girls (+971525382202{{ Dubai House Wife Indian Call 'Girl Deira Indian & Pakistani Girls (+971525382202{{ Dubai House Wife Indian Call 'Girl Deira Indian & Pakistani Girls (+971525382202{{ Dubai House Wife Indian Call 'Girl Deira Indian & Pakistani Girls (+971525382202{{ Dubai House Wife Indian Call 'Girl Deira Indian & Pakistani Girls (+971525382202{{ Dubai House Wife Indian Call 'Girl Deira Indian & Pakistani Girls (+971525382202{{ Dubai House Wife Indian Call 'Girl Deira
    • full-service 0506530048 pakistani call 'girls in deira by dubai full-service 0506530048 pakistani call 'girls in deira by dubai full-service 0506530048 pakistani call 'girls in deira by dubai full-service 0506530048 pakistani call 'girls in deira by dubai full-service 0506530048 pakistani call 'girls in deira by dubai full-service 0506530048 pakistani call 'girls in deira by dubai
    • Tempting +971525373611 Pakistani E'scorts in Deira Dubai by Escorts Near my Place Tempting +971525373611 Pakistani E'scorts in Deira Dubai by Escorts Near my Place Tempting +971525373611 Pakistani E'scorts in Deira Dubai by Escorts Near my Place Tempting +971525373611 Pakistani E'scorts in Deira Dubai by Escorts Near my Place Tempting +971525373611 Pakistani E'scorts in Deira Dubai by Escorts Near my Place Tempting +971525373611 Pakistani E'scorts in Deira Dubai by Escorts Near my Place Tempting +971525373611 Pakistani E'scorts in Deira Dubai by Escorts Near my Place
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.