Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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 :)

    /**
     * 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.

  • Author

Hey just wanted to find out is there a way to stop it acting as if I pressed it twice cause even when I debug it with saying a string of text on right click it acts as if I press it twice although I press it once

That is because the right click is called both client and server, you you need to check world.isRemote to make sure you are on the server

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.