Blaackyy / pathetic

A Simple and Intuitive 1.8-1.19 A* Pathfinding API for Spigot & Paper plugins in Minecraft

Home Page:http://patheticdocs.ollieee.xyz/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pathetic

A simple and intuitive 1.8-1.20 A* pathfinding API for Spigot & Paper plugins

How to import

Maven

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>
 
	<dependency>
	    <groupId>com.github.patheloper.pathetic</groupId>
	    <artifactId>pathetic-mapping</artifactId>
	    <version>VERSION</version>
	</dependency>

Gradle

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
    
	dependencies {
	        implementation 'com.github.patheloper.pathetic:pathetic-mapping:VERSION'
	}

Example API Usage

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).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));
    }
}

See the pathetic-example module for a more in-depth example plugin.

Javadocs:

Access the Javadocs here

About

A Simple and Intuitive 1.8-1.19 A* Pathfinding API for Spigot & Paper plugins in Minecraft

http://patheticdocs.ollieee.xyz/

License:GNU General Public License v3.0


Languages

Language:Java 100.0%