Posted December 16, 201212 yr 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
December 16, 201212 yr /** * 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.
December 16, 201212 yr Author Thanks and I would obviously change the custom teleporter to my teleportor class and would I change the 0 to my dimension id?
December 20, 201212 yr 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
December 20, 201212 yr 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.