2014-12-14 22:25:11 +00:00
|
|
|
From b8780a9816233ecf0d111d9ac45042bd32775eaf Mon Sep 17 00:00:00 2001
|
2014-11-28 22:30:20 +00:00
|
|
|
From: Aikar <aikar@aikar.co>
|
2014-11-28 01:17:45 +00:00
|
|
|
Date: Fri, 28 Nov 2014 00:24:18 -0600
|
2014-06-22 20:28:51 +00:00
|
|
|
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
|
2014-12-13 04:52:49 +00:00
|
|
|
index 2cca633..dcbc6b5 100644
|
2014-06-22 20:28:51 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2014-11-28 01:17:45 +00:00
|
|
|
@@ -40,6 +40,13 @@ public abstract class Entity implements ICommandListener {
|
2014-06-22 20:28:51 +00:00
|
|
|
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
|
|
|
|
}
|
2014-11-28 01:17:45 +00:00
|
|
|
// CraftBukikt end
|
|
|
|
+ // PaperSpigot start - Teleport passenger vehicle with player
|
2014-06-22 20:28:51 +00:00
|
|
|
+ public void retrack() {
|
|
|
|
+ final EntityTracker entityTracker = ((WorldServer) world).getTracker();
|
|
|
|
+ entityTracker.untrackEntity(this);
|
|
|
|
+ entityTracker.track(this);
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
|
2014-11-28 01:17:45 +00:00
|
|
|
private static final AxisAlignedBB a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
|
2014-06-22 20:28:51 +00:00
|
|
|
private static int entityCount;
|
2014-12-13 04:52:49 +00:00
|
|
|
@@ -1948,7 +1955,7 @@ public abstract class Entity implements ICommandListener {
|
2014-11-28 01:17:45 +00:00
|
|
|
// minecraftserver.getPlayerList().changeWorld(this, j, worldserver, worldserver1);
|
2014-06-22 20:28:51 +00:00
|
|
|
boolean before = worldserver1.chunkProviderServer.forceChunkLoad;
|
|
|
|
worldserver1.chunkProviderServer.forceChunkLoad = true;
|
|
|
|
- worldserver1.getMinecraftServer().getPlayerList().repositionEntity(this, exit, portal);
|
|
|
|
+ //worldserver1.getMinecraftServer().getPlayerList().repositionEntity(this, exit, portal); // PaperSpigot - no... this entity is dead
|
|
|
|
worldserver1.chunkProviderServer.forceChunkLoad = before;
|
|
|
|
// CraftBukkit end
|
|
|
|
this.world.methodProfiler.c("reloading");
|
2014-12-13 04:52:49 +00:00
|
|
|
@@ -1956,6 +1963,10 @@ public abstract class Entity implements ICommandListener {
|
2014-06-22 20:28:51 +00:00
|
|
|
|
|
|
|
if (entity != null) {
|
2014-11-28 01:17:45 +00:00
|
|
|
entity.n(this);
|
2014-06-22 20:28:51 +00:00
|
|
|
+ // PaperSpigot start - 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) {
|
2014-11-28 01:17:45 +00:00
|
|
|
BlockPosition blockposition = this.world.r(worldserver1.getSpawn());
|
2014-06-22 20:28:51 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2014-12-14 22:25:11 +00:00
|
|
|
index cb65795..5802707 100644
|
2014-06-22 20:28:51 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2014-12-14 22:25:11 +00:00
|
|
|
@@ -452,7 +452,27 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2014-12-01 04:35:33 +00:00
|
|
|
}
|
2014-06-22 20:28:51 +00:00
|
|
|
|
2014-12-01 04:35:33 +00:00
|
|
|
// If this player is riding another entity, we must dismount before teleporting.
|
|
|
|
- entity.mount(null);
|
2014-06-22 20:28:51 +00:00
|
|
|
+ // PaperSpigot start
|
2014-12-01 04:35:33 +00:00
|
|
|
+ entity.mount(null); // Comment out when fully working, until then leave this
|
|
|
|
+
|
2014-06-22 20:28:51 +00:00
|
|
|
+ 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;
|
2014-11-28 22:30:20 +00:00
|
|
|
+ vehicle.passenger = entity;
|
2014-06-22 20:28:51 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (passenger != null) {
|
|
|
|
+ passenger.vehicle = null;
|
|
|
|
+ passenger.teleportTo(location, false);
|
|
|
|
+ passenger = passenger.getBukkitEntity().getHandle();
|
|
|
|
+ entity.passenger = passenger;
|
2014-12-01 04:35:33 +00:00
|
|
|
+ passenger.vehicle = entity;
|
2014-06-22 20:28:51 +00:00
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
2014-12-01 04:35:33 +00:00
|
|
|
|
2014-06-22 20:28:51 +00:00
|
|
|
// Update the From Location
|
|
|
|
from = event.getFrom();
|
2014-12-14 22:25:11 +00:00
|
|
|
@@ -473,6 +493,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2014-06-22 20:28:51 +00:00
|
|
|
} else {
|
|
|
|
server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // PaperSpigot start
|
|
|
|
+ if (vehicle != null) {
|
|
|
|
+ vehicle.retrack();
|
|
|
|
+ }
|
2014-11-28 01:17:45 +00:00
|
|
|
+
|
2014-06-22 20:28:51 +00:00
|
|
|
+ if (passenger != null) {
|
|
|
|
+ passenger.retrack();
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
2014-11-28 01:17:45 +00:00
|
|
|
+
|
2014-06-22 20:28:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
|
|
|
1.9.1
|
|
|
|
|