paulevsGitch / EdenRing

MIT License
20 stars 17 forks source link

[bug] the exp bar will be clear when teleport through the portal #25

Closed Slarper closed 2 years ago

Slarper commented 2 years ago

Version: the dev environment of latest version.

Slarper commented 2 years ago

Description: When you go through the beautiful portal of copper block and amethyst, and teleport to the eden ring world ( or back to overworld), your exp bar will be clear , and will restore when you restart the game.

Slarper commented 2 years ago

Reason: The teleport code in method serverTick in class paulevs.edenring.blocks.entities.EdenPortalBlockEntity cause this bug. When we teleport a player to another dimension, we use the vanilla api like this:

player.teleportTo(
                            destination,
                            exit.getX() + 0.5,
                            exit.getY(),
                            exit.getZ() + 0.5,
                            player.getYRot(),
                            player.getXRot()
                        );
Slarper commented 2 years ago

but the method teleportTo has some vanilla bugs and is exactly the reason of this issue. So I suggest to use fabric api

                        FabricDimensions.teleport(
                                player,
                                destination,
                                new PortalInfo(
                                        new Vec3(
                                                exit.getX() + 0.5,
                                                exit.getY(),
                                                exit.getZ()+0.5
                                                ),
                                        new Vec3(0,0,0),
                                        player.getYRot(),
                                        player.getXRot()
                                )
                        );

to fix this bug.

Slarper commented 2 years ago

I had create the pull request.

paulevsGitch commented 2 years ago

I think this was added in 0.5.1, but I forgot to close this