Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

get ModDimension as DimensionType


bibouche_
 Share

Recommended Posts

Hi, I am currently trying to make a block that teleports the player in my custom dimension, and I runned into an issue. Indeed, for my player.changeDimension(), I need a DimensionType, and with my DefferedRegistrer I can just get a ModDimension, so I wanted to know if there is a way to get it as a DimensionType, otherwise it's quiet annoying as I can't make it to work :/

Thanks :)

Link to comment
Share on other sites

It crahses my game as soon as it execute that line of code, it may be because I don't know what to put as "PacketBuffer data" 😅, have you got any piece of idea ?

Here is the line that make it crash :

player.changeDimension(DimensionManager.registerOrGetDimension(DimensionInit.ORES_DIM.getId(), DimensionInit.ORES_DIM.get(), null, true);

 

Link to comment
Share on other sites

You need to register the dimension during the event, like this:

@SubscribeEvent
public static void dimReg(RegisterDimensionsEvent event) {
  while (sky() == null);
}
public static DimensionType sky() {
  ModDimension sky = SKY_DIM.get();
  return DimensionManager.registerOrGetDimension(sky.getRegistryName(), sky, null, true);
}

 

Have you ever want the new operator to return a type that you didn't ask for? Well, now you can!

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.

Guest
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.