NodeProcessor .java

net.minecraft.world.pathfinder.NodeProcessor (class): members: blockaccess, entitySizeX, entitySizeY, entitySizeZ, openPoint, pointMap, findPathOptions.

net.minecraft.world.pathfinderclass64 linescommon2.0 KB

API Surface (3)

void initProcessor(IBlockAccess iblockaccessIn, Entity entityIn)
void postProcess()
PathPoint openPoint(int x, int y, int z)

Fields & Constants (5)

blockaccess
pointMap
entitySizeX
entitySizeY
entitySizeZ

Code Graph: Dependencies (5)

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

Full Source

NodeProcessor.java64 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.pathfinder;
2
3
import net.minecraft.entity.Entity;
4
import net.minecraft.pathfinding.PathPoint;
5
import net.minecraft.util.IntHashMap;
6
import net.minecraft.util.MathHelper;
7
import net.minecraft.world.IBlockAccess;
8
9
public abstract class NodeProcessor
10
{
11
    protected IBlockAccess blockaccess;
12
    protected IntHashMap<PathPoint> pointMap = new IntHashMap();
13
    protected int entitySizeX;
14
    protected int entitySizeY;
15
    protected int entitySizeZ;
16
17
    public void initProcessor(IBlockAccess iblockaccessIn, Entity entityIn)
18
    {
19
        this.blockaccess = iblockaccessIn;
20
        this.pointMap.clearMap();
21
        this.entitySizeX = MathHelper.floor_float(entityIn.width + 1.0F);
22
        this.entitySizeY = MathHelper.floor_float(entityIn.height + 1.0F);
23
        this.entitySizeZ = MathHelper.floor_float(entityIn.width + 1.0F);
24
    }
25
26
    /**
27
     * This method is called when all nodes have been processed and PathEntity is created.
28
     *  {@link net.minecraft.world.pathfinder.WalkNodeProcessor WalkNodeProcessor} uses this to change its field {@link
29
     * net.minecraft.world.pathfinder.WalkNodeProcessor#avoidsWater avoidsWater}
30
     */
31
    public void postProcess()
32
    {
33
    }
34
35
    /**
36
     * Returns a mapped point or creates and adds one
37
     */
38
    protected PathPoint openPoint(int x, int y, int z)
39
    {
40
        int i = PathPoint.makeHash(x, y, z);
41
        PathPoint pathpoint = (PathPoint)this.pointMap.lookup(i);
42
43
        if (pathpoint == null)
44
        {
45
            pathpoint = new PathPoint(x, y, z);
46
            this.pointMap.addKey(i, pathpoint);
47
        }
48
49
        return pathpoint;
50
    }
51
52
    /**
53
     * Returns given entity's position as PathPoint
54
     */
55
    public abstract PathPoint getPathPointTo(Entity entityIn);
56
57
    /**
58
     * Returns PathPoint for given coordinates
59
     */
60
    public abstract PathPoint getPathPointToCoords(Entity entityIn, double x, double y, double target);
61
62
    public abstract int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance);
63
}
64

Deobfuscated MCP 1.8.9 source of NodeProcessor from Marcelektro/MavenMCP-1.8.9 (net/minecraft/world/pathfinder/NodeProcessor.java), stored verbatim.