mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 17:59:41 +00:00
there's always one ...
This commit is contained in:
parent
260e54e4b1
commit
a22276e679
62
src/block/utils/CopperTrait.php
Normal file
62
src/block/utils/CopperTrait.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user