Paper/patches/server/0034-Add-configurable-entity-despawn-distances.patch

28 lines
1.6 KiB
Diff
Raw Normal View History

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 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
index af1d4cab8ffa3b20dc7aa3af5d1cf8039ef9736f..9dcd90b8e027075ccec0902bd1b13f82f6fe1bcd 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
@@ -908,14 +908,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
if (entityhuman != null) {
2021-11-23 12:27:39 +01:00
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
2021-06-11 14:02:28 +02:00
int j = i * i;
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
2021-06-11 14:02:28 +02:00
}
- int k = this.getType().getCategory().getNoDespawnDistance();
+ 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;
if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) {