mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Add more collision code skipping logic (#7581)
This commit is contained in:
parent
3ef301c4f5
commit
0bb4b6ead5
1 changed files with 15 additions and 2 deletions
|
@ -3,8 +3,13 @@ From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||||
Date: Wed, 15 Apr 2020 17:56:07 -0700
|
Date: Wed, 15 Apr 2020 17:56:07 -0700
|
||||||
Subject: [PATCH] Don't run entity collision code if not needed
|
Subject: [PATCH] Don't run entity collision code if not needed
|
||||||
|
|
||||||
Will not run if max entity craming is disabled and
|
Will not run if:
|
||||||
the max collisions per entity is less than or equal to 0
|
Max entity cramming is disabled and the max collisions per entity is less than or equal to 0.
|
||||||
|
Entity#isPushable() returns false, meaning all entities will not be able to collide with this
|
||||||
|
entity anyways.
|
||||||
|
The entity's current team collision rule causes them to NEVER collide.
|
||||||
|
|
||||||
|
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
@ -15,6 +20,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
protected void pushEntities() {
|
protected void pushEntities() {
|
||||||
+ // Paper start - don't run getEntities if we're not going to use its result
|
+ // Paper start - don't run getEntities if we're not going to use its result
|
||||||
|
+ if (!this.isPushable()) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ net.minecraft.world.scores.Team team = this.getTeam();
|
||||||
|
+ if (team != null && team.getCollisionRule() == net.minecraft.world.scores.Team.CollisionRule.NEVER) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ int i = this.level.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
|
+ int i = this.level.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
|
||||||
+ if (i <= 0 && level.paperConfig().collisions.maxEntityCollisions <= 0) {
|
+ if (i <= 0 && level.paperConfig().collisions.maxEntityCollisions <= 0) {
|
||||||
+ return;
|
+ return;
|
||||||
|
|
Loading…
Reference in a new issue