mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: cc477e6a Force Plugins that use delayed tasks for init back in their place 597263fd Don't skip full player connection tick when dead e2c23475 Revert loaded entity list (#3304) fa87db6b Move another NetworkManager util into the inner class (#3303) 841c7d18 Make loaded entity list logic more consistent (#3301) 36f34f01 Updated Upstream (Bukkit/CraftBukkit) 5ca5f131 Rebuild all patches using the new rebuild pattern 1ccff6fa Add villager reputation API 5c0bfffa Speed up rebuilding patches and reduce diff f37381ea Optimize Network Manager to not need synchronization 8f9df2ed Anti Xray cleanup 878c66f1 No-Tick view distance implementation - Closes #3196 b87743c1 Stop copy-on-write operations for updating light data 97a9c972 Optimize isOutsideRange to use distance maps b4e629a2 Use distance map to optimise entity tracker / Misc Utils d80d1517 Optimize Entity Ticking to Loaded Chunks only 31d7686d Add item slot helper methods for various inventories (#3221) 75e1e3b3 Mob Goal API c7bc393a Revert "Don't flush packet queue off main thread" 1abd2bd2 Don't flush packet queue off main thread a4ed58a9 Clean up Direct Memory Region Files Fix for different Java versions 55e35019 Set cap on JDK per-thread native byte buffer cache b5101f4f Cleanup Region Files Direct Memory on close 81e655d7 Optimize Voxel Shape Merging ed9fc11f Sync position on teleportation 9c326fce Nanothing to see here 3e9fc24b Attempt to fix FastLogin maybe
87 lines
4.2 KiB
Diff
87 lines
4.2 KiB
Diff
From 8d6b566ea1808ad7ec747ea5224fc9f6c10cfabd Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Sat, 6 Jul 2019 17:00:04 -0500
|
|
Subject: [PATCH] Dont send useless entity packets
|
|
|
|
---
|
|
.../minecraft/server/EntityTrackerEntry.java | 17 +++++++++++++++++
|
|
.../minecraft/server/PacketPlayOutEntity.java | 10 +++++-----
|
|
src/main/java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
|
|
3 files changed, 27 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
index 6d3b34ead..8d4bcd34c 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
@@ -163,6 +163,7 @@ public class EntityTrackerEntry {
|
|
this.o = 0;
|
|
packet1 = new PacketPlayOutEntityTeleport(this.tracker);
|
|
}
|
|
+ if (net.pl3x.purpur.PurpurConfig.dontSendUselessEntityPackets && isUselessPacket(packet1)) packet1 = null; // Purpur
|
|
}
|
|
|
|
if ((this.e || this.tracker.impulse || this.tracker instanceof EntityLiving && ((EntityLiving) this.tracker).isGliding()) && this.tickCounter > 0) {
|
|
@@ -249,6 +250,22 @@ public class EntityTrackerEntry {
|
|
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ private boolean isUselessPacket(Packet<?> possibleUselessPacket) {
|
|
+ if (possibleUselessPacket instanceof PacketPlayOutEntity) {
|
|
+ PacketPlayOutEntity packet = (PacketPlayOutEntity) possibleUselessPacket;
|
|
+ if (possibleUselessPacket instanceof PacketPlayOutEntity.PacketPlayOutRelEntityMove) {
|
|
+ return packet.getX() == 0 && packet.getY() == 0 && packet.getZ() == 0;
|
|
+ } else if (possibleUselessPacket instanceof PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook) {
|
|
+ return packet.getX() == 0 && packet.getY() == 0 && packet.getZ() == 0 && packet.getYaw() == 0 && packet.getPitch() == 0;
|
|
+ } else if (possibleUselessPacket instanceof PacketPlayOutEntity.PacketPlayOutEntityLook) {
|
|
+ return packet.getYaw() == 0 && packet.getPitch() == 0;
|
|
+ }
|
|
+ }
|
|
+ return false;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public void a(EntityPlayer entityplayer) {
|
|
this.tracker.c(entityplayer);
|
|
entityplayer.c(this.tracker);
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
|
index e5da2b19c..5b1d95935 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
|
@@ -5,11 +5,11 @@ import java.io.IOException;
|
|
public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
|
|
|
|
protected int a;
|
|
- protected short b;
|
|
- protected short c;
|
|
- protected short d;
|
|
- protected byte e;
|
|
- protected byte f;
|
|
+ protected short b; public short getX() { return b; } // Purpur - OBFHELPER
|
|
+ protected short c; public short getY() { return c; } // Purpur - OBFHELPER
|
|
+ protected short d; public short getZ() { return d; } // Purpur - OBFHELPER
|
|
+ protected byte e; public byte getYaw() { return e; } // Purpur - OBFHELPER
|
|
+ protected byte f; public byte getPitch() { return f; } // Purpur - OBFHELPER
|
|
protected boolean g;
|
|
protected boolean h;
|
|
protected boolean i;
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
index d6f82d119..d3e1c8c40 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
@@ -139,6 +139,11 @@ public class PurpurConfig {
|
|
loggerSuppressIgnoredAdvancementWarnings = getBoolean("settings.logger.suppress-ignored-advancement-warnings", loggerSuppressIgnoredAdvancementWarnings);
|
|
}
|
|
|
|
+ public static boolean dontSendUselessEntityPackets = false;
|
|
+ private static void dontSendUselessEntityPackets() {
|
|
+ dontSendUselessEntityPackets = getBoolean("settings.dont-send-useless-entity-packets", dontSendUselessEntityPackets);
|
|
+ }
|
|
+
|
|
private static void timingsSettings() {
|
|
getString("settings.timings.url", "https://timings.pl3x.net");
|
|
}
|
|
--
|
|
2.24.0
|
|
|