2015-09-02 03:14:41 +02:00
|
|
|
From cfda7e08ad109fcd5f7afaa1407d26993c6d3878 Mon Sep 17 00:00:00 2001
|
2015-05-31 08:52:17 +02:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Sun, 31 May 2015 01:44:02 -0500
|
|
|
|
Subject: [PATCH] Teleport passenger/vehicle with player
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2015-09-02 03:14:41 +02:00
|
|
|
index 68126c4..d7b0dc6 100644
|
2015-05-31 08:52:17 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
@@ -41,6 +41,15 @@ public abstract class Entity implements ICommandListener {
|
|
|
|
}
|
|
|
|
// CraftBukikt end
|
|
|
|
|
|
|
|
+ // PaperSpigot start - Teleport passenger/vehicle with player
|
|
|
|
+ public void retrack() {
|
|
|
|
+ final EntityTracker entityTracker = ((WorldServer) world).getTracker();
|
|
|
|
+ entityTracker.untrackEntity(this);
|
|
|
|
+ entityTracker.track(this);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
+
|
|
|
|
private static final AxisAlignedBB a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
|
|
|
|
private static int entityCount;
|
|
|
|
private int id;
|
2015-09-02 03:14:41 +02:00
|
|
|
@@ -1968,7 +1977,7 @@ public abstract class Entity implements ICommandListener {
|
2015-05-31 08:52:17 +02:00
|
|
|
// minecraftserver.getPlayerList().changeWorld(this, j, worldserver, worldserver1);
|
|
|
|
boolean before = worldserver1.chunkProviderServer.forceChunkLoad;
|
|
|
|
worldserver1.chunkProviderServer.forceChunkLoad = true;
|
|
|
|
- worldserver1.getMinecraftServer().getPlayerList().repositionEntity(this, exit, portal);
|
|
|
|
+ //worldserver1.getMinecraftServer().getPlayerList().repositionEntity(this, exit, portal); // PaperSpigot - Teleport passenger/vehicle with player, no... this entity is dead;
|
|
|
|
worldserver1.chunkProviderServer.forceChunkLoad = before;
|
|
|
|
// CraftBukkit end
|
|
|
|
this.world.methodProfiler.c("reloading");
|
2015-09-02 03:14:41 +02:00
|
|
|
@@ -1976,6 +1985,12 @@ public abstract class Entity implements ICommandListener {
|
2015-05-31 08:52:17 +02:00
|
|
|
|
|
|
|
if (entity != null) {
|
|
|
|
entity.n(this);
|
|
|
|
+
|
|
|
|
+ // PaperSpigot start - Teleport passenger/vehicle with player, move entity to new location
|
|
|
|
+ exit.getBlock(); // force load
|
|
|
|
+ entity.setLocation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch());
|
|
|
|
+ // PaperSpigot end
|
|
|
|
+
|
|
|
|
/* CraftBukkit start - We need to do this...
|
|
|
|
if (j == 1 && i == 1) {
|
|
|
|
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
|
2015-07-14 17:59:57 +02:00
|
|
|
index 506a03c..9612c79 100644
|
2015-05-31 08:52:17 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2015-07-14 17:59:57 +02:00
|
|
|
@@ -450,7 +450,27 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2015-05-31 08:52:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// If this player is riding another entity, we must dismount before teleporting.
|
|
|
|
- entity.mount(null);
|
|
|
|
+ // PaperSpigot start - Teleport passenger/vehicle with player
|
|
|
|
+ //entity.mount(null);
|
|
|
|
+
|
|
|
|
+ Entity vehicle = entity.vehicle;
|
|
|
|
+ Entity passenger = entity.passenger;
|
|
|
|
+ if (vehicle != null) {
|
|
|
|
+ vehicle.passenger = null;
|
|
|
|
+ vehicle.teleportTo(location, false);
|
|
|
|
+ vehicle = vehicle.getBukkitEntity().getHandle();
|
|
|
|
+ entity.vehicle = vehicle;
|
|
|
|
+ vehicle.passenger = entity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (passenger != null) {
|
|
|
|
+ passenger.vehicle = null;
|
|
|
|
+ passenger.teleportTo(location, false);
|
|
|
|
+ passenger = passenger.getBukkitEntity().getHandle();
|
|
|
|
+ entity.passenger = passenger;
|
|
|
|
+ passenger.vehicle = entity;
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
|
|
|
|
// Update the From Location
|
|
|
|
from = event.getFrom();
|
2015-07-14 17:59:57 +02:00
|
|
|
@@ -471,6 +491,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2015-05-31 08:52:17 +02:00
|
|
|
} else {
|
|
|
|
server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // PaperSpigot start - Teleport passenger/vehicle with player
|
|
|
|
+ if (vehicle != null) {
|
|
|
|
+ vehicle.retrack();
|
|
|
|
+ //entity.retrack();
|
|
|
|
+ }
|
|
|
|
+ if (passenger != null) {
|
|
|
|
+ passenger.retrack();
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
2015-09-02 03:14:41 +02:00
|
|
|
2.5.1
|
2015-05-31 08:52:17 +02:00
|
|
|
|