Jump to content

Recommended Posts

Posted

I recently started working  on a new dimension with forge  for my mod. I registered my dimension and my WorldProvider with DimensionManager and I wonder how i can get to this dimension now. I tried this:

 

////////////////////////////////////////////////

  public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)

    {

    EntityPlayerMP entityplayer=(EntityPlayerMP)par5Entity;

    MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension(entityplayer, 11); //  11=id of my dimension

 

    }

///////////////////////////////////////

But  you obviously cant  cast EntityClientPlayerMP to EntityPlayerMP , and I cant figure out how I can get the player to the dimension on a differrent way  :( . (Note: my mod isnt smp yet). It would be great if someone can tell me how I can solve  the problem , because Im not a very good coder and (as said before)I dont now any other way to get to my dimension.( I am using forge 4.2.5.303)

 

Thank you in advance  :)

 

 

PS:

Do I really have to unregister the Dimensions 0,-1 and 1 to get the DimensionManager to work?

 

 

I solved it by doing this:

 

  public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)

    {

    if (par5Entity instanceof EntityPlayerMP) {

    EntityPlayerMP playerMP = (EntityPlayerMP)par5Entity;

    playerMP.mcServer.getConfigurationManager().transferPlayerToDimension(playerMP, 11);

    }

 

    }

 

:D

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.

Announcements



×
×
  • Create New...

Important Information

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