Jump to content

How to teleport mob stack with player sync?


nullsector76

Recommended Posts

So I wanted to know a proper way for teleporting a player and the rest of the passengers to a new location? Every time I tried getting the player to a new location he periodically just doesn't teleport with the rest of the stack. 
 

	public void teleport(Entity base,int x, int y, int z)
	{
		List<Entity> stack = Arrays.asList(base.getRecursivePassengers().toArray());
		stack.add(0,base);
		for(Entity e : stack)
		{
        		e.dismountRidingEntity();
			if(e instanceof EntityPlayerMP)
				((EntityPlayerMP)e).connection.setPlayerLocation(x, y, z, e.rotationYaw, e.rotationPitch);
			e.setLocationAndAngles(x, y, z, e.rotationYaw, e.rotationPitch);
		}
	}

 

Edited by nullsector76
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.