diff options
Diffstat (limited to 'patches/server/0717-More-Teleport-API.patch')
-rw-r--r-- | patches/server/0717-More-Teleport-API.patch | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/patches/server/0717-More-Teleport-API.patch b/patches/server/0717-More-Teleport-API.patch index 95e3046bb2..2bbaf5b834 100644 --- a/patches/server/0717-More-Teleport-API.patch +++ b/patches/server/0717-More-Teleport-API.patch @@ -112,10 +112,10 @@ index 4e6afa243d6108cb946a8a7cf96c4036a3c2ac0c..43786eacc72cdf3bb209d3dfb1808ea9 private final org.bukkit.entity.Entity.Spigot spigot = new org.bukkit.entity.Entity.Spigot() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 0bb2a75b2dd3d6d5d7815d3f4b1d8b11b002db62..d2029d88a4d9b060e199431ae092ce87ad5a09de 100644 +index 0bb2a75b2dd3d6d5d7815d3f4b1d8b11b002db62..2514fbae7c87a96c12e44d21ff7df1d2f3243387 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1303,13 +1303,101 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1303,13 +1303,102 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setRotation(float yaw, float pitch) { @@ -162,23 +162,24 @@ index 0bb2a75b2dd3d6d5d7815d3f4b1d8b11b002db62..d2029d88a4d9b060e199431ae092ce87 + }; + } + -+ public static net.minecraft.world.entity.RelativeMovement toNmsRelativeFlag(io.papermc.paper.entity.TeleportFlag.Relative apiFlag) { ++ public static net.minecraft.world.entity.Relative toNmsRelativeFlag(io.papermc.paper.entity.TeleportFlag.Relative apiFlag) { + return switch (apiFlag) { -+ case X -> net.minecraft.world.entity.RelativeMovement.X; -+ case Y -> net.minecraft.world.entity.RelativeMovement.Y; -+ case Z -> net.minecraft.world.entity.RelativeMovement.Z; -+ case PITCH -> net.minecraft.world.entity.RelativeMovement.X_ROT; -+ case YAW -> net.minecraft.world.entity.RelativeMovement.Y_ROT; ++ case X -> net.minecraft.world.entity.Relative.X; ++ case Y -> net.minecraft.world.entity.Relative.Y; ++ case Z -> net.minecraft.world.entity.Relative.Z; ++ case PITCH -> net.minecraft.world.entity.Relative.X_ROT; ++ case YAW -> net.minecraft.world.entity.Relative.Y_ROT; + }; + } + -+ public static io.papermc.paper.entity.TeleportFlag.Relative toApiRelativeFlag(net.minecraft.world.entity.RelativeMovement nmsFlag) { ++ public static io.papermc.paper.entity.TeleportFlag.Relative toApiRelativeFlag(net.minecraft.world.entity.Relative nmsFlag) { + return switch (nmsFlag) { + case X -> io.papermc.paper.entity.TeleportFlag.Relative.X; + case Y -> io.papermc.paper.entity.TeleportFlag.Relative.Y; + case Z -> io.papermc.paper.entity.TeleportFlag.Relative.Z; + case X_ROT -> io.papermc.paper.entity.TeleportFlag.Relative.PITCH; + case Y_ROT -> io.papermc.paper.entity.TeleportFlag.Relative.YAW; ++ default -> throw new RuntimeException("not yet"); // TODO figure out what to do with new flags + }; + } + @@ -218,7 +219,7 @@ index 0bb2a75b2dd3d6d5d7815d3f4b1d8b11b002db62..d2029d88a4d9b060e199431ae092ce87 location.checkFinite(); ServerPlayer entity = this.getHandle(); -@@ -1322,7 +1410,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1322,7 +1411,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return false; } @@ -227,7 +228,7 @@ index 0bb2a75b2dd3d6d5d7815d3f4b1d8b11b002db62..d2029d88a4d9b060e199431ae092ce87 return false; } -@@ -1331,7 +1419,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1331,7 +1420,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // To = Players new Location if Teleport is Successful Location to = location; // Create & Call the Teleport Event. @@ -236,7 +237,7 @@ index 0bb2a75b2dd3d6d5d7815d3f4b1d8b11b002db62..d2029d88a4d9b060e199431ae092ce87 this.server.getPluginManager().callEvent(event); // Return False to inform the Plugin that the Teleport was unsuccessful/cancelled. -@@ -1340,7 +1428,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1340,7 +1429,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } // If this player is riding another entity, we must dismount before teleporting. @@ -245,7 +246,7 @@ index 0bb2a75b2dd3d6d5d7815d3f4b1d8b11b002db62..d2029d88a4d9b060e199431ae092ce87 // SPIGOT-5509: Wakeup, similar to riding if (this.isSleeping()) { -@@ -1356,13 +1444,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1356,13 +1445,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { ServerLevel toWorld = ((CraftWorld) to.getWorld()).getHandle(); // Close any foreign inventory @@ -258,7 +259,7 @@ index 0bb2a75b2dd3d6d5d7815d3f4b1d8b11b002db62..d2029d88a4d9b060e199431ae092ce87 if (fromWorld == toWorld) { - entity.connection.teleport(to); + // Paper start - Teleport API -+ final Set<net.minecraft.world.entity.RelativeMovement> nms = java.util.EnumSet.noneOf(net.minecraft.world.entity.RelativeMovement.class); ++ final Set<net.minecraft.world.entity.Relative> nms = java.util.EnumSet.noneOf(net.minecraft.world.entity.Relative.class); + for (final io.papermc.paper.entity.TeleportFlag.Relative bukkit : relativeArguments) { + nms.add(toNmsRelativeFlag(bukkit)); + } |