mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-14 12:57:55 +00:00
Merge pull request #123 from nathank33/master
Fixed WaterBottles after dynamic sourcing broke them
This commit is contained in:
commit
919599cace
1 changed files with 28 additions and 1 deletions
|
@ -187,8 +187,35 @@ public class BlockSource {
|
|||
*/
|
||||
public static Block getWaterSourceBlock(Player player, double range, ClickType clickType, boolean allowWater,
|
||||
boolean allowIce, boolean allowPlant) {
|
||||
return getWaterSourceBlock(player, range, clickType, allowWater, allowIce, allowPlant, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to access a Water bendable block that was recently shifted or clicked on by the
|
||||
* player.
|
||||
*
|
||||
* @param player the player that is trying to bend.
|
||||
* @param range the maximum range to access the block.
|
||||
* @param clickType the action that was performed to access the source, either
|
||||
* ClickType.SHIFT_DOWN or ClickType.LEFT_CLICK.
|
||||
* @param allowWater true if water blocks are allowed.
|
||||
* @param allowIce true if ice blocks are allowed.
|
||||
* @param allowPlant true if plant blocks are allowed.
|
||||
* @param allowWaterBottles true if we should look for a close water block, that may have
|
||||
* been created by a WaterBottle.
|
||||
* @return a valid Water bendable block, or null if none was found.
|
||||
*/
|
||||
public static Block getWaterSourceBlock(Player player, double range, ClickType clickType, boolean allowWater,
|
||||
boolean allowIce, boolean allowPlant, boolean allowWaterBottles) {
|
||||
Block sourceBlock = null;
|
||||
if (allowWater) {
|
||||
if (allowWaterBottles) {
|
||||
// Check the block in front of the player's eyes, it may have been created by a WaterBottle.
|
||||
sourceBlock = WaterMethods.getWaterSourceBlock(player, range, allowPlant);
|
||||
if (sourceBlock == null || sourceBlock.getLocation().distance(player.getEyeLocation()) > 3) {
|
||||
sourceBlock = null;
|
||||
}
|
||||
}
|
||||
if (allowWater && sourceBlock == null) {
|
||||
sourceBlock = getSourceBlock(player, range, BlockSourceType.WATER, clickType);
|
||||
}
|
||||
if (allowIce && sourceBlock == null) {
|
||||
|
|
Loading…
Reference in a new issue