Jump to content

[Help] How to go to a new dimension by right clicking an item?


themineprojecthc

Recommended Posts

Hello I've recently ported my mod to forge and have started adding dimensions to it and I was wondering is it possible to  take the player to the new dimension when the player right clicks an item?

 

If this isn't possible then would anyone have any idea how Mystcraft did it with the books and clicking the box inside the gui?

 

Thanks for any help as this is a big part of my mod :)

Link to comment
Share on other sites

    /**
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
     */
    public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3)
    {
        if (var3 instanceof EntityPlayerMP)
        {
            WorldServer worldserver = (WorldServer)var2;
            EntityPlayerMP var4 = (EntityPlayerMP)var3;

            if (var3.ridingEntity == null && var3.riddenByEntity == null && var3 instanceof EntityPlayer && var4.dimension != 0)
            {
                var4.mcServer.getConfigurationManager().transferPlayerToDimension(var4, 0, new CustomTeleporter(worldserver));
            }
        }

        return var1;
    }

 

That might help you.

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.

Announcements



×
×
  • Create New...

Important Information

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