Compare commits

...

902 Commits

Author SHA1 Message Date
6fb41c5c7f UpdateBlockPacket fixed and changed skinName to skinId 2016-06-22 01:09:48 +02:00
df8e1e8702 Spawn unleashed, movement fixed and some Player DataProperty cleanup 2016-06-22 00:08:52 +02:00
ef8227a074 Bump version to 0.15.0.0 and protocol changes 2016-06-15 23:59:35 +02:00
80d6f8dfb3 Updated submodule 2016-06-07 10:41:57 -04:00
e2d079a7df Bump version to 0.14.3.0 and protocol changes 2016-05-20 00:21:44 +02:00
ee9ba9f1a0 Merge branch 'mob-heads' 2016-05-18 10:10:10 -05:00
292a212827 Merge branch master 2016-05-18 10:07:57 -05:00
ac482621a1 Bump version to 0.14.2.0 and protocol changes 2016-04-28 01:50:54 +02:00
754ff9b4c4 Fixes #3223 2016-04-04 17:59:23 +08:00
aade3fe390 Closes #3432 2016-03-28 02:42:08 +08:00
8441169365 Fixed warning messages when parsing @notscript files 2016-03-28 02:27:03 +08:00
e51c6b4b42 Merge branch 'notscript' 2016-03-28 01:26:29 +08:00
73f24786cd Fixed @notscript without trailing spaces not detected 2016-03-28 01:26:15 +08:00
13d1089d30 Fixed PluginManager:: type doc 2016-03-23 23:57:02 +08:00
eb3c1f95b0 Updated .gitignore to stage src/pocketmine/resources/pocketmine.yml 2016-03-23 23:56:29 +08:00
012d46dfd8 Added Mob Heads
Fixed duplicated items in JSON file
2016-03-22 22:25:36 -06:00
2fb3b41b8d Added the @notscript tag in potential script plugins
Then we can have .php files in the plugins folder that contain /** but are not script plugins
2016-03-23 02:32:11 +08:00
085ff56362 Clearer Config::__construct() documentation. 2016-03-21 14:41:49 +08:00
23da42f8a4 Merge pull request #4068 from PocketMine/PEMapModder-patch-2
Promotes the use of reactions
2016-03-18 23:35:36 +08:00
f82c59bdc4 Fixes #3991, closes #4011 2016-03-15 22:52:49 +08:00
3f801ff6f4 Promotes the use of reactions 2016-03-13 23:40:30 +08:00
6ba0abf587 Update README.md
Mentions that mbstring is used (already used in Player.php)
2016-03-11 01:16:07 +08:00
0b06a4f703 Fixed #3692; fixed "arrows should not catch fire in fire blocks" 2016-03-10 17:45:06 +08:00
8a0c2b7c4a Fixed time 2016-03-09 19:13:20 +08:00
8e909f05ca Fixed setSaturation() working incorrectly 2016-03-09 19:13:06 +08:00
27b7260c0a Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2016-03-09 18:03:50 +08:00
dd22e4963f Fixed #4051 2016-03-09 18:02:35 +08:00
54254ffc88 Merge pull request #2955 from TruDan/master
Add DATA_SIZE to Slime!
2016-03-08 23:05:39 +08:00
9a3929d8ad Merge pull request #3724 from thebigsmileXD/patch-2
Fixed commit #3595
2016-03-07 18:58:01 +08:00
913a1fdce4 Fixed #3463 2016-03-07 18:56:24 +08:00
6e41e6837f Fixed #3266 2016-03-07 18:50:26 +08:00
df7eaa7242 Closes #3548 2016-03-07 18:48:27 +08:00
08e6caad88 Fixed #3563 2016-03-07 18:38:42 +08:00
fc08759199 Merge pull request #3978 from PEMapModder/attr
Implemented attributes
2016-03-07 18:15:15 +08:00
09ce8fab82 Fixed speed and slowness potions 2016-03-07 18:12:54 +08:00
781de3efab Addresses #4024 2016-03-06 23:13:33 +08:00
95abec1886 Merge pull request #4009 from Falkirks/patch-1
Update ISSUE_TEMPLATE.md
2016-03-02 01:31:47 +08:00
5e1f38bdb3 Update ISSUE_TEMPLATE.md 2016-03-01 08:42:46 -08:00
de10dfa737 Added issue template 2016-02-29 00:06:20 +01:00
a43db5ca25 fixed #4006 2016-02-28 22:54:56 +01:00
ccadb5f2bb Merge pull request #3526 from PEMapModder/patch-9
Fixed getNested() using cache desynchroinized from set()
2016-02-28 23:10:12 +08:00
218eed1e7a Merge pull request #3959 from dongjoon-hyun/show_travis_build_status
Show Travis-CI Build Status on README.md.
2016-02-28 10:29:29 +08:00
d39f3059dd Show Travis-CI Build Status on README.md.
For Github visitors, many projects shows its project build status in README.md.
It would be nice if PocketMine-MP shows Travis-CI build status, too.
Here is the sample layout in this PR branch.

https://github.com/dongjoon-hyun/PocketMine-MP/tree/show_travis_build_status

Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
2016-02-27 18:05:56 -08:00
2c1ef0ada3 Updated raklib module 2016-02-28 00:14:25 +01:00
e11b76318c fixing chunk sending 2016-02-27 16:35:38 +01:00
b766b969e2 Merge pull request #3387 from PEMapModder/patch-6
Allow saving resources with parent directory being recursively created
2016-02-27 20:52:03 +08:00
d6c9bcbabb Merge pull request #3993 from dongjoon-hyun/fix_travis_test
Fix Travis Test.
2016-02-27 19:40:53 +08:00
f00b52f04d Fix Travis Test. 2016-02-24 19:10:07 -08:00
Dan
35f0f36524 Update Grass.php
@PEMapModder is that all correct now?
2016-02-24 12:06:28 +01:00
e9eaf69a41 Removed redundant debug code 2016-02-23 22:33:53 +08:00
f34f54664f Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2016-02-23 21:13:29 +08:00
7ba7eaf303 Fixed wrong InteractPacket constants
Thanks @thebigsmileXD
2016-02-23 21:05:59 +08:00
16c36d5a50 Updated TesterPlugin submodule 2016-02-23 13:36:03 +01:00
ad70e23659 Updated travis 2016-02-23 13:08:57 +01:00
ccb60ff81e update loop die 2016-02-23 18:25:04 +08:00
eb00dee8a6 removed int return from getSeed 2016-02-22 13:03:27 +01:00
068ad5e924 Added ACTION_JUMP
Thanks @thebigsmileXD
2016-02-22 19:41:30 +08:00
ed9888a2cb Fixed #3963, closes #3979, added hash for non-numeric seeds 2016-02-22 19:40:40 +08:00
41a847567c RandomSeed should be a TAG_Long 2016-02-22 18:42:49 +08:00
d59fd42fc6 Fixed EntityEatItemEvent::setResidue() declaration 2016-02-22 18:34:11 +08:00
86ec7ed771 Fixed player not dying 2016-02-22 18:24:51 +08:00
1574a823d4 Fixed #3864 2016-02-22 16:29:41 +08:00
17c73e9764 Fixed #3690 2016-02-22 16:26:35 +08:00
6945256e30 Resolved #3684 2016-02-22 16:05:45 +08:00
56644fed9d Fixed #3961 2016-02-22 15:42:44 +08:00
e2f7d657e8 Fixed trapdoors 2016-02-22 15:32:07 +08:00
83f29fd871 Fixed a crash 2016-02-22 15:06:45 +08:00
a2641f923d Merge branch master 2016-02-22 14:32:48 +08:00
36028679d8 Merge pull request #3956 from redcrab2016/redcrab2016-patch-1
PR: Bug Fix - Crash if player is spawn to Y coord. >0 & <1
2016-02-22 14:15:11 +08:00
542781c2b1 Merge branch 'php7-0.14-64ff00-01' of https://github.com/PurePlugins/PocketMine-MP 2016-02-22 01:11:55 -05:00
3640e13f17 Added some assertions for level seed 2016-02-21 22:46:44 -05:00
f98f180bbd fix for #3972 2016-02-21 22:21:50 +01:00
a6cd526e60 PHP7 to master 2016-02-21 12:47:30 +01:00
9acbd85b25 Bump version to 0.14.0.0 2016-02-19 13:39:42 +01:00
ffa835d730 Fixed #3557 2016-02-19 18:50:38 +08:00
80250aa78e Resolved 1️⃣ in #3961 2016-02-19 18:33:21 +08:00
675583293f Crash if player spawn back to Y coord. >0 & <1
The issue come from  line 2664 : $v = $spawn->floor()  
If $spawn->y is in ]0..1[ then $v->y == 0
Then getBlockId : line 2670 use  'y' as -1 => Crash boom
2016-02-18 10:54:54 +01:00
fc42fc534b Merge pull request #3952 from dongjoon-hyun/add_docs_for_throws
Add @throws docs.
2016-02-18 16:45:54 +08:00
302fb9e65e Add @throws docs.
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
2016-02-17 14:22:47 -08:00
fe2957c315 Fixed imports 2016-02-18 01:43:42 +08:00
21c2e2d429 Closes #3832 2016-02-18 00:08:44 +08:00
3a184ddf97 Merge pull request #3915 from legoboy0215/patch-3 2016-02-18 00:05:10 +08:00
92ee4b3c73 Merge pull request #3876 from PEMapModder/patch-12
Add return value for PluginBase::saveDefaultConfig()
2016-02-17 20:33:15 +08:00
420007cef8 Merge remote-tracking branch 'origin/php7-0.14' into attr 2016-02-17 19:58:48 +08:00
5459576833 Added hunger and experience saving 2016-02-17 19:56:19 +08:00
05530bedc6 Bump to 0.14.0.7, new packets and fixes 2016-02-16 00:43:59 +01:00
1b4880a22f Merge branch 'patch-1' of https://github.com/Pub4Game/PocketMine-MP 2016-02-14 21:36:12 +08:00
a75c713d34 Merge pull request #3665 from zhsj/fix-start-sh
fix test php binary in start.sh
2016-02-14 21:30:02 +08:00
ef0f74bbd8 Merge pull request #3564 from PEMapModder/patch-11
Added additional information to Plugin::getDataFolder()
2016-02-14 16:09:45 +08:00
03c19aefbf Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2016-02-12 14:09:39 +08:00
3b51d2c217 Resolved #3937 2016-02-12 14:08:59 +08:00
e79976bdac Added events 2016-02-11 22:07:04 +08:00
8807617480 Fixed attriutes not sending 2016-02-11 18:45:58 +08:00
cfca0a8726 Fixed TallGrass::getDrops() 2016-02-11 16:51:27 +08:00
28967ca495 Fixed eating 2016-02-11 15:42:07 +08:00
52e8781d36 Implemented hunger-related regen and damage 2016-02-11 01:53:51 +08:00
329a525ea1 Implemented food and hunger 2016-02-10 22:49:48 +08:00
d538a254ee Resolves #3918 2016-02-09 18:25:16 +08:00
074d7ed95c Resolve CompressBatchedTask-related crashes 2016-02-07 23:36:16 +09:00
1b6e8c14f0 Bump protocol version for 0.13.2 2016-02-06 22:01:26 +01:00
1082e32fd7 Fixed ShapedRecipe constructor 2016-02-07 01:02:40 +08:00
d5d2f46db2 Added "getter" for in air ticks. 2016-02-01 07:25:40 +08:00
e5937926cd Fix typo on ContainerSetSlotPacket
hotboar -> hotbar ![](http://i.imgur.com/n97uQb9.png)
2016-01-30 14:03:28 +01:00
e597314331 Read creative menu items from json 2016-01-28 04:39:30 +01:00
8a0bd85656 Item and Block, some wont work yet 2016-01-28 04:37:09 +01:00
b7d8956f23 Use ingredient damage to check inventory items on crafting event 2016-01-26 23:43:54 +01:00
bc3dca4736 Support for 0.14.0.1 2016-01-26 22:01:35 +01:00
d5f3c19054 Fix crafting not taking item from inventory 2016-01-25 23:10:18 +01:00
c7c78b1159 Read recipes from json 2016-01-25 20:40:26 +01:00
e2a400dd6b Fix for command alias arguments 2016-01-25 18:47:20 +01:00
99855773d7 Fix for command alias arguments 2016-01-24 18:33:34 +01:00
a2734f6dc0 Merged master into php7 to support 0.13.1 2016-01-22 17:36:45 +01:00
b66ce90c94 Add return value for PluginBase::saveDefaultConfig() 2016-01-16 11:39:11 +08:00
73b97c9490 fix sound error 2015-12-29 19:11:39 +03:00
ee0d4aa124 Merge pull request #3810 from markkrueg/markkrueg-patch-1
Fix Stair.php : add "use pocketmine\item\Tool;"
2015-12-28 17:42:26 +01:00
0b42ead2ab Update Stair.php to add use pocketmine\item\Tool;
Without this >= Tool::TIER_WOODEN does not work; so stone stairs do not give drops when broken. They also revert to not being broken on next connection.
2015-12-27 12:44:56 -08:00
78525e1f74 Seperated kick/ban messages 2015-12-22 21:26:26 +01:00
fb87165cd5 Merge branch 'PEMapModder-patch-12' 2015-12-20 00:41:03 +01:00
9f481fbdbe Merge branch 'patch-12' of https://github.com/PEMapModder/PocketMine-MP into PEMapModder-patch-12 2015-12-20 00:40:52 +01:00
7125148756 Merge branch 'MagicDroidX-patch-6' 2015-12-20 00:39:32 +01:00
9ca8c06f82 Merge branch 'patch-6' of https://github.com/MagicDroidX/PocketMine-MP into MagicDroidX-patch-6 2015-12-20 00:39:19 +01:00
32a0b61c2d Merge branch 'PEMapModder-patch-14' 2015-12-20 00:37:28 +01:00
15d6bf663d Merge branch 'patch-14' of https://github.com/PEMapModder/PocketMine-MP into PEMapModder-patch-14 2015-12-20 00:37:07 +01:00
d67fb9a721 Merge branch 'TrinityDevelopers-patch-1' 2015-12-20 00:32:07 +01:00
9ff58f6ab3 Merge branch 'patch-1' of https://github.com/TrinityDevelopers/PocketMine-MP into TrinityDevelopers-patch-1 2015-12-20 00:31:52 +01:00
b83964e527 Merge branch 'PEMapModder-patch-19' 2015-12-20 00:31:04 +01:00
c3e756a712 Merge branch 'patch-19' of https://github.com/PEMapModder/PocketMine-MP into PEMapModder-patch-19 2015-12-20 00:30:53 +01:00
55ce453e17 Merge branch 'Creeperface01-patch-11' 2015-12-20 00:30:15 +01:00
e4ab7a08ec Merge branch 'patch-11' of https://github.com/Creeperface01/PocketMine-MP into Creeperface01-patch-11 2015-12-20 00:28:50 +01:00
c1a484ee5c fixed #3702 and fix for setting timezone from php.ini 2015-12-19 23:58:05 +01:00
261ce1ba8b Merge branch 'mcpe-0.13' 2015-12-19 11:38:05 +01:00
90c3e66e6b Updated for .13.1. skinName replaces isSlim, API bump 2015-12-16 14:37:46 +01:00
7954754d4c Update Cake.php 2015-12-04 16:00:02 +01:00
2ddc4455c5 Added some blocks and items 2015-11-29 01:46:35 +01:00
c803dd8e69 skins fixed and added SetPlayerGameTypePacket 2015-11-26 00:47:58 +01:00
2e5490fb5b Merge pull request #3743 from hmy2001/patch-3
From TileEntityDataPacket in BlockEntityDataPacket
2015-11-25 17:05:16 +01:00
4f12533ad3 Update ChestInventory.php 2015-11-25 21:08:28 +09:00
8edebed11c Update DoubleChestInventory.php 2015-11-25 21:08:04 +09:00
963f7ee077 Update Spawnable.php 2015-11-25 21:00:03 +09:00
734736492a Added some creative items and removed nether reactor 2015-11-23 21:56:38 +01:00
58709293cf Fixed crafting 2015-11-23 21:04:23 +01:00
2ea81710ad Bump protocol and fixed packets for 0.13.0 2015-11-23 21:01:02 +01:00
Dan
f35db4a183 Fixed commit #3595
See https://github.com/PocketMine/PocketMine-MP/pull/3595
2015-11-20 13:01:28 +01:00
815411968b Silence the ifconfig not found message 2015-11-20 00:34:29 +08:00
cbed8d40ff Fix a mispelled "new" call 2015-11-05 17:11:42 -06:00
680d40d070 fix test php binary in start.sh 2015-11-01 20:47:41 +08:00
ea8ba995ac Update Player.php 2015-10-31 21:18:06 +08:00
6ae0f3c8d8 Cleaner (and maybe faster) INI parsing 2015-10-31 20:31:24 +08:00
4d5da41cd0 Fix autoSave in PlayerQuitEvent 2015-10-31 13:22:45 +08:00
f9d7e204c8 Block update on WallSign fix 2015-10-11 01:32:33 +02:00
94b79ac28a Tool tier added to getDrops 2015-10-11 00:52:44 +02:00
958c3589c9 Fix for #3569 NetherBrickFence 2015-10-10 23:40:59 +02:00
8ce02d8687 Hunger effect is not implemented 2015-10-10 23:30:42 +02:00
09b4d4dc7a Fixes for derps found with PHPStorm code inspector 2015-10-10 23:10:24 +02:00
813acc54dc Fixed translation for banlist command usage 2015-10-10 23:06:28 +02:00
c4fb469b4e Fixed recursive call 2015-10-10 05:26:01 +02:00
04fc062b2a Merge pull request #3568 from MagicDroidX/patch-3
Fixed recursive call
2015-10-08 07:40:58 +10:30
4e59d85cca Fixed recursive call 2015-10-07 17:04:27 +08:00
ae9a3dbd81 Added additional information to Plugin::getDataFolder() 2015-10-06 20:32:33 +08:00
84be56fefb edited TODO.md 2015-10-02 00:49:56 +02:00
19b2e1b4af sorted items in init() 2015-10-01 20:05:31 +02:00
cc8eca3084 Fixed string class conflict 2015-10-02 01:52:10 +08:00
6013213159 More items 2015-10-01 08:23:05 +02:00
a7413dac92 Merge branch with fixes for recipes 2015-09-30 18:14:51 +02:00
34df516d94 new branch to fix all issues with items and blocks 2015-09-30 18:09:09 +02:00
85dc136631 Crafting recipes, and packet fix 2015-09-29 00:45:57 +02:00
72e9765ec8 Merge branch 'Stonecutter-Recipes' of git://github.com/willowmaster66/PocketMine-MP into recipes-0.12-fix
Testing pull request.
2015-09-29 00:40:23 +02:00
cf3d8f449e Added some asserts 2015-09-27 19:48:42 +02:00
eaef40618b Send default reliable and ordered packets on RakNet 2015-09-27 19:48:31 +02:00
f560d07c97 Merge remote-tracking branch 'origin/mcpe-0.12' into php7 2015-09-27 14:31:28 +02:00
606948ef8e Fixed return value of Level::getTickRateTime() 2015-09-27 14:31:15 +02:00
46760abafc Require pthreads 3.0.7 2015-09-27 14:30:50 +02:00
a7e5e33db8 Merge pull request #3507 from alejandroliu/crafting-event
Added Player to CraftItemEvent
2015-09-27 14:05:38 +02:00
ddc140af5e Updated to new pthreads version, updated RakLib 2015-09-27 13:37:27 +02:00
a3ad5783b7 Fixed getNested() using cache desynchroinized from set() 2015-09-26 12:21:43 +08:00
cbef0e25a1 Merge pull request #3454 from Yosshi999/master
Fixed DoorSound won't be played
2015-09-25 10:01:15 +02:00
6273875a22 Added Player to CraftItemEvent 2015-09-19 23:08:57 +02:00
0b9ef5b856 Update of the stonecutter recipes
Added the shaped recipes and removed the shapeless ones.
2015-09-18 22:18:14 +02:00
a3bce67d35 Updating blocks and items
Added new blocks/items and added constants to existing blocks/items for
clearer recipe making.
2015-09-18 22:17:24 +02:00
cd6afb2020 Merge remote-tracking branch 'PocketMine/mcpe-0.12' into Stonecutter-Recipes 2015-09-18 22:14:34 +02:00
0bcf639a98 Changed how exceptions work and are logged, throw proper exceptions on tasks 2015-09-18 12:03:24 +02:00
472fcfa4c7 Removed ThreadedFactory 2015-09-18 11:18:41 +02:00
8768b7fdbd Merge remote-tracking branch 'origin/mcpe-0.12' into php7 2015-09-17 12:25:05 +02:00
86c1198648 Merge pull request #3495 from 0929hitoshi/mcpe-0.12
Changing the return value of getName
2015-09-17 09:47:30 +02:00
9665dfd63e Changing the return value of getName 2015-09-16 01:21:07 +09:00
ed559fdf98 Fixed not sending UUIDs properly 2015-09-15 12:23:15 +02:00
24f8de2cc3 Bad hack, TODO REMOVE, workarounds client bug by sending inventory contents specifically for creative players <-- this commit is full of sadness 2015-09-14 20:25:57 +02:00
885fc07e5c Merge pull request #3481 from LouisBHirst/patch-getOnlinePlayers
getOnlinePlayers() only returns the players already connected
2015-09-13 21:01:51 +02:00
3892d5d74f Removed call to detach 2015-09-13 17:56:21 +02:00
c7b915639d getOnlinePlayers() only returns the players already connected 2015-09-13 11:43:51 -04:00
21c3d03000 Removed sleep from ServerKiller 2015-09-13 17:38:55 +02:00
2d1b2050dc Merge remote-tracking branch 'origin/mcpe-0.12' into php7 2015-09-12 17:10:45 +02:00
3ffdb8e552 Removed @deprecated classes, methods and properties, added some type hints 2015-09-12 17:10:11 +02:00
79aa7583ec Merge pull request #3471 from PEMapModder/patch-7
Update Player.php
2015-09-12 15:16:10 +02:00
0d6f13cb4f Update Player.php 2015-09-12 20:53:35 +08:00
29a5012c02 Merge remote-tracking branch 'origin/mcpe-0.12' into php7 2015-09-12 01:03:09 +02:00
a1a1327415 Removed signed parameter in BinaryStream->getShort() in favor of getSignedShort() 2015-09-12 00:57:09 +02:00
16ff2d99b0 Merge remote-tracking branch 'origin/master' into mcpe-0.12 2015-09-11 17:34:11 +02:00
cb222601fd Haters gonna hate, also fix misleading interface default parameter 2015-09-11 16:50:57 +02:00
922e9d93d5 Moved exception handler to a big try catch 2015-09-11 09:09:45 +02:00
e137ac4c56 Base PHP7 work to make it "run" - READ NEXT LINES!
All plugins will need to bump the API if they want to use this.
NOTE THAT THIS IS NOT THE FINAL API 2.0.0 AND THAT THERE WILL BE MORE CHANGES.
To start updating, you might also want to read https://secure.php.net/manual/en/migration70.php and specifically https://secure.php.net/manual/en/migration70.incompatible.php

To compile PHP7 with some of the required dependencies, use https://gist.github.com/shoghicp/166ab26ce5cc7a390f45
ONLY LINUX IS TESTED, DO NOT ASK FOR OTHER PLATFORMS!

----- THIS VERSION IS NOT SUPPORTED -----

This version WILL crash randomly in unexpected places due to PHP7, pthreads, PocketMine or cosmic rays.

Handle with care, and store under direct sunlight for the best performance.
2015-09-10 21:29:29 +02:00
9501d03552 FIxed a bug No sound for TrapDoor
missing "use pocketmine\level\sound\DoorSound;"
2015-09-06 22:59:02 +09:00
ccca3ec0bf FIxed a bug No sound for FenceGate
missing "use pocketmine\level\sound\DoorSound;"
2015-09-06 22:55:56 +09:00
8f24306d65 Merge remote-tracking branch 'origin/master' into mcpe-0.12 2015-09-05 18:22:28 +02:00
59a775f82c Merge pull request #3448 from willowmaster66/willowmaster66-patch-4
First item in the hotbar is not loaded correctly
2015-09-05 18:19:45 +02:00
5baa87e9fe First item in the hotbar is not loaded correctly
When you logon the first hotbar item contains the first item of the inventory, but it should contain the previously selected item.
2015-09-04 23:40:19 +02:00
bdf5c46793 Merge branch 'master' into mcpe-0.12 2015-08-31 17:51:07 +02:00
4bd14e7424 Revert commit that removed useful parameter for plugins that made backwards-incompatible changes
Revert "@PEMapModder Removed redundant parameters for Living::knockBack. Closes #3427."

This reverts commit 9adcc19154.
2015-08-31 17:48:52 +02:00
a18826473b Added enderman teleport sound 2015-08-31 17:48:28 +02:00
9adcc19154 @PEMapModder Removed redundant parameters for Living::knockBack. Closes #3427. 2015-08-31 22:05:49 +09:30
66b86c3685 Merge pull request #3423 from willowmaster66/willowmaster66-patch-1
Block cache not cleared with a call to clearcache
2015-08-31 21:43:03 +09:30
7d18b92ea1 Merge pull request #3426 from PEMapModder/patch-7
Remove unused parameter in Level::requestChunk
2015-08-30 02:56:26 +09:30
0348d181d4 Remove unused parameter in Level::requestChunk 2015-08-29 18:03:40 +08:00
0b9b1738b3 Block cache not cleared with a call to clearcache
While trying to figure out Github and looking for a different bug I found this small bug in the code. The ClearCache function on Level.php did not correctly clear the blockcache.
2015-08-27 10:44:44 +02:00
244cef3b00 . <-- descriptive commit ftw! 2015-08-23 00:25:30 +02:00
b47cebb1d5 PHP7 changes 2015-08-23 00:25:30 +02:00
7f8b39a63c Renamed NBT tags to have Tag in the name 2015-08-23 00:25:29 +02:00
34dc6ea0d6 NOTE! THIS SHOULD BE REVERTED LATER! Removed WeakRef dependency 2015-08-23 00:25:29 +02:00
d7d05c20a9 Bumped to API 2.0.0 2015-08-23 00:25:29 +02:00
91bda131be Merge pull request #3395 from luca28pet/patch-1
Spelling fix
2015-08-22 23:37:23 +02:00
1a9ec65983 Spelling fix 2015-08-22 15:58:45 +02:00
4e0fc6d1de Allow saving resources with parent directory being recursively created 2015-08-18 10:20:04 +08:00
fabb632286 More changes! 2015-08-13 18:02:10 +02:00
99df6f8edc Updated language 2015-08-13 09:17:43 +02:00
6e2ea63ce1 Merge remote-tracking branch 'origin/master' into mcpe-0.12 2015-08-12 15:00:04 +02:00
31ef7721b1 Removed network channels, bumped protocol 2015-08-12 14:59:48 +02:00
f1cc8ddde4 Merge pull request #3372 from SuperMarcus/patch-2
Fix wrong id passed to constructer in CookedFish.php
2015-08-11 19:57:33 +02:00
25b9946d9e Fix wrong id passed to constructer in CookedFish.php 2015-08-11 23:06:40 +08:00
5a626405e3 Merge pull request #3368 from thebigsmileXD/patch-2
Added sound for opening/closing (FenceGates)
2015-08-11 12:58:34 +02:00
311d8d94dd Added sound for opening/closing (FenceGates)
Added DoorSound on opening/closing FenceGates depending on #3367 @0929hitoshi 's Idea
2015-08-11 12:48:41 +02:00
7d0810a5af Merge pull request #3367 from thebigsmileXD/patch-1
Added opening/closing sound
2015-08-11 12:27:18 +02:00
a5efd0bdf8 Added opening sound 2015-08-11 11:52:08 +02:00
ff232a9f04 Merge pull request #3332 from PEMapModder/dec
Disallow registration of events without handlerList, fixes #3330
2015-08-11 16:12:59 +09:30
8889e687c9 Changed TextPacket 2015-08-10 23:40:14 +02:00
0f993f8beb setDisplayName skin fix 2015-08-10 16:33:27 +02:00
d5c2702908 Update PluginManager.php 2015-08-10 22:14:11 +08:00
62848b914d Fixed String values on NBT parsing 2015-08-10 15:09:23 +02:00
0ce343d8ca Fixed escaping values in NBT parser 2015-08-09 13:52:15 +02:00
534b988a1c Added basic Nether generator 2015-08-09 00:38:23 +02:00
a9ead5567b Improved NBT json parsing, attribute base 2015-08-08 22:39:43 +02:00
f5429ef585 Merge remote-tracking branch 'origin/master' into mcpe-0.12 2015-08-08 16:50:37 +02:00
d729961bde Merge pull request #3331 from PEMapModder/patch-5
Fixes #3330
2015-08-09 00:12:35 +09:30
f093a6498d Added base enchantment adding utilities, /enchant command 2015-08-08 16:03:04 +02:00
4dd0469792 Base enchantment class 2015-08-08 14:53:03 +02:00
fe196c6404 Added display of names on death 2015-08-08 13:35:57 +02:00
fdf10b60dc Added PlayerToggleSneakEVent and PlayerToggleSprintEvent 2015-08-08 13:10:59 +02:00
d4163ea01c Added sneaking, sprinting 2015-08-08 13:02:59 +02:00
b3efb733a2 Improved block breaking timing, added faster block breaking with swords 2015-08-08 00:33:52 +02:00
fcba9596d6 Added CanDestroy and Lock tag 2015-08-07 22:20:01 +02:00
01d93d6e10 Added CanPlaceOn tag 2015-08-07 22:13:52 +02:00
1fa467eb58 Proper recipe ingredient matching, fixed crafting type resetting 2015-08-07 22:00:35 +02:00
3e2cce3c2c use cleanup 2015-08-07 21:26:24 +02:00
d026e2ecf0 Implemented new crafting mechanism 2015-08-07 21:26:12 +02:00
696edfd31f Added custom block data (example, chests), better deep checking of same NBT 2015-08-07 17:24:35 +02:00
e9c981b586 Updated lang 2015-08-07 16:28:49 +02:00
75b7b03857 Added support for more NBT data, renaming inventories, fixed tags not being saved, added support for tags in /give 2015-08-07 16:28:27 +02:00
d1bfb304cb Added some extra tile entities, fake enchanting table 2015-08-07 12:07:39 +02:00
cba9ff393c Fixed properties for NBT, fixed dropping items removing extra data set 2015-08-06 21:51:39 +02:00
02cb9d69a9 Save items properly on several places, added NBT::getItemHelper() and NBT::putItemHelper() 2015-08-06 21:44:00 +02:00
554bfb4855 Added methods for adding custom names directly to items 2015-08-06 21:09:37 +02:00
091d0b3ff9 Added compound tag checking for Item->equals() 2015-08-06 20:25:22 +02:00
a65109ff34 Oh well that fixes block placing 2015-08-06 17:47:17 +02:00
8a3c5ab6a1 Removed DropItemPacket field 2015-08-06 16:26:38 +02:00
2cec6812a8 Added extra data printing for Items, non-automatic bytearray on NBT 2015-08-06 14:51:41 +02:00
d0bfc826ea Updated protocol details, anvil menu creation 2015-08-06 11:51:41 +02:00
2e0ef645fa Fixed several issues with spawning/despawning Players/Humans, close #3345, close #3342 2015-08-05 13:40:11 +02:00
09720a2d90 Properly implemented Shaped recipes on Network and manager, no crafting! 2015-08-04 21:59:54 +02:00
9456e20770 Added support for extra data, improved BinaryStream 2015-08-04 18:29:13 +02:00
7fd053fb09 More changes! Alsp added Anvil block and BinaryStream 2015-08-03 18:04:13 +02:00
522932d7c0 Added new sounds, events, particles 2015-08-03 12:42:47 +02:00
2b2a1b18e7 Updated RakLib protocol 2015-08-03 10:54:24 +02:00
1b812d373c Updated protocol packet ids 2015-08-03 10:53:23 +02:00
5621ab0c49 Updated some packets for 0.12, UUIDs, other stuff! 2015-08-02 01:22:36 +02:00
4258e22c02 Made some changes for 0.12 2015-08-01 19:14:44 +02:00
ff16f2ef05 Disallow registration of events without handlerList 2015-07-29 21:47:39 -04:00
9bbaf5d00d Possible workaround with #3330
Filters away non-public event handlers
2015-07-30 09:21:35 +08:00
0380e9009a Added block break tool type, fixed falling sand, fixed duplicated jungle leaves 2015-07-27 20:31:55 +02:00
866fde5351 Improved speed of some int arrays, fixed block metadata 2015-07-27 20:31:55 +02:00
9f953fa675 Fixed #3232 2015-07-27 20:31:55 +02:00
4d95c65d95 Changed TIER_IRON to TIER_STONE 2015-07-27 20:31:55 +02:00
26c9eed82e Added all block hardness 2015-07-27 20:31:55 +02:00
f3c46b12c5 Block breaking part 1 2015-07-27 20:31:55 +02:00
b14d14d3d5 Merge pull request #3305 from SuperMarcus/patch-1
Fix wrong size increasing code.
2015-07-24 09:19:55 +02:00
60ab35774a Fix wrong size increasing code. 2015-07-24 15:14:17 +08:00
2df901b064 Merge pull request #3274 from SopaXorzTaker/patch-1
Update Utils.php #2
2015-07-17 06:44:15 +09:30
0c09361c46 Added main-hard-limit memory property similar to old memory-limit, use less memory on startup (RakLib) 2015-07-11 13:16:39 +02:00
1ebf2476df Merge pull request #3245 from alejandroliu/lastPlayed-fix
Fixes lastPlayed
2015-07-03 08:33:42 +02:00
fe85b5026d Fixes lastPlayed 2015-07-02 00:54:20 +02:00
bfd3fb6636 Merge pull request #3199 from alejandroliu/tile-fix-teleport-glitch-new
Teleport glitch fix
2015-06-20 09:48:08 +02:00
0723112207 Once again... 2015-06-19 21:06:15 +02:00
be9f5521e1 Fixed undefined index on async worker crash 2015-06-19 18:36:08 +02:00
6063738e69 Fixed setting inventory index after new entity id 0 for players 2015-06-19 17:14:09 +02:00
ef738ef299 Fixed effect entity id 2015-06-19 15:34:33 +02:00
5796784442 Stop calculating permissions on closed Players 2015-06-19 14:52:08 +02:00
a1cc60d472 Fixed eye height 2015-06-19 14:49:41 +02:00
f7ec1de0fd Players now have entity id 0 2015-06-19 14:40:05 +02:00
b856e5e909 Fixed #3093 2015-06-19 13:42:20 +02:00
f7e6246dc2 Destroy cycles that reference player for faster collection 2015-06-19 13:31:29 +02:00
b166628940 Added ability to dump memory 2015-06-19 13:01:49 +02:00
4e76c30788 Update Utils.php
Correct a typo
2015-06-17 08:39:18 +03:00
33e312c7d0 Added extra memory reportings (heap, stack), stop tasks faster, added extra timeouts fro ServerKiller 2015-06-13 15:37:02 +02:00
2ac27bd382 Improved safe spawn calculation, fixes #3094 2015-06-13 14:43:14 +02:00
f490ff8074 Added mossy stone brick recipe, added chiseled stone brick recipe, added cracked stone brick furnace recipe, fixed crafting stone bricks, fixed crafting stone brick slabs, closes #3161, fixes #3160 2015-06-13 13:45:05 +02:00
eeef81e2b1 Fixed #3154 2015-06-10 10:10:07 +02:00
4a8ca96aaa Skip getting bigger bounding boxes on higher tick rates 2015-06-09 18:24:17 +02:00
eef33d64e6 Fixed new players having air ticks to 0 instead of 300 2015-06-09 15:26:28 +02:00
7cf5df7e46 New console output formatting 2015-06-09 14:40:40 +02:00
ac2bcf7e30 Made /list output similar to PC output 2015-06-09 12:21:00 +02:00
ec226105e4 Added support for overriding properties over the command line 2015-06-09 11:23:57 +02:00
2a1a09a923 Create chunks in case of dropping items outside of world boundaries 2015-06-09 09:45:40 +02:00
20911930cf Fixed bad permission nodes on /kill, closes #3139 2015-06-09 09:45:10 +02:00
2eaa12005e Changed knockback process 2015-06-08 15:52:57 +02:00
fdcddcc04b Fix entity unloading after teleporting, closes #3136 2015-06-08 15:02:00 +02:00
4fd5e9ba7d Improved RakNet encapsulated packet encoding 2015-06-08 12:45:52 +02:00
7b17bf416e Fixed Arrows not hitting entities, added new movement system 2015-06-07 21:08:46 +02:00
d0f743a99e Fixed /time add message, chunk tick reset default 2015-06-07 20:15:30 +02:00
cbb1c55a06 Improved biome generation, get grass color from gradient interpolation, improved performance of generation, try to recreate grass colors from imported chunks, closes #2845, closes #1792 2015-06-07 15:17:02 +02:00
d881dbf1a2 Only spawn break particles when needed 2015-06-07 12:33:53 +02:00
383fcba8e1 Fixed skins issue 2015-06-07 12:17:27 +02:00
e5f28e0f7a Throw exception on invalid parameters on Inventory addItem() and removeItem() 2015-06-07 12:05:10 +02:00
cf3f32fdae Added Script plugin loader 2015-06-06 23:09:54 +02:00
c4bdbc5443 Report players as EntityPlayer all the time 2015-06-06 23:09:43 +02:00
62a8f58bb0 Improved block and chunk cache, fixed PlayerQuitEvent player save 2015-06-06 20:28:37 +02:00
f21ed39c1c Improved timing reports 2015-06-06 19:07:12 +02:00
b358a2e474 Fixed underscores >.< 2015-06-06 18:12:39 +02:00
21c6eeef11 Fixed A-Z range 2015-06-06 17:57:07 +02:00
96f67bdadf Added auto save to PlayerQuitEvent 2015-06-06 17:56:36 +02:00
6ee61cce7b Faster player login 2015-06-06 17:38:32 +02:00
7f6704f761 Chunk ticking depends on chunk loaders, fixes #3118 2015-06-06 17:38:10 +02:00
9e4d88a852 New extended packet timings 2015-06-06 16:58:49 +02:00
5682026eae Fixed state corruption for auto saving 2015-06-06 15:53:28 +02:00
2a805dc0ed Limited chat and sign length using UTF-8 2015-06-05 17:08:24 +02:00
bdb9b1865b Added exception when unloading the default level without switching it first, #3112 2015-06-05 16:48:27 +02:00
1e03c5b795 Workaround for players getting stuck on far chunks 2015-06-05 16:48:27 +02:00
ec82434ef4 Added charcoal for torches, improved recipe matching for wildcards, closes #3108 2015-06-05 16:48:27 +02:00
7bafa217c8 Fixed some saving 2015-06-05 16:46:53 +02:00
fe55023761 Better Terminal detection 2015-06-05 14:07:32 +02:00
ac4194eb3f Added lily pad, checked some bounding boxes 2015-06-05 13:58:59 +02:00
6e69e15dfd Moved network check out of level, added server killer for long stops 2015-06-05 11:46:33 +02:00
a53b041984 Improved region save and saving of chunks before population 2015-06-05 02:27:37 +02:00
d542dfc2ce Split player into more methods, added extra timings 2015-06-05 00:19:45 +02:00
188f4d7778 Clear chunk cache on tile change 2015-06-04 17:36:12 +02:00
71490f60f2 Fixed other invisibility issues 2015-06-04 16:51:48 +02:00
05dbf7b47f Fixed some corrupted states, probably fixed most invisible players cases 2015-06-04 15:46:57 +02:00
14ff537e71 Improved damage sources for projectiles, falling blocks, TNT, and items 2015-05-31 14:19:47 +02:00
9e14435dbb Moved network ids to constants, improved some entity methods, more performance 2015-05-30 23:59:24 +02:00
32680843fa Added multisize loading 2015-05-30 19:38:57 +02:00
9768bf4f8a Added BlockBreakEvent::getDrops() and BlockBreakEvent::setDrops(Item[] $drops) 2015-05-30 18:26:47 +02:00
7c806c7920 Added missing brace 2015-05-30 17:29:38 +02:00
b61c54c9cb Send motion to players on downwards movement 2015-05-30 17:16:12 +02:00
a349f6d4dd Merge pull request #3083 from PEMapModder/patch-5
Added Location::fromObject(Vector3, Level, yaw, pitch)
2015-05-30 17:11:40 +02:00
9541c9751b Merge pull request #3087 from PEMapModder/patch-6
Block break optimization
2015-05-30 17:09:36 +02:00
3c0efe9af2 Block break optimization 2015-05-30 22:20:05 +08:00
24c1e6880d Added Location::fromObject(Vector3, Level, yaw, pitch) 2015-05-30 12:46:40 +08:00
74917923b6 Improved checks, area collision checks, etc 2015-05-29 15:13:19 +02:00
f20d5b2c69 Fixed MainLogger 2015-05-29 11:38:18 +02:00
eaa42f8449 Workaround for bad calls to teleport, closes #3074 2015-05-29 10:17:27 +02:00
1e2038fac5 Faster respawn when needed 2015-05-29 10:04:56 +02:00
c8abbf4f2f Added Snowballs to the creative inventory 2015-05-29 10:04:31 +02:00
009a3b657f Merge pull request #3076 from xpyctum/patch-1
Torches didn't craft
2015-05-29 08:27:24 +02:00
5b57fe6967 Update CraftingManager.php
Torch can't crafting
2015-05-29 10:30:20 +05:00
f133154919 New chunk ordering algorithm 2015-05-29 00:35:40 +02:00
8d4decc548 Fixed bad vector initialization 2015-05-28 23:58:29 +02:00
3bb037204e light population is now optional via pocketmine.yml 2015-05-28 23:39:09 +02:00
c578898aa4 Moved light population to an async task when needed, improved empty chunks 2015-05-28 23:34:07 +02:00
0f5f71e612 Forgot to check chunks after moving 2015-05-28 22:55:09 +02:00
75cab3dfc3 Improved updates after first tick 2015-05-28 22:43:39 +02:00
03f178379e Fixed items getting corrupted pickup delay, not being able to be killed by other damage sources 2015-05-28 22:17:12 +02:00
ce59703dd0 Merge pull request #3072 from alejandroliu/Kill-entity-bug
Fixes bug #3071
2015-05-28 17:34:38 +02:00
a77d82ac81 Changed how creator tag works on signs 2015-05-28 16:44:31 +02:00
1833da01fe oops 2015-05-28 15:16:09 +02:00
c97e1fdce0 Made Player::close() final, fixes several plugin issues that crashed the server 2015-05-28 15:03:45 +02:00
0e9bff6f4e Fixed armor not being sent correctly to current player, fixes #3073 2015-05-28 14:28:23 +02:00
3dd4fe706c Changed Vector3 floor() and ceil() 2015-05-28 14:20:50 +02:00
9a2170d296 protocol 27, added player spawn events after death from new protocol, added EntityEvent constants 2015-05-28 14:19:00 +02:00
8a41512194 Fixes bug #3071 2015-05-28 00:44:16 +02:00
51062940c5 Implemented QueryRegenerateEvent as base for other interfaces 2015-05-26 01:17:34 +02:00
66435d4f6a Workaround client-sede issue, remove this when fixed 2015-05-24 10:16:43 +02:00
c4d63326be Fixed fix for flowers, removed corrupted flower state, added proper identifiers that do not collide, added remaining IDs everywhere for consistency, removed magic number for constants, closes #3058 2015-05-23 22:49:06 +02:00
f91a3a2666 Fixed invalid fix for block updates that corrupted state 2015-05-23 22:47:46 +02:00
d429992f5b Fix Fallable not dropping after explosion, Fixes #2735, Fixes #2806.
Signed-off-by: Michael Yoo <michael@yoo.id.au>
2015-05-23 22:36:23 +09:30
76c27fc18b Use broadcast permission to broadcast tips and popups 2015-05-23 22:05:48 +09:30
a0f8bc15dc Fix small whitespace issues, make broadcasts return count() as specified in PHPDoc 2015-05-23 22:05:48 +09:30
adc5aa11ac Added Server->broadcastTip() and Server->broadcastPopup()
Signed-off-by: Michael Yoo <michael@yoo.id.au>
2015-05-23 22:05:48 +09:30
388f5c2c91 Added flowers compatible with MCPE 0.11.
Signed-off-by: Michael Yoo <michael@yoo.id.au>
2015-05-23 21:57:59 +09:30
f64caf6c96 Use best method to create identifier on linux 2015-05-23 14:10:42 +02:00
b2b4cf788c Fixed possible channel order issue with chunks and start game packet 2015-05-23 13:38:50 +02:00
d7be531868 Limit amount of messages per tick per player to 2 2015-05-23 12:09:26 +02:00
5ad4f44dce Fixes sending newlines on messages to impersonate chat messages 2015-05-23 12:03:47 +02:00
7201372b0d oops 2015-05-23 12:02:20 +02:00
744ea6af8f Fixed #3023 2015-05-23 11:47:07 +02:00
1da0a48edb Fixed #3055 2015-05-23 11:37:48 +02:00
be6b0656a0 Do async saving only when needed 2015-05-23 10:54:15 +02:00
4f7aac50d3 build 13 2015-05-22 16:46:23 +02:00
149234f125 Added asynchronous file writing 2015-05-22 16:32:08 +02:00
cfe5ca91b2 Updated endpoint 2015-05-21 16:31:42 +02:00
46f20d36b3 Improved unique id generation for server 2015-05-21 12:59:33 +02:00
cde2d39029 New statistics system 2015-05-21 11:41:11 +02:00
36ddbf286d Build 12, added SILENT flag to entities, closes #3052 2015-05-21 11:40:51 +02:00
8d4abe2f39 Improved world loading, added chunk queue delay, closes #3046 2015-05-20 11:05:35 +02:00
32722856ea Updated FloatingTextParticle to use less heavy method 2015-05-19 21:59:23 +02:00
7753b1d8be Fixed items (and other entities) vibrating, bad offsets in tile calculation 2015-05-19 21:29:30 +02:00
92a2be024a Improved saving of modified properties 2015-05-19 20:49:47 +02:00
66f28f6dc4 Fixes #3042 2015-05-19 17:48:35 +02:00
1122a3c511 More undefined variables D: 2015-05-19 16:02:59 +02:00
0c6d8b9815 Fixed loader counter on Level, closes #1147 2015-05-19 14:49:18 +02:00
70a7c4c552 Added nametag saving 2015-05-18 19:04:37 +02:00
840690d801 Replaced old deprecated calls 2015-05-18 15:52:31 +02:00
f3a53be117 Moved Human->setNameTag() to Entity 2015-05-18 15:29:31 +02:00
ea7c0cb357 Removed debug code 2015-05-18 14:00:21 +02:00
85c43ba011 Allow setting nametag for any kind of entity 2015-05-18 13:08:06 +02:00
fbbe02a3bc Fixed some issues related to new indexes 2015-05-16 22:36:55 +02:00
fb05636694 Fixed Item vibration 2015-05-16 21:38:10 +02:00
63a5269313 Added settings.profile-report-trigger to only extract timings on a given tps rate 2015-05-16 16:02:32 +02:00
7705d8c52f Updated translations 2015-05-16 15:49:08 +02:00
419abdaad6 Proper chunk unloading in case of generation/loading without players 2015-05-16 15:43:34 +02:00
d6ebff412c Added ChunkLoader interface 2015-05-16 15:28:31 +02:00
7a34417e67 Kill player below -16 as now the bottom of the world can be rendered, send player count 2015-05-15 16:51:20 +02:00
76e6ccebd5 Proper recipe matching from network, bumped protocol, build 11, fixed entities not being killed on void (closes #3021), fixes achievement acquireIron not being possible (fixes #2600) 2015-05-15 13:59:29 +02:00
e61db8ad06 Added login timeout for players that do not complete the login process in time 2015-05-14 14:52:39 +02:00
b1edfd7631 Improved Falling blocks physics, entity kill, chunk unserialize, fixed flat generator color, fixed nbt tags __toString(), fixed explosion offsets, fixed increased player interaction range in creative 2015-05-13 12:18:59 +02:00
f3bdef7513 Fixed Anvil chunks not having NBT set 2015-05-12 16:52:11 +02:00
9791071262 Added Player->teleportImmediate() for tp force 2015-05-12 00:21:02 +02:00
aa38a4885f Fixed some issues with world generation and not creating chunks, closes #3008 2015-05-11 23:53:01 +02:00
de0f653027 build 10, improved levelDB constants 2015-05-11 20:31:28 +02:00
13906b32b8 Check connection status on batch, check sleep when players leave a level 2015-05-10 14:58:07 +02:00
925b0c1b07 Fixed empty chunks on generation, closes #2998 2015-05-10 13:18:39 +02:00
db409851e9 World generation is timed by type and chunks can be created on the fly 2015-05-09 19:03:41 +02:00
ab18b7833f Fixed light population happening before population 2015-05-09 16:37:34 +02:00
1a1b8830a4 Added MemoryManager object watcher for object leak debugging, improved SPL Thread/Worker stopping, fixed some possible weak references crashing unexpectedly 2015-05-09 16:11:12 +02:00
7e539ec85a Fixed invalid check 2015-05-08 15:38:51 +02:00
563f6f8e4f Interaction checks happen using the plane and not 3d space 2015-05-07 15:38:22 +02:00
82b0dbfe8e Improved /status, added world information 2015-05-06 19:11:47 +02:00
a4769248fb Set nextTick on start 2015-05-06 19:11:47 +02:00
fb03df3d06 Calculate skylight on chunk population 2015-05-06 16:57:49 +02:00
44b5c23ee1 Fixed dead entities and Item picking, improved timing reports 2015-05-06 16:21:35 +02:00
bff51322af Merge pull request #2986 from 64FF00/master
Fixed /tell command not displaying the sender's name correctly (aka "I'm Bored x3")
2015-05-05 14:27:49 +02:00
cc58d96071 Fixed /tell command not displaying the sender's name correctly 2015-05-05 19:59:12 +09:00
001915fcd6 beta build 9 2015-05-04 17:58:29 +02:00
cd607b0cec Oops distance 2015-05-04 17:57:03 +02:00
5ec4b3f46f "Fixed" #2982 2015-05-04 17:53:48 +02:00
d9a9808844 Added interaction and 3rd person cheat protection 2015-05-04 17:52:55 +02:00
f718d06a7d Updated RakLib, tick inside thread instead of depending on main thread 2015-05-03 23:40:36 +02:00
563f7404fe Time less than target fix 2015-05-03 23:20:40 +02:00
0ddf396b08 Use time_sleep_until() instead of usleep(), improved thread kill 2015-05-03 23:17:39 +02:00
d830386786 Changed default async compression 2015-05-03 22:14:57 +02:00
49f34ec524 Send spawn position after respawn on death, fixes #2976 2015-05-03 21:46:46 +02:00
9ec609d025 Improved Player flight detection after setMotion(), other method improvement 2015-05-03 13:42:54 +02:00
0ead3ec781 Changed round/floor to floor on BlockIterator 2015-05-02 17:38:45 +02:00
fdf395721e Improvements on player move updates 2015-05-01 15:09:37 +02:00
211e1ae121 Fixed slots on creative 2015-04-30 17:51:04 +02:00
923be2fffc Improved slot selection on creative mode, closes #2960 2015-04-30 12:53:03 +02:00
fb257c16f1 Set entities on fire if hit by an entity on fire 2015-04-30 11:40:22 +02:00
b33706d427 Merge pull request #2959 from LDX-MCPE/patch-1
fixed typo
2015-04-30 08:34:57 +02:00
LDX
6bcb319fb5 fixed typo 2015-04-29 23:12:22 -04:00
d4b2e3d1b7 Improved heightmap generation 2015-04-29 23:19:27 +02:00
7754aa71a3 Fixed end of regex on Config 2015-04-29 21:09:35 +02:00
978aa2ba0f Protocol changes 2015-04-29 17:04:34 +02:00
f74f5cfde7 Add DATA_SIZE to Slime! 2015-04-29 15:55:11 +01:00
c2b3f7cd7f Noclip in spectator mode, changed chunk format 2015-04-29 12:29:59 +02:00
3872a21474 Allow setting the flying status for any given player 2015-04-29 11:31:04 +02:00
11e2d23b83 Improved LoginPacket and BatchPacket handling 2015-04-29 10:55:29 +02:00
2cd78d4ae3 Merge pull request #2951 from EnderBrine101/patch-1
No longer needed :P
2015-04-28 18:52:21 +02:00
08f09cc3c8 No longer needed :P 2015-04-28 17:34:38 +01:00
1b13a4c1ec Protocol 25 2015-04-28 16:56:59 +02:00
71587db2be Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2015-04-28 14:49:52 +02:00
8caf04ade5 build 8, allow setting selected hotbar slot, auto_jump setting 2015-04-28 14:20:35 +02:00
488fbc27fe Fixed issue reading/writing YAML 2015-04-27 21:26:50 +02:00
84d1f4596b Improved Anvil live conversion speed 2015-04-27 14:43:33 +02:00
6fc7ee2775 Fixed some bad defaults, improved spawning 2015-04-27 14:43:33 +02:00
ef00103fec Merge pull request #2944 from alejandroliu/generator-list
Added a getGeneratorList
2015-04-27 09:53:50 +02:00
bdf069ebe1 Added a getGeneratorList 2015-04-27 01:18:04 +02:00
5942cafa53 Send in the correct channel 2015-04-26 23:11:07 +02:00
fbdbac06cc New delayed teleporting system 2015-04-26 23:04:24 +02:00
fba12f2a13 Be sure that AsyncTask finish executing, fixes #2931 2015-04-25 17:52:57 +02:00
7ad98d4659 Deprecated CallbackTask, moved sleep checking to level 2015-04-25 17:28:30 +02:00
1d8c29add7 Fixed Block Iterator and getLineOfSight() 2015-04-24 18:10:45 +02:00
d4cae729c3 Added AsyncTasks timings 2015-04-24 17:21:39 +02:00
529f9b148b Save/reload skin on Human based entities 2015-04-24 17:05:00 +02:00
20842636f9 Added timings to chunk sending 2015-04-24 16:59:46 +02:00
7b699d9afd Improved fall damage while on jump boost, new protocol update, build 7, allow for live inventory resizing 2015-04-24 16:43:59 +02:00
ba635b8858 Fixed particles being emmited on non-player block breaks 2015-04-23 17:02:37 +02:00
04f3cc4905 Measure highest TPS load and lowest TPS between measurements 2015-04-23 15:34:42 +02:00
4a1e122605 Move UUID generation before PreLogin 2015-04-23 12:07:34 +02:00
a0739a7b03 Added more level tick options, force player ticks, base tick rate for levels 2015-04-23 11:34:01 +02:00
f73bd02198 Allow to tick players partially 2015-04-23 11:19:27 +02:00
ec7db3be4f build 6! 2015-04-22 17:08:59 +02:00
2ea8835b12 Removed possible crash on RakLibInterface 2015-04-22 15:45:04 +02:00
0aebcb9f81 Correctly load Anvil worlds 2015-04-22 12:07:27 +02:00
1578fc3ddb Improved world generation manager, UUIDs (some work for future usage) 2015-04-21 19:54:16 +02:00
514ce0fb04 Fixed colors not being shown on windows :s 2015-04-20 17:55:49 +02:00
f6e88ec055 Protect against null chunk on entity 2015-04-20 17:29:58 +02:00
15b4cd8fb3 Improved format constants, fixed cake eating when max health is > 20 2015-04-20 17:25:58 +02:00
f88aed1208 Fixed NBT parsing on false properties 2015-04-20 13:57:16 +02:00
6ed63edd89 Removed some remaining references, removed duplicated code on Anvil 2015-04-19 16:49:15 +02:00
897774f848 Increased manuall garbage collection rate 2015-04-19 16:16:05 +02:00
bf4a8398c4 Moved chunk garbage collector to memory manager 2015-04-19 16:14:54 +02:00
05385acb36 Added Memory Manager timings 2015-04-19 16:01:46 +02:00
094234dc0f Updated references and submodules 2015-04-19 15:37:18 +02:00
c2f72ea9ac Updated languages 2015-04-19 11:50:30 +02:00
e3c48b22cb Anvil fixes, improved memory settings 2015-04-19 11:45:43 +02:00
5860bdcc4d Improved network 2015-04-18 22:38:57 +02:00
1b84340e3f Improved manager 2015-04-18 22:35:00 +02:00
61828baa8f Improved manager 2015-04-18 22:33:50 +02:00
11ecaaa87f fixed oops in RakLib 2015-04-18 21:04:07 +02:00
b2c25eaf36 Added MemoryManager, new memory properties, improved performance, updated RakLib, fixed misc. bugs 2015-04-18 20:13:52 +02:00
ddc152ae0a Merge pull request #2903 from PEMapModder/patch-4
Added paramter types for some Config.php functions
2015-04-17 18:15:12 +02:00
08a612954e Added creative mode block list API 2015-04-17 18:01:10 +02:00
5b10ccf431 0.11.0 build 5, removed chat format workaround, improved gamemode switch, send allowed creative blocks (TBI as API) 2015-04-17 17:10:25 +02:00
2add19a4c8 Added paramter types for some Config.php functions 2015-04-17 16:32:40 +08:00
7ee21f6254 Try to clean chunks on other threads 2015-04-15 22:14:51 +02:00
f79476f530 Fixed health setting 2015-04-15 22:00:01 +02:00
4fbafe7c2f HACK: added workaround for MCPE eating characters, enable settings.force-language 2015-04-15 21:14:24 +02:00
d6186fa7c6 Moved Player->setGamemode() message to /gamemode command 2015-04-15 20:49:38 +02:00
88797d4c6c Enabled GC on AsyncWorker 2015-04-15 20:47:34 +02:00
fc2e4ddc63 Fixed long trunk generation 2015-04-15 20:47:18 +02:00
7f28deefcb Better BatchPacket decoding and LoginPacket handling 2015-04-15 19:30:49 +02:00
81fe98d4cc Added Milk bucket to creative inventory 2015-04-15 17:19:05 +02:00
dfec44645b Added milk drinking 2015-04-15 16:45:03 +02:00
1ef6328635 Allow negative potion effects 2015-04-15 16:37:13 +02:00
c0782caab9 Added alternate name for Swiftness 2015-04-15 16:15:17 +02:00
298b973604 Fixed a crash when saving chunks 2015-04-15 15:54:27 +02:00
5ca4f5416c More protocol updates 2015-04-15 15:53:11 +02:00
c36c0dfa66 Fixed health boost addition 2015-04-15 13:04:53 +02:00
64c366bdb5 Protocol 22 2015-04-15 12:38:52 +02:00
68ea9b067f Added health boost potion effect, added Player->sendTip(), MCPE 0.11.0 build 4 2015-04-15 12:33:16 +02:00
79adbdeafe Fixed trees not generating trunk 2015-04-15 11:04:00 +02:00
e09ebb0623 Oops! 2015-04-14 21:12:57 +02:00
91388c6b86 Added chunk-sending.cache-chunks property (old advanced-cache), improved chunk unload saving times 2015-04-14 20:57:09 +02:00
42eda170b5 Oops, forgot to do it correctly! 2015-04-14 20:39:37 +02:00
6ee3a7b8d7 Updated languages 2015-04-14 18:28:57 +02:00
18f6e1805f MCPE 0.11.0 build 3 2015-04-14 18:25:05 +02:00
0b176b3fe0 Implemented Channeled packet sending 2015-04-14 18:24:40 +02:00
bb945446b7 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2015-04-14 14:04:26 +02:00
1d1766a876 Removed format characters correctly :) 2015-04-14 14:04:10 +02:00
bd560ab3b1 Spawning mechanics change 2015-04-14 01:04:17 +02:00
547aa2ae31 Removed formatting on signs, allow OPs to use colored chat (or people with disabled remove format) 2015-04-13 16:45:20 +02:00
a993f15387 Added tick ms to level warning, call correct method on Anvil 2015-04-13 16:34:42 +02:00
1865622b89 Added settings.force-language property to force server language on clients 2015-04-13 12:02:40 +02:00
31387ff0be Added localized invalid name message 2015-04-13 11:36:15 +02:00
928660d59a Updated languages 2015-04-13 00:25:39 +02:00
5e2a21fc26 Added level-settings.auto-tick-rate property, added Level tick rate 2015-04-12 14:13:36 +02:00
410f6ba618 Fixed some potion effect names 2015-04-12 12:46:06 +02:00
05a9ad57bd Fixed BaseLang->get() 2015-04-12 12:41:38 +02:00
ba226d03c3 Added more translations 2015-04-12 12:27:55 +02:00
674a486654 Fixed #2863 2015-04-12 12:19:28 +02:00
e9963b603d Fixed #2864, closes #2864 2015-04-12 12:17:53 +02:00
e2bae92df8 Updated language files and command descriptions 2015-04-12 00:59:12 +02:00
8d468a1efb Format fix 2015-04-11 21:59:55 +02:00
ddeea2942c Updated RakLib, improved packet reading 2015-04-11 21:41:05 +02:00
a65c300a0a Fixed moving from different chunks, lots of issues fixed (all kind of strange things) 2015-04-11 21:39:51 +02:00
363e0e3b13 Revert slot change harder 2015-04-11 18:50:27 +02:00
6504047292 New translations, fixed multiplayer.player.leave 2015-04-11 18:19:28 +02:00
87a779afaf Enforced max distance checks 2015-04-11 18:07:12 +02:00
6b1b6711bd Send extra id on Add/Remove player 2015-04-11 18:00:25 +02:00
f71cf1c749 Added Fallback formatting codes to Windows/Android 2015-04-11 17:27:20 +02:00
3685d967a8 Fixed crash on /ban 2015-04-11 17:09:01 +02:00
d1006de421 Added fallback to BaseLang, better use by plugins 2015-04-11 16:15:45 +02:00
3cf42b558c Fixed language selection 2015-04-11 15:37:44 +02:00
5a0d1affcc Base translations moved to submodule! 2015-04-11 15:31:22 +02:00
414549659a Fixed crash on already dead players, closes #2856 2015-04-11 15:13:27 +02:00
3b6e10b759 More langs :D 2015-04-11 14:59:15 +02:00
c2138aa30c More language files 2015-04-11 12:56:38 +02:00
de052a79de Localized kick messages 2015-04-11 02:31:34 +02:00
c29ae333a2 Translate format text 2015-04-11 02:15:46 +02:00
0c041ebca3 Added base translation system 2015-04-11 01:32:08 +02:00
3224cd7dc5 Added Grass Path block, fixed redstone blocks not being able to be placed 2015-04-10 19:05:10 +02:00
3f60f7c0fb Merge pull request #2847 from matcracker/patch-3
Added Iron Shovel
2015-04-10 16:52:01 +02:00
c786ace355 Skin methods 2015-04-10 16:47:18 +02:00
60ac8f91ba Fixed pre-login disconnect messages 2015-04-10 15:26:32 +02:00
5720cb2be7 Added Iron Shovel
I think to have add Iron Shovel in creative inventory.
2015-04-10 15:06:02 +02:00
c32a7467bb Fixed wrong shift due to compiler change 2015-04-10 15:05:15 +02:00
0626d27003 Moved skin checks after protocol checks 2015-04-10 10:23:28 +02:00
2ae095a15a Fixed disable-ansi not working 2015-04-10 10:16:57 +02:00
5d102c2ede Fixed backwards compatibility issue on PlayerInteractyEvent 2015-04-10 10:16:03 +02:00
a7b1c6e086 Merge pull request #2844 from Falkirks/patch-1
Fix #2843
2015-04-10 08:48:22 +02:00
d855bbba0b Fix #2843 2015-04-09 20:59:42 -07:00
73d1d131e1 Added skin checks to Player and Human 2015-04-09 20:58:38 +02:00
0aa9586a52 Packet crashes fixed :D 2015-04-09 20:44:04 +02:00
205f6d50c1 Fixed PlayerActionPacket encode 2015-04-09 20:00:39 +02:00
ac6e2f9bf7 Fixed packet issues 2015-04-09 19:55:19 +02:00
1ddd58fd3b Fixed a few issues 2015-04-09 18:50:34 +02:00
66b58e36a1 Updated Code Guidelines 2015-04-09 18:24:29 +02:00
86184a230e Merge branch 'mcpe-0.11' 2015-04-09 18:18:10 +02:00
b4a0afc2c8 Getting ready, protocol changes! 2015-04-09 17:42:06 +02:00
f2e2cec024 Removed entity mask 2015-04-09 14:23:37 +02:00
0117e8dfae New codename, MCPE version, bumped split packet limit 2015-04-09 12:30:07 +02:00
69f841a00c Added Squids with basic AI 2015-04-09 00:12:50 +02:00
02ba9ffc16 Improved entity movement ySize offset 2015-04-08 22:09:06 +02:00
71657a2a4e Improved effects, threading changes 2015-04-08 17:31:06 +02:00
76767294bf Fish items, block of redstone! 2015-04-08 15:34:50 +02:00
3cae81c01b Added Nausea effect 2015-04-08 13:40:48 +02:00
141c0a297e Skins, protocol changes, handle split packets 2015-04-08 13:00:15 +02:00
45c6694ef9 Merge pull request #2827 from PEMapModder/patch-3
Removed useless code in Entity::getDirectionVector()
2015-04-07 10:11:09 +02:00
9b09b7ddd1 Removed useless code in Entity::getDirectionVector() 2015-04-03 15:15:35 +08:00
c9adc336ee Fixed items doing crazy things 2015-03-29 18:10:02 +02:00
d5ba2a72a5 Added strength, weakness, resistance effects, fixed entity area 2015-03-29 14:49:47 +02:00
9f6b5992e3 Merge pull request #2813 from Gamecrafter/patch-1
Really small fix
2015-03-29 20:32:11 +10:30
e51858ae17 Update ReloadCommand.php 2015-03-28 11:58:32 -07:00
c2baaf435d Merge branch 'master' into mcpe-0.11 2015-03-28 19:14:02 +01:00
c422b83abf Merge pull request #2812 from alejandroliu/patch-1
Added missing LEATHER_BOOTs to Item::$list
2015-03-28 18:08:08 +01:00
e0a6d0feab Critical arrows, fixed arrow interception calculation 2015-03-28 17:54:10 +01:00
0a85ad0d1f Improved trees, improved inventory transactions, improved snowball/bow usage 2015-03-28 16:59:15 +01:00
91315645cd Added missing LEATHER_BOOTs to Item::$list
For some reason the leather boots are missing.
2015-03-28 07:25:42 +01:00
47de616ac5 Fixed commands, added level automatic tick delay, improved biome gradient 2015-03-28 01:26:06 +01:00
e0522d8b1a Fixed data on generation, biome gradient 2015-03-27 12:42:59 +01:00
08f2b7f291 Moved chunk population to async tasks, and no more cut trees! 2015-03-27 01:57:08 +01:00
72c4c01542 Yay generation uses async tasks 2015-03-26 18:21:39 +01:00
668ddeeb13 Removed outdated Cache 2015-03-26 11:55:51 +01:00
286c1ee880 Added chunk spawn threshold for players 2015-03-26 11:28:44 +01:00
ed2ba70a29 Merge remote-tracking branch 'origin/master' into mcpe-0.11 2015-03-26 01:32:44 +01:00
962c28aaca BatchPacket, compress any packet depending on the size, really fast threaded chunk sending 2015-03-26 00:06:46 +01:00
7d1313c63d >= <= on move 2015-03-25 20:00:55 +01:00
d19631226f Improved Entity attack()/heal() event firing 2015-03-25 11:11:02 +01:00
6836e4fe58 Merge pull request #2800 from alejandroliu/patch-1
Corrected MINECART constant definition on Item.php
2015-03-25 11:03:39 +01:00
4a79c65544 Corrected MINECART constant definition on Item.php
MINECART was defined as 329, where it should be 328.
2015-03-24 23:47:33 +01:00
d1760d9bb8 Synchronize hotbar slots, removed RotateHeadPacket, improved MoveEntityPacket, FullChunkDataPacket 2015-03-24 16:26:46 +01:00
355ddc469c Merge pull request #2788 from alejandroliu/patch-1
Clone initial chunk in Flat.php
2015-03-24 10:23:35 +01:00
4e934654ef More awesomeness, No AI flag! 2015-03-23 14:44:04 +01:00
38f3dda13b Oops! 2015-03-23 11:15:03 +01:00
c68cd2c496 Cloned the initial empty chunk 2015-03-23 10:28:29 +01:00
a6b8170d9c Improved biomes 2015-03-23 08:02:18 +01:00
9da26fdb88 World generation with biomes! 2015-03-22 22:57:40 +01:00
1666602652 Improved memory output, logging, removed locks 2015-03-22 03:20:48 +01:00
d2bf92c3ed New batched UpdateBlockPacket, added Level->sendBlocks() 2015-03-22 02:44:39 +01:00
93a50d08e7 Merge branch 'master' into mcpe-0.11 2015-03-22 02:20:32 +01:00
1f977f68c0 Merge pull request #2794 from sekjun9878/master
Utils\Config preserves document type between reloads. Fixes #2777
2015-03-21 15:03:05 +01:00
91a26c15dd Utils\Config preserves document type between reloads. Fixes #2777 2015-03-21 21:35:57 +10:30
add380c7ed A few fixes! 2015-03-21 00:45:29 +01:00
652987110a Added popup notices! 2015-03-20 17:56:07 +01:00
58253be0a0 Implemented swiftness, added invisible status to FloatingTextParticle 2015-03-20 17:19:06 +01:00
b42424eb22 Sounds! 2015-03-20 16:42:50 +01:00
1d1a8a316e Take-2: Delay "parsePreset" until we have to really generate a block 2015-03-20 08:13:55 +01:00
a2b3e48b45 Added /particle command 2015-03-20 03:37:58 +01:00
ebc8928c21 Implemented effect colors 2015-03-20 02:31:54 +01:00
62ba36b474 New TextPacket, second part! 2015-03-19 20:27:51 +01:00
2c59983672 New TextPacket, first part 2015-03-19 18:48:03 +01:00
8ae9cd4eaf Clone initial chunk in Flat.php
The Flat generator destroys Chunk at 0,0.

What happens is that it request the level to read Chunk at 0,0.  It then uses that chunk to create the template chunk.  However this obliterates whatever was in Chunk at 0,0.

Added a line to "clone" this chunk, so when parsePreset generates the template chunk, all this goes to a copy rather than the original file chunk 0,0.
2015-03-19 15:41:26 +01:00
275a1e3f60 Water breathing potion 2015-03-19 10:14:35 +01:00
6735234bf4 Protocol update 2015-03-19 10:12:09 +01:00
d66a2d7105 Merge branch 'master' into mcpe-0.11 2015-03-19 09:18:39 +01:00
c882df7465 Fixed destroyblock particle duplicating on clients 2015-03-19 08:30:07 +01:00
f21e457dc0 Fixed particle constructor 2015-03-18 21:49:01 +01:00
6bf30c133a Merge pull request #2785 from PocketMine/revert-2776-armor-fix
Revert "Implemented proportional armor modifier, applied armor in other ...
2015-03-18 17:26:53 +01:00
d34499e67b Revert "Implemented proportional armor modifier, applied armor in other damage types and consume armor when player is damaged" 2015-03-18 17:26:06 +01:00
c2a3298a7e Particles. 2015-03-18 16:34:19 +01:00
b31604a536 Fixed data sending, more particles 2015-03-18 12:11:44 +01:00
c00370cfbf Added experimental particles 2015-03-18 08:51:38 +01:00
7c0bd45d1d Merge pull request #2779 from alejandroliu/patch-1
Fixed a silly typo in Server.php line 1142.
2015-03-18 14:04:36 +10:30
5f2254cc42 Fixed a silly typo in Server.php line 1142.
Fixed a silly typo in Server.php line 1142.  Yes, the "t" is next to the "y" on my keyboard too!
2015-03-17 23:48:23 +01:00
8169803bb4 Updated Water/Lava to use new methods 2015-03-17 21:22:51 +01:00
5a35e7b058 Removed damage reduction by armor for lava 2015-03-17 21:10:54 +01:00
1b25cd6ffa Merge branch 'master' into mcpe-0.11 2015-03-17 19:12:03 +01:00
891eeff75a PocketMine 1.4.1 2015-03-17 18:01:58 +01:00
b4f62bf423 Fixed salling sand breaking on full BB partial blocks, closes #2770 2015-03-17 18:00:19 +01:00
7c76c1e3d7 Changed generator choosing logic, add proper preset if needed, fixes #2751 2015-03-17 18:00:19 +01:00
37bc1273ee Implemented double chest fix, closes #2744, fixes #2493 2015-03-17 18:00:19 +01:00
ffcdf49912 Allow plugins to cancel some kicks better, closes #2743 2015-03-17 18:00:18 +01:00
3e893ed0f7 Implemented hardcore banning, closes #2574 2015-03-17 18:00:18 +01:00
bfb7e8bb9e Merge pull request #2776 from PEMapModder/armor-fix
Implemented proportional armor modifier, applied armor in other damage types and consume armor when player is damaged
2015-03-17 17:57:28 +01:00
5067b96184 Merge pull request #2631 from 64FF00/master
TallGrass blocks should be only placed on grass blocks
2015-03-17 17:49:46 +01:00
cb2157ea80 Merge pull request #2614 from mmlmml1/master
Fixed for Iron bars and stonecutter
2015-03-17 17:36:01 +01:00
6af87814e3 Added 64-bit entity data field 2015-03-17 16:26:02 +01:00
5b3e65345f Fixed a typo
`$source->isCancelled()` shouldn't be checked twice
2015-03-17 22:20:33 +08:00
8aa8ae5094 Implemented proportional armor modifier, applied armor in other damage types and consume armor when player is damaged 2015-03-17 20:04:59 +08:00
b5b46bfd7e Improved thread count 2015-03-17 00:47:43 +01:00
2ae80031f0 New implementation of sending/setting/getting entity data, added effect saving 2015-03-17 00:01:54 +01:00
85c5714cbf API 1.12.0, 1.5dev 2015-03-16 21:39:32 +01:00
bc31df37d0 Added invisibility potion, metadata sending for invisibility/nametags 2015-03-16 19:05:31 +01:00
29ca349b3d Less protocol madness 2015-03-16 12:13:52 +01:00
4ec584d800 Added real memory and thread usage 2015-03-16 11:56:00 +01:00
4383e272eb Added Effects base, /effect and methods 2015-03-15 23:15:54 +01:00
f9361aa931 Use new colors in terminal 2015-03-15 18:32:36 +01:00
220d2b7bee Fixed NBT IntArray off-by-one reading 2015-03-15 16:40:44 +01:00
d5601b0c9f Generator works! 2015-03-15 16:40:18 +01:00
5bfc747622 Fixed NBT IntArray off-by-one reading 2015-03-15 16:39:53 +01:00
b0f8c14640 Added Terminal class, Improved normal generator speed 2015-03-15 00:15:24 +01:00
328cd585c0 Merge branch 'biome-generation' into mcpe-0.11 2015-03-14 15:52:38 +01:00
807107e581 Fixed constructors, default memory to -1, default async generator 2015-03-14 15:51:21 +01:00
94c2ec8498 Fixed constructors, default memory to -1, default async generator 2015-03-14 15:50:33 +01:00
9158cc4f19 Implemented Threaded ClassLoader, improves class loading while on different threads (no need to synchronize states) 2015-03-14 15:22:42 +01:00
11c13cd666 Implemented Threaded ClassLoader, improves class loading while on different threads (no need to synchronize states) 2015-03-14 15:22:13 +01:00
284958a21e Merge branch 'mcpe-0.11' of bitbucket.org:pocketmine/pocketmine-mp into mcpe-0.11 2015-03-14 02:39:12 +01:00
91e8bdbd37 Fixed size on MobSpawnParticle 2015-03-13 16:21:33 +01:00
9e0b9a6e5b Added right and left click interaction events 2015-03-13 14:39:37 +01:00
e48a3e5713 Added some types of Particles, Block break particles 2015-03-13 14:24:19 +01:00
1ce7cc64a6 Use ContainerSetSlotPacket instead of ContainerSetContentsPacket 2015-03-13 10:25:48 +01:00
7f9aad6840 Removed player foreach on Entity 2015-03-13 09:27:09 +01:00
3af784012c Fixed packets 2015-03-13 09:27:09 +01:00
a6c19734ce Fixed picking up items, entity IDs on packets 2015-03-13 09:27:09 +01:00
8ddd701d76 Renamed LoginStatusPacket to PlayStatusPacket, added spawn status, new colors 2015-03-13 09:27:09 +01:00
15ee0c37c6 Fixed Entity->setMotion() for Players 2015-03-13 09:27:09 +01:00
fc128affc5 Removed chat wrapping, deprecated TextWrapper 2015-03-13 09:27:09 +01:00
218fd999b0 More packets changed, unique IDs D: 2015-03-13 09:27:09 +01:00
eeeaac04e9 Updated packet order, removed player entity id as 0 2015-03-13 09:27:09 +01:00
8679ad5b86 Added colors, Disconnect Packet, protocol 21 2015-03-13 09:27:09 +01:00
2cd757d80a Fixed formatting of #2771 2015-03-13 09:26:45 +01:00
be20f61a93 Merge pull request #2771 from alejandroliu/ChunkCorruption
Fix some Chunk corruption due to Chunk overlap
2015-03-13 09:24:24 +01:00
59e9446fe5 Added another place where the same happens 2015-03-13 08:19:47 +01:00
4f47dac8ec Fix some Chunk corrumption due to Chunk overlap 2015-03-13 06:23:32 +01:00
b54c0835b7 Update RakLib 2015-03-12 18:40:12 +01:00
1e00ff9e4a Update RakLib 2015-03-12 18:37:22 +01:00
1ac7f9f061 Removed player foreach on Entity 2015-03-12 15:58:10 +01:00
5b3ce2da9d Fixed packets 2015-03-12 15:38:17 +01:00
00942d3a2b Fixed picking up items, entity IDs on packets 2015-03-12 12:02:37 +01:00
4b442a9d7c Renamed LoginStatusPacket to PlayStatusPacket, added spawn status, new colors 2015-03-12 11:43:50 +01:00
44dfb59409 Fixed Entity->setMotion() for Players 2015-03-12 11:43:50 +01:00
696ba08a81 Removed chat wrapping, deprecated TextWrapper 2015-03-12 11:43:50 +01:00
d80b8524fb More packets changed, unique IDs D: 2015-03-12 11:43:50 +01:00
2175d7922a Updated packet order, removed player entity id as 0 2015-03-12 11:43:50 +01:00
5fcb0d6aa5 Added colors, Disconnect Packet, protocol 21 2015-03-12 11:43:50 +01:00
9ca3ad8971 Merge pull request #2767 from alejandroliu/blockskylight
Fixed some typos in Anvil
2015-03-10 09:57:48 +01:00
a644b46ec4 Fixed some typos 2015-03-09 23:57:53 +01:00
9d3f59fab6 Merge pull request #2750 from LDX-MCPE/patch-2
Fixed Dark Oak Fence's name
2015-03-09 11:10:17 +01:00
6309d4abf1 Fixed #2762 2015-03-08 15:53:01 +01:00
LDX
39291e4061 Fixed Dark Oak Fence's name 2015-03-02 16:14:31 -05:00
bb71a3c4a6 Added Entity->fastMove() for players and direct-controlled entities, improved speed checking 2015-02-22 21:16:05 +01:00
eb0525e892 Ignore spawn protection when no ops are set 2015-02-22 19:07:45 +01:00
f49db47b2e Added basic speed protection 2015-02-18 00:37:57 +01:00
3ff5e12302 Updated RakLib 2015-02-17 21:12:28 +01:00
99ad65ba44 Catch file saving exceptions 2015-02-15 20:01:47 +01:00
5f4f996efe Fixed #2599 2015-02-15 19:01:25 +01:00
21e0739845 Fixed #2598 2015-02-15 18:48:30 +01:00
3a157d0f02 Future workaround for #2626 2015-02-15 18:45:25 +01:00
8e56782138 Fixed #2619 BlockMetadataStore 2015-02-15 18:25:40 +01:00
116ede3679 Improved flight detection, added Entity->resetFallDistance(), closes #2632 2015-02-15 17:40:17 +01:00
7c0f5987d3 Fixed players getting kicked for flying when going through special blocks 2015-02-15 16:26:05 +01:00
547e152e40 Fixed #2615, closes #2634 invalid pull request 2015-02-15 15:12:33 +01:00
7905fbdd29 TallGrass blocks should be only placed on grass blocks 2015-02-12 19:33:44 +09:00
ae65701a23 Update IronBars.php 2015-02-05 20:11:08 +08:00
9134a69936 Merge pull request #2613 from 64FF00/master
OH-GAWD-WHY blame @PEMapModder
2015-02-05 12:57:44 +01:00
907fe8aff6 Fixed for wrong hardness and stonecutter 2015-02-05 19:05:00 +08:00
afa9acf22f OH-GAWD-WHY 2015-02-05 19:30:52 +09:00
9a5afff4ab Merge pull request #2612 from PEMapModder/patch-1
Added Location::__toString()
2015-02-05 11:06:52 +01:00
2f8c281a2e Added Location::__toString() 2015-02-05 18:00:25 +08:00
2096dace68 fixed for some bugs
Signed-off-by: mmlmml1 <mmlmml1@126.com>
2015-02-04 23:12:06 +08:00
8421985102 Merge pull request #2577 from Falkirks/master
Improve FallingSand behaviour
2015-01-28 08:48:01 +01:00
f63e859b3a Falling sand will become block when in contact with a Liquid
This replicates the behaviour of MCPE.
2015-01-27 17:09:31 -08:00
c56eb0b9df Merge pull request #2566 from sekjun9878/master
Fixed #2565
2015-01-26 19:01:22 +10:30
3f2e5bbef4 Fixed #2565 2015-01-26 18:59:56 +10:30
9886eb4768 Return on Level->getSafeSpawn() in case of invalid position 2015-01-25 10:23:04 +01:00
ea44eee5df Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2015-01-24 10:35:24 +01:00
9173f930ca Fixed #2541 server not saving chunks on chunk unloading 2015-01-24 10:35:08 +01:00
80b6a8ebaf Merge pull request #2555 from Striker209MPE/patch-6
Removed useless spawned check...
2015-01-24 10:29:18 +01:00
7c64a33389 Fixed #2557 2015-01-21 14:48:31 +01:00
9fac896f28 Removed useless spawned check...
because it has already be done before
2015-01-20 16:29:29 +01:00
5bd76e955c Added rotation transformations to remaining packet 2015-01-16 01:43:40 +01:00
63f1a50be4 Added new predictive flight protection 2015-01-14 23:47:01 +01:00
24c6cca664 Updated RakLib, fixed help message not showing command, added documentation to Plugin->getResource() 2015-01-14 17:23:16 +01:00
9fac990b19 Throw exception when RakLib crashes 2015-01-13 18:44:15 +01:00
e8e7938490 Fixed PHPRC env. variable being set 2015-01-13 17:25:52 +01:00
f6c4a726b3 Bump Minecraft version to 0.10.5 2015-01-12 20:00:11 +01:00
8eec5e6b5e Allow placing Snow Layers on top of solid transparent blocks 2015-01-12 02:18:02 +01:00
bd7fa71d7f Updated RakLib 2015-01-11 20:33:17 +01:00
7d406066a7 Added outdated event static properties 2015-01-11 19:37:21 +01:00
3e9196d224 Changed max speed per tick from 100 to 10 blocks 2015-01-11 17:31:34 +01:00
f30986d187 Block saving chunks too big 2015-01-11 15:48:08 +01:00
f8c144be31 Fixed #2529 2015-01-11 15:06:16 +01:00
c61e4adcf1 Improved chunk ticking a bit more 2015-01-08 23:27:14 +01:00
5a55040ab9 Improved chunk ticking 2015-01-08 23:22:47 +01:00
83360187c9 Removed fence classes, added fence damage (¬¬ Mojang) 2015-01-08 17:51:29 +01:00
a893174473 Second biome generator iteration 2015-01-08 01:05:23 +01:00
9d97a940a6 Merge pull request #2517 from PEMapModder/patch-1
Fixed /timings off
2015-01-07 14:42:17 +01:00
cd21c28d46 Fixed /timings off
When issuing `/timings off`, the message `Please enable timings by typing /timings on` is sent to the issuer. This commit fixes this issue.
2015-01-07 17:34:45 +08:00
a76be6cf38 First biome based generator iteration 2015-01-07 04:07:11 +01:00
37fd0372cc Added GarbageCollectionTask, workaround for weird PHP behaviour when using --disable-ansi 2015-01-06 19:45:41 +01:00
ed02026815 Improved file resource usage 2015-01-06 19:04:24 +01:00
042a143dd6 Unload unused regions after 5 minutes 2015-01-06 18:59:21 +01:00
4b73dbd9f8 Fixed Flat generator on existing chunks, region issues 2015-01-06 18:46:18 +01:00
d4e4430df0 Fixed Entities being placed in recreated chunks 2015-01-06 18:45:08 +01:00
469ef84733 Fixed issue where plugins schedule a Player update before log in 2015-01-06 00:25:40 +01:00
efe75f2836 Catch more coruption issues in Region-based worlds, fixed first chunk being generated on an invalid sector 2015-01-06 00:11:38 +01:00
53f2f21f2d Fixed #2511 2015-01-05 16:15:57 +01:00
9c28f0a5be Decrease async worker task amount after crashed task 2015-01-05 02:41:14 +01:00
5bf5014b60 Added Async Task crash warning 2015-01-05 00:16:47 +01:00
f37e79b611 Added Level->getChunks(), fixed some Doc Comments 2015-01-04 23:16:03 +01:00
7a0118820c Improved chunk saving times by not marking it as changed when Players are added/removed 2015-01-04 23:07:08 +01:00
c8b5c023cd Fixed visual typo in /ban-ip, closes #2503 2015-01-04 09:36:07 +01:00
f9dd929e04 Fixed phar check 2015-01-03 16:49:10 +01:00
87970726e4 Added PlayerCreationEvent->setBaseClass() 2015-01-03 16:46:00 +01:00
1daf9a96a3 Added PlayerCreationEvent->setBaseClass() 2015-01-03 16:45:43 +01:00
6c8b33fcc8 Fixed PlayerCreationEvent 2015-01-03 16:41:14 +01:00
438591bd75 API 1.11.0, fixed phar check 2015-01-03 16:38:36 +01:00
7ef8edccf4 Added PlayerCreationEvent 2015-01-03 16:38:00 +01:00
074c8b876d Cleaned up code 2015-01-03 16:07:49 +01:00
f9762c870a Cleaned up BanEntry creation 2015-01-03 15:47:03 +01:00
4039895d3c Fixed #2489 2015-01-03 03:43:41 +01:00
d207a5daea WTF, ghost objects and why does this fix it? (and btw, fixes #2488) 2015-01-03 03:38:25 +01:00
8e3667c95b Fixed messages and default settings 2015-01-03 02:56:46 +01:00
0da628deca Fixed some crashes related to crashing 2015-01-02 19:19:34 +01:00
04bdb13103 Improved move offset check 2015-01-02 19:14:18 +01:00
e8ad828498 Catch exceptions on level generation 2015-01-02 18:56:27 +01:00
f46473bbe8 Removed all @mkdir() calls 2015-01-02 18:52:45 +01:00
692045d714 Improved threading and resource usage, new defaults 2015-01-02 18:46:39 +01:00
47cbf56725 Version bump 2015-01-02 07:04:20 +01:00
3de14d8ba6 Preparing release 2015-01-02 01:37:33 +01:00
5fffabe05b Fixed players not calculating onGround correctly 2015-01-02 01:22:33 +01:00
3128ae9736 Improved exception handling and trace creation 2015-01-01 22:50:45 +01:00
7be4e2fa81 Merge pull request #2438 from PocketMine/new-version-format
New release version format
2014-12-31 17:53:12 +01:00
95b305ce87 Detect really big corrupted chunks, closes #2471 2014-12-31 12:40:11 +01:00
767800662c Added chunk check on Level 2014-12-30 15:54:12 +01:00
fe32e6f5d0 Merge branch 'master' into new-version-format 2014-12-29 12:43:15 +01:00
2cec0d9f36 Improved Simplex 2D noise 2014-12-28 03:51:08 +01:00
d800a21bd4 Higher chunk defaults 2014-12-28 02:58:17 +01:00
8d9fbec4ce Fixed memory leak issues on chunk generation under 32-bit hosts, fixed issue with generated chunks not having a provider. Closes #2419, fixes #2308, closes #2421 2014-12-28 02:22:13 +01:00
ab72c32769 Improved Normal generator speed 2014-12-28 02:12:48 +01:00
346626305c Corrected fence crafting recipes, closes #2457 2014-12-28 01:49:42 +01:00
fafbd500e1 Added typehints to HelpCommand 2014-12-28 01:49:10 +01:00
2db2e8cfc4 Block IP addresses on ban-ip 2014-12-26 13:56:35 +01:00
854479180f Move Query exceptions to debug level > 1 2014-12-26 13:47:15 +01:00
902ba81e02 Added automatic/manual RakLib IP address, block addresses when exceptions are thrown 2014-12-26 13:33:41 +01:00
1ac17abec0 Fixed #2446 2014-12-24 23:00:11 +01:00
714ea54121 Players won't take damage 60 ticks after spawning / respawning. 2014-12-24 20:44:22 +01:00
aa992684ba Possible workaround for some PHP bug 2014-12-24 00:55:23 +01:00
0c58de86b7 New version format 2014-12-23 14:02:35 +01:00
7ecac019a9 Bitmask block state 2014-12-23 13:58:30 +01:00
6cb88afe1a Improved block breaking time and event handling 2014-12-22 23:49:17 +01:00
a677bcb331 Increased transaction timeout, not needed anymore due to packet ordering 2014-12-22 23:38:47 +01:00
2f6007342c Fixed server.log created in two different places on path changed 2014-12-22 23:00:28 +01:00
b6c0eb8c96 Added optional parameter for multiple NBT read 2014-12-22 16:25:12 +01:00
afa8496767 Fixed possible memory leak when hiding players from each other 2014-12-21 20:03:39 +01:00
d7be2ce439 Added Chest recreation on imported levels 2014-12-21 14:29:18 +01:00
6dcb5da069 Added Double Plant block, fixes damage walking inside it. 2014-12-21 14:28:45 +01:00
3cf1692c96 Possible fix for #2424 2014-12-21 13:59:04 +01:00
d04af590d1 Updated RakLib
* Fixes issues with packets without messageIndex
* Workarounds possible CPU-hog DoS attack over ACK/NACK packets
2014-12-21 13:45:28 +01:00
d4c43215b1 Fixed typo about async chunk generation 2014-12-19 16:10:01 +01:00
a40918aabf LevelDB load/write fixes 2014-12-19 10:35:16 +01:00
20f9352714 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-12-19 01:07:13 +01:00
a605e90dfc Added experimental LevelDB support, fixed a few issues with NBT, spawning and Binary R/W 2014-12-19 00:28:50 +01:00
9fc250956f Merge pull request #2395 from PEMapModder/patch-6
Allow $base in knockback() to be dynamic and getters/setters in EntityDa...
2014-12-18 20:39:48 +09:00
db2dfc47a6 Update RakLib 2014-12-18 03:33:33 +01:00
408a537001 Added TesterPlugin submodule, updated RakLib to fix packet loop issues 2014-12-17 23:29:57 +01:00
922bfb33ac Updated .gitignore 2014-12-16 18:50:57 +01:00
8e47c93fbc Fixed some issues with chunks being generated on a loop 2014-12-16 02:57:44 +01:00
c175485cd8 Added World Generation timings 2014-12-15 17:52:07 +01:00
b6981cc31d Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-12-15 01:05:55 +01:00
1f9cd6a99b Added default parameter to Config getters, implements and closes #2398 2014-12-15 01:05:32 +01:00
ded7ada7d7 Merge pull request #2399 from PEMapModder/patch-7
Update documentation of PluginBase::getCommand() for IDEs' auto completion
2014-12-15 00:52:43 +01:00
1b50879823 Snow layer recipe added: Fix for #2400 2014-12-13 17:10:17 +01:00
1bd9cbd4d3 Update documentation of PluginBase::getCommand() for IDEs' auto completion 2014-12-13 20:42:23 +08:00
96122d3be7 Allow $base in knockback() to be dynamic and getters/setters in EntityDamageByEntityEvent
This change is backwards-compatible.
2014-12-12 23:01:31 +08:00
71d602a4cf Faster chunk setting on provider 2014-12-12 15:51:31 +01:00
c81bbdaaa9 Possible fix for #2394 2014-12-12 12:05:36 +01:00
2752393c42 Fixed #2392 2014-12-12 12:05:15 +01:00
312e064b07 Updated RakLib, changed some Entity move AABB calls 2014-12-11 17:39:59 +01:00
94f91967f3 Updated RakLib: Implemented packet reordering, fixed packet recovery in both sides, errors are now debug level 2014-12-11 03:13:44 +01:00
fe900b417e Less calls! 2014-12-10 02:42:02 +01:00
4c30b6b8a1 Optimized Liquid spreading, optimized light updates, improved side block get/update, fixed raw set not cleaning Block cache (TNT explosions) 2014-12-10 00:37:04 +01:00
c41ac7b0a2 Updated PocketMine-SPL, added trait autoloading 2014-12-09 16:33:42 +01:00
b220bd2a45 Updated chunk indexes on generator 2014-12-09 15:14:11 +01:00
04ee94dc91 Fixed #2388 2014-12-09 15:05:36 +01:00
ea8f10efa4 Limited death animation to Living entities 2014-12-09 14:57:28 +01:00
04ecbd1a76 Level optimization, added new chunk/block hashes 2014-12-09 14:55:21 +01:00
ddfc9d9ce1 Fixed players not getting sound when they are harmed 2014-12-09 02:22:42 +01:00
a4735eaf76 Replaced some instanceof to null checks 2014-12-09 02:22:18 +01:00
306f492fc0 Added Player death animations, improved spawning behavior to correct invisible players, fixed players getting stuck when dead, closes #2304 2014-12-09 01:36:46 +01:00
5e5f8bf33d Better block creation on Level 2014-12-08 22:02:36 +01:00
3bb2f12cde Improved block reading
* Created global block states array
* Improved Level->getBlock() using block states
* Improved Level->getBlock() for 64-bit systems
* Added Level->getFullBlock()
* Added FullChunk->getFullBlock()
* Added Chunk->getFullBlock()
* Added ChunkSection->getFullBlock()
* Deprecated FullChunk->getBlock()
* Deprecated Chunk->getBlock()
* Deprecated ChunkSection->getBlock()
2014-12-08 20:54:47 +01:00
1041bb0e6a Do not quiet error messages when parsing config files 2014-12-07 23:21:47 +01:00
49e93cee80 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-12-07 22:05:58 +01:00
8b6681c56d FIxed some preprocessor includes 2014-12-07 22:05:45 +01:00
9e3d432b9e Faster Level provider chunk unloading 2014-12-07 21:51:57 +01:00
841a3d5ee6 Merge pull request #2381 from PocketMine/revert-2379-master
Revert "Fixed small possible error in permission"
2014-12-07 20:54:46 +01:00
a5294d5ec7 Revert "Fixed small possible error in permission" 2014-12-07 20:54:38 +01:00
5373e6be07 Merge pull request #2379 from sudoku173/master
Fixed small possible error in permission
2014-12-07 20:41:08 +01:00
075137bd3c Fixed small possible error in permission
Changed permission to "pocketmine.command.deop" from "pocketmine.command.op.take"
2014-12-07 11:38:44 -08:00
68da4b5b39 Collect unallocated chunks from the Level provider 2014-12-07 18:27:11 +01:00
e4557a2e8e Added HeightMap get/set methods on chunks, Level 2014-12-07 18:02:07 +01:00
964bf98ca6 Added Config->getNested(key) and Config->setNested(key, value) 2014-12-07 16:41:43 +01:00
747f7685e7 Fix formatting issues due to bad IDE settings 2014-12-07 16:30:04 +01:00
bb82e7be50 Handle a hotbar queue to allow using more than the first slot (won't save order due to the protocol) 2014-12-07 16:01:45 +01:00
7506f01302 Improved Item property handling 2014-12-07 15:51:00 +01:00
a98da3bab1 Renamed old getID() calls to getId() 2014-12-07 15:21:32 +01:00
f0d6128282 Use squared distance on movement handling 2014-12-07 15:18:14 +01:00
161e7ae7ec Fix CPU issue when starting without STDIN 2014-12-07 02:42:38 +01:00
6104c5b5a3 API 1.9.0, backwards-compatible 2014-12-07 02:24:45 +01:00
af82d616c1 Block creating and property handling rewrite, part2 2014-12-07 02:20:26 +01:00
a0d4bff385 Block creating and property handling rewrite, part1 2014-12-07 01:53:27 +01:00
79236c971c Possibly fix issues related to new lines on different operating systems and event listeners modifiers 2014-12-05 22:43:31 +01:00
20e63ae543 Force player setting their new position 2014-12-05 02:24:34 +01:00
add7879720 Implemented no damage ticks 2014-12-05 02:24:08 +01:00
1a064d38b1 Merge remote-tracking branch 'origin/master' 2014-12-04 00:04:18 +01:00
294e680d5d Added armor items and max stack size for them. 2014-12-04 00:04:09 +01:00
811970e58d Merge pull request #2352 from PEMapModder/patch-3
Added internal use warning for TaskHandler::cancel()
2014-12-01 12:07:30 +01:00
941961f5ef Added internal use warning for TaskHandler::cancel()
It is confusing for some developers to whether to use this function or `ServerScheduler::cancelTask($taskId)`. It is better to add warning in the documentation.
2014-12-01 16:25:37 +08:00
1963d8fde0 Change last X/Y/Z/Yaw/Pitch on teleport 2014-11-30 12:49:35 +01:00
e44ed4da3b Enabled batch block sending again 2014-11-29 12:58:31 +01:00
a72488d41e Updated player movement processing and event handling 2014-11-29 12:43:34 +01:00
3930f379cf Updated light filter values 2014-11-29 11:58:50 +01:00
66ba327e62 Improved light spread algorithm even more 2014-11-29 11:27:22 +01:00
329ca62465 Improved light spread algorithm 2014-11-28 19:54:25 +01:00
26e47ef694 Removed old revert flag from Player->processMovement() 2014-11-28 14:49:06 +01:00
61ea149ff0 API 1.8.0 2014-11-28 14:44:56 +01:00
b3c3f896a3 Implemented light population, added Level->getFullLight() 2014-11-28 14:44:27 +01:00
d139e5f342 Removed temporal pthreads workaround 2014-11-28 13:01:25 +01:00
3abf36ad07 Fixed invalid worlds property being set by users 2014-11-28 12:47:28 +01:00
0bc9a9bdab Fixed armor dropping twice 2014-11-27 23:19:46 +01:00
98340522d9 Fixed items getting added on the same empty slot 2014-11-27 20:49:18 +01:00
6d09754ea7 Improved Inventory->addItem(), fixed breaking containers duplicating the last slot, removed not necessary slot changes 2014-11-27 20:10:55 +01:00
a3b1d318cc Fixed ladder crafting recipe 2014-11-27 20:02:38 +01:00
f866efb622 Removed unused Block->isLiquid property 2014-11-27 17:26:43 +01:00
b1c4578726 Fixed #2340 2014-11-27 16:18:43 +01:00
739 changed files with 29077 additions and 12063 deletions

18
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,18 @@
### Issue description
<!--- use our forum https://forums.pocketmine.net for questions -->
Write a short description about the issue
### Steps to reproduce the issue
<!--- help us find the problem by adding steps to reproduce the issue -->
1. ...
2. ...
### OS and versions
<!--- use the 'version' command in PocketMine-MP -->
* PocketMine-MP:
* PHP:
* OS:
### Crashdump, backtrace or other files
<!--- please use gist or anything else and add links here -->
* ...

3
.gitignore vendored
View File

@ -2,11 +2,12 @@ players/*
worlds/*
plugins/*
bin/*
timings/*
*.log
*.txt
*.phar
server.properties
pocketmine.yml
/pocketmine.yml
# Common IDEs
.idea/*

6
.gitmodules vendored
View File

@ -9,3 +9,9 @@
[submodule "src/spl"]
path = src/spl
url = https://github.com/PocketMine/PocketMine-SPL.git
[submodule "tests/TesterPlugin"]
path = tests/TesterPlugin
url = https://github.com/PocketMine/TesterPlugin.git
[submodule "src/pocketmine/lang/locale"]
path = src/pocketmine/lang/locale
url = https://github.com/PocketMine/PocketMine-Language.git

View File

@ -1,17 +1,17 @@
language: php
php:
- 5.6
- 7.0
branches:
- master
before_script:
- mkdir plugins
- wget -O plugins/DevTools.phar https://github.com/PocketMine/DevTools/releases/download/v1.9.0/DevTools_v1.9.0.phar
- pecl install channel://pecl.php.net/pthreads-2.0.10
- pecl install channel://pecl.php.net/weakref-0.2.6
- echo | pecl install channel://pecl.php.net/yaml-1.1.1
- wget -O plugins/DevTools.phar https://github.com/PocketMine/DevTools/releases/download/v1.11.0/DevTools_v1.11.0.phar
- pecl install channel://pecl.php.net/pthreads-3.1.6
- pecl install channel://pecl.php.net/weakref-0.3.2
- echo | pecl install channel://pecl.php.net/yaml-2.0.0RC7
script:
- php tests/TravisTest.php

View File

@ -18,6 +18,7 @@ You must follow these guidelines if you wish to contribute to the PocketMine-MP
- **No generic titles** such as "Question", "Help", "Crash Report" etc. If an issue has a generic title they will either be closed on the spot, or a collaborator will edit it to describe the actual symptom.
- Information must be provided in the issue body, not in the title. No tags are allowed in the title, and do not change the title if the issue has been solved.
- Similarly, no generic issue reports. It is the issue submitter's responsibility to provide us an issue that is **trackable, debuggable, reproducible, reported professionally and is an actual bug**. If you do not provide us with a summary or instructions on how to reproduce the issue, it is a support request until the actual bug has been found and therefore the issue is closed.
- To express appreciation, objection, confusion or other supported reactions on pull requests, issues or comments on them, use GitHub [reactions](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) rather than posting an individual comment with an emoji only. This helps keeping the issue/pull rqeuest conversation clean and readable.
## Contributing Code
* Use the [Pull Request](https://github.com/PocketMine/PocketMine-MP/pull/new) system, your request will be checked and discussed.
@ -34,14 +35,13 @@ You must follow these guidelines if you wish to contribute to the PocketMine-MP
It is mainly [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) with a few exceptions.
* Opening braces MUST go on the same line, and MUST NOT have spaces before.
* `else if` MUST be written as `elseif`. _(It is in PSR-2, but using a SHOULD)_
* Control structure keywords or opening braces MUST NOT have one space after them.
* Control structure keywords or opening braces MUST NOT have one space before or after them.
* Code MUST use tabs for indenting.
* Long arrays MAY be split across multiple lines, where each subsequent line is indented once.
* Files MUST use only the `<?php` tag.
* Files MUST NOT have an ending `?>` tag.
* Code MUST use namespaces.
* Strings SHOULD use the double quote `"` except when the single quote is required.
* Argument lists MAY NOT be split across multiple lines, except long arrays.
```php
<?php

View File

@ -1,4 +1,5 @@
# ![PocketMine-MP](http://cdn.pocketmine.net/img/PocketMine-MP-h.png)
[![Build Status](https://travis-ci.org/PocketMine/PocketMine-MP.svg?branch=master)](https://travis-ci.org/PocketMine/PocketMine-MP)
This program is free software: you can redistribute it and/or modify
@ -44,6 +45,7 @@ __PocketMine-MP is a free, open-source software that creates Minecraft: Pocket E
## Third-party Libraries/Protocols Used
* __[PHP Sockets](http://php.net/manual/en/book.sockets.php)__
* __[PHP mbstring](http://php.net/manual/en/book.mbstring.php)__
* __[PHP SQLite3](http://php.net/manual/en/book.sqlite3.php)__
* __[PHP BCMath](http://php.net/manual/en/book.bc.php)__
* __[PHP pthreads](http://pthreads.org/)__ by _[krakjoe](https://github.com/krakjoe)_: Threading for PHP - Share Nothing, Do Everything.

View File

@ -2,11 +2,11 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* 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
@ -14,13 +14,14 @@
* (at your option) any later version.
*
* @author PocketMine Team
*
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
use pocketmine\event\TranslationContainer;
use pocketmine\utils\TextFormat;
/**
@ -106,10 +107,11 @@ abstract class Achievement{
public static function broadcast(Player $player, $achievementId){
if(isset(Achievement::$list[$achievementId])){
$translation = new TranslationContainer("chat.type.achievement", [$player->getDisplayName(), TextFormat::GREEN . Achievement::$list[$achievementId]["name"]]);
if(Server::getInstance()->getConfigString("announce-player-achievements", true) === true){
Server::getInstance()->broadcastMessage($player->getDisplayName() . " has just earned the achievement " . TextFormat::GREEN . Achievement::$list[$achievementId]["name"]);
Server::getInstance()->broadcastMessage($translation);
}else{
$player->sendMessage("You have just earned the achievement " . TextFormat::GREEN . Achievement::$list[$achievementId]["name"]);
$player->sendMessage($translation);
}
return true;

View File

@ -0,0 +1,35 @@
<?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/
*
*
*/
namespace pocketmine;
abstract class Collectable extends \Threaded implements \Collectable{
private $isGarbage = false;
public function isGarbage() : bool{
return $this->isGarbage;
}
public function setGarbage(){
$this->isGarbage = true;
}
}

