aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0032-Add-configurable-entity-despawn-distances.patch
blob: 4a3938bdf2d39a979c4b9fa39630242eb172b4ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 entity despawn distances


diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 17c9f99e777e211437cb5d693fe247a22ae51c7d..c8ff4b01186f924473b9ffde948d7f0573e8d56f 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -911,14 +911,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
 
             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 - Configurable despawn distances
                 int j = i * i;
 
                 if (d0 > (double) j && this.removeWhenFarAway(d0)) {
                     this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
                 }
 
-                int k = this.getType().getCategory().getNoDespawnDistance();
+                int k = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - Configurable despawn distances
                 int l = k * k;
 
                 if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) {