mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
33 lines
1.7 KiB
Diff
33 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Fri, 6 Mar 2020 13:37:26 -0600
|
|
Subject: [PATCH] |FIX| Stop dead entities lagging the server
|
|
|
|
Skips heavy processing of chunks when a dead entity is ticked
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 3ba4408f172f22bc9a86c5fcc71e01119f85ca07..7417cfa1a64f7adbc8b4699eef05a2662846dce4 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -1768,6 +1768,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
|
this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F);
|
|
this.yRotO = this.getYRot();
|
|
this.xRotO = this.getXRot();
|
|
+ if (valid && !this.isRemoved()) level.getChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4); // CraftBukkit // Paper // Purpur
|
|
}
|
|
|
|
public void absMoveTo(double x, double y, double z) {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index 56c4319ba36b3bec71f5fc5548ec2022ac49331e..fce1b923f33bae53141b9cffda7808d031812a06 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -2898,7 +2898,7 @@ public abstract class LivingEntity extends Entity {
|
|
}
|
|
}
|
|
|
|
- this.aiStep();
|
|
+ if (!this.isRemoved()) this.aiStep(); // Purpur
|
|
double d0 = this.getX() - this.xo;
|
|
double d1 = this.getZ() - this.zo;
|
|
float f = (float) (d0 * d0 + d1 * d1);
|