I am currently registering my dimensions upon item use on a teleporter block. Here is how I'm checking if they are registered, and if not then register them:
tile = (TileEntityTeleporter)world.getTileEntity(pos);
The print statement shows false before going into the !world.isRemote if statement. Then, it creates the dimension that it found not registered and then later teleports the player to that dimension. The problem is, when I relaunch the game it does not work. The print statement prints false again, and the game creates a new dimension which overwrites anything you did inside the dimension.
First troubleshooting, I removed the check if it was registered and didn't re-register the dimension (The dimensions are being dynamically created from an item). This showed the classic error of: "Could not get provider type for dimension #, does not exist"
So what I've gathered is the server or the client or both are not loading registered dimensions when I restart Minecraft. I'm not sure exactly why and am hoping someone can point me in the right direction.
EDIT* I also have checked the save file, and the folders for the dimensions are in fact there. So it is just not being loaded up on launch. I haven't been able to test on world restart because I haven't created a portal back to the overworld (relaunching creates a new player id, thus respawning me in overworld anyways). because I am in the process of creating the teleporter and ran into this bug first.
That fixed the issue, however, it created a new one or allowed a new one to happen.
When I create a new world, it creates folders for all of the dimensions that were in a previous world as well as the new folder for the new dimension in the current world. I have a feeling they are being registered with the game but never unregistered because of the TODO comment from the forge team inside DimensionType. The TODO line kinda makes me think this just happens with dimensions in general..
public static DimensionType register(String name, String suffix, int id, Class<? extends WorldProvider> provider, boolean keepLoaded)
String enum_name = name.replace(" ", "_").toLowerCase();
DimensionType ret = net.minecraftforge.common.util.EnumHelper.addEnum(DimensionType.class, enum_name, ENUM_ARGS,
id, name, suffix, provider);
//TODO: Unregister? There is no way to really delete a enum value...