Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shipyard height isn't properly adjusted when changing a ships dimension #992

Open
1 task done
blockninja124 opened this issue Oct 25, 2024 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@blockninja124
Copy link

This issue occurs when only Valkyrien Skies and addons are installed and no other mods

  • I have tested this issue and it occurs when no other mods are installed

Minecraft Version

1.20.x

Mod Loader

Forge

Issue description

I'm currently writing an addon to VS, and came across this bug. Its really in the way of what I need to do, so any temporary solutions or permanent fixes are appreciated.

NOTE: I am using a newer, unreleased version of VS for access to the ServerShipWorldCore.updateDimension function to set the gravity of a dimension for VS ships. I am using VS 2.5.0-beta.1+a81efdff02 and VS core 1.1.0+cf7b0d3c5b as can be found at this github package: https://github.com/ValkyrienSkies/Valkyrien-Skies-2/packages/2020984

When using ServerShipWorldCore.teleportShip(ServerShip, ShipTeleportData), with a newDimension argument included in the ShipTeleportData, when the ship is moved its shipyard height isn't changed, even if the new dimension has a different world height. This can result in a situation where going from a dimension with a high world height (say, 1000) into a dimension with a low world height (say, 320), any blocks in the shipyard above the new height limit get cleared from the ship.

While this makes sense in a way, it really shouldn't be done before the fix I'm suggesting. Without my suggested fix, people may not realise why their ships made in one dimension are getting deleted when moved to another dimension, since most people probably don't build their ships low enough for any blocks to be below 320.

Intended behaviour should be that when a ship is moved to a new dimension, its shipyard height should be adjusted to the new dimension. So if it was made in a 1000 dimension, the blocks start off at 500. But then when it goes into a 320 dimension, instead of just clearing all blocks above 320, it should first move all blocks down so that blocks previously at 500 would now be at 320. This would greatly decrease the number of blocks cleared to fit into the new world height.

Issue reproduction

Increase the logical_height in the dimension_type for a dimension to above that of the overworld (320). Then, create a ship in the dimension with the greater height. When running the following code to move it to the overworld, all blocks in the shipyard that were above 320 will get cleared.

public static void TeleportShip(Ship ship, ServerLevel level) {
   // Prepare ship teleport info for later
   ShipTeleportData teleportData = new ShipTeleportDataImpl(
      new Vector3d(0, 100, 0), //New position
      ship.getTransform().getShipToWorldRotation(), //New rotation
      new Vector3d(),
      new Vector3d(),
      "minecraft:dimension:minecraft:overworld", //New dimension
      null //New scale
   );

   ServerShipWorldCore shipWorld = VSGameUtilsKt.getShipObjectWorld(level);

   ServerShip serverShip = (ServerShip) ship;
   shipWorld.teleportShip(serverShip, teleportData);
}

Logs

I don't think logs really help much here, but I can provide them if needed

@blockninja124 blockninja124 added the bug Something isn't working label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant