2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Sun, 22 Jan 2017 18:07:56 -0500
|
|
|
|
Subject: [PATCH] Cap Entity Collisions
|
|
|
|
|
|
|
|
Limit a single entity to colliding a max of configurable times per tick.
|
|
|
|
This will alleviate issues where living entities are hoarded in 1x1 pens
|
|
|
|
|
|
|
|
This is not tied to the maxEntityCramming rule. Cramming will still apply
|
|
|
|
just as it does in Vanilla, but entity pushing logic will be capped.
|
|
|
|
|
|
|
|
You can set this to 0 to disable collisions.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
2023-09-10 04:28:03 +02:00
|
|
|
index 069fe5df02806103c9bbef396c2e39ca3be90101..ca46bea3799e1bc962debe742ea75f4d7f4ab771 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2023-06-07 21:19:26 +02:00
|
|
|
@@ -387,6 +387,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
2021-06-11 14:02:28 +02:00
|
|
|
public void inactiveTick() { }
|
|
|
|
// Spigot end
|
2021-12-03 22:28:15 +01:00
|
|
|
// Paper start
|
|
|
|
+ protected int numCollisions = 0; // Paper
|
|
|
|
@javax.annotation.Nullable
|
|
|
|
private org.bukkit.util.Vector origin;
|
|
|
|
@javax.annotation.Nullable
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2023-09-10 04:28:03 +02:00
|
|
|
index 01b9635e71a55f29e565fc095cc53f102945423d..0470329b43afd4e8c5e033666d1c5f8f0a03fe6a 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2023-07-04 10:22:56 +02:00
|
|
|
@@ -3317,8 +3317,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
2022-12-07 19:52:24 +01:00
|
|
|
}
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2022-12-07 19:52:24 +01:00
|
|
|
- for (j = 0; j < list.size(); ++j) {
|
2023-06-07 23:35:19 +02:00
|
|
|
+ this.numCollisions = Math.max(0, this.numCollisions - this.level().paperConfig().collisions.maxEntityCollisions); // Paper
|
|
|
|
+ for (j = 0; j < list.size() && this.numCollisions < this.level().paperConfig().collisions.maxEntityCollisions; ++j) { // Paper
|
2022-12-07 19:52:24 +01:00
|
|
|
Entity entity = (Entity) list.get(j);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ entity.numCollisions++; // Paper
|
2021-06-12 11:01:04 +02:00
|
|
|
+ this.numCollisions++; // Paper
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2022-12-07 19:52:24 +01:00
|
|
|
this.doPush(entity);
|
|
|
|
}
|