PaperMC/Spigot-Server-Patches/0124-SPIGOT-1903-Update-PlayerConnection-on-teleporting-p.patch
Aikar 3faaaab75d Optimize isInvalidYLocation, getType and getBlockData
Some pretty micro optimizations, but this is the hottest method in the server....

This will drastically reduce number of operations to perform getType

the 2 previous patches was squashed into 1
2016-06-22 22:43:02 -04:00

36 lines
1.5 KiB
Diff

From 89cc41ddcc93c188ecdc21c2c817a18541fee80f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 10 Apr 2016 22:36:10 -0400
Subject: [PATCH] SPIGOT-1903: Update PlayerConnection on teleporting players
Otherwise the player will trigger a "moved too quickly" next movement packet
and rubber band.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 3ed3732..eff088d 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -292,6 +292,7 @@ public abstract class Entity implements ICommandListener {
this.locX = d0;
this.locY = d1;
this.locZ = d2;
+ if (this instanceof EntityPlayer && ((EntityPlayer) this).playerConnection != null) ((EntityPlayer) this).playerConnection.captureCurrentPosition(); // Paper
float f = this.width / 2.0F;
float f1 = this.length;
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 2538cc5..390528c 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -204,7 +204,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
- private void d() {
+ public void captureCurrentPosition() { d(); } private void d() { // Paper // OBFHELPER
this.l = this.player.locX;
this.m = this.player.locY;
this.n = this.player.locZ;
--
2.9.0