geforkt von Mirrors/Paper
36f34f01c0
Upstream has released updates that appears 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: da9ef3c5 #496: Add methods to get/set ItemStacks in EquipmentSlots 3abebc9f #492: Let Tameable extend Animals rather than Entity 941111a0 #495: Expose ItemStack and hand used in PlayerShearEntityEvent 4fe19cae #494: InventoryView - Add missing Brewing FUEL_TIME CraftBukkit Changes:933e9094
#664: Add methods to get/set ItemStacks in EquipmentSlots18722312
#662: Expose ItemStack and hand used in PlayerShearEntityEvent
58 Zeilen
2.9 KiB
Diff
58 Zeilen
2.9 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 f164844f339793860e773c499443ce160d0a6830..751551f173338217f6682532a9a5e1a269415177 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -322,4 +322,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/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index 3b02a65ba2df5c01515c9cbf03b39b3c518451dc..0d7dcc1463efa395458e95f1236a20241ff66abe 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -188,6 +188,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
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/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index 306435c1c6f28ad1a891d4ee8c124b14a83ae25b..639d113de3fa1bbb610c596b84121ccde58f2622 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -2626,8 +2626,11 @@ public abstract class EntityLiving extends Entity {
|
|
}
|
|
}
|
|
|
|
- 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
|
|
|
|
this.C(entity);
|
|
}
|