2019-08-05 18:35:40 +02:00
|
|
|
From 99aef69d63d3a44c6b7fcb9a5cbe573b0826402c Mon Sep 17 00:00:00 2001
|
2017-01-23 00:24:14 +01:00
|
|
|
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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2019-07-20 06:01:24 +02:00
|
|
|
index 46d5252239..de8362ddd7 100644
|
2017-01-23 00:24:14 +01:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2019-07-03 22:44:07 +02:00
|
|
|
@@ -315,4 +315,10 @@ public class PaperWorldConfig {
|
2018-07-18 02:08:13 +02:00
|
|
|
log("Treasure Maps will return already discovered locations");
|
|
|
|
}
|
2017-01-23 00:24:14 +01:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public int maxCollisionsPerEntity;
|
|
|
|
+ private void maxEntityCollision() {
|
|
|
|
+ maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) );
|
|
|
|
+ log( "Max Entity Collisions: " + maxCollisionsPerEntity );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2019-07-20 06:01:24 +02:00
|
|
|
index f4188fc75d..482864ac62 100644
|
2017-01-23 00:24:14 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2019-05-06 04:58:04 +02:00
|
|
|
@@ -184,6 +184,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2017-01-23 00:24:14 +01:00
|
|
|
public final boolean defaultActivationState;
|
|
|
|
public long activatedTick = Integer.MIN_VALUE;
|
2017-06-11 19:03:07 +02:00
|
|
|
public boolean fromMobSpawner;
|
2017-01-23 00:24:14 +01:00
|
|
|
+ protected int numCollisions = 0; // Paper
|
|
|
|
public void inactiveTick() { }
|
|
|
|
// Spigot end
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
2019-08-05 18:35:40 +02:00
|
|
|
index 6ba5e98400..79edb3b3cb 100644
|
2017-01-23 00:24:14 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
2019-08-05 18:35:40 +02:00
|
|
|
@@ -2560,8 +2560,11 @@ public abstract class EntityLiving extends Entity {
|
2017-01-23 00:24:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- for (j = 0; j < list.size(); ++j) {
|
|
|
|
+ numCollisions = Math.max(0, numCollisions - world.paperConfig.maxCollisionsPerEntity); // Paper
|
|
|
|
+ for (j = 0; j < list.size() && numCollisions < world.paperConfig.maxCollisionsPerEntity; ++j) { // Paper
|
|
|
|
Entity entity = (Entity) list.get(j);
|
|
|
|
+ entity.numCollisions++; // Paper
|
|
|
|
+ numCollisions++; // Paper
|
|
|
|
|
2019-04-27 08:26:04 +02:00
|
|
|
this.D(entity);
|
2017-01-23 00:24:14 +01:00
|
|
|
}
|
|
|
|
--
|
2019-06-25 21:18:50 +02:00
|
|
|
2.22.0
|
2017-01-23 00:24:14 +01:00
|
|
|
|