mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-21 14:39:01 +01:00
#704: Add generateTree method with a predicate
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
5dd0f2a5b6
commit
64aa0d9c60
1 changed files with 21 additions and 0 deletions
|
@ -3,6 +3,7 @@ package org.bukkit;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.function.Predicate;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
@ -183,6 +184,26 @@ public interface RegionAccessor {
|
||||||
*/
|
*/
|
||||||
boolean generateTree(@NotNull Location location, @NotNull Random random, @NotNull TreeType type, @Nullable Consumer<BlockState> stateConsumer);
|
boolean generateTree(@NotNull Location location, @NotNull Random random, @NotNull TreeType type, @Nullable Consumer<BlockState> stateConsumer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a tree at the given {@link Location}
|
||||||
|
* <p>
|
||||||
|
* The provided predicate gets called for every block which gets changed
|
||||||
|
* as a result of the tree generation. When the predicate gets called no
|
||||||
|
* modifications to the world are done yet. Which means, that calling
|
||||||
|
* {@link #getBlockState(Location)} in the predicate will return the state
|
||||||
|
* of the block before the generation.
|
||||||
|
* <p>
|
||||||
|
* If the predicate returns {@code true} the block gets set in the world.
|
||||||
|
* If it returns {@code false} the block won't get set in the world.
|
||||||
|
*
|
||||||
|
* @param location Location to spawn the tree
|
||||||
|
* @param random Random to use to generated the tree
|
||||||
|
* @param type Type of the tree to create
|
||||||
|
* @param statePredicate The predicate which should get used to test if a block should be set or not.
|
||||||
|
* @return true if the tree was created successfully, otherwise false
|
||||||
|
*/
|
||||||
|
boolean generateTree(@NotNull Location location, @NotNull Random random, @NotNull TreeType type, @Nullable Predicate<BlockState> statePredicate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a entity at the given {@link Location}
|
* Creates a entity at the given {@link Location}
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue