CopperGolemTransportItemsGoal 5.46.0
Extends Goal
Copper golems sort items (vanilla TransportItemsBetweenContainers with the CopperGolemAi settings): with an empty hand the golem walks to the nearest copper chest within 32 blocks (8 vertically) and takes up to 16 items from its first non-empty slot; holding items, it walks to the nearest chest or trapped chest that is empty or already holds the same item, and puts them there. Each chest is opened for 60 ticks (actor property minecraft:chest_interaction: take, take_fail, put, put_fail) before the items move. Chests already tried are skipped (at most 10, forgotten after 5 minutes or when items moved); when nothing is left to try the golem rests for 7 seconds. The golem waits while a player has the chest open.
Simplifications: the half of a double chest is visited like a single chest, reachability uses the path finder only (no line of sight check), and trapped chests are not powered while the golem has them open.
Constants
INTERACTION_NONE
public const INTERACTION_NONE = "none"INTERACTION_PUT
public const INTERACTION_PUT = "put"INTERACTION_PUT_FAIL
public const INTERACTION_PUT_FAIL = "put_fail"INTERACTION_TAKE
public const INTERACTION_TAKE = "take"INTERACTION_TAKE_FAIL
public const INTERACTION_TAKE_FAIL = "take_fail"INTERACTION_TICKS
public const INTERACTION_TICKS = 60MAX_STACK
public const MAX_STACK = 16Methods
__construct()
public function __construct(\pocketmine\entity\golem\CopperGolem $golem, float $speed = 1.0)acceptsItem()
public static function acceptsItem(\pocketmine\inventory\Inventory $inventory, \pocketmine\item\Item $held) : boolWhether the golem can leave the held item in the inventory: it is empty or already holds the same item.
addItems()
public static function addItems(\pocketmine\inventory\Inventory $inventory, \pocketmine\item\Item $items) : \pocketmine\item\ItemPuts the items in the first empty slot or merges them with matching stacks, in slot order (vanilla addItemsToContainer). Returns what did not fit.
canContinue()
public function canContinue() : boolcanStart()
public function canStart() : boolgetFlags()
public function getFlags() : intisEmpty()
public static function isEmpty(\pocketmine\inventory\Inventory $inventory) : boolstop()
public function stop() : voidtakeItems()
public static function takeItems(\pocketmine\inventory\Inventory $inventory) : ?\pocketmine\item\ItemTakes up to 16 items from the first non-empty slot.
tick()
public function tick() : void