Jump to content

[Solved] [1.16.5] Teleporting a player in the same Dimension using entityInside()


Recommended Posts

Posted (edited)

I have tried in vain to teleport a player within the same Dimension when they collide with a block with no collision. In creative mode, it works flawlessly, but in singleplayer I keep getting this error: 

[01:50:38] [Server thread/WARN] [minecraft/ServerPlayNetHandler]: TheCosmicNebula_ moved wrongly!

I have tried many methods, from many classes that teleport. I can use

ServerPlayerEntity.changeDimension()

However it causes massive lag because it is repeating the same code with all of the blocks.

 

Any help would be appreciated, i'm pulling my hair out!

Edited by Zeher_Monkey
Issue was Solved.
Posted

Here is where I call the teleport:

TileEntityPortal

  Reveal hidden contents

 

Here is my ITeleporter:

  Reveal hidden contents

 

CosmosTeleportCore

  Reveal hidden contents

 

As you can see, I have tried many variations on 

ServerPlayerEntity.teleport()

 

And I cannot just pull the 

ServerPlayerEntity.changeDimension()

method because it uses variables that are private.

Posted
  On 11/24/2021 at 12:34 PM, diesieben07 said:

When teleporting within the same dimension no ITeleporter is necessary. Simply call ServerPlayerNetHandler#teleport with the target coordinates (this is what /teleport does).

When teleporting across dimensions you can use ServerPlayerNetHandler#teleportTo to just do a direct teleport, without any dimension change effects. To have those you need to call ServerPlayerEntity#changeDimension with a custom teleporter. There is no reason to copy any of this code.

Expand  

 

I have tried this:

playerIn.connection.teleport(targetPos.getX(), targetPos.getY(), targetPos.getZ(), yaw, pitch);

And I am still getting the same error:

[12:42:47] [Server thread/WARN] [minecraft/ServerPlayNetHandler]: TheCosmicNebula_ moved wrongly!

 

Posted
  On 11/24/2021 at 12:45 PM, diesieben07 said:

Show that code, specifically where exactly you are calling it.

Expand  

 

  Reveal hidden contents

 

Posted
  On 11/24/2021 at 12:48 PM, diesieben07 said:

Are you sure you are only calling that once and not repeatedly every tick for the same entity?

Expand  

 

I'm using vanilla code to create the Portal Blocks, so when the player is trying to enter the Portal it could be calling the code multiple times, but it works in Creative mode and when travelling across dimensions. Just not the same dimension in survival mode.

 

Here is where I pass the method to my TileEntity:

BlockPortal:

  Reveal hidden contents
  • Zeher_Monkey changed the title to [Solved] [1.16.5] Teleporting a player in the same Dimension using entityInside()

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.