FindTreasureGoal 5.47.0
Extends Goal
A dolphin that was fed fish leads the way to the nearest treasure (Bedrock behavior.find_underwater_treasure, Java DolphinSwimToTreasureGoal): the nearest ocean ruin, shipwreck or buried treasure within FindTreasureGoal::SEARCH_RADIUS_CHUNKS chunks (Java DOLPHIN_LOCATED structures, the /locate structure locator of the world). It swims there in hops of up to 16 blocks through the water, shows its treasure hunt particles now and then, and stops within 4 blocks of it (horizontally), when no hop through the water is found (stuck) or when it runs low on air; then the fish is used up.
The structure search runs once per feeding, off the main thread when the locator supports it, and its results are cached per world and 128-block area: the goal never searches on its own ticks.
Constants
ARRIVE_DISTANCE
public const ARRIVE_DISTANCE = 4.0Horizontal distance from the treasure at which the dolphin stops.
MIN_AIR_TICKS
public const MIN_AIR_TICKS = 100Air ticks the dolphin needs to lead (Java).
SEARCH_RADIUS_CHUNKS
public const SEARCH_RADIUS_CHUNKS = 50Search radius (Java findNearestMapStructure(DOLPHIN_LOCATED, pos, 50, false)).
STRUCTURES
public const STRUCTURES = ["ocean_ruin", "shipwreck", "buried_treasure"]Structures dolphins lead to (Java structure tag dolphin_located), as /locate structure names.
Properties
$dolphin
public \pocketmine\entity\aquatic\Dolphin $dolphin$speedMultiplier
public float $speedMultiplierMethods
__construct()
public function __construct(\pocketmine\entity\aquatic\Dolphin $dolphin, float $speedMultiplier = 2.0)canContinue()
public function canContinue() : boolcanStart()
public function canStart() : boolgetFlags()
public function getFlags() : intgetTreasure()
public function getTreasure() : ?\pocketmine\math\Vector3Returns the treasure the dolphin swims to, null while it isn't known (yet).
isInterruptible()
public function isInterruptible() : boollocateTreasure()
public static function locateTreasure(\pocketmine\world\World $world, \pocketmine\math\Vector3 $from, \Closure $onResult) : voidFinds the nearest treasure structure (FindTreasureGoal::STRUCTURES) around the position with the world's structure locator and passes it to $onResult (null if there is none, or the world has no locator). The result comes later, on the main thread, when the locator searches off it (AsyncStructureLocator); results are cached per 128-block area, and searches of the same area are shared.
start()
public function start() : voidstop()
public function stop() : voidtick()
public function tick() : void