Improvements to teleport with passenger vehicle
This commit is contained in:
parent
718ed221b4
commit
4e29dfb788
1 changed files with 10 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
From d5d998345385422fa5f96941068f849fbaa69558 Mon Sep 17 00:00:00 2001
|
From 26e2ea6f7f563be44fdc37919251dae52d6142c5 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Fri, 28 Nov 2014 00:24:18 -0600
|
Date: Fri, 28 Nov 2014 00:24:18 -0600
|
||||||
Subject: [PATCH] Teleport passenger/vehicle with player
|
Subject: [PATCH] Teleport passenger/vehicle with player
|
||||||
|
@ -43,14 +43,17 @@ index b0a90d7..1e5f057 100644
|
||||||
if (j == 1 && i == 1) {
|
if (j == 1 && i == 1) {
|
||||||
BlockPosition blockposition = this.world.r(worldserver1.getSpawn());
|
BlockPosition blockposition = this.world.r(worldserver1.getSpawn());
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
index 5864a51..2d4398e 100644
|
index d1f69dc..8a2d6e0 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
@@ -453,6 +453,26 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -451,7 +451,27 @@ 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
|
+ // PaperSpigot start
|
||||||
|
+ entity.mount(null); // Comment out when fully working, until then leave this
|
||||||
|
+
|
||||||
+ Entity vehicle = entity.vehicle;
|
+ Entity vehicle = entity.vehicle;
|
||||||
+ Entity passenger = entity.passenger;
|
+ Entity passenger = entity.passenger;
|
||||||
+ if (vehicle != null) {
|
+ if (vehicle != null) {
|
||||||
|
@ -66,13 +69,12 @@ index 5864a51..2d4398e 100644
|
||||||
+ passenger.teleportTo(location, false);
|
+ passenger.teleportTo(location, false);
|
||||||
+ passenger = passenger.getBukkitEntity().getHandle();
|
+ passenger = passenger.getBukkitEntity().getHandle();
|
||||||
+ entity.passenger = passenger;
|
+ entity.passenger = passenger;
|
||||||
+ entity.vehicle = entity;
|
+ passenger.vehicle = entity;
|
||||||
+ }
|
+ }
|
||||||
+ // PaperSpigot end
|
+ // PaperSpigot end
|
||||||
+
|
|
||||||
// Update the From Location
|
// Update the From Location
|
||||||
from = event.getFrom();
|
from = event.getFrom();
|
||||||
// Grab the new To Location dependent on whether the event was cancelled.
|
|
||||||
@@ -472,6 +492,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -472,6 +492,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
} else {
|
} else {
|
||||||
server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true);
|
server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true);
|
||||||
|
|
Loading…
Reference in a new issue