Skip to content

GrindstoneTransaction 5.46.0 ​

class · pocketmine\inventory\transaction\GrindstoneTransaction · source

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 ​

php
public const TAG_REPAIR_COST = "RepairCost"

Vanilla anvil/grindstone prior work penalty tag (not otherwise used by PocketMine).

Methods ​

__construct() ​

php
public function __construct(\pocketmine\player\Player $source, \pocketmine\world\Position $grindstonePosition, array $actions = [])

calculateResult() ​

php
public static function calculateResult(?\pocketmine\item\Item $input, ?\pocketmine\item\Item $additional) : ?\pocketmine\item\Item

Returns 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() ​

php
public function execute() : void

getEnchantmentExperience() ​

php
public static function getEnchantmentExperience(\pocketmine\item\Item $item) : int

Returns the sum of the minimum enchanting power of all the non-curse enchantments on the item.

getInputs() ​

php
public function getInputs() : array

isCurse() ​

php
public static function isCurse(\pocketmine\item\enchantment\Enchantment $enchantment) : bool

validate() ​

php
public function validate() : void

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