22declare(strict_types=1);
24namespace pocketmine\block\utils;
38 private CopperOxidation $oxidation = CopperOxidation::NONE;
39 private bool $waxed =
false;
41 public function describeBlockItemState(RuntimeDataDescriber $w) : void{
42 $w->enum($this->oxidation);
43 $w->bool($this->waxed);
46 public function getOxidation() : CopperOxidation{ return $this->oxidation; }
49 public function setOxidation(CopperOxidation $oxidation) : self{
50 $this->oxidation = $oxidation;
54 public function isWaxed() : bool{ return $this->waxed; }
57 public function setWaxed(
bool $waxed) : self{
58 $this->waxed = $waxed;
66 public function onInteract(Item $item,
int $face, Vector3 $clickVector, ?Player $player =
null, array &$returnedItems = []) : bool{
67 if(!$this->waxed && $item->getTypeId() === ItemTypeIds::HONEYCOMB){
69 $this->position->getWorld()->setBlock($this->position, $this);
71 $this->position->getWorld()->addSound($this->position,
new CopperWaxApplySound());
76 if($item instanceof Axe){
79 $this->position->getWorld()->setBlock($this->position, $this);
81 $this->position->getWorld()->addSound($this->position,
new CopperWaxRemoveSound());
82 $item->applyDamage(1);
86 $previousOxidation = $this->oxidation->getPrevious();
87 if($previousOxidation !==
null){
88 $this->oxidation = $previousOxidation;
89 $this->position->getWorld()->setBlock($this->position, $this);
91 $this->position->getWorld()->addSound($this->position,
new ScrapeSound());
92 $item->applyDamage(1);