9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00

Fix useless packet check

This commit is contained in:
violetc
2022-08-15 08:04:36 +08:00
parent 71f6b7ea55
commit a5aaf4fbcc

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] Dont send useless entity packets
This patch is Powered by Purpur(https://github.com/PurpurMC/Purpur)
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 3b144c820531122eb37d41be06c182b5f5dc0724..a38114acf2d960e9dccf6a65ea8e39cfaef9f9ee 100644
index 3b144c820531122eb37d41be06c182b5f5dc0724..8eb4a062489b42b26076d5f3bdfbff368c1a199b 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -165,20 +165,29 @@ public class ServerEntity {
@@ -29,17 +29,14 @@ index 3b144c820531122eb37d41be06c182b5f5dc0724..a38114acf2d960e9dccf6a65ea8e39cf
+ } else {
+ packet1 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), (byte) i, (byte) j, this.entity.isOnGround());
}
} else {
- } else {
- packet1 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), (byte) i, (byte) j, this.entity.isOnGround());
+ this.wasOnGround = this.entity.isOnGround();
+ this.teleportDelay = 0;
+ packet1 = new ClientboundTeleportEntityPacket(this.entity);
}
- } else {
- this.wasOnGround = this.entity.isOnGround();
- this.teleportDelay = 0;
- packet1 = new ClientboundTeleportEntityPacket(this.entity);
+ // Leaves end - Better checking
} else {
this.wasOnGround = this.entity.isOnGround();
this.teleportDelay = 0;
packet1 = new ClientboundTeleportEntityPacket(this.entity);
}
+ // Leaves start - dont send useless entity packets
+ if (top.leavesmc.leaves.LeavesConfig.dontSendUselessEntityPackets && isUselessPacket(packet1)) {