Add getVillagesInRange(@NotNull double, @NotNull double, @NotNull double) and getNearestVillage(@NotNull double, @NotNull double, @NotNull double) method in class CraftVillager.

This commit is contained in:
CBM1014
2019-04-21 22:42:50 +08:00
parent ed1528a5fa
commit 3b538f0cb5
4 changed files with 78 additions and 2 deletions

View File

@@ -3,7 +3,11 @@ package org.bukkit.entity;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.server.Village;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.Merchant;
@@ -15,6 +19,21 @@ import org.jetbrains.annotations.Nullable;
*/
public interface Villager extends Ageable, NPC, InventoryHolder, Merchant {
/**
* Get the nearest village of this villager in range .
*
* @return The nearest village. null if there is no village in range.
*/
public Village getNearestVillage(@NotNull double xRadius,@NotNull double yRadius,@NotNull double zRadius);
/**
* Get villages which are near by this villager in range.
*
* @return All the villages in range. Empty List if there is no village in range.
*/
public List<Village> getVillagesInRange(@NotNull double xRadius, @NotNull double yRadius, @NotNull double zRadius);
/**
* Gets the current profession of this villager.
*