Paper/patches/server/0024-Add-configurable-despawn-distances-for-living-entiti.patch

28 Zeilen
1.5 KiB
Diff

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
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
2023-12-05 20:39:26 +01:00
index 183866636eb67f632728a01c8e5e11b514d89f84..007a5c9a6dc70ca6a215fdeb3fe77f8a8ee46818 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 {
if (entityhuman != null) {
2021-11-23 12:27:39 +01:00
double d0 = entityhuman.distanceToSqr((Entity) this);
- int i = this.getType().getCategory().getDespawnDistance();
2023-06-08 00:12:41 +02:00
+ int i = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - custom despawn distances
2021-06-11 14:02:28 +02:00
int j = i * i;
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
}
- int k = this.getType().getCategory().getNoDespawnDistance();
2023-06-08 00:12:41 +02:00
+ int k = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - custom despawn distances
2021-06-11 14:02:28 +02:00
int l = k * k;
if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) {