PaperMC/patches/server/0227-Option-to-prevent-armor-stands-from-doing-entity-loo.patch
2023-02-28 12:27:38 +01:00

36 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Hugo Manrique <hugmanrique@gmail.com>
Date: Mon, 23 Jul 2018 12:57:39 +0200
Subject: [PATCH] Option to prevent armor stands from doing entity lookups
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index 4398a33df4e0f0e9d28c51af3d48e41d957d7c9e..3488c882c654a2cb7a470ed84066bcc0bbbbf9c4 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -336,6 +336,7 @@ public class ArmorStand extends LivingEntity {
@Override
protected void pushEntities() {
+ if (!level.paperConfig().entities.armorStands.doCollisionEntityLookups) return; // Paper
List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox(), ArmorStand.RIDABLE_MINECARTS);
for (int i = 0; i < list.size(); ++i) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 7b4fe58cb6b9e0b4b9a09c79a5385c785983c955..bb5d49a1b002fbe9109b2fe6c31c9d4f7c3f9ac8 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -766,6 +766,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end
}
}
+ // Paper start - Prevent armor stands from doing entity lookups
+ @Override
+ public boolean noCollision(@Nullable Entity entity, AABB box) {
+ if (entity instanceof net.minecraft.world.entity.decoration.ArmorStand && !entity.level.paperConfig().entities.armorStands.doCollisionEntityLookups) return false;
+ return LevelAccessor.super.noCollision(entity, box);
+ }
+ // Paper end
public boolean shouldTickDeath(Entity entity) {
return true;