there's always one ...

This commit is contained in:
Dylan K. Taylor 2022-07-10 00:19:27 +01:00
parent 260e54e4b1
commit a22276e679
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -0,0 +1,62 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block\utils;
use pocketmine\data\runtime\RuntimeDataReader;
use pocketmine\data\runtime\RuntimeDataWriter;
use pocketmine\data\runtime\RuntimeEnumDeserializer;
use pocketmine\data\runtime\RuntimeEnumSerializer;
trait CopperTrait{
private CopperOxidation $oxidation;
private bool $waxed;
public function getRequiredTypeDataBits() : int{ return 3; }
protected function decodeType(RuntimeDataReader $r) : void{
$this->oxidation = RuntimeEnumDeserializer::readCopperOxidation($r);
$this->waxed = $r->readBool();
}
protected function encodeType(RuntimeDataWriter $w) : void{
RuntimeEnumSerializer::writeCopperOxidation($w, $this->oxidation);
$w->writeBool($this->waxed);
}
public function getOxidation() : CopperOxidation{ return $this->oxidation; }
/** @return $this */
public function setOxidation(CopperOxidation $oxidation) : self{
$this->oxidation = $oxidation;
return $this;
}
public function isWaxed() : bool{ return $this->waxed; }
/** @return $this */
public function setWaxed(bool $waxed) : self{
$this->waxed = $waxed;
return $this;
}
}