Skip to content

CopperGolemTransportItemsGoal 5.46.0 ​

class · pocketmine\entity\golem\CopperGolemTransportItemsGoal · source

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 ​

php
public const INTERACTION_NONE = "none"

INTERACTION_PUT ​

php
public const INTERACTION_PUT = "put"

INTERACTION_PUT_FAIL ​

php
public const INTERACTION_PUT_FAIL = "put_fail"

INTERACTION_TAKE ​

php
public const INTERACTION_TAKE = "take"

INTERACTION_TAKE_FAIL ​

php
public const INTERACTION_TAKE_FAIL = "take_fail"

INTERACTION_TICKS ​

php
public const INTERACTION_TICKS = 60

MAX_STACK ​

php
public const MAX_STACK = 16

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\golem\CopperGolem $golem, float $speed = 1.0)

acceptsItem() ​

php
public static function acceptsItem(\pocketmine\inventory\Inventory $inventory, \pocketmine\item\Item $held) : bool

Whether the golem can leave the held item in the inventory: it is empty or already holds the same item.

addItems() ​

php
public static function addItems(\pocketmine\inventory\Inventory $inventory, \pocketmine\item\Item $items) : \pocketmine\item\Item

Puts the items in the first empty slot or merges them with matching stacks, in slot order (vanilla addItemsToContainer). Returns what did not fit.

canContinue() ​

php
public function canContinue() : bool

canStart() ​

php
public function canStart() : bool

getFlags() ​

php
public function getFlags() : int

isEmpty() ​

php
public static function isEmpty(\pocketmine\inventory\Inventory $inventory) : bool

stop() ​

php
public function stop() : void

takeItems() ​

php
public static function takeItems(\pocketmine\inventory\Inventory $inventory) : ?\pocketmine\item\Item

Takes up to 16 items from the first non-empty slot.

tick() ​

php
public function tick() : void

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.