-
-
Notifications
You must be signed in to change notification settings - Fork 55
/
ChunkSnapshotBlockSource.java
38 lines (30 loc) · 1.13 KB
/
ChunkSnapshotBlockSource.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package net.citizensnpcs.api.astar.pathfinder;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import net.citizensnpcs.api.util.BoundingBox;
public class ChunkSnapshotBlockSource extends CachingChunkBlockSource<ChunkSnapshot> {
public ChunkSnapshotBlockSource(Location location, float radius) {
super(location, radius);
}
public ChunkSnapshotBlockSource(World world, int x, int z, float radius) {
super(world, x, z, radius);
}
@Override
protected ChunkSnapshot getChunkObject(int x, int z) {
return world.getChunkAt(x, z).getChunkSnapshot(false, false, false);
}
@Override
protected BoundingBox getCollisionBox(ChunkSnapshot chunk, int x, int y, int z) {
return null; // TODO
}
@Override
protected int getLightLevel(ChunkSnapshot chunk, int x, int y, int z) {
return Math.min(15, chunk.getBlockSkyLight(x, y, z) + chunk.getBlockEmittedLight(x, y, z));
}
@Override
protected Material getType(ChunkSnapshot chunk, int x, int y, int z) {
return chunk.getBlockType(x, y, z);
}
}