Implement enchanting using enchanting tables (#5953)

Co-authored-by: Dylan K. Taylor <dktapps@pmmp.io>
This commit is contained in:
S3v3Nice
2023-08-15 19:28:26 +03:00
committed by GitHub
parent e48b5b2ec0
commit 39867b97c5
34 changed files with 1892 additions and 128 deletions

View File

@@ -44,8 +44,11 @@ class Armor extends Durable{
protected ?Color $customColor = null;
public function __construct(ItemIdentifier $identifier, string $name, ArmorTypeInfo $info){
parent::__construct($identifier, $name);
/**
* @param string[] $enchantmentTags
*/
public function __construct(ItemIdentifier $identifier, string $name, ArmorTypeInfo $info, array $enchantmentTags = []){
parent::__construct($identifier, $name, $enchantmentTags);
$this->armorInfo = $info;
}
@@ -72,6 +75,14 @@ class Armor extends Durable{
return $this->armorInfo->isFireProof();
}
public function getMaterial() : ArmorMaterial{
return $this->armorInfo->getMaterial();
}
public function getEnchantability() : int{
return $this->armorInfo->getMaterial()->getEnchantability();
}
/**
* Returns the dyed colour of this armour piece. This generally only applies to leather armour.
*/