mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-26 23:13:09 +00:00
Narrow bounds of some getEntitiesWithinAAB calls, should yield a very minor performance boost
This commit is contained in:
1 parent
24c542f31f
commit
767ecf78c2
5 files changed
+20
-11
No files matched your search
@@ -169,7 +169,13 @@ public class EntityMagicMissile extends EntityThrowable {
|
||||
setTarget(null);
|
||||
|
||||
double range = 12;
|
||||
List entities = world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(posX - range, posY - range, posZ - range, posX + range, posY + range, posZ + range), Predicates.instanceOf(isEvil() ? EntityPlayer.class : IMob.class));
|
||||
AxisAlignedBB bounds = new AxisAlignedBB(posX - range, posY - range, posZ - range, posX + range, posY + range, posZ + range);
|
||||
List entities;
|
||||
if(isEvil()) {
|
||||
entities = world.getEntitiesWithinAABB(EntityPlayer.class, bounds);
|
||||
} else {
|
||||
entities = world.getEntitiesWithinAABB(Entity.class, bounds, Predicates.instanceOf(IMob.class));
|
||||
}
|
||||
while(entities.size() > 0) {
|
||||
Entity e = (Entity) entities.get(world.rand.nextInt(entities.size()));
|
||||
if(!(e instanceof EntityLivingBase) || e.isDead) { // Just in case...
|
||||
|
||||
Reference in new issue
Block a user