Fixes a minecart rotation bug caused by changing the rotation of the deleted vehicle instead of the new one
This commit is contained in:
parent
051a6b8f98
commit
ba3304a716
@ -499,6 +499,7 @@ public class Portal {
|
|||||||
exit = stargatePortalEvent.getExit();
|
exit = stargatePortalEvent.getExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Load chunks to make sure not to teleport to the void
|
||||||
loadChunks();
|
loadChunks();
|
||||||
|
|
||||||
//If no event is passed in, assume it's a teleport, and act as such
|
//If no event is passed in, assume it's a teleport, and act as such
|
||||||
@ -546,13 +547,15 @@ public class Portal {
|
|||||||
|
|
||||||
List<Entity> passengers = vehicle.getPassengers();
|
List<Entity> passengers = vehicle.getPassengers();
|
||||||
|
|
||||||
|
//Load chunks to make sure not to teleport to the void
|
||||||
loadChunks();
|
loadChunks();
|
||||||
|
|
||||||
if (!passengers.isEmpty()) {
|
if (!passengers.isEmpty()) {
|
||||||
if (vehicle instanceof RideableMinecart || vehicle instanceof Boat) {
|
if (vehicle instanceof RideableMinecart || vehicle instanceof Boat) {
|
||||||
World vehicleWorld = exit.getWorld();
|
World vehicleWorld = exit.getWorld();
|
||||||
if (vehicleWorld == null) {
|
if (vehicleWorld == null) {
|
||||||
Stargate.logger.warning(Stargate.getString("prefix") + "Unable to get the world to teleport the vehicle to");
|
Stargate.logger.warning(Stargate.getString("prefix") +
|
||||||
|
"Unable to get the world to teleport the vehicle to");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
putPassengersInNewVehicle(vehicle, passengers, vehicleWorld, exit, newVelocity);
|
putPassengersInNewVehicle(vehicle, passengers, vehicleWorld, exit, newVelocity);
|
||||||
@ -593,7 +596,7 @@ public class Portal {
|
|||||||
Vehicle newVehicle = vehicleWorld.spawn(exit, vehicle.getClass());
|
Vehicle newVehicle = vehicleWorld.spawn(exit, vehicle.getClass());
|
||||||
vehicle.eject();
|
vehicle.eject();
|
||||||
vehicle.remove();
|
vehicle.remove();
|
||||||
vehicle.setRotation(exit.getYaw(), exit.getPitch());
|
newVehicle.setRotation(exit.getYaw(), exit.getPitch());
|
||||||
handleVehiclePassengers(passengers, newVehicle);
|
handleVehiclePassengers(passengers, newVehicle);
|
||||||
Stargate.server.getScheduler().scheduleSyncDelayedTask(Stargate.stargate,
|
Stargate.server.getScheduler().scheduleSyncDelayedTask(Stargate.stargate,
|
||||||
() -> newVehicle.setVelocity(newVelocity), 1);
|
() -> newVehicle.setVelocity(newVelocity), 1);
|
||||||
@ -643,7 +646,8 @@ public class Portal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Stargate.logger.log(Level.WARNING, Stargate.getString("prefix") + "Missing destination point in .gate file " + gate.getFilename());
|
Stargate.logger.log(Level.WARNING, Stargate.getString("prefix") +
|
||||||
|
"Missing destination point in .gate file " + gate.getFilename());
|
||||||
}
|
}
|
||||||
|
|
||||||
return adjustExitLocation(traveller, exitLocation);
|
return adjustExitLocation(traveller, exitLocation);
|
||||||
@ -734,13 +738,15 @@ public class Portal {
|
|||||||
Stargate.debug("adjustExitLocation", "Added half a block to get above a slab");
|
Stargate.debug("adjustExitLocation", "Added half a block to get above a slab");
|
||||||
exitLocation.add(0, 0.5, 0);
|
exitLocation.add(0, 0.5, 0);
|
||||||
} else if (blockData.getMaterial() == Material.WATER) {
|
} else if (blockData.getMaterial() == Material.WATER) {
|
||||||
|
//If there's water outside, go one up to allow for boat teleportation
|
||||||
exitLocation.add(0, 1, 0);
|
exitLocation.add(0, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
exitLocation.setPitch(traveller.getPitch());
|
exitLocation.setPitch(traveller.getPitch());
|
||||||
return exitLocation;
|
return exitLocation;
|
||||||
} else {
|
} else {
|
||||||
Stargate.logger.log(Level.WARNING, Stargate.getString("prefix") + "Unable to generate exit location");
|
Stargate.logger.log(Level.WARNING, Stargate.getString("prefix") +
|
||||||
|
"Unable to generate exit location");
|
||||||
}
|
}
|
||||||
return traveller;
|
return traveller;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user