mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
Cleanup dead code from Paper
This commit is contained in:
@@ -0,0 +1,174 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 13 Jul 2025 20:03:51 +0300
|
||||
Subject: [PATCH] Cleanup dead code from Paper
|
||||
|
||||
|
||||
diff --git a/net/minecraft/network/Connection.java b/net/minecraft/network/Connection.java
|
||||
index 8bb7d9f2bce06880164f0ae36e1674e9dc380809..04d47ef66f17daf3dfc9223c9f382e058d09a10b 100644
|
||||
--- a/net/minecraft/network/Connection.java
|
||||
+++ b/net/minecraft/network/Connection.java
|
||||
@@ -609,13 +609,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
if (!(this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginPacketListener)
|
||||
|| loginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.VERIFYING
|
||||
|| Connection.joinAttemptsThisTick++ < MAX_PER_TICK) {
|
||||
- // Paper start - detailed watchdog information
|
||||
- net.minecraft.network.protocol.PacketUtils.packetProcessing.push(this.packetListener);
|
||||
- try {
|
||||
- tickablePacketListener.tick();
|
||||
- } finally {
|
||||
- net.minecraft.network.protocol.PacketUtils.packetProcessing.pop();
|
||||
- } // Paper end - detailed watchdog information
|
||||
+ tickablePacketListener.tick();
|
||||
} // Paper end - Buffer joins to world
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/network/protocol/PacketUtils.java b/net/minecraft/network/protocol/PacketUtils.java
|
||||
index aa4dd7517e8be167aef1eaf7aa907e3ce7cc0e62..e3d3b062e273fee4a9d3ba3cadc212787096dc54 100644
|
||||
--- a/net/minecraft/network/protocol/PacketUtils.java
|
||||
+++ b/net/minecraft/network/protocol/PacketUtils.java
|
||||
@@ -21,8 +21,6 @@ public class PacketUtils {
|
||||
public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T processor, BlockableEventLoop<?> executor) throws RunningOnDifferentThreadException {
|
||||
if (!executor.isSameThread()) {
|
||||
executor.executeIfPossible(() -> {
|
||||
- packetProcessing.push(processor); // Paper - detailed watchdog information
|
||||
- try { // Paper - detailed watchdog information
|
||||
if (processor instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // Paper - Don't handle sync packets for kicked players
|
||||
if (processor.shouldHandleMessage(packet)) {
|
||||
try {
|
||||
@@ -41,12 +39,6 @@ public class PacketUtils {
|
||||
} else {
|
||||
LOGGER.debug("Ignoring packet due to disconnection: {}", packet);
|
||||
}
|
||||
- // Paper start - detailed watchdog information
|
||||
- } finally {
|
||||
- totalMainThreadPacketsProcessed.getAndIncrement();
|
||||
- packetProcessing.pop();
|
||||
- }
|
||||
- // Paper end - detailed watchdog information
|
||||
});
|
||||
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
|
||||
}
|
||||
@@ -73,22 +65,4 @@ public class PacketUtils {
|
||||
|
||||
packetListener.fillCrashReport(crashReport);
|
||||
}
|
||||
-
|
||||
- // Paper start - detailed watchdog information
|
||||
- public static final java.util.concurrent.ConcurrentLinkedDeque<PacketListener> packetProcessing = new java.util.concurrent.ConcurrentLinkedDeque<>();
|
||||
- static final java.util.concurrent.atomic.AtomicLong totalMainThreadPacketsProcessed = new java.util.concurrent.atomic.AtomicLong();
|
||||
-
|
||||
- public static long getTotalProcessedPackets() {
|
||||
- return totalMainThreadPacketsProcessed.get();
|
||||
- }
|
||||
-
|
||||
- public static java.util.List<PacketListener> getCurrentPacketProcessors() {
|
||||
- java.util.List<PacketListener> listeners = new java.util.ArrayList<>(4);
|
||||
- for (PacketListener listener : packetProcessing) {
|
||||
- listeners.add(listener);
|
||||
- }
|
||||
-
|
||||
- return listeners;
|
||||
- }
|
||||
- // Paper end - detailed watchdog information
|
||||
}
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index d4841095157106c3c69501ac2cd09511f62cfea0..e68d857b59c3e3320221dd995b29cf7aa09aafc2 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1349,13 +1349,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
// Paper end - log detailed entity tick information
|
||||
|
||||
public void tickNonPassenger(Entity entity) {
|
||||
- // Paper start - log detailed entity tick information
|
||||
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot tick an entity off-main");
|
||||
- try {
|
||||
- if (currentlyTickingEntity.get() == null) {
|
||||
- currentlyTickingEntity.lazySet(entity);
|
||||
- }
|
||||
- // Paper end - log detailed entity tick information
|
||||
entity.setOldPosAndRot();
|
||||
entity.tickCount++;
|
||||
entity.totalEntityAge++; // Paper - age-like counter for all entities
|
||||
@@ -1368,13 +1362,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
for (Entity entity1 : entity.getPassengers()) {
|
||||
this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2
|
||||
}
|
||||
- // Paper start - log detailed entity tick information
|
||||
- } finally {
|
||||
- if (currentlyTickingEntity.get() == entity) {
|
||||
- currentlyTickingEntity.lazySet(null);
|
||||
- }
|
||||
- }
|
||||
- // Paper end - log detailed entity tick information
|
||||
}
|
||||
|
||||
private void tickPassenger(Entity ridingEntity, Entity passengerEntity, final boolean isActive) { // Paper - EAR 2
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index c1c8e235b9c096cd36c3e83b0831af7cb722cad2..7e6e5d5962de14d064321ed7e4f5254046c15d0b 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -1111,29 +1111,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return this.onGround;
|
||||
}
|
||||
|
||||
- // Paper start - detailed watchdog information
|
||||
- public final Object posLock = new Object(); // Paper - log detailed entity tick information
|
||||
-
|
||||
- @Nullable
|
||||
- private Vec3 moveVector;
|
||||
- private double moveStartX;
|
||||
- private double moveStartY;
|
||||
- private double moveStartZ;
|
||||
- // Paper end - detailed watchdog information
|
||||
-
|
||||
public void move(MoverType type, Vec3 movement) {
|
||||
if (!this.boundingBoxChanged && movement.equals(Vec3.ZERO)) return; // DivineMC - VMP: skip entity move if movement is zero
|
||||
final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity
|
||||
- // Paper start - detailed watchdog information
|
||||
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main");
|
||||
- synchronized (this.posLock) {
|
||||
- this.moveStartX = this.getX();
|
||||
- this.moveStartY = this.getY();
|
||||
- this.moveStartZ = this.getZ();
|
||||
- this.moveVector = movement;
|
||||
- }
|
||||
- try {
|
||||
- // Paper end - detailed watchdog information
|
||||
if (this.noPhysics) {
|
||||
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
|
||||
} else {
|
||||
@@ -1248,13 +1229,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor));
|
||||
}
|
||||
}
|
||||
- // Paper start - detailed watchdog information
|
||||
- } finally {
|
||||
- synchronized (this.posLock) { // Paper
|
||||
- this.moveVector = null;
|
||||
- } // Paper
|
||||
- }
|
||||
- // Paper end - detailed watchdog information
|
||||
}
|
||||
|
||||
private void applyMovementEmissionAndPlaySound(Entity.MovementEmission movementEmission, Vec3 movement, BlockPos pos, BlockState state) {
|
||||
@@ -4948,9 +4922,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public void setDeltaMovement(Vec3 deltaMovement) {
|
||||
- synchronized (this.posLock) { // Paper - detailed watchdog information
|
||||
this.deltaMovement = deltaMovement;
|
||||
- } // Paper - detailed watchdog information
|
||||
}
|
||||
|
||||
public void addDeltaMovement(Vec3 addend) {
|
||||
@@ -5048,9 +5020,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
// Paper end - Block invalid positions and bounding box
|
||||
if (this.position.x != x || this.position.y != y || this.position.z != z) {
|
||||
- synchronized (this.posLock) { // Paper - detailed watchdog information
|
||||
this.position = new Vec3(x, y, z);
|
||||
- } // Paper - detailed watchdog information
|
||||
int floor = Mth.floor(x);
|
||||
int floor1 = Mth.floor(y);
|
||||
int floor2 = Mth.floor(z);
|
||||
Reference in New Issue
Block a user