View File

@ -23,10 +23,4 @@ namespace pocketmine;
class CompatibleClassLoader extends \BaseClassLoader{
/**
* @deprecated
*/
public function add($namespace, $paths){
$this->addPath(array_shift($paths));
}
}

View File

@ -14,7 +14,7 @@
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
@ -42,7 +42,10 @@ class CrashDump{
$this->time = time();
$this->server = $server;
$this->path = $this->server->getDataPath() . "CrashDump_" . date("D_M_j-H.i.s-T_Y", $this->time) . ".log";
$this->fp = fopen($this->path, "wb");
$this->fp = @fopen($this->path, "wb");
if(!is_resource($this->fp)){
throw new \RuntimeException("Could not create Crash Dump");
}
$this->data["time"] = $this->time;
$this->addLine($this->server->getName() . " Crash Dump " . date("D M j H:i:s T Y", $this->time));
$this->addLine();
@ -137,7 +140,7 @@ class CrashDump{
$error = $lastExceptionError;
}else{
$error = (array) error_get_last();
$error["trace"] = @getTrace(4);
$error["trace"] = @getTrace(3);
$errorConversion = [
E_ERROR => "E_ERROR",
E_WARNING => "E_WARNING",

View File

@ -0,0 +1,334 @@
<?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/
*
*
*/
namespace pocketmine;
use pocketmine\event\server\LowMemoryEvent;
use pocketmine\event\Timings;
use pocketmine\scheduler\GarbageCollectionTask;
use pocketmine\utils\Utils;
class MemoryManager{
/** @var Server */
private $server;
private $memoryLimit;
private $globalMemoryLimit;
private $checkRate;
private $checkTicker = 0;
private $lowMemory = false;
private $continuousTrigger = true;
private $continuousTriggerRate;
private $continuousTriggerCount = 0;
private $continuousTriggerTicker = 0;
private $garbageCollectionPeriod;
private $garbageCollectionTicker = 0;
private $garbageCollectionTrigger;
private $garbageCollectionAsync;
private $chunkLimit;
private $chunkCollect;
private $chunkTrigger;
private $chunkCache;
private $cacheTrigger;
public function __construct(Server $server){
$this->server = $server;
$this->init();
}
private function init(){
$this->memoryLimit = ((int) $this->server->getProperty("memory.main-limit", 0)) * 1024 * 1024;
$defaultMemory = 1024;
if(preg_match("/([0-9]+)([KMGkmg])/", $this->server->getConfigString("memory-limit", ""), $matches) > 0){
$m = (int) $matches[1];
if($m <= 0){
$defaultMemory = 0;
}else{
switch(strtoupper($matches[2])){
case "K":
$defaultMemory = $m / 1024;
break;
case "M":
$defaultMemory = $m;
break;
case "G":
$defaultMemory = $m * 1024;
break;
default:
$defaultMemory = $m;
break;
}
}
}
$hardLimit = ((int) $this->server->getProperty("memory.main-hard-limit", $defaultMemory));
if($hardLimit <= 0){
ini_set("memory_limit", -1);
}else{
ini_set("memory_limit", $hardLimit . "M");
}
$this->globalMemoryLimit = ((int) $this->server->getProperty("memory.global-limit", 0)) * 1024 * 1024;
$this->checkRate = (int) $this->server->getProperty("memory.check-rate", 20);
$this->continuousTrigger = (bool) $this->server->getProperty("memory.continuous-trigger", true);
$this->continuousTriggerRate = (int) $this->server->getProperty("memory.continuous-trigger-rate", 30);
$this->garbageCollectionPeriod = (int) $this->server->getProperty("memory.garbage-collection.period", 36000);
$this->garbageCollectionTrigger = (bool) $this->server->getProperty("memory.garbage-collection.low-memory-trigger", true);
$this->garbageCollectionAsync = (bool) $this->server->getProperty("memory.garbage-collection.collect-async-worker", true);
$this->chunkLimit = (int) $this->server->getProperty("memory.max-chunks.trigger-limit", 96);
$this->chunkCollect = (bool) $this->server->getProperty("memory.max-chunks.trigger-chunk-collect", true);
$this->chunkTrigger = (bool) $this->server->getProperty("memory.max-chunks.low-memory-trigger", true);
$this->chunkCache = (bool) $this->server->getProperty("memory.world-caches.disable-chunk-cache", true);
$this->cacheTrigger = (bool) $this->server->getProperty("memory.world-caches.low-memory-trigger", true);
gc_enable();
}
public function isLowMemory(){
return $this->lowMemory;
}
public function canUseChunkCache(){
return !($this->lowMemory and $this->chunkTrigger);
}
public function getViewDistance($distance){
return $this->lowMemory ? min($this->chunkLimit, $distance) : $distance;
}
public function trigger($memory, $limit, $global = false, $triggerCount = 0){
$this->server->getLogger()->debug("[Memory Manager] ".($global ? "Global " : "") ."Low memory triggered, limit ". round(($limit / 1024) / 1024, 2)."MB, using ". round(($memory / 1024) / 1024, 2)."MB");
if($this->cacheTrigger){
foreach($this->server->getLevels() as $level){
$level->clearCache(true);
}
}
if($this->chunkTrigger and $this->chunkCollect){
foreach($this->server->getLevels() as $level){
$level->doChunkGarbageCollection();
}
}
$ev = new LowMemoryEvent($memory, $limit, $global, $triggerCount);
$this->server->getPluginManager()->callEvent($ev);
$cycles = 0;
if($this->garbageCollectionTrigger){
$cycles = $this->triggerGarbageCollector();
}
$this->server->getLogger()->debug("[Memory Manager] Freed " . round(($ev->getMemoryFreed() / 1024) / 1024, 2)."MB, $cycles cycles");
}
public function check(){
Timings::$memoryManagerTimer->startTiming();
if(($this->memoryLimit > 0 or $this->globalMemoryLimit > 0) and ++$this->checkTicker >= $this->checkRate){
$this->checkTicker = 0;
$memory = Utils::getMemoryUsage(true);
$trigger = false;
if($this->memoryLimit > 0 and $memory[0] > $this->memoryLimit){
$trigger = 0;
}elseif($this->globalMemoryLimit > 0 and $memory[1] > $this->globalMemoryLimit){
$trigger = 1;
}
if($trigger !== false){
if($this->lowMemory and $this->continuousTrigger){
if(++$this->continuousTriggerTicker >= $this->continuousTriggerRate){
$this->continuousTriggerTicker = 0;
$this->trigger($memory[$trigger], $this->memoryLimit, $trigger > 0, ++$this->continuousTriggerCount);
}
}else{
$this->lowMemory = true;
$this->continuousTriggerCount = 0;
$this->trigger($memory[$trigger], $this->memoryLimit, $trigger > 0);
}
}else{
$this->lowMemory = false;
}
}
if($this->garbageCollectionPeriod > 0 and ++$this->garbageCollectionTicker >= $this->garbageCollectionPeriod){
$this->garbageCollectionTicker = 0;
$this->triggerGarbageCollector();
}
Timings::$memoryManagerTimer->stopTiming();
}
public function triggerGarbageCollector(){
Timings::$garbageCollectorTimer->startTiming();
if($this->garbageCollectionAsync){
$size = $this->server->getScheduler()->getAsyncTaskPoolSize();
for($i = 0; $i < $size; ++$i){
$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GarbageCollectionTask(), $i);
}
}
$cycles = gc_collect_cycles();
Timings::$garbageCollectorTimer->stopTiming();
return $cycles;
}
public function dumpServerMemory($outputFolder, $maxNesting, $maxStringSize){
gc_disable();
if(!file_exists($outputFolder)){
mkdir($outputFolder, 0777, true);
}
$this->server->getLogger()->notice("[Dump] After the memory dump is done, the server might crash");
$obData = fopen($outputFolder . "/objects.js", "wb+");
$staticProperties = [];
$data = [];
$objects = [];
$refCounts = [];
$this->continueDump($this->server, $data, $objects, $refCounts, 0, $maxNesting, $maxStringSize);
do{
$continue = false;
foreach($objects as $hash => $object){
if(!is_object($object)){
continue;
}
$continue = true;
$className = get_class($object);
$objects[$hash] = true;
$reflection = new \ReflectionObject($object);
$info = [
"information" => "$hash@$className",
"properties" => []
];
if($reflection->getParentClass()){
$info["parent"] = $reflection->getParentClass()->getName();
}
if(count($reflection->getInterfaceNames()) > 0){
$info["implements"] = implode(", ", $reflection->getInterfaceNames());
}
foreach($reflection->getProperties() as $property){
if($property->isStatic()){
continue;
}
if(!$property->isPublic()){
$property->setAccessible(true);
}
$this->continueDump($property->getValue($object), $info["properties"][$property->getName()], $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
fwrite($obData, "$hash@$className: ". json_encode($info, JSON_UNESCAPED_SLASHES) . "\n");
if(!isset($objects["staticProperties"][$className])){
$staticProperties[$className] = [];
foreach($reflection->getProperties() as $property){
if(!$property->isStatic() or $property->getDeclaringClass()->getName() !== $className){
continue;
}
if(!$property->isPublic()){
$property->setAccessible(true);
}
$this->continueDump($property->getValue($object), $staticProperties[$className][$property->getName()], $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
}
}
echo "[Dump] Wrote " . count($objects) . " objects\n";
}while($continue);
file_put_contents($outputFolder . "/staticProperties.js", json_encode($staticProperties, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
file_put_contents($outputFolder . "/serverEntry.js", json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
file_put_contents($outputFolder . "/referenceCounts.js", json_encode($refCounts, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
echo "[Dump] Finished!\n";
gc_enable();
$this->server->forceShutdown();
}
private function continueDump($from, &$data, &$objects, &$refCounts, $recursion, $maxNesting, $maxStringSize){
if($maxNesting <= 0){
$data = "(error) NESTING LIMIT REACHED";
return;
}
--$maxNesting;
if(is_object($from)){
if(!isset($objects[$hash = spl_object_hash($from)])){
$objects[$hash] = $from;
$refCounts[$hash] = 0;
}
++$refCounts[$hash];
$data = "(object) $hash@" . get_class($from);
}elseif(is_array($from)){
if($recursion >= 5){
$data = "(error) ARRAY RECURSION LIMIT REACHED";
return;
}
$data = [];
foreach($from as $key => $value){
$this->continueDump($value, $data[$key], $objects, $refCounts, $recursion + 1, $maxNesting, $maxStringSize);
}
}elseif(is_string($from)){
$data = "(string) len(".strlen($from).") " . substr(Utils::printable($from), 0, $maxStringSize);
}elseif(is_resource($from)){
$data = "(resource) " . print_r($from, true);
}else{
$data = $from;
}
}
}

View File

@ -23,7 +23,7 @@ namespace pocketmine;
use pocketmine\metadata\MetadataValue;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\plugin\Plugin;
class OfflinePlayer implements IPlayer{
@ -103,15 +103,15 @@ class OfflinePlayer implements IPlayer{
}
public function getFirstPlayed(){
return $this->namedtag instanceof Compound ? $this->namedtag["firstPlayed"] : null;
return $this->namedtag instanceof CompoundTag ? $this->namedtag["firstPlayed"] : null;
}
public function getLastPlayed(){
return $this->namedtag instanceof Compound ? $this->namedtag["lastPlayed"] : null;
return $this->namedtag instanceof CompoundTag ? $this->namedtag["lastPlayed"] : null;
}
public function hasPlayedBefore(){
return $this->namedtag instanceof Compound;
return $this->namedtag instanceof CompoundTag;
}
public function setMetadata($metadataKey, MetadataValue $metadataValue){

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ namespace {
}
echo str_repeat(" ", $cnt) . "}" . PHP_EOL;
break;
case is_integer($var):
case is_int($var):
echo str_repeat(" ", $cnt) . "int(" . $var . ")" . PHP_EOL;
break;
case is_float($var):
@ -67,13 +67,16 @@ namespace {
namespace pocketmine {
use pocketmine\utils\Binary;
use pocketmine\utils\MainLogger;
use pocketmine\utils\ServerKiller;
use pocketmine\utils\Terminal;
use pocketmine\utils\Utils;
use pocketmine\wizard\Installer;
const VERSION = "Alpha_1.4dev";
const API_VERSION = "1.7.1";
const CODENAME = "絶好(Zekkou)ケーキ(Cake)";
const MINECRAFT_VERSION = "v0.10.4 alpha";
const VERSION = "1.6dev";
const API_VERSION = "2.0.0";
const CODENAME = "Unleashed";
const MINECRAFT_VERSION = "v0.15.0.0 alpha";
const MINECRAFT_VERSION_NETWORK = "0.15.0.0";
/*
* Startup code. Do not look at it, it may harm you.
@ -83,9 +86,15 @@ namespace pocketmine {
*/
if(\Phar::running(true) !== ""){
@define("pocketmine\\PATH", \Phar::running(true) . "/");
@define('pocketmine\PATH', \Phar::running(true) . "/");
}else{
@define("pocketmine\\PATH", \getcwd() . DIRECTORY_SEPARATOR);
@define('pocketmine\PATH', \getcwd() . DIRECTORY_SEPARATOR);
}
if(version_compare("7.0", PHP_VERSION) > 0){
echo "[CRITICAL] You must use PHP >= 7.0" . PHP_EOL;
echo "[CRITICAL] Please use the installer provided on the homepage." . PHP_EOL;
exit(1);
}
if(!extension_loaded("pthreads")){
@ -103,7 +112,6 @@ namespace pocketmine {
$autoloader = new CompatibleClassLoader();
$autoloader->addPath(\pocketmine\PATH . "src");
$autoloader->addPath(\pocketmine\PATH . "src" . DIRECTORY_SEPARATOR . "spl");
$autoloader->addPath(\pocketmine\PATH . "src" . DIRECTORY_SEPARATOR . "raklib");
$autoloader->register(true);
@ -116,21 +124,25 @@ namespace pocketmine {
ini_set("display_startup_errors", 1);
ini_set("default_charset", "utf-8");
ini_set("memory_limit", "256M"); //Default
define("pocketmine\\START_TIME", microtime(true));
ini_set("memory_limit", -1);
define('pocketmine\START_TIME', microtime(true));
$opts = getopt("", ["enable-ansi", "disable-ansi", "data:", "plugins:", "no-wizard", "enable-profiler"]);
$opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-profiler"]);
define("pocketmine\\DATA", isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
define("pocketmine\\PLUGIN_PATH", isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
define('pocketmine\DATA', isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
define('pocketmine\PLUGIN_PATH', isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
define("pocketmine\\ANSI", (Utils::getOS() !== "win" or isset($opts["enable-ansi"])) and !isset($opts["disable-ansi"]));
Terminal::init();
define('pocketmine\ANSI', Terminal::hasFormattingCodes());
@mkdir(\pocketmine\DATA, 0777, true);
if(!file_exists(\pocketmine\DATA)){
mkdir(\pocketmine\DATA, 0777, true);
}
//Logger has a dependency on timezone, so we'll set it to UTC until we can get the actual timezone.
date_default_timezone_set("UTC");
$logger = new MainLogger(\pocketmine\DATA . "server.log", \pocketmine\ANSI);
if(!ini_get("date.timezone")){
@ -143,8 +155,8 @@ namespace pocketmine {
if($response = Utils::getURL("http://ip-api.com/json")
and $ip_geolocation_data = json_decode($response, true)
and $ip_geolocation_data['status'] != 'fail'
and date_default_timezone_set($ip_geolocation_data['timezone']))
{
and date_default_timezone_set($ip_geolocation_data['timezone'])
){
//Again, for redundancy.
ini_set("date.timezone", $ip_geolocation_data['timezone']);
}else{
@ -158,11 +170,13 @@ namespace pocketmine {
* This is here so that people don't come to us complaining and fill up the issue tracker when they put
* an incorrect timezone abbreviation in php.ini apparently.
*/
$default_timezone = date_default_timezone_get();
if(strpos($default_timezone, "/") === false){
$default_timezone = timezone_name_from_abbr($default_timezone);
$timezone = ini_get("date.timezone");
if(strpos($timezone, "/") === false){
$default_timezone = timezone_name_from_abbr($timezone);
ini_set("date.timezone", $default_timezone);
date_default_timezone_set($default_timezone);
} else {
date_default_timezone_set($timezone);
}
}
@ -192,8 +206,7 @@ namespace pocketmine {
//Detect the Time Zone string
preg_match($regex, $string, $matches);
if(!isset($matches[2]))
{
if(!isset($matches[2])){
return false;
}
@ -251,6 +264,7 @@ namespace pocketmine {
/**
* @param string $offset In the format of +09:00, +02:00, -04:00 etc.
*
* @return string
*/
function parse_offset($offset){
@ -306,10 +320,32 @@ namespace pocketmine {
case "mac":
case "linux":
default:
exec("kill -9 " . ((int) $pid) . " > /dev/null 2>&1");
if(function_exists("posix_kill")){
posix_kill($pid, SIGKILL);
}else{
exec("kill -9 " . ((int)$pid) . " > /dev/null 2>&1");
}
}
}
/**
* @param object $value
* @param bool $includeCurrent
*
* @return int
*/
function getReferenceCount($value, $includeCurrent = true){
ob_start();
debug_zval_dump($value);
$ret = explode("\n", ob_get_contents());
ob_end_clean();
if(count($ret) >= 1 and preg_match('/^.* refcount\\(([0-9]+)\\)\\{$/', trim($ret[0]), $m) > 0){
return ((int) $m[1]) - ($includeCurrent ? 3 : 4); //$value + zval call + extra call
}
return -1;
}
function getTrace($start = 1, $trace = null){
if($trace === null){
if(function_exists("xdebug_get_function_stack")){
@ -331,10 +367,10 @@ namespace pocketmine {
$args = $trace[$i]["params"];
}
foreach($args as $name => $value){
$params .= (is_object($value) ? get_class($value) . " " . (method_exists($value, "__toString") ? $value->__toString() : "object") : gettype($value) . " " . @strval($value)) . ", ";
$params .= (is_object($value) ? get_class($value) . " " . (method_exists($value, "__toString") ? $value->__toString() : "object") : gettype($value) . " " . (is_array($value) ? "Array()" : Utils::printable(@strval($value)))) . ", ";
}
}
$messages[] = "#$j " . (isset($trace[$i]["file"]) ? cleanPath($trace[$i]["file"]) : "") . "(" . (isset($trace[$i]["line"]) ? $trace[$i]["line"] : "") . "): " . (isset($trace[$i]["class"]) ? $trace[$i]["class"] . (($trace[$i]["type"] === "dynamic" or $trace[$i]["type"] === "->") ? "->" : "::") : "") . $trace[$i]["function"] . "(" . substr($params, 0, -2) . ")";
$messages[] = "#$j " . (isset($trace[$i]["file"]) ? cleanPath($trace[$i]["file"]) : "") . "(" . (isset($trace[$i]["line"]) ? $trace[$i]["line"] : "") . "): " . (isset($trace[$i]["class"]) ? $trace[$i]["class"] . (($trace[$i]["type"] === "dynamic" or $trace[$i]["type"] === "->") ? "->" : "::") : "") . $trace[$i]["function"] . "(" . Utils::printable(substr($params, 0, -2)) . ")";
}
return $messages;
@ -344,15 +380,8 @@ namespace pocketmine {
return rtrim(str_replace(["\\", ".php", "phar://", rtrim(str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PATH), "/"), rtrim(str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PLUGIN_PATH), "/")], ["/", "", "", "", ""], $path), "/");
}
set_error_handler([\ExceptionHandler::class, "handler"], -1);
$errors = 0;
if(version_compare("5.6.0", PHP_VERSION) > 0){
$logger->critical("You must use PHP >= 5.6");
++$errors;
}
if(php_sapi_name() !== "cli"){
$logger->critical("You must run PocketMine-MP using the CLI.");
++$errors;
@ -367,8 +396,8 @@ namespace pocketmine {
if(substr_count($pthreads_version, ".") < 2){
$pthreads_version = "0.$pthreads_version";
}
if(version_compare($pthreads_version, "2.0.8") < 0){
$logger->critical("pthreads >= 2.0.8 is required, while you have $pthreads_version.");
if(version_compare($pthreads_version, "3.1.5") < 0){
$logger->critical("pthreads >= 3.1.5 is required, while you have $pthreads_version.");
++$errors;
}
@ -386,23 +415,18 @@ namespace pocketmine {
}
}
if(!extension_loaded("Weakref") and !extension_loaded("weakref")){
$logger->critical("Unable to find the Weakref extension.");
++$errors;
}
if(!extension_loaded("curl")){
$logger->critical("Unable to find the cURL extension.");
++$errors;
}
if(!extension_loaded("sqlite3")){
$logger->critical("Unable to find the SQLite3 extension.");
if(!extension_loaded("yaml")){
$logger->critical("Unable to find the YAML extension.");
++$errors;
}
if(!extension_loaded("yaml")){
$logger->critical("Unable to find the YAML extension.");
if(!extension_loaded("sqlite3")){
$logger->critical("Unable to find the SQLite3 extension.");
++$errors;
}
@ -419,9 +443,9 @@ namespace pocketmine {
}
if(file_exists(\pocketmine\PATH . ".git/refs/heads/master")){ //Found Git information!
define("pocketmine\\GIT_COMMIT", strtolower(trim(file_get_contents(\pocketmine\PATH . ".git/refs/heads/master"))));
define('pocketmine\GIT_COMMIT', strtolower(trim(file_get_contents(\pocketmine\PATH . ".git/refs/heads/master"))));
}else{ //Unknown :(
define("pocketmine\\GIT_COMMIT", str_repeat("00", 20));
define('pocketmine\GIT_COMMIT', str_repeat("00", 20));
}
@define("ENDIANNESS", (pack("d", 1) === "\77\360\0\0\0\0\0\0" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN));
@ -432,7 +456,7 @@ namespace pocketmine {
new Installer();
}
if(substr(__FILE__, 0, 7) !== "phar://"){
if(\Phar::running(true) === ""){
$logger->warning("Non-packaged PocketMine-MP installation detected, do not use on production.");
}
@ -442,30 +466,18 @@ namespace pocketmine {
$logger->info("Stopping other threads");
foreach(ThreadManager::getInstance()->getAll() as $id => $thread){
if($thread->isRunning()){
$logger->debug("Stopping " . (new \ReflectionClass($thread))->getShortName() . " thread");
if($thread instanceof Thread){
$thread->kill();
sleep(1);
if($thread->isRunning()){
$thread->detach();
}
}elseif($thread instanceof Worker){
$thread->kill();
sleep(1);
if($thread->isRunning()){
$thread->detach();
}
}
}elseif(!$thread->isJoined()){
$logger->debug("Joining " . (new \ReflectionClass($thread))->getShortName() . " thread");
$thread->join();
}
$logger->debug("Stopping " . (new \ReflectionClass($thread))->getShortName() . " thread");
$thread->quit();
}
$killer = new ServerKiller(8);
$killer->start();
$logger->shutdown();
$logger->join();
echo Terminal::$FORMAT_RESET . "\n";
exit(0);
}

File diff suppressed because it is too large Load Diff

View File

@ -26,9 +26,63 @@ namespace pocketmine;
*/
abstract class Thread extends \Thread{
public final function start($options = PTHREADS_INHERIT_ALL){
/** @var \ClassLoader */
protected $classLoader;
protected $isKilled = false;
public function getClassLoader(){
return $this->classLoader;
}
public function setClassLoader(\ClassLoader $loader = null){
if($loader === null){
$loader = Server::getInstance()->getLoader();
}
$this->classLoader = $loader;
}
public function registerClassLoader(){
if(!interface_exists("ClassLoader", false)){
require(\pocketmine\PATH . "src/spl/ClassLoader.php");
require(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
require(\pocketmine\PATH . "src/pocketmine/CompatibleClassLoader.php");
}
if($this->classLoader !== null){
$this->classLoader->register(true);
}
}
public function start(int $options = PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this);
return parent::start($options);
if(!$this->isRunning() and !$this->isJoined() and !$this->isTerminated()){
if($this->getClassLoader() === null){
$this->setClassLoader();
}
return parent::start($options);
}
return false;
}
}
/**
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
*/
public function quit(){
$this->isKilled = true;
$this->notify();
if(!$this->isJoined()){
if(!$this->isTerminated()){
$this->join();
}
}
ThreadManager::getInstance()->remove($this);
}
public function getThreadName(){
return (new \ReflectionClass($this))->getShortName();
}
}

View File

@ -21,7 +21,7 @@
namespace pocketmine;
class ThreadManager extends \Threaded{
class ThreadManager extends \Volatile{
/** @var ThreadManager */
private static $instance = null;

View File

@ -26,9 +26,68 @@ namespace pocketmine;
*/
abstract class Worker extends \Worker{
public final function start($options = PTHREADS_INHERIT_ALL){
/** @var \ClassLoader */
protected $classLoader;
protected $isKilled = false;
public function getClassLoader(){
return $this->classLoader;
}
public function setClassLoader(\ClassLoader $loader = null){
if($loader === null){
$loader = Server::getInstance()->getLoader();
}
$this->classLoader = $loader;
}
public function registerClassLoader(){
if(!interface_exists("ClassLoader", false)){
require(\pocketmine\PATH . "src/spl/ClassLoader.php");
require(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
require(\pocketmine\PATH . "src/pocketmine/CompatibleClassLoader.php");
}
if($this->classLoader !== null){
$this->classLoader->register(true);
}
}
public function start(int $options = PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this);
return parent::start($options);
if(!$this->isRunning() and !$this->isJoined() and !$this->isTerminated()){
if($this->getClassLoader() === null){
$this->setClassLoader();
}
return parent::start($options);
}
return false;
}
}
/**
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
*/
public function quit(){
$this->isKilled = true;
$this->notify();
if($this->isRunning()){
$this->shutdown();
$this->notify();
$this->unstack();
}elseif(!$this->isJoined()){
if(!$this->isTerminated()){
$this->join();
}
}
ThreadManager::getInstance()->remove($this);
}
public function getThreadName(){
return (new \ReflectionClass($this))->getShortName();
}
}

View File

@ -22,10 +22,18 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class AcaciaWoodStairs extends Stair{
protected $id = self::ACACIA_WOOD_STAIRS;
public function __construct($meta = 0){
parent::__construct(self::ACACIA_WOOD_STAIRS, $meta, "Acacia Wood Stairs");
$this->meta = $meta;
}
public function getName(){
return "Acacia Wood Stairs";
}
public function getDrops(Item $item){
@ -33,4 +41,16 @@ class AcaciaWoodStairs extends Stair{
[$this->id, 0, 1],
];
}
public function getHardness(){
return 2;
}
public function getResistance(){
return 15;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
}

View File

@ -0,0 +1,35 @@
<?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/
*
*
*/
namespace pocketmine\block;
class ActivatorRail extends Solid {
protected $id = self::ACTIVATOR_RAIL;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Activator Rail";
}
}

View File

@ -21,31 +21,59 @@
namespace pocketmine\block;
use pocketmine\item\Item;
/**
* Air block
*/
class Air extends Transparent{
public $isActivable = false;
public $breakable = false;
public $isFlowable = true;
public $isTransparent = true;
public $isReplaceable = true;
public $isPlaceable = false;
public $hasPhysics = false;
public $isSolid = false;
public $isFullBlock = true;
protected $id = self::AIR;
protected $meta = 0;
protected $name = "Air";
protected $hardness = 0;
public function __construct(){
}
public function getName(){
return "Air";
}
public function canPassThrough(){
return true;
}
public function isBreakable(Item $item){
return false;
}
public function canBeFlowedInto(){
return true;
}
public function canBeReplaced(){
return true;
}
public function canBePlaced(){
return false;
}
public function isSolid(){
return false;
}
public function getBoundingBox(){
return null;
}
public function getHardness(){
return -1;
}
public function getResistance(){
return 0;
}
}

View File

@ -0,0 +1,82 @@
<?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/
*
*
*/
namespace pocketmine\block;
use pocketmine\inventory\AnvilInventory;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\Player;
class Anvil extends Fallable{
protected $id = self::ANVIL;
public function isSolid(){
return false;
}
public function __construct($meta = 0){
$this->meta = $meta;
}
public function canBeActivated(){
return true;
}
public function getHardness(){
return 5;
}
public function getResistance(){
return 6000;
}
public function getName(){
return "Anvil";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function onActivate(Item $item, Player $player = null){
if($player instanceof Player){
if($player->isCreative()){
return true;
}
$player->addWindow(new AnvilInventory($this));
}
return true;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[$this->id, 0, 1], //TODO break level
];
}else{
return [];
}
}
}

View File

@ -24,15 +24,27 @@ namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\network\protocol\ChatPacket;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class Bed extends Transparent{
public function __construct($type = 0){
parent::__construct(self::BED_BLOCK, $type, "Bed Block");
$this->isActivable = true;
$this->isFullBlock = false;
$this->hardness = 1;
protected $id = self::BED_BLOCK;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function canBeActivated(){
return true;
}
public function getHardness(){
return 0.2;
}
public function getName(){
return "Bed Block";
}
protected function recalculateBoundingBox(){
@ -53,10 +65,7 @@ class Bed extends Transparent{
$isNight = ($time >= Level::TIME_NIGHT and $time < Level::TIME_SUNRISE);
if($player instanceof Player and !$isNight){
$pk = new ChatPacket();
$pk->message = "You can only sleep at night";
$player->dataPacket($pk);
$player->sendMessage(TextFormat::GRAY . "You can only sleep at night");
return true;
}
@ -67,19 +76,17 @@ class Bed extends Transparent{
if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed
$b = $this;
}else{ //Bottom Part of Bed
if($blockNorth->getID() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
if($blockNorth->getId() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
$b = $blockNorth;
}elseif($blockSouth->getID() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
}elseif($blockSouth->getId() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
$b = $blockSouth;
}elseif($blockEast->getID() === $this->id and ($blockEast->meta & 0x08) === 0x08){
}elseif($blockEast->getId() === $this->id and ($blockEast->meta & 0x08) === 0x08){
$b = $blockEast;
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
}elseif($blockWest->getId() === $this->id and ($blockWest->meta & 0x08) === 0x08){
$b = $blockWest;
}else{
if($player instanceof Player){
$pk = new ChatPacket();
$pk->message = "This bed is incomplete";
$player->dataPacket($pk);
$player->sendMessage(TextFormat::GRAY . "This bed is incomplete");
}
return true;
@ -87,9 +94,7 @@ class Bed extends Transparent{
}
if($player instanceof Player and $player->sleepOn($b) === false){
$pk = new ChatPacket();
$pk->message = "This bed is occupied";
$player->dataPacket($pk);
$player->sendMessage(TextFormat::GRAY . "This bed is occupied");
}
return true;
@ -97,7 +102,7 @@ class Bed extends Transparent{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->isTransparent === false){
if($down->isTransparent() === false){
$faces = [
0 => 3,
1 => 4,
@ -107,7 +112,7 @@ class Bed extends Transparent{
$d = $player instanceof Player ? $player->getDirection() : 0;
$next = $this->getSide($faces[(($d + 3) % 4)]);
$downNext = $this->getSide(0);
if($next->isReplaceable === true and $downNext->isTransparent === false){
if($next->canBeReplaced() === true and $downNext->isTransparent() === false){
$meta = (($d + 3) % 4) & 0x03;
$this->getLevel()->setBlock($block, Block::get($this->id, $meta), true, true);
$this->getLevel()->setBlock($next, Block::get($this->id, $meta | 0x08), true, true);
@ -126,23 +131,23 @@ class Bed extends Transparent{
$blockWest = $this->getSide(4);
if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed
if($blockNorth->getID() === $this->id and $blockNorth->meta !== 0x08){ //Checks if the block ID and meta are right
if($blockNorth->getId() === $this->id and $blockNorth->meta !== 0x08){ //Checks if the block ID and meta are right
$this->getLevel()->setBlock($blockNorth, new Air(), true, true);
}elseif($blockSouth->getID() === $this->id and $blockSouth->meta !== 0x08){
}elseif($blockSouth->getId() === $this->id and $blockSouth->meta !== 0x08){
$this->getLevel()->setBlock($blockSouth, new Air(), true, true);
}elseif($blockEast->getID() === $this->id and $blockEast->meta !== 0x08){
}elseif($blockEast->getId() === $this->id and $blockEast->meta !== 0x08){
$this->getLevel()->setBlock($blockEast, new Air(), true, true);
}elseif($blockWest->getID() === $this->id and $blockWest->meta !== 0x08){
}elseif($blockWest->getId() === $this->id and $blockWest->meta !== 0x08){
$this->getLevel()->setBlock($blockWest, new Air(), true, true);
}
}else{ //Bottom Part of Bed
if($blockNorth->getID() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
if($blockNorth->getId() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockNorth, new Air(), true, true);
}elseif($blockSouth->getID() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
}elseif($blockSouth->getId() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockSouth, new Air(), true, true);
}elseif($blockEast->getID() === $this->id and ($blockEast->meta & 0x08) === 0x08){
}elseif($blockEast->getId() === $this->id and ($blockEast->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockEast, new Air(), true, true);
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
}elseif($blockWest->getId() === $this->id and ($blockWest->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockWest, new Air(), true, true);
}
}

View File

@ -24,10 +24,23 @@ namespace pocketmine\block;
use pocketmine\item\Item;
class Bedrock extends Solid{
protected $id = self::BEDROCK;
public function __construct(){
parent::__construct(self::BEDROCK, 0, "Bedrock");
$this->breakable = false;
$this->hardness = 18000000;
}
public function getName(){
return "Bedrock";
}
public function getHardness(){
return -1;
}
public function getResistance(){
return 18000000;
}
public function isBreakable(Item $item){

View File

@ -24,8 +24,15 @@ namespace pocketmine\block;
use pocketmine\item\Item;
class Beetroot extends Crops{
protected $id = self::BEETROOT_BLOCK;
public function __construct($meta = 0){
parent::__construct(self::BEETROOT_BLOCK, $meta, "Beetroot Block");
$this->meta = $meta;
}
public function getName(){
return "Beetroot Block";
}
public function getDrops(Item $item){

View File

@ -22,10 +22,18 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class BirchWoodStairs extends Stair{
protected $id = self::BIRCH_WOOD_STAIRS;
public function __construct($meta = 0){
parent::__construct(self::BIRCH_WOOD_STAIRS, $meta, "Birch Wood Stairs");
$this->meta = $meta;
}
public function getName(){
return "Birch Wood Stairs";
}
public function getDrops(Item $item){
@ -33,4 +41,16 @@ class BirchWoodStairs extends Stair{
[$this->id, 0, 1],
];
}
public function getHardness(){
return 2;
}
public function getResistance(){
return 15;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -22,10 +22,26 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class Bookshelf extends Solid{
protected $id = self::BOOKSHELF;
public function __construct(){
parent::__construct(self::BOOKSHELF, 0, "Bookshelf");
$this->hardness = 7.5;
}
public function getName(){
return "Bookshelf";
}
public function getHardness(){
return 1.5;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
}

View File

@ -0,0 +1,46 @@
<?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/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class BrewingStand extends Transparent{
protected $id = self::BREWING_STAND;
public function __construct(){
}
public function getName(){
return "Brewing Stand";
}
public function getHardness(){
return 0.5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
}

View File

@ -22,9 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class BrickStairs extends Stair{
protected $id = self::BRICK_STAIRS;
public function __construct($meta = 0){
parent::__construct(self::BRICK_STAIRS, $meta, "Brick Stairs");
$this->meta = $meta;
}
public function getHardness(){
return 2;
}
public function getResistance(){
return 30;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Brick Stairs";
}
}

View File

@ -22,32 +22,34 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Bricks extends Solid{
protected $id = self::BRICKS_BLOCK;
public function __construct(){
parent::__construct(self::BRICKS_BLOCK, 0, "Bricks");
$this->hardness = 30;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 10;
}
public function getHardness(){
return 2;
}
public function getResistance(){
return 30;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Bricks";
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::BRICKS_BLOCK, 0, 1],
];

View File

@ -26,14 +26,24 @@ use pocketmine\level\Level;
use pocketmine\Player;
class BrownMushroom extends Flowable{
public function __construct(){
parent::__construct(self::BROWN_MUSHROOM, 0, "Brown Mushroom");
$this->hardness = 0;
protected $id = self::BROWN_MUSHROOM;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Brown Mushroom";
}
public function getLightLevel(){
return 1;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){
if($this->getSide(0)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
@ -45,7 +55,7 @@ class BrownMushroom extends Flowable{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->isTransparent === false){
if($down->isTransparent() === false){
$this->getLevel()->setBlock($block, $this, true, true);
return true;

View File

@ -22,20 +22,42 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\String;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\tile\Furnace;
use pocketmine\tile\Tile;
class BurningFurnace extends Solid{
protected $id = self::BURNING_FURNACE;
public function __construct($meta = 0){
parent::__construct(self::BURNING_FURNACE, $meta, "Burning Furnace");
$this->isActivable = true;
$this->hardness = 17.5;
$this->meta = $meta;
}
public function getName(){
return "Burning Furnace";
}
public function canBeActivated(){
return true;
}
public function getHardness(){
return 3.5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getLightLevel(){
return 13;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
@ -47,14 +69,25 @@ class BurningFurnace extends Solid{
];
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
$this->getLevel()->setBlock($block, $this, true, true);
$nbt = new Compound(false, [
new Enum("Items", []),
new String("id", Tile::FURNACE),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::FURNACE),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
if($item->hasCustomName()){
$nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
}
if($item->hasCustomBlockData()){
foreach($item->getCustomBlockData() as $key => $v){
$nbt->{$key} = $v;
}
}
Tile::createTile("Furnace", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
return true;
@ -73,18 +106,24 @@ class BurningFurnace extends Solid{
if($t instanceof Furnace){
$furnace = $t;
}else{
$nbt = new Compound(false, [
new Enum("Items", []),
new String("id", Tile::FURNACE),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::FURNACE),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$furnace = Tile::createTile("Furnace", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if(($player->getGamemode() & 0x01) === 0x01){
if(isset($furnace->namedtag->Lock) and $furnace->namedtag->Lock instanceof StringTag){
if($furnace->namedtag->Lock->getValue() !== $item->getCustomName()){
return true;
}
}
if($player->isCreative()){
return true;
}
@ -94,26 +133,9 @@ class BurningFurnace extends Solid{
return true;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.7;
case 4:
return 0.9;
case 3:
return 1.35;
case 2:
return 0.45;
case 1:
return 2.65;
default:
return 17.5;
}
}
public function getDrops(Item $item){
$drops = [];
if($item->isPickaxe() >= 1){
if($item->isPickaxe() >= Tool::TIER_WOODEN){
$drops[] = [Item::FURNACE, 0, 1];
}

View File

@ -34,22 +34,32 @@ use pocketmine\Server;
class Cactus extends Transparent{
public $hasEntityCollision = true;
protected $id = self::CACTUS;
public function __construct($meta = 0){
parent::__construct(self::CACTUS, $meta, "Cactus");
$this->isFullBlock = false;
$this->hardness = 2;
$this->meta = $meta;
}
public function getHardness(){
return 0.4;
}
public function hasEntityCollision(){
return true;
}
public function getName(){
return "Cactus";
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x + 0.0625,
$this->y,
$this->y + 0.0625,
$this->z + 0.0625,
$this->x + 0.9375,
$this->y + 1,
$this->y + 0.9375,
$this->z + 0.9375
);
}
@ -62,22 +72,22 @@ class Cactus extends Transparent{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0);
if($down->getID() !== self::SAND and $down->getID() !== self::CACTUS){
if($down->getId() !== self::SAND and $down->getId() !== self::CACTUS){
$this->getLevel()->useBreakOn($this);
}else{
for($side = 2; $side <= 5; ++$side){
$b = $this->getSide($side);
if(!$b->isFlowable){
if(!$b->canBeFlowedInto()){
$this->getLevel()->useBreakOn($this);
}
}
}
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if($this->getSide(0)->getID() !== self::CACTUS){
if($this->getSide(0)->getId() !== self::CACTUS){
if($this->meta == 0x0F){
for($y = 1; $y < 3; ++$y){
$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
if($b->getID() === self::AIR){
if($b->getId() === self::AIR){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, new Cactus()));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
@ -98,12 +108,12 @@ class Cactus extends Transparent{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::SAND or $down->getID() === self::CACTUS){
if($down->getId() === self::SAND or $down->getId() === self::CACTUS){
$block0 = $this->getSide(2);
$block1 = $this->getSide(3);
$block2 = $this->getSide(4);
$block3 = $this->getSide(5);
if($block0->isTransparent === true and $block1->isTransparent === true and $block2->isTransparent === true and $block3->isTransparent === true){
if($block0->isTransparent() === true and $block1->isTransparent() === true and $block2->isTransparent() === true and $block3->isTransparent() === true){
$this->getLevel()->setBlock($this, $this, true);
return true;

View File

@ -21,20 +21,32 @@
namespace pocketmine\block;
use pocketmine\event\entity\EntityRegainHealthEvent;
use pocketmine\entity\Effect;
use pocketmine\event\entity\EntityEatBlockEvent;
use pocketmine\item\FoodSource;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\Player;
use pocketmine\Server;
class Cake extends Transparent{
class Cake extends Transparent implements FoodSource{
protected $id = self::CAKE_BLOCK;
public function __construct($meta = 0){
parent::__construct(self::CAKE_BLOCK, 0, "Cake Block");
$this->isFullBlock = false;
$this->isActivable = true;
$this->meta = $meta & 0x07;
$this->hardness = 2.5;
$this->meta = $meta;
}
public function canBeActivated(){
return true;
}
public function getHardness(){
return 0.5;
}
public function getName(){
return "Cake Block";
}
protected function recalculateBoundingBox(){
@ -53,7 +65,7 @@ class Cake extends Transparent{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() !== self::AIR){
if($down->getId() !== self::AIR){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
@ -64,7 +76,7 @@ class Cake extends Transparent{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), true);
return Level::BLOCK_UPDATE_NORMAL;
@ -79,22 +91,39 @@ class Cake extends Transparent{
}
public function onActivate(Item $item, Player $player = null){
if($player instanceof Player and $player->getHealth() < 20){
++$this->meta;
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityRegainHealthEvent($player, 3, EntityRegainHealthEvent::CAUSE_EATING));
if(!$ev->isCancelled()){
$player->heal($ev->getAmount(), $ev);
}
if($this->meta >= 0x06){
$this->getLevel()->setBlock($this, new Air(), true);
}else{
$this->getLevel()->setBlock($this, $this, true);
}
if($player instanceof Player and $player->getHealth() < $player->getMaxHealth()){
$ev = new EntityEatBlockEvent($player, $this);
return true;
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($this, $ev->getResidue());
return true;
}
}
return false;
}
}
public function getFoodRestore() : int{
return 2;
}
public function getSaturationRestore() : float{
return 0.4;
}
public function getResidue(){
$clone = clone $this;
$clone->meta++;
if($clone->meta >= 0x06){
$clone = new Air();
}
return $clone;
}
/**
* @return Effect[]
*/
public function getAdditionalEffects() : array{
return [];
}
}

View File

@ -27,9 +27,23 @@ use pocketmine\math\AxisAlignedBB;
use pocketmine\Player;
class Carpet extends Flowable{
protected $id = self::CARPET;
public function __construct($meta = 0){
parent::__construct(self::CARPET, $meta, "Carpet");
$names = [
$this->meta = $meta;
}
public function getHardness(){
return 0.1;
}
public function isSolid(){
return true;
}
public function getName(){
static $names = [
0 => "White Carpet",
1 => "Orange Carpet",
2 => "Magenta Carpet",
@ -47,10 +61,7 @@ class Carpet extends Flowable{
14 => "Red Carpet",
15 => "Black Carpet",
];
$this->name = $names[$this->meta];
$this->hardness = 0;
$this->isFullBlock = false;
$this->isSolid = true;
return $names[$this->meta & 0x0f];
}
protected function recalculateBoundingBox(){
@ -67,7 +78,7 @@ class Carpet extends Flowable{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() !== self::AIR){
if($down->getId() !== self::AIR){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
@ -78,7 +89,7 @@ class Carpet extends Flowable{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){
if($this->getSide(0)->getId() === self::AIR){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;

View File

@ -24,8 +24,15 @@ namespace pocketmine\block;
use pocketmine\item\Item;
class Carrot extends Crops{
protected $id = self::CARROT_BLOCK;
public function __construct($meta = 0){
parent::__construct(self::CARROT_BLOCK, $meta, "Carrot Block");
$this->meta = $meta;
}
public function getName(){
return "Carrot Block";
}
public function getDrops(Item $item){

View File

@ -22,28 +22,42 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\String;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\tile\Chest as TileChest;
use pocketmine\tile\Tile;
class Chest extends Transparent{
const SLOTS = 27;
protected $id = self::CHEST;
public function __construct($meta = 0){
parent::__construct(self::CHEST, $meta, "Chest");
$this->isActivable = true;
$this->hardness = 15;
$this->meta = $meta;
}
public function canBeActivated(){
return true;
}
public function getHardness(){
return 2.5;
}
public function getName(){
return "Chest";
}
public function getToolType(){
return Tool::TYPE_AXE;
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x + 0.0625,
$this->y,
@ -82,14 +96,25 @@ class Chest extends Transparent{
}
$this->getLevel()->setBlock($block, $this, true, true);
$nbt = new Compound(false, [
new Enum("Items", []),
new String("id", Tile::CHEST),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::CHEST),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
if($item->hasCustomName()){
$nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
}
if($item->hasCustomBlockData()){
foreach($item->getCustomBlockData() as $key => $v){
$nbt->{$key} = $v;
}
}
$tile = Tile::createTile("Chest", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
if($chest instanceof TileChest and $tile instanceof TileChest){
@ -113,7 +138,7 @@ class Chest extends Transparent{
public function onActivate(Item $item, Player $player = null){
if($player instanceof Player){
$top = $this->getSide(1);
if($top->isTransparent !== true){
if($top->isTransparent() !== true){
return true;
}
@ -122,17 +147,22 @@ class Chest extends Transparent{
if($t instanceof TileChest){
$chest = $t;
}else{
$nbt = new Compound(false, [
new Enum("Items", []),
new String("id", Tile::CHEST),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::CHEST),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$chest = Tile::createTile("Chest", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if(isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof StringTag){
if($chest->namedtag->Lock->getValue() !== $item->getCustomName()){
return true;
}
}
if($player->isCreative()){
return true;

View File

@ -22,11 +22,26 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Clay extends Solid{
protected $id = self::CLAY_BLOCK;
public function __construct(){
parent::__construct(self::CLAY_BLOCK, 0, "Clay Block");
$this->hardness = 3;
}
public function getHardness(){
return 0.6;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function getName(){
return "Clay Block";
}
public function getDrops(Item $item){

View File

@ -22,32 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Coal extends Solid{
protected $id = self::COAL_BLOCK;
public function __construct(){
parent::__construct(self::COAL_BLOCK, 0, "Coal Block");
$this->hardness = 30;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.95;
case 4:
return 1.25;
case 3:
return 1.9;
case 2:
return 0.65;
case 1:
return 3.75;
default:
return 25;
}
public function getHardness(){
return 5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Coal Block";
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::COAL_BLOCK, 0, 1],
];

View File

@ -22,32 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class CoalOre extends Solid{
protected $id = self::COAL_ORE;
public function __construct(){
parent::__construct(self::COAL_ORE, 0, "Coal Ore");
$this->hardness = 15;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
case 3:
return 1.15;
case 2:
return 0.4;
case 1:
return 2.25;
default:
return 15;
}
public function getHardness(){
return 3;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Coal Ore";
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::COAL, 0, 1],
];

View File

@ -22,32 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Cobblestone extends Solid{
protected $id = self::COBBLESTONE;
public function __construct(){
parent::__construct(self::COBBLESTONE, 0, "Cobblestone");
$this->hardness = 30;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 10;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Cobblestone";
}
public function getHardness(){
return 2;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::COBBLESTONE, 0, 1],
];

View File

@ -22,9 +22,26 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
class CobblestoneStairs extends Stair{
protected $id = self::COBBLESTONE_STAIRS;
public function __construct($meta = 0){
parent::__construct(self::COBBLESTONE_STAIRS, $meta, "Cobblestone Stairs");
$this->meta = $meta;
}
public function getHardness(){
return 2;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Cobblestone Stairs";
}
}

View File

@ -23,23 +23,38 @@ namespace pocketmine\block;
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Cobweb extends Flowable{
public $hasEntityCollision = true;
protected $id = self::COBWEB;
public function __construct(){
parent::__construct(self::COBWEB, 0, "Cobweb");
$this->isSolid = true;
$this->isFullBlock = false;
$this->hardness = 25;
}
public function hasEntityCollision(){
return true;
}
public function getName(){
return "Cobweb";
}
public function getHardness(){
return 4;
}
public function getToolType(){
return Tool::TYPE_SWORD;
}
public function onEntityCollide(Entity $entity){
$entity->fallDistance = 0;
$entity->resetFallDistance();
}
public function getDrops(Item $item){
//TODO: correct drops
return [];
}
}

View File

@ -0,0 +1,35 @@
<?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/
*
*
*/
namespace pocketmine\block;
class CocoaBlock extends Solid {
protected $id = self::COCOA_BLOCK;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Cocoa Block";
}
}

View File

@ -29,17 +29,13 @@ use pocketmine\Server;
abstract class Crops extends Flowable{
public $isActivable = true;
public $hardness = 0;
public function getBoundingBox(){
return null;
public function canBeActivated(){
return true;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::FARMLAND){
if($down->getId() === self::FARMLAND){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
@ -50,7 +46,7 @@ abstract class Crops extends Flowable{
public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
$block = clone $this;
$block->meta += mt_rand(2, 5);
if($block->meta > 7){
@ -73,7 +69,7 @@ abstract class Crops extends Flowable{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){
if($this->getSide(0)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -26,19 +26,21 @@ use pocketmine\level\Level;
use pocketmine\Player;
class Dandelion extends Flowable{
protected $id = self::DANDELION;
public function __construct(){
parent::__construct(self::DANDELION, 0, "Dandelion");
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
public function getName(){
return "Dandelion";
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
if($down->getId() === 2 or $down->getId() === 3 or $down->getId() === 60){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
@ -49,7 +51,7 @@ class Dandelion extends Flowable{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){
if($this->getSide(0)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;

View File

@ -22,10 +22,22 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class DarkOakWoodStairs extends Stair{
protected $id = self::DARK_OAK_WOOD_STAIRS;
public function __construct($meta = 0){
parent::__construct(self::DARK_OAK_WOOD_STAIRS, $meta, "Dark Oak Wood Stairs");
$this->meta = $meta;
}
public function getName(){
return "Dark Oak Wood Stairs";
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getDrops(Item $item){

View File

@ -0,0 +1,35 @@
<?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/
*
*
*/
namespace pocketmine\block;
class DaylightSensor extends Solid {
protected $id = self::DAYLIGHT_SENSOR;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Daylight Sensor";
}
}

View File

@ -24,21 +24,22 @@ namespace pocketmine\block;
use pocketmine\level\Level;
class DeadBush extends Flowable{
public function __construct(){
parent::__construct(self::DEAD_BUSH, 0, "Dead Bush");
//$this->isReplaceable = true;
$this->hardness = 0;
protected $id = self::DEAD_BUSH;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
return null;
public function getName(){
return "Dead Bush";
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), false, false, true);
if($this->getSide(0)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -0,0 +1,35 @@
<?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/
*
*
*/
namespace pocketmine\block;
class DetectorRail extends Solid {
protected $id = self::DETECTOR_RAIL;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Detector Rail";
}
}

View File

@ -22,26 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Diamond extends Solid{
protected $id = self::DIAMOND_BLOCK;
public function __construct(){
parent::__construct(self::DIAMOND_BLOCK, 0, "Diamond Block");
$this->hardness = 30;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.95;
case 4:
return 1.25;
default:
return 25;
}
public function getHardness(){
return 5;
}
public function getName(){
return "Diamond Block";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::DIAMOND_BLOCK, 0, 1],
];

View File

@ -22,26 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class DiamondOre extends Solid{
protected $id = self::DIAMOND_ORE;
public function __construct(){
parent::__construct(self::DIAMOND_ORE, 0, "Diamond Ore");
$this->hardness = 15;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
public function getHardness(){
return 3;
}
public function getName(){
return "Diamond Ore";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::DIAMOND, 0, 1],
];

View File

@ -22,20 +22,33 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\Player;
class Dirt extends Solid{
public $isActivable = true;
protected $hardness = 2.5;
protected $id = self::DIRT;
protected $meta = 0;
protected $name = "Dirt";
public function __construct(){
}
public function canBeActivated(){
return true;
}
public function getHardness(){
return 0.5;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function getName(){
return "Dirt";
}
public function onActivate(Item $item, Player $player = null){
if($item->isHoe()){
$item->useOn($this);

View File

@ -23,33 +23,37 @@ namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\level\sound\DoorSound;
use pocketmine\math\AxisAlignedBB;
use pocketmine\network\protocol\LevelEventPacket;
use pocketmine\math\Vector3;
use pocketmine\Player;
use pocketmine\Server;
abstract class Door extends Transparent{
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
$this->isSolid = false;
public function canBeActivated(){
return true;
}
public function isSolid(){
return false;
}
private function getFullDamage(){
$damage = $this->getDamage();
$flag = ($damage & 0x08) > 0;
$isUp = ($damage & 0x08) > 0;
if($flag){
$first = $this->getSide(0)->getDamage();
$second = $damage;
if($isUp){
$down = $this->getSide(Vector3::SIDE_DOWN)->getDamage();
$up = $damage;
}else{
$first = $damage;
$second = $this->getSide(1)->getDamage();
$down = $damage;
$up = $this->getSide(Vector3::SIDE_UP)->getDamage();
}
$flag1 = ($second & 0x01) > 0;
$isRight = ($up & 0x01) > 0;
return $first & 0x07 | ($flag ? 8 : 0) | ($flag1 ? 0x10 : 0);
return $down & 0x07 | ($isUp ? 8 : 0) | ($isRight ? 0x10 : 0);
}
protected function recalculateBoundingBox(){
@ -67,12 +71,12 @@ abstract class Door extends Transparent{
);
$j = $damage & 0x03;
$flag = (($damage & 0x04) > 0);
$flag1 = (($damage & 0x10) > 0);
$isOpen = (($damage & 0x04) > 0);
$isRight = (($damage & 0x10) > 0);
if($j === 0){
if($flag){
if(!$flag1){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
@ -102,8 +106,8 @@ abstract class Door extends Transparent{
);
}
}elseif($j === 1){
if($flag){
if(!$flag1){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x + 1 - $f,
$this->y,
@ -133,8 +137,8 @@ abstract class Door extends Transparent{
);
}
}elseif($j === 2){
if($flag){
if(!$flag1){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
@ -164,8 +168,8 @@ abstract class Door extends Transparent{
);
}
}elseif($j === 3){
if($flag){
if(!$flag1){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
@ -201,7 +205,7 @@ abstract class Door extends Transparent{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), false);
if($this->getSide(1) instanceof Door){
$this->getLevel()->setBlock($this->getSide(1), new Air(), false);
@ -218,7 +222,7 @@ abstract class Door extends Transparent{
if($face === 1){
$blockUp = $this->getSide(1);
$blockDown = $this->getSide(0);
if($blockUp->isReplaceable === false or $blockDown->isTransparent === true){
if($blockUp->canBeReplaced() === false or $blockDown->isTransparent() === true){
return false;
}
$direction = $player instanceof Player ? $player->getDirection() : 0;
@ -231,13 +235,13 @@ abstract class Door extends Transparent{
$next = $this->getSide($face[(($direction + 2) % 4)]);
$next2 = $this->getSide($face[$direction]);
$metaUp = 0x08;
if($next->getID() === $this->id or ($next2->isTransparent === false and $next->isTransparent === true)){ //Door hinge
if($next->getId() === $this->getId() or ($next2->isTransparent() === false and $next->isTransparent() === true)){ //Door hinge
$metaUp |= 0x01;
}
$this->meta = $player->getDirection() & 0x03;
$this->setDamage($player->getDirection() & 0x03);
$this->getLevel()->setBlock($block, $this, true, true); //Bottom
$this->getLevel()->setBlock($blockUp, $b = Block::get($this->id, $metaUp), true); //Top
$this->getLevel()->setBlock($blockUp, $b = Block::get($this->getId(), $metaUp), true); //Top
return true;
}
@ -245,14 +249,14 @@ abstract class Door extends Transparent{
}
public function onBreak(Item $item){
if(($this->meta & 0x08) === 0x08){
if(($this->getDamage() & 0x08) === 0x08){
$down = $this->getSide(0);
if($down->getID() === $this->id){
if($down->getId() === $this->getId()){
$this->getLevel()->setBlock($down, new Air(), true);
}
}else{
$up = $this->getSide(1);
if($up->getID() === $this->id){
if($up->getId() === $this->getId()){
$this->getLevel()->setBlock($up, new Air(), true);
}
}
@ -262,23 +266,17 @@ abstract class Door extends Transparent{
}
public function onActivate(Item $item, Player $player = null){
if(($this->meta & 0x08) === 0x08){ //Top
if(($this->getDamage() & 0x08) === 0x08){ //Top
$down = $this->getSide(0);
if($down->getID() === $this->id){
if($down->getId() === $this->getId()){
$meta = $down->getDamage() ^ 0x04;
$this->getLevel()->setBlock($down, Block::get($this->id, $meta), true);
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
$this->getLevel()->setBlock($down, Block::get($this->getId(), $meta), true);
$players = $this->getLevel()->getChunkPlayers($this->x >> 4, $this->z >> 4);
if($player instanceof Player){
unset($players[$player->getID()]);
unset($players[$player->getLoaderId()]);
}
$pk = new LevelEventPacket();
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->evid = 1003;
$pk->data = 0;
Server::broadcastPacket($players, $pk);
$this->level->addSound(new DoorSound($this));
return true;
}
@ -286,17 +284,11 @@ abstract class Door extends Transparent{
}else{
$this->meta ^= 0x04;
$this->getLevel()->setBlock($this, $this, true);
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
$players = $this->getLevel()->getChunkPlayers($this->x >> 4, $this->z >> 4);
if($player instanceof Player){
unset($players[$player->getID()]);
unset($players[$player->getLoaderId()]);
}
$pk = new LevelEventPacket();
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->evid = 1003;
$pk->data = 0;
Server::broadcastPacket($players, $pk);
$this->level->addSound(new DoorSound($this));
}
return true;

View File

@ -23,34 +23,36 @@ namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
class CyanFlower extends Flowable{
public function __construct(){
parent::__construct(self::POPPY, 0, "Cyan Flower");
$this->hardness = 0;
class DoublePlant extends Flowable{
protected $id = self::DOUBLE_PLANT;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getBoundingBox(){
return null;
public function canBeReplaced(){
return true;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
return false;
public function getName(){
static $names = [
0 => "Sunflower",
1 => "Lilac",
2 => "Double Tallgrass",
3 => "Large Fern",
4 => "Rose Bush",
5 => "Peony"
];
return $names[$this->meta & 0x07];
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){
$this->getLevel()->useBreakOn($this);
if($this->getSide(0)->isTransparent() === true){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), false, false, true);
return Level::BLOCK_UPDATE_NORMAL;
}
@ -58,4 +60,11 @@ class CyanFlower extends Flowable{
return false;
}
public function getDrops(Item $item){
//TODO
return [];
}
}

View File

@ -22,11 +22,26 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class DoubleSlab extends Solid{
protected $id = self::DOUBLE_SLAB;
public function __construct($meta = 0){
parent::__construct(self::DOUBLE_SLAB, $meta, "Double Slab");
$names = [
$this->meta = $meta;
}
public function getHardness(){
return 2;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
static $names = [
0 => "Stone",
1 => "Sandstone",
2 => "Wooden",
@ -34,31 +49,13 @@ class DoubleSlab extends Solid{
4 => "Brick",
5 => "Stone Brick",
6 => "Quartz",
7 => "",
7 => "Nether Brick",
];
$this->name = "Double " . $names[$this->meta & 0x07] . " Slab";
$this->hardness = 30;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 10;
}
return "DoubleTag " . $names[$this->meta & 0x07] . " Slab";
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::SLAB, $this->meta & 0x07, 2],
];

View File

@ -22,37 +22,36 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class DoubleWoodSlab extends Solid{
protected $id = self::DOUBLE_WOOD_SLAB;
public function __construct($meta = 0){
parent::__construct(self::DOUBLE_WOOD_SLAB, $meta, "Double Wooden Slab");
$names = [
$this->meta = $meta;
}
public function getHardness(){
return 2;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getName(){
static $names = [
0 => "Oak",
1 => "Spruce",
2 => "Birch",
3 => "Jungle",
4 => "Acacia",
5 => "Dark Oak",
6 => "",
7 => ""
];
$this->name = "Double " . $names[$this->meta & 0x07] . " Wooden Slab";
$this->hardness = 15;
}
public function getBreakTime(Item $item){
switch($item->isAxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 3;
}
return "DoubleTag " . $names[$this->meta & 0x07] . " Wooden Slab";
}
public function getDrops(Item $item){

View File

@ -22,26 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Emerald extends Solid{
protected $id = self::EMERALD_BLOCK;
public function __construct(){
parent::__construct(self::EMERALD_BLOCK, 0, "Emerald Block");
$this->hardness = 30;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.95;
case 4:
return 1.25;
default:
return 25;
}
public function getHardness(){
return 5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Emerald Block";
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::EMERALD_BLOCK, 0, 1],
];

View File

@ -22,26 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class EmeraldOre extends Solid{
protected $id = self::EMERALD_ORE;
public function __construct(){
parent::__construct(self::EMERALD_ORE, 0, "Emerald Ore");
$this->hardness = 15;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
public function getName(){
return "Emerald Ore";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
return 3;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::EMERALD, 0, 1],
];

View File

@ -0,0 +1,108 @@
<?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/
*
*
*/
namespace pocketmine\block;
use pocketmine\inventory\EnchantInventory;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\tile\Tile;
class EnchantingTable extends Transparent{
protected $id = self::ENCHANTING_TABLE;
public function __construct(){
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$this->getLevel()->setBlock($block, $this, true, true);
$nbt = new CompoundTag("", [
new StringTag("id", Tile::ENCHANT_TABLE),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
if($item->hasCustomName()){
$nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
}
if($item->hasCustomBlockData()){
foreach($item->getCustomBlockData() as $key => $v){
$nbt->{$key} = $v;
}
}
Tile::createTile(Tile::ENCHANT_TABLE, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
return true;
}
public function canBeActivated(){
return true;
}
public function getHardness(){
return 5;
}
public function getResistance(){
return 6000;
}
public function getName(){
return "Enchanting Table";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function onActivate(Item $item, Player $player = null){
if($player instanceof Player){
//TODO lock
if($player->isCreative()){
return true;
}
$player->addWindow(new EnchantInventory($this));
}
return true;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[$this->id, 0, 1],
];
}else{
return [];
}
}
}

View File

@ -21,12 +21,35 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
class EndPortal extends Solid{
class EndPortalFrame extends Solid{
protected $id = self::END_PORTAL_FRAME;
public function __construct($meta = 0){
parent::__construct(self::END_PORTAL, $meta, "End Portal");
$this->hardness = 18000000;
$this->meta = $meta;
}
public function getLightLevel(){
return 1;
}
public function getName(){
return "EndTag Portal Frame";
}
public function getHardness(){
return -1;
}
public function getResistance(){
return 18000000;
}
public function isBreakable(Item $item){
return false;
}
protected function recalculateBoundingBox(){

View File

@ -21,28 +21,26 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class EndStone extends Solid{
protected $id = self::END_STONE;
public function __construct(){
parent::__construct(self::END_STONE, 0, "End Stone");
$this->hardness = 45;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
case 3:
return 1.15;
case 2:
return 0.4;
case 1:
return 2.25;
default:
return 15;
}
public function getName(){
return "EndTag Stone";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
return 3;
}
}

View File

@ -24,18 +24,17 @@ namespace pocketmine\block;
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Double;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Float;
use pocketmine\nbt\tag\Int;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\ByteTag;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\DoubleTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\FloatTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\Player;
abstract class Fallable extends Solid{
public $hasPhysics = true;
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$ret = $this->getLevel()->setBlock($this, $this, true, true);
@ -43,26 +42,26 @@ abstract class Fallable extends Solid{
}
public function onUpdate($type){
if($this->hasPhysics === true and $type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0);
if($down->getID() === self::AIR or ($down instanceof Liquid)){
$fall = Entity::createEntity("FallingSand", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new Compound("", [
"Pos" => new Enum("Pos", [
new Double("", $this->x + 0.5),
new Double("", $this->y),
new Double("", $this->z + 0.5)
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === self::AIR or ($down instanceof Liquid)){
$fall = Entity::createEntity("FallingSand", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new CompoundTag("", [
"Pos" => new ListTag("Pos", [
new DoubleTag("", $this->x + 0.5),
new DoubleTag("", $this->y),
new DoubleTag("", $this->z + 0.5)
]),
"Motion" => new Enum("Motion", [
new Double("", 0),
new Double("", 0),
new Double("", 0)
"Motion" => new ListTag("Motion", [
new DoubleTag("", 0),
new DoubleTag("", 0),
new DoubleTag("", 0)
]),
"Rotation" => new Enum("Rotation", [
new Float("", 0),
new Float("", 0)
"Rotation" => new ListTag("Rotation", [
new FloatTag("", 0),
new FloatTag("", 0)
]),
"TileID" => new Int("TileID", $this->getID()),
"Data" => new Byte("Data", $this->getDamage()),
"TileID" => new IntTag("TileID", $this->getId()),
"Data" => new ByteTag("Data", $this->getDamage()),
]));
$fall->spawnToAll();

View File

@ -22,16 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
class Farmland extends Solid{
protected $id = self::FARMLAND;
public function __construct($meta = 0){
parent::__construct(self::FARMLAND, $meta, "Farmland");
$this->hardness = 3;
$this->meta = $meta;
}
public function getName(){
return "Farmland";
}
public function getHardness(){
return 0.6;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x,
$this->y,

View File

@ -21,39 +21,71 @@
namespace pocketmine\block;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
class Fence extends Transparent{
public function __construct(){
parent::__construct(self::FENCE, 0, "Oak Fence");
$this->isFullBlock = false;
$this->hardness = 15;
const FENCE_OAK = 0;
const FENCE_SPRUCE = 1;
const FENCE_BIRCH = 2;
const FENCE_JUNGLE = 3;
const FENCE_ACACIA = 4;
const FENCE_DARKOAK = 5;
protected $id = self::FENCE;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getHardness(){
return 2;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getName(){
static $names = [
self::FENCE_OAK => "Oak Fence",
self::FENCE_SPRUCE => "Spruce Fence",
self::FENCE_BIRCH => "Birch Fence",
self::FENCE_JUNGLE => "Jungle Fence",
self::FENCE_ACACIA => "Acacia Fence",
self::FENCE_DARKOAK => "Dark Oak Fence",
"",
""
];
return $names[$this->meta & 0x07];
}
protected function recalculateBoundingBox(){
$flag = $this->canConnect($this->getSide(2));
$flag1 = $this->canConnect($this->getSide(3));
$flag2 = $this->canConnect($this->getSide(4));
$flag3 = $this->canConnect($this->getSide(5));
$north = $this->canConnect($this->getSide(Vector3::SIDE_NORTH));
$south = $this->canConnect($this->getSide(Vector3::SIDE_SOUTH));
$west = $this->canConnect($this->getSide(Vector3::SIDE_WEST));
$east = $this->canConnect($this->getSide(Vector3::SIDE_EAST));
$f = $flag2 ? 0 : 0.375;
$f1 = $flag3 ? 1 : 0.625;
$f2 = $flag ? 0 : 0.375;
$f3 = $flag1 ? 1 : 0.625;
$n = $north ? 0 : 0.375;
$s = $south ? 1 : 0.625;
$w = $west ? 0 : 0.375;
$e = $east ? 1 : 0.625;
return new AxisAlignedBB(
$this->x + $f,
$this->x + $w,
$this->y,
$this->z + $f2,
$this->x + $f1,
$this->z + $n,
$this->x + $e,
$this->y + 1.5,
$this->z + $f3
$this->z + $s
);
}
public function canConnect(Block $block){
return (!($block instanceof Fence) and !($block instanceof FenceGate)) ? $block->isSolid : true;
return ($block instanceof Fence or $block instanceof FenceGate) ? true : $block->isSolid() and !$block->isTransparent();
}
}
}

View File

@ -22,19 +22,33 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\sound\DoorSound;
use pocketmine\math\AxisAlignedBB;
use pocketmine\Player;
class FenceGate extends Transparent{
protected $id = self::FENCE_GATE;
public function __construct($meta = 0){
parent::__construct(self::FENCE_GATE, $meta, "Oak Fence Gate");
$this->isActivable = true;
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
}
$this->hardness = 15;
$this->meta = $meta;
}
public function getName(){
return "Oak Fence Gate";
}
public function getHardness(){
return 2;
}
public function canBeActivated(){
return true;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
@ -93,13 +107,8 @@ class FenceGate extends Transparent{
3 => 2,
];
$this->meta = ($faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03) | ((~$this->meta) & 0x04);
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
}
$this->getLevel()->setBlock($this, $this, true);
$this->level->addSound(new DoorSound($this));
return true;
}
}
}

View File

@ -23,14 +23,10 @@ namespace pocketmine\block;
class FenceGateAcacia extends FenceGate{
public function __construct($meta = 0){
Transparent::__construct(self::FENCE_GATE_ACACIA, $meta, "Acacia Fence Gate");
$this->isActivable = true;
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
}
$this->hardness = 15;
protected $id = self::FENCE_GATE_ACACIA;
public function getName(){
return "Acacia Fence Gate";
}
}

View File

@ -23,14 +23,10 @@ namespace pocketmine\block;
class FenceGateBirch extends FenceGate{
public function __construct($meta = 0){
Transparent::__construct(self::FENCE_GATE_BIRCH, $meta, "Birch Fence Gate");
$this->isActivable = true;
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
}
$this->hardness = 15;
protected $id = self::FENCE_GATE_BIRCH;
public function getName(){
return "Birch Fence Gate";
}
}

View File

@ -23,14 +23,10 @@ namespace pocketmine\block;
class FenceGateDarkOak extends FenceGate{
public function __construct($meta = 0){
Transparent::__construct(self::FENCE_GATE_DARK_OAK, $meta, "Dark Oak Fence Gate");
$this->isActivable = true;
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
}
$this->hardness = 15;
protected $id = self::FENCE_GATE_DARK_OAK;
public function getName(){
return "Dark Oak Fence Gate";
}
}

View File

@ -23,14 +23,10 @@ namespace pocketmine\block;
class FenceGateJungle extends FenceGate{
public function __construct($meta = 0){
Transparent::__construct(self::FENCE_GATE_JUNGLE, $meta, "Jungle Fence Gate");
$this->isActivable = true;
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
}
$this->hardness = 15;
protected $id = self::FENCE_GATE_JUNGLE;
public function getName(){
return "Jungle Fence Gate";
}
}

View File

@ -23,14 +23,10 @@ namespace pocketmine\block;
class FenceGateSpruce extends FenceGate{
public function __construct($meta = 0){
Transparent::__construct(self::FENCE_GATE_SPRUCE, $meta, "Spruce Fence Gate");
$this->isActivable = true;
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
}
$this->hardness = 15;
protected $id = self::FENCE_GATE_SPRUCE;
public function getName(){
return "Spruce Fence Gate";
}
}

View File

@ -1,30 +0,0 @@
<?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/
*
*
*/
namespace pocketmine\block;
class FenceSpruce extends Fence{
public function __construct(){
Transparent::__construct(self::FENCE_SPRUCE, 0, "Spruce Fence");
$this->isFullBlock = false;
$this->hardness = 15;
}
}

View File

@ -21,6 +21,8 @@
namespace pocketmine\block;
use pocketmine\entity\Arrow;
use pocketmine\entity\Effect;
use pocketmine\entity\Entity;
use pocketmine\event\entity\EntityCombustByBlockEvent;
use pocketmine\event\entity\EntityDamageByBlockEvent;
@ -31,25 +33,42 @@ use pocketmine\Server;
class Fire extends Flowable{
public $hasEntityCollision = true;
protected $id = self::FIRE;
public function __construct($meta = 0){
parent::__construct(self::FIRE, $meta, "Fire");
$this->isReplaceable = true;
$this->breakable = false;
$this->isFullBlock = true;
$this->hardness = 0;
$this->meta = $meta;
}
public function getBoundingBox(){
return null;
public function hasEntityCollision(){
return true;
}
public function getName(){
return "Fire Block";
}
public function getLightLevel(){
return 15;
}
public function isBreakable(Item $item){
return false;
}
public function canBeReplaced(){
return true;
}
public function onEntityCollide(Entity $entity){
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1);
$entity->attack($ev->getFinalDamage(), $ev);
if(!$entity->hasEffect(Effect::FIRE_RESISTANCE)){
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1);
$entity->attack($ev->getFinalDamage(), $ev);
}
$ev = new EntityCombustByBlockEvent($this, $entity, 8);
if($entity instanceof Arrow){
$ev->setCancelled();
}
Server::getInstance()->getPluginManager()->callEvent($ev);
if(!$ev->isCancelled()){
$entity->setOnFire($ev->getDuration());
@ -64,7 +83,7 @@ class Fire extends Flowable{
if($type === Level::BLOCK_UPDATE_NORMAL){
for($s = 0; $s <= 5; ++$s){
$side = $this->getSide($s);
if($side->getID() !== self::AIR and !($side instanceof Liquid)){
if($side->getId() !== self::AIR and !($side instanceof Liquid)){
return false;
}
}
@ -72,10 +91,17 @@ class Fire extends Flowable{
return Level::BLOCK_UPDATE_NORMAL;
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if($this->getSide(0)->getID() !== self::NETHERRACK){
$this->getLevel()->setBlock($this, new Air(), true);
if($this->getSide(0)->getId() !== self::NETHERRACK){
if(mt_rand(0, 2) === 0){
if($this->meta === 0x0F){
$this->level->setBlock($this, new Air());
}else{
$this->meta++;
$this->level->setBlock($this, $this);
}
return Level::BLOCK_UPDATE_NORMAL;
return Level::BLOCK_UPDATE_NORMAL;
}
}
}

View File

@ -22,10 +22,27 @@
namespace pocketmine\block;
abstract class Flowable extends Transparent{
public $isFlowable = true;
public $isFullBlock = false;
public $isSolid = false;
public function canBeFlowedInto(){
return true;
}
public function getHardness(){
return 0;
}
public function getResistance(){
return 0;
}
public function isSolid(){
return false;
}
public function getBoundingBox(){
return null;
}
}

View File

@ -0,0 +1,91 @@
<?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/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\Player;
class Flower extends Flowable{
const TYPE_POPPY = 0;
const TYPE_BLUE_ORCHID = 1;
const TYPE_ALLIUM = 2;
const TYPE_AZURE_BLUET = 3;
const TYPE_RED_TULIP = 4;
const TYPE_ORANGE_TULIP = 5;
const TYPE_WHITE_TULIP = 6;
const TYPE_PINK_TULIP = 7;
const TYPE_OXEYE_DAISY = 8;
protected $id = self::RED_FLOWER;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
static $names = [
self::TYPE_POPPY => "Poppy",
self::TYPE_BLUE_ORCHID => "Blue Orchid",
self::TYPE_ALLIUM => "Allium",
self::TYPE_AZURE_BLUET => "Azure Bluet",
self::TYPE_RED_TULIP => "Red Tulip",
self::TYPE_ORANGE_TULIP => "Orange Tulip",
self::TYPE_WHITE_TULIP => "White Tulip",
self::TYPE_PINK_TULIP => "Pink Tulip",
self::TYPE_OXEYE_DAISY => "Oxeye Daisy",
9 => "Unknown",
10 => "Unknown",
11 => "Unknown",
12 => "Unknown",
13 => "Unknown",
14 => "Unknown",
15 => "Unknown"
];
return $names[$this->meta];
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getId() === Block::GRASS or $down->getId() === Block::DIRT or $down->getId() === Block::FARMLAND){
$this->getLevel()->setBlock($block, $this, true);
return true;
}
return false;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}
}
return false;
}
}

View File

@ -21,11 +21,18 @@
namespace pocketmine\block;
use pocketmine\item\Item;
class FlowerPot extends Transparent{
protected $id = self::FLOWER_POT_BLOCK;
class NetherReactor extends Solid{
public function __construct($meta = 0){
parent::__construct(self::NETHER_REACTOR, $meta, "Nether Reactor");
$this->isActivable = true;
$this->meta = $meta;
}
public function getName(){
return "Flower Pot Block";
}
}

View File

@ -23,10 +23,10 @@ namespace pocketmine\block;
class Furnace extends BurningFurnace{
public function __construct($meta = 0){
parent::__construct($meta);
$this->id = self::FURNACE;
$this->name = "Furnace";
$this->isActivable = true;
protected $id = self::FURNACE;
public function getName(){
return "Furnace";
}
}

View File

@ -24,9 +24,19 @@ namespace pocketmine\block;
use pocketmine\item\Item;
class Glass extends Transparent{
protected $id = self::GLASS;
public function __construct(){
parent::__construct(self::GLASS, 0, "Glass");
$this->hardness = 1.5;
}
public function getName(){
return "Glass";
}
public function getHardness(){
return 0.3;
}
public function getDrops(Item $item){

View File

@ -22,9 +22,25 @@
namespace pocketmine\block;
use pocketmine\item\Item;
class GlassPane extends Thin{
protected $id = self::GLASS_PANE;
public function __construct(){
parent::__construct(self::GLASS_PANE, 0, "Glass Pane");
}
public function getName(){
return "Glass Pane";
}
public function getHardness(){
return 0.3;
}
public function getDrops(Item $item){
return [];
}
}

View File

@ -23,8 +23,19 @@ namespace pocketmine\block;
class GlowingObsidian extends Solid{
protected $id = self::GLOWING_OBSIDIAN;
public function __construct($meta = 0){
parent::__construct(self::GLOWING_OBSIDIAN, $meta, "Glowing Obsidian");
$this->meta = $meta;
}
public function getName(){
return "Glowing Obsidian";
}
public function getLightLevel(){
return 12;
}
}

View File

@ -24,42 +24,25 @@ namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
class GlowingRedstoneOre extends Solid{
public function __construct(){
parent::__construct(self::GLOWING_REDSTONE_ORE, 0, "Glowing Redstone Ore");
$this->hardness = 15;
class GlowingRedstoneOre extends RedstoneOre{
protected $id = self::GLOWING_REDSTONE_ORE;
public function getName(){
return "Glowing Redstone Ore";
}
public function getLightLevel(){
return 9;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_SCHEDULED or $type === Level::BLOCK_UPDATE_RANDOM){
$this->getLevel()->setBlock($this, Block::get(Item::REDSTONE_ORE, $this->meta), false, false, true);
$this->getLevel()->setBlock($this, Block::get(Item::REDSTONE_ORE, $this->meta), false, false);
return Level::BLOCK_UPDATE_WEAK;
}
return false;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
return [
[Item::REDSTONE_DUST, 0, mt_rand(4, 5)],
];
}else{
return [];
}
}
}

View File

@ -22,11 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Glowstone extends Transparent{
protected $id = self::GLOWSTONE_BLOCK;
public function __construct(){
parent::__construct(self::GLOWSTONE_BLOCK, 0, "Glowstone");
$this->hardness = 1.5;
}
public function getName(){
return "Glowstone";
}
public function getHardness(){
return 0.3;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getLightLevel(){
return 15;
}
public function getDrops(Item $item){

View File

@ -22,26 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Gold extends Solid{
protected $id = self::GOLD_BLOCK;
public function __construct(){
parent::__construct(self::GOLD_BLOCK, 0, "Gold Block");
$this->hardness = 30;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
public function getName(){
return "Gold Block";
}
public function getHardness(){
return 3;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::GOLD_BLOCK, 0, 1],
];

View File

@ -22,26 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class GoldOre extends Solid{
protected $id = self::GOLD_ORE;
public function __construct(){
parent::__construct(self::GOLD_ORE, 0, "Gold Ore");
$this->hardness = 15;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
public function getName(){
return "Gold Ore";
}
public function getHardness(){
return 3;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 4){
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::GOLD_ORE, 0, 1],
];

View File

@ -23,6 +23,7 @@ namespace pocketmine\block;
use pocketmine\event\block\BlockSpreadEvent;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\generator\object\TallGrass as TallGrassObject;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
@ -32,16 +33,28 @@ use pocketmine\utils\Random;
class Grass extends Solid{
public $isActivable = true;
protected $hardness = 3;
protected $id = self::GRASS;
protected $meta = 0;
protected $name = "Grass";
public function __construct(){
}
public function canBeActivated(){
return true;
}
public function getName(){
return "Grass";
}
public function getHardness(){
return 0.6;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function getDrops(Item $item){
return [
[Item::DIRT, 0, 1],
@ -50,16 +63,20 @@ class Grass extends Solid{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_RANDOM){
//TODO: light levels
$x = mt_rand($this->x - 1, $this->x + 1);
$y = mt_rand($this->y - 2, $this->y + 2);
$z = mt_rand($this->z - 1, $this->z + 1);
$block = $this->getLevel()->getBlock(new Vector3($x, $y, $z));
if($block->getID() === Block::DIRT){
if($block->getSide(1) instanceof Transparent){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Grass()));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($block, $ev->getNewState());
$block = $this->getLevel()->getBlock(new Vector3($this->x, $this->y, $this->z));
if($block->getSide(1)->getLightLevel() < 4){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Dirt()));
}elseif($block->getSide(1)->getLightLevel() >= 9){
for($l = 0; $l < 4; ++$l){
$x = mt_rand($this->x - 1, $this->x + 1);
$y = mt_rand($this->y - 2, $this->y + 2);
$z = mt_rand($this->z - 1, $this->z + 1);
$block = $this->getLevel()->getBlock(new Vector3($x, $y, $z));
if($block->getId() === Block::DIRT && $block->getDamage() === 0x0F && $block->getSide(1)->getLightLevel() >= 4 && $block->z <= 2){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Grass()));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($block, $ev->getNewState());
}
}
}
}
@ -67,7 +84,7 @@ class Grass extends Solid{
}
public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){
$item->count--;
TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2);
@ -76,9 +93,14 @@ class Grass extends Solid{
$item->useOn($this);
$this->getLevel()->setBlock($this, new Farmland());
return true;
}elseif($item->isShovel() and $this->getSide(1)->getId() === Block::AIR){
$item->useOn($this);
$this->getLevel()->setBlock($this, new GrassPath());
return true;
}
return false;
}
}
}

View File

@ -0,0 +1,68 @@
<?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/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
class GrassPath extends Transparent{
protected $id = self::GRASS_PATH;
public function __construct(){
}
public function getName(){
return "Grass Path";
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 0.9375,
$this->z + 1
);
}
public function getHardness(){
return 0.6;
}
public function getDrops(Item $item){
return [
[Item::DIRT, 0, 1],
];
}
}

View File

@ -22,11 +22,26 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Gravel extends Fallable{
protected $id = self::GRAVEL;
public function __construct(){
parent::__construct(self::GRAVEL, 0, "Gravel");
$this->hardness = 3;
}
public function getName(){
return "Gravel";
}
public function getHardness(){
return 0.6;
}
public function getToolType(){
return Tool::TYPE_SHOVEL;
}
public function getDrops(Item $item){

View File

@ -21,29 +21,26 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class HardenedClay extends Solid{
protected $id = self::HARDENED_CLAY;
public function __construct(){
parent::__construct(self::HARDENED_CLAY, 0, "Hardened Clay");
$this->hardness = 30;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.25;
case 4:
return 0.35;
case 3:
return 0.5;
case 2:
return 0.2;
case 1:
return 0.95;
default:
return 6.25;
}
public function getName(){
return "Hardened Clay";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
return 1.25;
}
}

View File

@ -25,9 +25,19 @@ use pocketmine\item\Item;
use pocketmine\Player;
class HayBale extends Solid{
protected $id = self::HAY_BALE;
public function __construct($meta = 0){
parent::__construct(self::HAY_BALE, $meta, "Hay Bale");
$this->hardness = 10;
$this->meta = $meta;
}
public function getName(){
return "Hay Bale";
}
public function getHardness(){
return 0.5;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){

View File

@ -22,11 +22,26 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Ice extends Transparent{
protected $id = self::ICE;
public function __construct(){
parent::__construct(self::ICE, 0, "Ice");
$this->hardness = 2.5;
}
public function getName(){
return "Ice";
}
public function getHardness(){
return 0.5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function onBreak(Item $item){
@ -35,23 +50,6 @@ class Ice extends Transparent{
return true;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.1;
case 4:
return 0.15;
case 3:
return 0.2;
case 2:
return 0.1;
case 1:
return 0.4;
default:
return 0.75;
}
}
public function getDrops(Item $item){
return [];
}

View File

@ -22,28 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Iron extends Solid{
protected $id = self::IRON_BLOCK;
public function __construct(){
parent::__construct(self::IRON_BLOCK, 0, "Iron Block");
$this->hardness = 30;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.95;
case 4:
return 1.25;
case 3:
return 1.9;
default:
return 25;
}
public function getName(){
return "Iron Block";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
return 5;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 3){
if($item->isPickaxe() >= Tool::TIER_STONE){
return [
[Item::IRON_BLOCK, 0, 1],
];

View File

@ -21,10 +21,38 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class IronBars extends Thin{
protected $id = self::IRON_BARS;
public function __construct(){
parent::__construct(self::IRON_BARS, 0, "Iron Bars");
}
}
public function getName(){
return "Iron Bars";
}
public function getHardness(){
return 5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::IRON_BARS, 0, 1],
];
}else{
return [];
}
}
}

View File

@ -22,33 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class IronDoor extends Door{
protected $id = self::IRON_DOOR_BLOCK;
public function __construct($meta = 0){
parent::__construct(self::IRON_DOOR_BLOCK, $meta, "Iron Door Block");
//$this->isActivable = true;
$this->hardness = 25;
$this->meta = $meta;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.95;
case 4:
return 1.25;
case 3:
return 1.9;
case 2:
return 0.65;
case 1:
return 3.75;
default:
return 25;
}
public function getName(){
return "Iron Door Block";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
return 5;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::IRON_DOOR, 0, 1],
];

View File

@ -22,28 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class IronOre extends Solid{
protected $id = self::IRON_ORE;
public function __construct(){
parent::__construct(self::IRON_ORE, 0, "Iron Ore");
$this->hardness = 15;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
case 3:
return 1.15;
default:
return 15;
}
public function getName(){
return "Iron Ore";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
return 3;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 3){
if($item->isPickaxe() >= Tool::TIER_STONE){
return [
[Item::IRON_ORE, 0, 1],
];

View File

@ -21,10 +21,21 @@
namespace pocketmine\block;
class FenceJungle extends Fence{
public function __construct(){
Transparent::__construct(self::FENCE_JUNGLE, 0, "Jungle Fence");
$this->isFullBlock = false;
$this->hardness = 15;
use pocketmine\item\Tool;
class IronTrapdoor extends Trapdoor{
protected $id = self::IRON_TRAPDOOR;
public function getName(){
return "Iron Trapdoor";
}
}
public function getHardness(){
return 5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
}

View File

@ -22,10 +22,22 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class JungleWoodStairs extends Stair{
protected $id = self::JUNGLE_WOOD_STAIRS;
public function __construct($meta = 0){
parent::__construct(self::JUNGLE_WOOD_STAIRS, $meta, "Jungle Wood Stairs");
$this->meta = $meta;
}
public function getName(){
return "Jungle Wood Stairs";
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getDrops(Item $item){

View File

@ -23,23 +23,37 @@ namespace pocketmine\block;
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\Player;
class Ladder extends Transparent{
public $hasEntityCollision = true;
protected $id = self::LADDER;
public function __construct($meta = 0){
parent::__construct(self::LADDER, $meta, "Ladder");
$this->isSolid = false;
$this->isFullBlock = false;
$this->hardness = 2;
$this->meta = $meta;
}
public function getName(){
return "Ladder";
}
public function hasEntityCollision(){
return true;
}
public function isSolid(){
return false;
}
public function getHardness(){
return 0.4;
}
public function onEntityCollide(Entity $entity){
$entity->fallDistance = 0;
$entity->resetFallDistance();
$entity->onGround = true;
}
@ -90,7 +104,7 @@ class Ladder extends Transparent{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
if($target->isTransparent === false){
if($target->isTransparent() === false){
$faces = [
2 => 2,
3 => 3,
@ -110,7 +124,7 @@ class Ladder extends Transparent{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
/*if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
/*if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method
Server::getInstance()->api->entity->drop($this, Item::get(LADDER, 0, 1));
$this->getLevel()->setBlock($this, new Air(), true, true, true);
return Level::BLOCK_UPDATE_NORMAL;
@ -120,6 +134,10 @@ class Ladder extends Transparent{
return false;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getDrops(Item $item){
return [
[$this->id, 0, 1],

View File

@ -22,28 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Lapis extends Solid{
protected $id = self::LAPIS_BLOCK;
public function __construct(){
parent::__construct(self::LAPIS_BLOCK, 0, "Lapis Block");
$this->hardness = 15;
}
public function getBreakTime(Item $item){
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
case 3:
return 1.15;
default:
return 15;
}
public function getName(){
return "Lapis Lazuli Block";
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
return 3;
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 3){
if($item->isPickaxe() >= Tool::TIER_STONE){
return [
[Item::LAPIS_BLOCK, 0, 1],
];

View File

@ -22,29 +22,30 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class LapisOre extends Solid{
protected $id = self::LAPIS_ORE;
public function __construct(){
parent::__construct(self::LAPIS_ORE, 0, "Lapis Ore");
$this->hardness = 15;
}
public function getBreakTime(Item $item){
public function getHardness(){
return 3;
}
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
case 3:
return 1.15;
default:
return 15;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Lapis Lazuli Ore";
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 3){
if($item->isPickaxe() >= Tool::TIER_STONE){
return [
[Item::DYE, 4, mt_rand(4, 8)],
];

Some files were not shown because too many files have changed in this diff Show More