mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 09:57:43 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: 840e72091 [CI-SKIP] [Auto] Rebuild Patches a33232d4a Add beacon activation and deactivation events (#5121) bc7ea673a Add internal channel initialization listeners (#5557) b28ad17ac Check for world change in MoveEvent API methods 3095c7592 [Auto] Updated Upstream (CraftBukkit) f56989c97 Add RespawnFlags to PlayerRespawnEvent (#5533) 7579c2667 Add more API to PlayerMoveEvent (#5553)
This commit is contained in:
@@ -1,78 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutEntity.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutEntity.java
|
||||
index 0eed10a6c4e0c7245f219d19ed1e2e5c94364db9..2b54a5f3347f788b751892105f888663bb349629 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutEntity.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutEntity.java
|
||||
@@ -9,11 +9,11 @@ import net.minecraft.world.phys.Vec3D;
|
||||
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/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
index 37e64e24ca3a90370cdf12e5ff9cd1fceede796b..f63ec5fa5a1cb34f4809a06a29d01603efb178f1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
@@ -208,6 +208,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) {
|
||||
@@ -301,6 +302,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/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index c5da5c0a6f68d4844ad8f59ad603611c909f8dfd..892f72c89af1b550305e2771f1ff5f470941faf8 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -179,6 +179,11 @@ public class PurpurConfig {
|
||||
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
|
||||
}
|
||||
|
||||
+ public static boolean dontSendUselessEntityPackets = false;
|
||||
+ private static void dontSendUselessEntityPackets() {
|
||||
+ dontSendUselessEntityPackets = getBoolean("settings.dont-send-useless-entity-packets", dontSendUselessEntityPackets);
|
||||
+ }
|
||||
+
|
||||
public static boolean loggerSuppressInitLegacyMaterialError = false;
|
||||
public static boolean loggerSuppressIgnoredAdvancementWarnings = false;
|
||||
private static void loggerSettings() {
|
||||
Reference in New Issue
Block a user