ship turns invisible and physics stop working when teleporting between dimensions
ShipTeleportData teleportData = new ShipTeleportDataImpl(new Vector3d(x, y, z), ship.getTransform().getShipToWorldRotation(), new Vector3d(), new Vector3d(), "minecraft:dimension:ourmod:dimension", null);
ServerShipWorldCore shipWorld = VSGameUtilsKt.getShipObjectWorld(level);
ServerShip serverShip = (ServerShip) ship;
shipWorld.teleportShip(serverShip, teleportData);```
Strangly enough, it only does this when we call the teleport in a certain way. In other places it works. So I’m less asking why it isn’t working (since clearly its not the teleporting thats at fault), but why this might happen
Have you checked if the teleported ship still has its blocks ?
Because, i remember i once did experiments in my mod with teleportation across dimensions, and i noticed that the ship gets teleported, but not the blocks on it.
This caused the ship to have zero mass and no collision box, and just fall trough the world, while spamming the logs with error messages.
It was on an older version of VS2, but maybe its still the same problem.
I did not yet look into it, but if the problem still exists, i planed to just create a new ship in the other dimension, copy the blocks, and delete the old ship.
Well, in theory thats what teleportShip should do, and it seems to work some of the time. But yeah I think probably your right in whats happening is that the blocks aren’t being copied over
Maybe the chunks on the origin-dimension get unloaded to early, and VS2 is not able to copy the blocks or somethine.
Because, i noticed an another weird bug.
I have conduits in my mod which, when the world gets loaded, also need to be loaded on the ships.
And i noticed, that sometimes (like in ~5% of the cases), the chunks of the ship get loaded delayed.
Which causes the code for loading the conduits to read void_air as blocks, and so, the conduits get not loaded on ships in this case.
Its just a guess, but it could be that the loading of ship-chunks is just a bit … random …
Then maybe its the other way around, maybe VS2 is unable to copy the blocks, because the chunks are not loaded yet on the target dimension ?
Wait, so use two different functions, and both give different results ?
Im currently not up to date with the current VS2 API, since i currently work on other parts of my mod.
What is the difference between the two functions (except the bug) ?
we move the ship when it reaches the “top of the world” and move it into space (works 100% of the time), and we move ships that have touched a planet into the planet (works 0% of the time)
and they both use a “move VS ship” static utility function thats made to also bring entities with the ship
Oh, you mean not two VS2 functions, but two functions you wrote that call the VS2 teleport functions.
Hm, what if you create the ship in space, and let it be teleported to the planet ?
Does it work then ?
May idea was, that it might not be the “direction” of the teleport, but that its a second teleport.
The main difference between the two functions is probably the fact that the “go to space” function just teleports instantly at a certain y level, but the “go to planet” gives the player a GUI when it thinks they’ve entered a planet, and then goes to a location once they have picked coordinates in the GUI
its probably we’ve messed something up really subtly and its borking the teleport
basically it just sets a value on the player, and the function running every tick detects any “selected coordinates” values on the player and then teleports the ship
and if it doesn’t find any “selected coordinates”, and they havent opened the gui, it instead jsut opens it for them
This conversation is on Discord · Reply there