More work?
This commit is contained in:
parent
152e82ceec
commit
9e92fed7a2
18 changed files with 158 additions and 172 deletions
44
patches/server/0126-Cap-Entity-Collisions.patch
Normal file
44
patches/server/0126-Cap-Entity-Collisions.patch
Normal file
|
@ -0,0 +1,44 @@
|
|||
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
|
||||
index 847fd720f11e89d906430c820bc92afe0454761d..b1b26e7c0f66f0697bcfe9eb045d45f31cd9ab06 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -404,6 +404,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public long activatedTick = Integer.MIN_VALUE;
|
||||
public void inactiveTick() { }
|
||||
// Spigot end
|
||||
+ protected int numCollisions = 0; // Paper - Cap entity collisions
|
||||
// Paper start - Entity origin API
|
||||
@javax.annotation.Nullable
|
||||
private org.bukkit.util.Vector origin;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 237025be183b3cc93920430075edcc0bb2899b68..f2f8fbc8a8cf32bcba0ad7ac9b6cdd75468e062a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3642,10 +3642,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
Iterator iterator1 = list.iterator();
|
||||
+ this.numCollisions = Math.max(0, this.numCollisions - this.level().paperConfig().collisions.maxEntityCollisions); // Paper - Cap entity collisions
|
||||
|
||||
- while (iterator1.hasNext()) {
|
||||
+ while (iterator1.hasNext() && this.numCollisions < this.level().paperConfig().collisions.maxEntityCollisions) { // Paper - Cap entity collisions
|
||||
Entity entity1 = (Entity) iterator1.next();
|
||||
-
|
||||
+ entity1.numCollisions++; // Paper - Cap entity collisions
|
||||
+ this.numCollisions++; // Paper - Cap entity collisions
|
||||
this.doPush(entity1);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue