Improvements to teleport with passenger vehicle

This commit is contained in:
Zach Brown 2014-11-30 22:35:33 -06:00
parent c5d9810268
commit 1610f6d153

View File

@ -47,10 +47,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// If this player is riding another entity, we must dismount before teleporting.
entity.mount(null);
}
// If this player is riding another entity, we must dismount before teleporting.
- entity.mount(null);
+ // PaperSpigot start
+ entity.mount(null); // Comment out when fully working, until then leave this
+
+ Entity vehicle = entity.vehicle;
+ Entity passenger = entity.passenger;
+ if (vehicle != null) {
@ -66,13 +69,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ passenger.teleportTo(location, false);
+ passenger = passenger.getBukkitEntity().getHandle();
+ entity.passenger = passenger;
+ entity.vehicle = entity;
+ passenger.vehicle = entity;
+ }
+ // PaperSpigot end
+
// Update the From Location
from = event.getFrom();
// Grab the new To Location dependent on whether the event was cancelled.
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} else {
server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true);