Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Disable sending Entity Movement Packets
Browse files Browse the repository at this point in the history
  • Loading branch information
404Setup committed Sep 5, 2024
1 parent 878767a commit 2a9a2a8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Wed, 25 Oct 2023 17:05:29 -0500
Subject: [PATCH] Slice: Disable sending Entity Movement Packets


diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index d855ac522f9e57640e348ad28bfed8c352cbdd18..204b2a14d64b98dc0937e0ea7d4add39839ec27a 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -161,7 +161,7 @@ public class ServerEntity {
boolean flag = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1;

if (flag) {
- this.broadcast.accept(new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte) i, (byte) j, this.entity.onGround()));
+ if (entity.sendMovementPackets) this.broadcast.accept(new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte) i, (byte) j, this.entity.onGround())); // Vine - Slice Disable sending Entity Movement Packets
this.yRotp = i;
this.xRotp = j;
}
@@ -196,14 +196,14 @@ public class ServerEntity {
if (!this.forceStateResync && !flag6 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.onGround()&& !(io.papermc.paper.configuration.GlobalConfiguration.get().collisions.sendFullPosForHardCollidingEntities && this.entity.hardCollides())) { // Paper - send full pos for hard colliding entities to prevent collision problems due to desync
if ((!flag2 || !flag3) && !(this.entity instanceof AbstractArrow)) {
if (flag2) {
- packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.onGround());
+ if (entity.sendMovementPackets) packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.onGround()); // Vine - Slice Disable sending Entity Movement Packets
flag4 = true;
} else if (flag3) {
- packet1 = new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte) i, (byte) j, this.entity.onGround());
+ if (entity.sendMovementPackets) packet1 = new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte) i, (byte) j, this.entity.onGround()); // Vine - Slice Disable sending Entity Movement Packets
flag5 = true;
}
} else {
- packet1 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), (byte) i, (byte) j, this.entity.onGround());
+ if (entity.sendMovementPackets) packet1 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), (byte) i, (byte) j, this.entity.onGround()); // Vine - Slice Disable sending Entity Movement Packets
flag4 = true;
flag5 = true;
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 620aa4e8004e75db38641ed7c69f6ef108e2a093..558001dba5793dc2ea6cdfdd7d57202949c4d8db 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -438,6 +438,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public final BlockPos.MutableBlockPos cachedBlockPos = new BlockPos.MutableBlockPos(); // Pufferfish - reduce entity allocations
private CompoundTag vineStorage = new CompoundTag(); // Vine - Vine data bundler
private CompoundTag leavesData = new CompoundTag(); // Leaves - Leaves ex data
+ public boolean sendMovementPackets = true; // Vine - Slice Disable sending Entity Movement Packets

public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector();

0 comments on commit 2a9a2a8

Please sign in to comment.