mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Added support for different tree generation types and a callback.
By: sk89q <the.sk89q@gmail.com>
This commit is contained in:
parent
8ea6bf1889
commit
301b48abea
3 changed files with 64 additions and 4 deletions
42
paper-api/src/main/java/org/bukkit/BlockChangeDelegate.java
Normal file
42
paper-api/src/main/java/org/bukkit/BlockChangeDelegate.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package org.bukkit;
|
||||
|
||||
/**
|
||||
* A delegate for handling block changes. This serves as a direct interface
|
||||
* between generation algorithms in the server implementation and utilizing
|
||||
* code.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public interface BlockChangeDelegate {
|
||||
/**
|
||||
* Set a block type at the specified coordinates.
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param typeId
|
||||
* @return true if the block was set successfully
|
||||
*/
|
||||
public boolean setTypeId(int x, int y, int z, int typeId);
|
||||
|
||||
/**
|
||||
* Set a block type and data at the specified coordinates.
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param typeId
|
||||
* @param data
|
||||
* @return true if the block was set successfully
|
||||
*/
|
||||
public boolean setTypeIdAndData(int x, int y, int z, int typeId, int data);
|
||||
|
||||
/**
|
||||
* Get the block type at the location.
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return
|
||||
*/
|
||||
public int getTypeId(int x, int y, int z);
|
||||
}
|
14
paper-api/src/main/java/org/bukkit/TreeType.java
Normal file
14
paper-api/src/main/java/org/bukkit/TreeType.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
package org.bukkit;
|
||||
|
||||
/**
|
||||
* Tree type.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public enum TreeType {
|
||||
TREE,
|
||||
BIG_TREE,
|
||||
REDWOOD,
|
||||
TALL_REDWOOD,
|
||||
BIRCH
|
||||
}
|
|
@ -115,17 +115,21 @@ public interface World {
|
|||
* Spawns a tree at a location.
|
||||
*
|
||||
* @param loc
|
||||
* @param type
|
||||
* @return whether the tree was created
|
||||
*/
|
||||
public boolean generateTree(Location loc);
|
||||
|
||||
public boolean generateTree(Location loc, TreeType type);
|
||||
|
||||
/**
|
||||
* Spawns a big tree at a location.
|
||||
* Spawns a tree at a location.
|
||||
*
|
||||
* @param loc
|
||||
* @param type
|
||||
* @param delegate
|
||||
* @return whether the tree was created
|
||||
*/
|
||||
public boolean generateBigTree(Location loc);
|
||||
public boolean generateTree(Location loc, TreeType type,
|
||||
BlockChangeDelegate delegate);
|
||||
|
||||
/**
|
||||
* Spawns a regular passenger minecart.
|
||||
|
|
Loading…
Reference in a new issue