22declare(strict_types=1);
24namespace pocketmine\block\utils;
37 private CopperOxidation $oxidation = CopperOxidation::NONE;
38 private bool $waxed =
false;
40 public function describeBlockItemState(RuntimeDataDescriber $w) : void{
41 $w->enum($this->oxidation);
42 $w->bool($this->waxed);
45 public function getOxidation() : CopperOxidation{ return $this->oxidation; }
48 public function setOxidation(CopperOxidation $oxidation) : self{
49 $this->oxidation = $oxidation;
53 public function isWaxed() : bool{ return $this->waxed; }
56 public function setWaxed(
bool $waxed) : self{
57 $this->waxed = $waxed;
61 public function onInteract(Item $item,
int $face, Vector3 $clickVector, ?Player $player =
null, array &$returnedItems = []) : bool{
62 if(!$this->waxed && $item->getTypeId() === ItemTypeIds::HONEYCOMB){
64 $this->position->getWorld()->setBlock($this->position, $this);
66 $this->position->getWorld()->addSound($this->position,
new CopperWaxApplySound());
71 if($item instanceof Axe){
74 $this->position->getWorld()->setBlock($this->position, $this);
76 $this->position->getWorld()->addSound($this->position,
new CopperWaxRemoveSound());
77 $item->applyDamage(1);
81 $previousOxidation = $this->oxidation->getPrevious();
82 if($previousOxidation !==
null){
83 $this->oxidation = $previousOxidation;
84 $this->position->getWorld()->setBlock($this->position, $this);
86 $this->position->getWorld()->addSound($this->position,
new ScrapeSound());
87 $item->applyDamage(1);