From 7d902591943518002acd1d7d4ce88b4ef7847de0 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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 83e54cb904..f06bb3ae19 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -326,6 +326,11 @@ public class PaperWorldConfig {
         }
     }
 
+    public boolean armorStandEntityLookups = true;
+    private void armorStandEntityLookups() {
+        armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true);
+    }
+
     public int maxCollisionsPerEntity;
     private void maxEntityCollision() {
         maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) );
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 299a316a4b..d205ec01ac 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -873,6 +873,14 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
         }
     }
 
+    // Paper start - Prevent armor stands from doing entity lookups
+    @Override
+    public boolean getCubes(@Nullable Entity entity, AxisAlignedBB axisAlignedBB) {
+        if (entity instanceof EntityArmorStand && !entity.world.paperConfig.armorStandEntityLookups) return false;
+        return GeneratorAccess.super.getCubes(entity, axisAlignedBB);
+    }
+    // Paper end
+
     public boolean a(AxisAlignedBB axisalignedbb) {
         int i = MathHelper.floor(axisalignedbb.minX);
         int j = MathHelper.f(axisalignedbb.maxX);
-- 
2.21.0

