2020-04-02 23:07:06 +02:00
|
|
|
From c60aec0eb4548625a800d36c5977d5ba6990a891 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
|
2020-02-21 18:52:20 +01:00
|
|
|
index f164844f33..751551f173 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
|
2020-01-18 18:28:32 +01:00
|
|
|
@@ -322,4 +322,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
|
2020-04-02 23:07:06 +02:00
|
|
|
index 1c8958d15d..4f8e10b860 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
|
2020-02-21 18:52:20 +01:00
|
|
|
@@ -188,6 +188,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
|
|
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
2017-01-23 00:24:14 +01:00
|
|
|
public final boolean defaultActivationState;
|
|
|
|
public long activatedTick = Integer.MIN_VALUE;
|
|
|
|
+ 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
|
2020-02-21 18:52:20 +01:00
|
|
|
index 2775afc327..74de19bbfb 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
|
2020-01-22 03:02:07 +01:00
|
|
|
@@ -2623,8 +2623,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-12-12 00:43:22 +01:00
|
|
|
this.C(entity);
|
2017-01-23 00:24:14 +01:00
|
|
|
}
|
|
|
|
--
|
2020-04-02 23:07:06 +02:00
|
|
|
2.25.1
|
2017-01-23 00:24:14 +01:00
|
|
|
|