EntitySenses .java

net.minecraft.entity.ai.EntitySenses (class, 60 lines): members: clearSensingCache, unseenEntities, seenEntities, canSee, entityObj. strings: "canSee".

net.minecraft.entity.aiclass60 linescommon1.5 KB

API Surface (2)

void clearSensingCache()
boolean canSee(Entity entityIn)

Fields & Constants (3)

entityObj
seenEntities
unseenEntities

String literals (1)

"canSee"

Code Graph: Dependencies (2)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

EntitySenses.java60 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.entity.ai;
2
3
import com.google.common.collect.Lists;
4
import java.util.List;
5
import net.minecraft.entity.Entity;
6
import net.minecraft.entity.EntityLiving;
7
8
public class EntitySenses
9
{
10
    EntityLiving entityObj;
11
    List<Entity> seenEntities = Lists.<Entity>newArrayList();
12
    List<Entity> unseenEntities = Lists.<Entity>newArrayList();
13
14
    public EntitySenses(EntityLiving entityObjIn)
15
    {
16
        this.entityObj = entityObjIn;
17
    }
18
19
    /**
20
     * Clears canSeeCachePositive and canSeeCacheNegative.
21
     */
22
    public void clearSensingCache()
23
    {
24
        this.seenEntities.clear();
25
        this.unseenEntities.clear();
26
    }
27
28
    /**
29
     * Checks, whether 'our' entity can see the entity given as argument (true) or not (false), caching the result.
30
     */
31
    public boolean canSee(Entity entityIn)
32
    {
33
        if (this.seenEntities.contains(entityIn))
34
        {
35
            return true;
36
        }
37
        else if (this.unseenEntities.contains(entityIn))
38
        {
39
            return false;
40
        }
41
        else
42
        {
43
            this.entityObj.worldObj.theProfiler.startSection("canSee");
44
            boolean flag = this.entityObj.canEntityBeSeen(entityIn);
45
            this.entityObj.worldObj.theProfiler.endSection();
46
47
            if (flag)
48
            {
49
                this.seenEntities.add(entityIn);
50
            }
51
            else
52
            {
53
                this.unseenEntities.add(entityIn);
54
            }
55
56
            return flag;
57
        }
58
    }
59
}
60

Deobfuscated MCP 1.8.9 source of EntitySenses from Marcelektro/MavenMCP-1.8.9 (net/minecraft/entity/ai/EntitySenses.java), stored verbatim.