19972e09b8
5a0150f586ed3eb15fe6f1f596d1a5a7d806f0f9 Fix ITEM_BREAK e6a3911057bd94d8bd7021cbb4923fb84fb106d1 Upstream merge d1cdcf8d4c3639f956474f02ed662517cffbe23e Remove old patch 068df64aeee368377e1673667bffc7a6dcf90554 Rebuild all patches
67 lines
2.8 KiB
Diff
67 lines
2.8 KiB
Diff
From 9b567653a5ac2657bce8dbed472768f6f7bbd311 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Fri, 31 Jan 2014 11:18:34 -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.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index fd7c615..d6c8be8 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -1060,6 +1060,7 @@ public abstract class Entity implements ICommandListener {
|
|
|
|
public void d(EntityHuman entityhuman) {}
|
|
|
|
+ int numCollisions = 0; // Spigot
|
|
public void collide(Entity entity) {
|
|
if (entity.passenger != this && entity.vehicle != this) {
|
|
if (!entity.T && !this.T) {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index 6358f5e..9604034 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -1617,7 +1617,9 @@ public abstract class EntityLiving extends Entity {
|
|
List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
|
|
|
|
if (this.ad() && list != null && !list.isEmpty()) { // Spigot: Add this.ad() condition
|
|
+ numCollisions -= world.spigotConfig.maxCollisionsPerEntity; // Spigot
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
+ if (numCollisions > world.spigotConfig.maxCollisionsPerEntity) { break; } // Spigot
|
|
Entity entity = (Entity) list.get(i);
|
|
|
|
// TODO better check now?
|
|
@@ -1628,9 +1630,12 @@ public abstract class EntityLiving extends Entity {
|
|
// CraftBukkit end
|
|
|
|
if (entity.ae()) {
|
|
+ entity.numCollisions++; // Spigot
|
|
+ numCollisions++; // Spigot
|
|
this.s(entity);
|
|
}
|
|
}
|
|
+ numCollisions = 0; // Spigot
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
index 93ab1c1..71f772c 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
@@ -273,4 +273,11 @@ public class SpigotWorldConfig
|
|
maxBulkChunk = getInt( "max-bulk-chunks", 10 );
|
|
log( "Sending up to " + maxBulkChunk + " chunks per packet" );
|
|
}
|
|
+
|
|
+ public int maxCollisionsPerEntity;
|
|
+ private void maxEntityCollision()
|
|
+ {
|
|
+ maxCollisionsPerEntity = getInt( "max-entity-collisions", 8 );
|
|
+ log( "Max Entity Collisions: " + maxCollisionsPerEntity );
|
|
+ }
|
|
}
|
|
--
|
|
2.1.0
|
|
|