GrindstoneTransaction 5.46.0
Extends InventoryTransaction
Taking the result out of a grindstone. Validates the result against the consumed inputs and gives the vanilla amount of experience (as orbs dropped at the grindstone) once executed.
Constants
TAG_REPAIR_COST
public const TAG_REPAIR_COST = "RepairCost"Vanilla anvil/grindstone prior work penalty tag (not otherwise used by PocketMine).
Methods
__construct()
public function __construct(\pocketmine\player\Player $source, \pocketmine\world\Position $grindstonePosition, array $actions = [])calculateResult()
public static function calculateResult(?\pocketmine\item\Item $input, ?\pocketmine\item\Item $additional) : ?\pocketmine\item\ItemReturns what the grindstone produces from the given items, or null if they can't be used together. Mirrors the vanilla rules: a single item must be enchanted (or an enchanted book); two items must be the same item, and are repaired (sum of both durabilities plus 5% of the maximum) if they are damageable, or must be identical otherwise. Every non-curse enchantment is removed, curses from both items are kept.
execute()
public function execute() : voidgetEnchantmentExperience()
public static function getEnchantmentExperience(\pocketmine\item\Item $item) : intReturns the sum of the minimum enchanting power of all the non-curse enchantments on the item.
getInputs()
public function getInputs() : arrayisCurse()
public static function isCurse(\pocketmine\item\enchantment\Enchantment $enchantment) : boolvalidate()
public function validate() : void