PocketMine-MP 5.17.1 git-df4ada81e5d74a14046f27cf44a37dcee69d657e
RailConnectionInfo.php
1<?php
2
3/*
4 *
5 * ____ _ _ __ __ _ __ __ ____
6 * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8 * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9 * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * @author PocketMine Team
17 * @link http://www.pocketmine.net/
18 *
19 *
20 */
21
22declare(strict_types=1);
23
24namespace pocketmine\block\utils;
25
28
30
31 public const FLAG_ASCEND = 1 << 24; //used to indicate direction-up
32
33 public const CONNECTIONS = [
34 //straights
35 BlockLegacyMetadata::RAIL_STRAIGHT_NORTH_SOUTH => [
36 Facing::NORTH,
37 Facing::SOUTH
38 ],
39 BlockLegacyMetadata::RAIL_STRAIGHT_EAST_WEST => [
40 Facing::EAST,
41 Facing::WEST
42 ],
43
44 //ascending
45 BlockLegacyMetadata::RAIL_ASCENDING_EAST => [
46 Facing::WEST,
47 Facing::EAST | self::FLAG_ASCEND
48 ],
49 BlockLegacyMetadata::RAIL_ASCENDING_WEST => [
50 Facing::EAST,
51 Facing::WEST | self::FLAG_ASCEND
52 ],
53 BlockLegacyMetadata::RAIL_ASCENDING_NORTH => [
54 Facing::SOUTH,
55 Facing::NORTH | self::FLAG_ASCEND
56 ],
57 BlockLegacyMetadata::RAIL_ASCENDING_SOUTH => [
58 Facing::NORTH,
59 Facing::SOUTH | self::FLAG_ASCEND
60 ]
61 ];
62
63 /* extended meta values for regular rails, to allow curving */
64 public const CURVE_CONNECTIONS = [
65 BlockLegacyMetadata::RAIL_CURVE_SOUTHEAST => [
66 Facing::SOUTH,
67 Facing::EAST
68 ],
69 BlockLegacyMetadata::RAIL_CURVE_SOUTHWEST => [
70 Facing::SOUTH,
71 Facing::WEST
72 ],
73 BlockLegacyMetadata::RAIL_CURVE_NORTHWEST => [
74 Facing::NORTH,
75 Facing::WEST
76 ],
77 BlockLegacyMetadata::RAIL_CURVE_NORTHEAST => [
78 Facing::NORTH,
79 Facing::EAST
80 ]
81 ];
82}