Jump to content

teleportation


NEG2013

Recommended Posts

well I'm trying to create and item that gets the players coordinates when right clicked at first and then teleport then to those cords whenever right clicked after that here is  my code.

 

 

public void func_meta(ItemStack itemstack, int a)

    {

        itemstack.setItemDamage(a);

    }

   

    public static int func_return(int a)

    {

        return a;

    }

   

    public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player, int x, int y, int z)

    {

    int i1 = itemstack.getItemDamage();

          int j1 = func_return(i1);

         

           

         

          if(j1 == 0){

        itemstack.setItemDamage(1);

          player.getPlayerCoordinates().posX =  x;

          player.getPlayerCoordinates().posY =  y;

          player.getPlayerCoordinates().posZ =  z;

       

          return itemstack;

         

      }   

   

   

   

    if(j1 == 1){

   

   

        if (player.capabilities.isCreativeMode)

        {

            return itemstack;

        }

        else

        {

          // --itemstack.stackSize;

        if (!world.isRemote)

            {

             

        player.setPosition(x, y, z);

        return itemstack;

            }

           

 

            return itemstack;

        }    

Link to comment
Share on other sites

When you post code use the [.code] and [./code] modifiers without the periods and if it's a longer piece of code use a spoiler around that or pastebin.com. Then it will appear as such:

 

 

//----------------------
//      Coding!!!
//----------------------

 

 

Just a suggestion not meaning any offense.

Link to comment
Share on other sites

This does not get the player's coordinates.  This moves the player to a location (x,y,z)

                player.getPlayerCoordinates().posX =  x;
                player.getPlayerCoordinates().posY =  y;
                player.getPlayerCoordinates().posZ =  z;

This also moves the player

player.setPosition(x, y, z);

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

When you post code use the [.code] and [./code] modifiers without the https://skinnyexpress.com/phenq-review phenq periods and if it's a longer piece of code use a spoiler around that or pastebin.com. Then it will appear as such:

 

 

//----------------------
//      Coding!!!
//----------------------

 

 

Just a suggestion not meaning any offense.

 

Have you figured out how to do this NEG2013? I want to be able to easily teleport to players locations too on my server.

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.