forked from OneLiteFeatherNET/BetterGoPaint
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
## Repository | ||
|
||
To seamlessly integrate our API into your project, please visit | ||
our [repository](https://repo.thenextlvl.net/#/releases/net/thenextlvl/gopaint/api). | ||
Select your preferred build tool and incorporate the version you intend to use. | ||
|
||
### Gradle Example | ||
|
||
For Gradle users, add the repository and dependency to your `build.gradle.kts`: | ||
|
||
```kt | ||
repositories { | ||
maven("https://repo.thenextlvl.net/releases") | ||
} | ||
|
||
dependencies { | ||
compileOnly("net.thenextlvl.gopaint:api:version") | ||
} | ||
``` | ||
|
||
> [!NOTE] | ||
> Be sure to replace `version` with the actual version number.<br> | ||
> The correct version of FastAsyncWorldEdit will be provided automatically<br> | ||
> Also you shouldn't shade the API into your Jar as it is already provided by the plugin. | ||
## API Documentation | ||
|
||
### The BrushController | ||
|
||
With the brush controller you can manage and retrieve brush settings from players and items | ||
|
||
```java | ||
BrushController controller = Bukkit.getServicesManager().load(BrushController.class); | ||
``` | ||
|
||
### The BrushRegistry | ||
|
||
The brush registry allows you to register, unregister and retrieve brushes | ||
|
||
```java | ||
BrushRegistry registry = Bukkit.getServicesManager().load(BrushRegistry.class); | ||
``` | ||
|
||
To register a new brush you have to invoke `BrushRegistry#register` | ||
|
||
### Creating new brushes | ||
|
||
In order to create a new brush you have to extend `Brush`, | ||
you need to provide a name, description and player head value.<br> | ||
In addition to that you have to overwrite the `Brush#paint` method. | ||
In there you perform all of your calculations and edits.<br> | ||
We recommend using `Brush#performEdit` to retrieve an edit session and `Brush#setBlock` to manipulate blocks, | ||
as it immediately frees resources after execution. | ||
|
||
For ease of use we provide some math classes for you: | ||
|
||
- Curve | ||
- BezierSpline | ||
- BezierSplineSegment | ||
- ConnectedBlocks | ||
- Height | ||
- Sphere | ||
- Surface | ||
|
||
> [!TIP] | ||
> You can always take a look at our default implementations of brushes if you need help | ||