2021-06-11 12:02:28 +00: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
|
2022-09-12 11:31:45 +00:00
|
|
|
index 38d3749104742f63f1f4f4c9595e83a4fa445cd1..ce04fa5ae8c539fd6f6aa7648a4cdce6b680463e 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
2022-09-12 11:31:45 +00:00
|
|
|
@@ -794,14 +794,14 @@ public abstract class Mob extends LivingEntity {
|
2021-11-09 07:59:15 +00:00
|
|
|
|
|
|
|
if (entityhuman != null) {
|
2021-11-23 11:27:39 +00:00
|
|
|
double d0 = entityhuman.distanceToSqr((Entity) this);
|
2021-11-09 07:59:15 +00:00
|
|
|
- int i = this.getType().getCategory().getDespawnDistance();
|
2022-06-09 08:51:45 +00:00
|
|
|
+ int i = this.level.paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - custom despawn distances
|
2021-06-11 12:02:28 +00:00
|
|
|
int j = i * i;
|
|
|
|
|
2022-05-09 09:03:07 +00:00
|
|
|
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
|
2021-06-11 22:37:16 +00:00
|
|
|
this.discard();
|
2021-06-11 12:02:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-09 07:59:15 +00:00
|
|
|
- int k = this.getType().getCategory().getNoDespawnDistance();
|
2022-06-09 08:51:45 +00:00
|
|
|
+ int k = this.level.paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - custom despawn distances
|
2021-06-11 12:02:28 +00:00
|
|
|
int l = k * k;
|
|
|
|
|
2022-05-09 09:03:07 +00:00
|
|
|
if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) {
|