Paper/patches/server/0024-Add-configurable-despawn-distances-for-living-entiti.patch
2023-09-22 13:13:57 -07:00

28 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Suddenly <suddenly@suddenly.coffee>
Date: Tue, 1 Mar 2016 13:51:54 -0600
Subject: [PATCH] Add configurable despawn distances for living entities
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index ffd8b35b606452ce5d189f2761aa76eb9b56ccd6..dc9162e8fa4b5649a631d3869be7cd9776f5c7b7 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -852,14 +852,14 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (entityhuman != null) {
double d0 = entityhuman.distanceToSqr((Entity) this);
- int i = this.getType().getCategory().getDespawnDistance();
+ int i = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - custom despawn distances
int j = i * i;
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
this.discard();
}
- int k = this.getType().getCategory().getNoDespawnDistance();
+ int k = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - custom despawn distances
int l = k * k;
if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) {