2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Suddenly <suddenly@suddenly.coffee>
Date: Tue, 1 Mar 2016 13:51:54 -0600
2024-01-24 11:45:17 +01:00
Subject: [PATCH] Add configurable entity despawn distances
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
2024-01-24 11:45:17 +01:00
index 093c60df0948fd1a46aef86223ecc63bc9e8b440..7cbb74f4bc7b63af86b7b2c52783fb20c7739258 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
2023-12-05 20:39:26 +01:00
@@ -853,14 +853,14 @@ public abstract class Mob extends LivingEntity implements Targeting {
2021-11-09 08:59:15 +01:00
if (entityhuman != null) {
2021-11-23 12:27:39 +01:00
double d0 = entityhuman.distanceToSqr((Entity) this);
2021-11-09 08:59:15 +01:00
- int i = this.getType().getCategory().getDespawnDistance();
2024-01-24 11:45:17 +01:00
+ int i = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - Configurable despawn distances
2021-06-11 14:02:28 +02:00
int j = i * i;
2022-05-09 11:03:07 +02:00
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
2021-06-12 00:37:16 +02:00
this.discard();
2021-06-11 14:02:28 +02:00
}
2021-11-09 08:59:15 +01:00
- int k = this.getType().getCategory().getNoDespawnDistance();
2024-01-24 11:45:17 +01:00
+ int k = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - Configurable despawn distances
2021-06-11 14:02:28 +02:00
int l = k * k;
2022-05-09 11:03:07 +02:00
if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) {