Getting started
This is a guide to getting started with pathetic.
Installation
pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.patheloper.pathetic</groupId>
<artifactId>pathetic-mapping</artifactId>
<version>VERSION</version>
</dependency>
</dependencies>
build.gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.patheloper.pathetic:pathetic-mapping:VERSION'
}
Usage
Example.java
public class PathExample extends JavaPlugin {
@Override
public void onEnable() {
PatheticMapper.initialize(this);
goFindSomePath(randomLocation(), randomLocation());
}
private void goFindSomePath(PathPosition start, PathPosition end) {
Pathfinder pathfinder = PatheticMapper.newPathfinder();
pathfinder
.findPath(start, end, new DirectPathfinderStrategy())
.thenAccept(
pathfinderResult ->
pathfinderResult
.getPath()
.getPositions()
.forEach(
location ->
player.sendBlockChange(
location, Material.YELLOW_STAINED_GLASS.createBlockData())));
}
private PathPosition randomLocation() {
ThreadLocalRandom instance = ThreadLocalRandom.current();
return new PathPosition(
instance.nextInt(0, 100), instance.nextInt(0, 100), instance.nextInt(0, 100));
}
}