mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 04:55:47 +01:00
5960af9d87
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 7da4c0be SPIGOT-6729: Add Chunk.isEntitiesLoaded() CraftBukkit Changes: 9217b523 #929: Call EntityBlockFormEvent for Wither Rose placed by dead entity 757d42ae SPIGOT-6729: Add Chunk.isEntitiesLoaded()
58 lines
3.0 KiB
Diff
58 lines
3.0 KiB
Diff
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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index b2b3f336ac4e5d9c2598ecc7b3202d1efdd55feb..91e9672d01b6042d6f9a0f96c351ad97dfee0b73 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -329,4 +329,10 @@ public class PaperWorldConfig {
|
|
log("Treasure Maps will return already discovered locations");
|
|
}
|
|
}
|
|
+
|
|
+ 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/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 6211a425e81f9ba9718af6c30e534d35b10bad02..bf52f5f9b13e8b4eb3c7ee19b0e57bb872d2af1d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -322,6 +322,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
|
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
|
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/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index b71b611f3b4506a68ab6c9195c67ba0f52c84ed2..290cf1289cdbe344d4009f8012309fc1f7875100 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -3228,8 +3228,11 @@ public abstract class LivingEntity extends Entity {
|
|
}
|
|
}
|
|
|
|
- for (j = 0; j < list.size(); ++j) {
|
|
+ this.numCollisions = Math.max(0, this.numCollisions - this.level.paperConfig.maxCollisionsPerEntity); // Paper
|
|
+ for (j = 0; j < list.size() && this.numCollisions < this.level.paperConfig.maxCollisionsPerEntity; ++j) { // Paper
|
|
Entity entity = (Entity) list.get(j);
|
|
+ entity.numCollisions++; // Paper
|
|
+ this.numCollisions++; // Paper
|
|
|
|
this.doPush(entity);
|
|
}
|