mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 09:49:50 +00:00
thanks git
This commit is contained in:
parent
4a7f8fd9d9
commit
a093ba3ed9
81
src/pocketmine/block/utils/Color.php
Normal file
81
src/pocketmine/block/utils/Color.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?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;
|
||||
|
||||
class Color{
|
||||
public const WHITE = 0;
|
||||
public const ORANGE = 1;
|
||||
public const MAGENTA = 2;
|
||||
public const LIGHT_BLUE = 3;
|
||||
public const YELLOW = 4;
|
||||
public const LIME = 5;
|
||||
public const PINK = 6;
|
||||
public const GRAY = 7;
|
||||
public const LIGHT_GRAY = 8;
|
||||
public const CYAN = 9;
|
||||
public const PURPLE = 10;
|
||||
public const BLUE = 11;
|
||||
public const BROWN = 12;
|
||||
public const GREEN = 13;
|
||||
public const RED = 14;
|
||||
public const BLACK = 15;
|
||||
|
||||
public const ALL = [
|
||||
self::WHITE,
|
||||
self::ORANGE,
|
||||
self::MAGENTA,
|
||||
self::LIGHT_BLUE,
|
||||
self::YELLOW,
|
||||
self::LIME,
|
||||
self::PINK,
|
||||
self::GRAY,
|
||||
self::LIGHT_GRAY,
|
||||
self::CYAN,
|
||||
self::PURPLE,
|
||||
self::BLUE,
|
||||
self::BROWN,
|
||||
self::GREEN,
|
||||
self::RED,
|
||||
self::BLACK
|
||||
];
|
||||
|
||||
public const NAMES = [
|
||||
self::WHITE => "White",
|
||||
self::ORANGE => "Orange",
|
||||
self::MAGENTA => "Magenta",
|
||||
self::LIGHT_BLUE => "Light Blue",
|
||||
self::YELLOW => "Yellow",
|
||||
self::LIME => "Lime",
|
||||
self::PINK => "Pink",
|
||||
self::GRAY => "Gray",
|
||||
self::LIGHT_GRAY => "Light Gray",
|
||||
self::CYAN => "Cyan",
|
||||
self::PURPLE => "Purple",
|
||||
self::BLUE => "Blue",
|
||||
self::BROWN => "Brown",
|
||||
self::GREEN => "Green",
|
||||
self::RED => "Red",
|
||||
self::BLACK => "Black"
|
||||
];
|
||||
}
|
76
src/pocketmine/block/utils/PillarRotationTrait.php
Normal file
76
src/pocketmine/block/utils/PillarRotationTrait.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?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\block\Block;
|
||||
use pocketmine\math\Facing;
|
||||
|
||||
trait PillarRotationTrait{
|
||||
|
||||
/** @var int */
|
||||
protected $axis = Facing::AXIS_Y;
|
||||
|
||||
/**
|
||||
* @see Block::writeStateToMeta()
|
||||
* @return int
|
||||
*/
|
||||
protected function writeStateToMeta() : int{
|
||||
return $this->writeAxisToMeta();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Block::readStateFromMeta()
|
||||
* @param int $meta
|
||||
*/
|
||||
public function readStateFromMeta(int $meta) : void{
|
||||
$this->readAxisFromMeta($meta);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Block::getStateBitmask()
|
||||
* @return int
|
||||
*/
|
||||
public function getStateBitmask() : int{
|
||||
return 0b1100;
|
||||
}
|
||||
|
||||
protected function readAxisFromMeta(int $meta) : void{
|
||||
static $map = [
|
||||
0 => Facing::AXIS_Y,
|
||||
1 => Facing::AXIS_X,
|
||||
2 => Facing::AXIS_Z,
|
||||
3 => Facing::AXIS_Y //TODO: how to deal with all-bark logs?
|
||||
];
|
||||
$this->axis = $map[$meta >> 2];
|
||||
}
|
||||
|
||||
protected function writeAxisToMeta() : int{
|
||||
static $bits = [
|
||||
Facing::AXIS_Y => 0,
|
||||
Facing::AXIS_Z => 2,
|
||||
Facing::AXIS_X => 1
|
||||
];
|
||||
return $bits[$this->axis] << 2;
|
||||
}
|
||||
}
|
51
src/pocketmine/block/utils/WoodType.php
Normal file
51
src/pocketmine/block/utils/WoodType.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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;
|
||||
|
||||
class WoodType{
|
||||
public const OAK = 0;
|
||||
public const SPRUCE = 1;
|
||||
public const BIRCH = 2;
|
||||
public const JUNGLE = 3;
|
||||
public const ACACIA = 4;
|
||||
public const DARK_OAK = 5;
|
||||
|
||||
public const ALL = [
|
||||
self::OAK,
|
||||
self::SPRUCE,
|
||||
self::BIRCH,
|
||||
self::JUNGLE,
|
||||
self::ACACIA,
|
||||
self::DARK_OAK
|
||||
];
|
||||
|
||||
public const NAMES = [
|
||||
self::OAK => "Oak",
|
||||
self::SPRUCE => "Spruce",
|
||||
self::BIRCH => "Birch",
|
||||
self::JUNGLE => "Jungle",
|
||||
self::ACACIA => "Acacia",
|
||||
self::DARK_OAK => "Dark Oak"
|
||||
];
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user