001 package net.minecraft.src; 002 003 import java.util.ArrayList; 004 import java.util.List; 005 006 public class EntitySenses 007 { 008 EntityLiving entityObj; 009 List field_75524_b = new ArrayList(); 010 List field_75525_c = new ArrayList(); 011 012 public EntitySenses(EntityLiving par1EntityLiving) 013 { 014 this.entityObj = par1EntityLiving; 015 } 016 017 /** 018 * Clears canSeeCachePositive and canSeeCacheNegative. 019 */ 020 public void clearSensingCache() 021 { 022 this.field_75524_b.clear(); 023 this.field_75525_c.clear(); 024 } 025 026 /** 027 * Checks, whether 'our' entity can see the entity given as argument (true) or not (false), caching the result. 028 */ 029 public boolean canSee(Entity par1Entity) 030 { 031 if (this.field_75524_b.contains(par1Entity)) 032 { 033 return true; 034 } 035 else if (this.field_75525_c.contains(par1Entity)) 036 { 037 return false; 038 } 039 else 040 { 041 this.entityObj.worldObj.theProfiler.startSection("canSee"); 042 boolean var2 = this.entityObj.canEntityBeSeen(par1Entity); 043 this.entityObj.worldObj.theProfiler.endSection(); 044 045 if (var2) 046 { 047 this.field_75524_b.add(par1Entity); 048 } 049 else 050 { 051 this.field_75525_c.add(par1Entity); 052 } 053 054 return var2; 055 } 056 } 057 }