Jump to content

Using a item to change dimension


Recommended Posts

Hi,

I'm trying to create an item that generates random coordinates and when right-clicking a block with matching X and Z it teleports you to another dimension (for now I'm just using the nether as a proof of concept). Been trying to use .changeDimension method but it keeps crashing the game. Is it because I'm trying it on an item rather than an entity? 

Link to comment
Share on other sites

public static void sendEntityToLevel(ServerLevel otherDimensionLevel, LivingEntity entity, Vec3 location) {
        entity.teleportTo(otherDimensionLevel,
                location.x,
                location.y,
                location.z,
                new HashSet<>(),
                0,
                0
        );
}

This is what I'm using and it's worked fine

  • Like 1
Link to comment
Share on other sites

On 4/23/2024 at 9:44 PM, dee12452 said:
public static void sendEntityToLevel(ServerLevel otherDimensionLevel, LivingEntity entity, Vec3 location) {
        entity.teleportTo(otherDimensionLevel,
                location.x,
                location.y,
                location.z,
                new HashSet<>(),
                0,
                0
        );
}

This is what I'm using and it's worked fine

Thank you it worked!!

  • Like 1
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.



×
×
  • Create New...

Important Information

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