From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Hugo Manrique 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 4813f62d1e382d5ac6971b2244df3f13c80d1950..3562950df4868b1393790b1a1ff1fe0dc589c155 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -379,4 +379,9 @@ public class PaperWorldConfig { private void scanForLegacyEnderDragon() { scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true); } + + public boolean armorStandEntityLookups = true; + private void armorStandEntityLookups() { + armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); + } } diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java index e9ea670248eb0680cdff9a72412e9331fc57ff8a..0936924707306204c06064ee796413159835bfa9 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java @@ -355,6 +355,7 @@ public class EntityArmorStand extends EntityLiving { @Override protected void collideNearby() { + if (!world.paperConfig.armorStandEntityLookups) return; // Paper List list = this.world.getEntities(this, this.getBoundingBox(), EntityArmorStand.br); for (int i = 0; i < list.size(); ++i) { diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 6b81392010c216a1c478cae170388d6836e4206e..06ec41f816bc75ee0fa6418c21ff5a416c834518 100644 --- a/src/main/java/net/minecraft/world/level/World.java +++ b/src/main/java/net/minecraft/world/level/World.java @@ -853,6 +853,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // Paper end } } + // 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 Explosion explode(@Nullable Entity entity, double d0, double d1, double d2, float f, Explosion.Effect explosion_effect) { return this.createExplosion(entity, (DamageSource) null, (ExplosionDamageCalculator) null, d0, d1, d2, f, false, explosion_effect);