mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 08:57:44 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: c8028d1c Fix data version check for ItemStack serialization (#3394) 9254a80a Fix race condition reintroduced in Prioritize class loader patch 6f196fe7 Add Raw Byte ItemStack Serialization df43f828 Allow server startup for those poor people running <1G Xmx 3c9b65ef Fix cases where no-tick < tick view distance 72f89a07 Workaround for Client Lag Spikes (MC-162253) 3f941c0c Add option for console having all permissions d2ae4658 Add permission for command blocks 9f8ae5cb Prioritise own classes where possible 74466412 Check portal restrictions when entering end gateways fc9cf84d Fix NPE when temp ip bans expire (#3373) 16bd420d Add missing mob goals for API (#3367) b5c4e2f6 Ensure no-tick view is not smaller than ticking VD 52564b1f Expand Pathfinding API with more options dde65481 Fix usage of vanilla goals 7797aebe Drop Leads from nether portals - Fixes #3226 511b6bc2 Reduce MutableInt and Vec3d allocations, use ArrayDeque 84673141 Optimize NibbleArray to use pooled buffers 897dd2c8 Foundational work for Future Memory usage improvements bb4002d8 Handle CraftPlayer#setSpectatorTarget better 4ae08959 Fix collision checks on spawning hanging entities and null on async chunk loads c2f8d1ef Protect Bedrock and End Portal/Frames from being destroyed 827cc632 Updated Upstream (Bukkit/CraftBukkit/Spigot) 92f680ed Fix Pathfinding and obscure glitchy buggy 0 tick farms 7a7c4292 Optimize Pathfinder - Remove Streams / Optimized collections fc917d16 Optimize Hoppers - Major performance improvement 14ad77c6 Fix PotionEffect API Ignoring Icon bug eb3ce8a2 Fix EntityRaider picking up items when they shouldn't be able 1ea9ada0 Add a TELEPORT ticket when changing dimensions 8e9459ea Fix missing flag pass for isUrgent 7befec44 Potential bed api (#3339) 27945a6b Optimize WorldBorder collision checks and air 55e17a85 Wait for Async Tasks during shutdown b5905256 Ensure Entity AABB's are never invalid a054aa6f Properly remove Entities from current chunk c894ddfd Fix teleporting onto a chunk line 57d6cc01 Send LOGIN protocol packets immediately - Fix disconnect during async prelogin cd93e54d Don't use our modified chunk checks for collision in world gen b4003ef1 Allow loading entities current chunk if needed to fix collision checks e5f64896 Add Urgent API for Async Chunks API and use it for Async Teleport ad8e59dc Ensure chunks loaded on respawn for suffocation check
87 lines
4.2 KiB
Diff
87 lines
4.2 KiB
Diff
From 46c6b61048ea662203af345382ace73735a9e179 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 5cc89c0cf..390cb8e76 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
@@ -169,6 +169,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) {
|
|
@@ -255,6 +256,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
|
|
|