Compare commits

...

1488 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
f4181a6e36 Bump Minecraft: PE version 2014-11-27 14:37:44 +01:00
38089af098 Improved global entity motion encoding using per-player queues 2014-11-27 14:26:36 +01:00
cd135b39ad Improved player spawn item in hand sending 2014-11-27 13:59:32 +01:00
dd3207cbd8 Possible fix for #2267, #2314 2014-11-27 13:47:17 +01:00
a7abd5ff9d Catch exceptions when chunks are unloaded 2014-11-27 13:35:54 +01:00
a3e50f6337 Properly close inventory windows from Players 2014-11-27 13:32:07 +01:00
441a98e60a Removed old trigger_error() calls, closes #2335 2014-11-27 13:16:39 +01:00
4a90ac270f Improved exception handling and debugging 2014-11-22 13:52:36 +01:00
a906a2988b Bumped Minecraft: PE version string 2014-11-22 13:44:34 +01:00
545f68382c Increased Fence, Fence Gate and Stone Wall Y bounding box 2014-11-22 13:44:05 +01:00
8249cac592 Catch corrupted chunk data errors 2014-11-20 22:02:00 +01:00
7b7bbe9105 Regenerate corrupt player data if invalid data is found 2014-11-20 21:58:27 +01:00
05679c7872 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-11-20 21:46:14 +01:00
8eb80be691 Remove duplicated tiles from chunk table automatically 2014-11-20 21:45:52 +01:00
f55b0d0b45 Merge pull request #2295 from LukeDarling/patch-1
Fixed Server->getOps() capitalization
2014-11-19 13:10:03 +01:00
754e0dbb49 Protect permission removal against bad plugins 2014-11-18 18:43:30 +01:00
525c8db779 Improved chunk loading/unloading 2014-11-18 18:33:24 +01:00
c7f578f297 Possible fix for #2297 2014-11-18 13:57:03 +01:00
19c030281f Fixed #1969 2014-11-18 13:53:38 +01:00
ca9fe1b89a Improved and fixed command exception message, closes #2301 2014-11-18 13:46:00 +01:00
9fd6a695f6 Fixed permission-related memory leak 2014-11-18 13:42:24 +01:00
c07b0ff35b Fixed tile entities not being placed in the correct array 2014-11-15 11:49:09 +01:00
00be3f0dd3 Fixed Server->getOps() capitalization
I'm not 100% sure, but I believe this is how it's supposed to be.
2014-11-15 00:01:57 -05:00
6796fca2b6 Merge pull request #2294 from LukeDarling/patch-1
fixed version message color
2014-11-15 14:20:14 +10:30
5657cce3db fixed version message color 2014-11-14 15:52:38 -05:00
05ac256cc3 Fixed Acacia / Dark Oak logs crafting recipes 2014-11-14 15:58:31 +01:00
49977c5410 Bumped weakref version, fixes travis builds 2014-11-14 10:30:06 +01:00
ca40bb678c Merge pull request #2288 from sekjun9878/master
Get timezone directly. Fixes #2287.
2014-11-13 23:08:22 +10:30
2068cc9cdf Merge pull request #2243 from PEMapModder/patch-1
cmd files comment syntax should be like this.
2014-11-13 21:42:25 +10:30
ea4617cedd Get timezone directly. Fixes #2287. 2014-11-13 21:13:12 +10:30
1a5544f68c Fixed Chunk tile indexes 2014-11-08 15:00:18 +01:00
0128a7aeb2 API version 1.7.1 (fixes) 2014-11-07 09:45:30 +01:00
fd954ce708 Fixed PlayerInventory->setItem() with null items 2014-11-07 09:43:36 +01:00
d63a82de0a MCPE protocol 20 2014-11-06 19:08:32 +01:00
92143d523c Added SetDifficultyPacket 2014-11-06 19:07:24 +01:00
1818e64c8e Merge branch 'master' into 0.10 2014-11-06 18:56:47 +01:00
7e1095e28d Reenabled collision against entities on move 2014-11-06 12:57:17 +01:00
f1519e6d13 Improved Level->getTile() to a direct lookup instead of linear search 2014-11-06 12:34:33 +01:00
3b9a9bcd5d Use proper indexes on Living->getLineOfSight() when a max length is set 2014-11-06 12:23:45 +01:00
263bff01c8 Change RuntimeException to InvalidStateException on BlockIterator 2014-11-06 12:16:12 +01:00
987d647b76 Return proper BlockIterator index, throw more exceptions, improved blockQueue performance 2014-11-06 12:12:31 +01:00
522b75645c Merge branch 'master' into 0.10 2014-11-05 19:04:36 +01:00
9eed0a579c Fixed red sand smelting recipe 2014-11-05 17:41:12 +01:00
064976d32b Fixed ladder recipe 2014-11-05 17:38:23 +01:00
2abb577178 Fixed String -> Wool recipe 2014-11-05 17:36:44 +01:00
127855c220 Fixed Snow block recipe 2014-11-05 17:36:06 +01:00
93c7a3c170 Fixed bonemeal recipe, closes #2260 2014-11-05 17:32:28 +01:00
31903a764a Fixed unloaded chunks residing on memory and getting loaded again causing crash, fixed spawn chunks getting unloaded by players 2014-11-04 17:16:02 +01:00
79bc1d6c85 Fixed server not stopping after a special crash 2014-11-04 17:15:20 +01:00
cc7f12739d Added vertical and horizontal collision detection to Entities 2014-11-04 12:23:42 +01:00
32dae93ef9 Removed unused imports 2014-11-04 12:08:24 +01:00
8fd6582e74 Automatically set Entity / Tile entity save identifiers 2014-11-04 12:04:08 +01:00
a5369b3570 Fixed unloading chunks 2014-11-04 11:18:34 +01:00
abbd33210a Possible fix for #2245 2014-11-04 00:19:50 +01:00
6b6222c09c Allow passing a Player source as last parameter on Inventory->addItem() and Inventory->removeItem() 2014-11-04 00:16:25 +01:00
a8c997d88a ¬¬ 2014-11-03 12:54:46 +01:00
6993718a83 Added EntityDamageByChildEntityEvent 2014-11-03 12:03:37 +01:00
86afecec89 Improved inventory sending, send single slots instead of full inventory as much as possible 2014-11-03 11:48:10 +01:00
29d1fd1fc8 Fixed player viewer list including themselves 2014-11-03 11:29:01 +01:00
af4eb2ab1e Create server.log properly on non-existent directories 2014-11-02 16:15:15 +01:00
f7baf46a54 Fire PlayerInteractEvent on 0xff face 2014-11-02 16:12:51 +01:00
75c0d8324c Fixed some inventory events not firing on players 2014-11-02 13:26:58 +01:00
da4334f06b Revert Armor then Inventory instead of Inventory then Armor on failed transaction 2014-11-01 23:02:59 +01:00
413bd3c0df Use SplFixedArray for improved performance 2014-11-01 22:12:35 +01:00
1a0428654b Updated timings command, give direct link to results 2014-11-01 21:20:44 +01:00
2803a38fd1 Fixed random block updates not firing 2014-11-01 20:26:13 +01:00
95a5ca7889 Added command message to /time add 2014-11-01 20:12:55 +01:00
240f14c425 Fixed #2253 2014-11-01 19:40:15 +01:00
cb9b6ab1d1 Fixed server not using the correct provided path if it did not exist 2014-11-01 19:23:10 +01:00
8a87280566 Added /time start and /time stop 2014-11-01 17:45:11 +01:00
4d97827d44 Improved level switching for players 2014-11-01 17:39:09 +01:00
f8f1e0e9df Despawn entities correctly from clients as they move 2014-11-01 16:47:40 +01:00
bf596ebf05 Fixed Query-related crash 2014-11-01 16:20:40 +01:00
90777014b6 Fixed Stone crash 2014-11-01 16:17:47 +01:00
4a78ffd2dd Fixed FallingSand crash 2014-11-01 16:15:09 +01:00
7c361a52d2 Fixed #2252 2014-11-01 13:52:20 +01:00
13fc0df92c Fixed #2251 2014-11-01 12:40:45 +01:00
d5012f6fcf Fixed server not stopping after a fatal error 2014-11-01 03:07:47 +01:00
4569a73f3d Fixed Entity being set position after being closed 2014-10-31 23:10:29 +01:00
66acb5cdd7 Possible fix for crashing server not stopping 2014-10-31 23:10:12 +01:00
8601405a88 Fixed CPU leak 2014-10-31 21:07:00 +01:00
ae06681b60 Added packet exception handling, updated RakLib 2014-10-31 19:14:59 +01:00
01ffb14e39 Fixed #2204 2014-10-31 17:34:45 +01:00
ce989876af Improved freeing chunks 2014-10-31 16:39:32 +01:00
f8d6ebabf3 Removed some calls 2014-10-31 15:57:07 +01:00
094b600a0c Updated NBT/DataPacket reading 2014-10-31 01:02:31 +01:00
82cfe6ea9c Updated NBT/DataPacket reading 2014-10-31 00:32:50 +01:00
4fba6d7c86 Merge branch 'master' into 0.10 2014-10-30 23:20:59 +01:00
f72d7284b9 Added EncapsulatedPacket reuse on broadcast 2014-10-30 23:20:28 +01:00
8f0527832f Removed extra AxisAlignedBB generation on Door and Trapdoor 2014-10-30 22:15:19 +01:00
f66944368d Update RakLib 2014-10-30 22:06:23 +01:00
7ab3c57b00 Optimized networking code & AxisAlignedBB 2014-10-30 22:06:07 +01:00
673b867ee8 Fixed players not loading chunks when stuck on a unloaded chunk 2014-10-30 20:05:40 +01:00
2424c8a76c Update RakLib, possible fix for notifyACK 2014-10-30 19:44:05 +01:00
92eb5cb0b8 Added LE Triad methods 2014-10-30 17:56:58 +01:00
fd46c71120 Updated RakLib 2014-10-30 17:18:43 +01:00
6a4259bf24 Updated RakLib 2014-10-30 17:04:19 +01:00
9a65279c6a Added ifndef for packets Binary 2014-10-30 16:41:11 +01:00
09a01be709 Added ifndef for NBT Binary 2014-10-30 16:32:57 +01:00
57d1847c50 Updated to receive new optimizations 2014-10-30 16:02:48 +01:00
6e8e2a79dd Fixed Event name being null 2014-10-30 14:52:11 +01:00
d8f9def7f4 Added preprocessor optimizations 2014-10-30 07:58:53 +01:00
8cb9dd9a14 Fixed #2244 2014-10-29 22:58:40 +01:00
c4c374e3fa Added extra chunk sending timings 2014-10-29 21:52:27 +01:00
d57e37896d Improved Region / RakLib 2014-10-29 17:43:21 +01:00
022a978ffb Added InventoryPickupArrowEvent 2014-10-29 16:29:00 +01:00
00b282d40c Improved cache pool cleanup times 2014-10-29 16:13:47 +01:00
8a768cea33 EntityDamageEvent and children now only fire if the attack is possible, moved event trigger to Entity->attack() 2014-10-29 16:02:40 +01:00
289bc56b4b Blocks now save their bounding box, fixed entity block collision check 2014-10-29 15:43:23 +01:00
6f64af3066 Reuse even more objects! 2014-10-29 14:23:51 +01:00
72c09045d5 Fixed Zombie drops crash 2014-10-29 13:21:54 +01:00
5e55c3a8f0 Fixed Chest->unpair() 2014-10-29 13:21:14 +01:00
afaa2cf722 Fixed Double Chest behavior 2014-10-29 12:57:26 +01:00
50cfeaa393 Fixed Stonecutter recipe 2014-10-29 12:36:34 +01:00
dda8b03349 Fixed Bowl recipe 2014-10-29 12:12:54 +01:00
56e848488a Fixed Trapdoor recipe 2014-10-29 12:10:48 +01:00
7e4f862634 Fixed typo in OfflinePlayer 2014-10-29 11:42:29 +01:00
577a7a1c3d cmd files comment syntax should be like this. 2014-10-29 17:20:36 +08:00
78f8d0280d Removed unused imports 2014-10-29 01:14:09 +01:00
0680b98380 Remove chunks from advanced cache after setting 2014-10-29 01:07:30 +01:00
cbe0fe5e46 Added Entity->onGround setting when entities keep moving without checks 2014-10-29 00:41:13 +01:00
7eed92e8fb Use Player->forceMovement on MovePlayerPacket non-tick revert 2014-10-29 00:31:17 +01:00
f772391866 Fixed InventoryPickupItemEvent 2014-10-28 22:05:54 +01:00
8c4faa8622 Added extra Exceptions 2014-10-28 21:07:12 +01:00
b6f7ee20fc Added Error -> Exception handling 2014-10-28 20:43:36 +01:00
0fce83c671 Fixed #2189 2014-10-28 13:27:30 +01:00
8080643cc9 Fixed plugins crashing the server when teleporting players on an invalid event 2014-10-28 13:18:40 +01:00
5bf2174cad Fixed UseItemPacket being able to be sent before spawning 2014-10-28 13:16:20 +01:00
34ae760def New way to spawn entities/tiles using a global register table, allow overriding default entity/tile classes via classes 2014-10-28 13:09:27 +01:00
a5b85c549a Added Snowballs 2014-10-28 12:13:31 +01:00
b9f1812f61 Disallow further modification of Signs by its creator after load/unload 2014-10-28 11:05:32 +01:00
350cee3d41 Added Event allocation pool, updated SPL with Class::onClassLoaded() 2014-10-28 10:47:40 +01:00
144a871c07 Improved Vector3 and Block handling, less allocation on Positions 2014-10-28 10:03:10 +01:00
69492474e4 Improve #2238, do not crash when an invalid/corrupt RCON stop event happens 2014-10-28 02:09:36 +01:00
4299ebebcc Bump API version to 1.6.1 2014-10-28 00:55:07 +01:00
119b429ab8 RakLib update 2014-10-28 00:43:47 +01:00
8f1eb41ca5 RakLib update 2014-10-28 00:23:55 +01:00
ca92d2a0d3 Bumped API version to 1.7.0 2014-10-27 20:30:58 +01:00
db82f76c11 Improved network packets allocation 2014-10-27 20:30:33 +01:00
3f5b129cf5 Updated RakLib 2014-10-27 19:39:24 +01:00
f6aac8728b Mark chunk to be saved when removing invalid entities/tiles 2014-10-27 18:43:58 +01:00
809fc44813 Bump API version to 1.6.1 2014-10-27 16:07:00 +01:00
64f1ff066d Fixed /setworldspawn changing sender data 2014-10-27 15:57:26 +01:00
a5a3f4801a Fixed entities not getting ticks on movement 2014-10-27 15:53:14 +01:00
23d1532ff9 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-10-27 15:44:44 +01:00
ecbbcc2e8e Drop invalid entities / tile entities on chunk loading 2014-10-27 15:44:36 +01:00
7abf52e615 Implemented Vector3 List and AxisAlignedBB Pool to decrease object allocation 2014-10-27 15:39:20 +01:00
9e01e2ef49 Merge pull request #2235 from nno88551/patch-2
Update BaseInventory.php
2014-10-26 15:52:08 +01:00
df81b365e5 Update BaseInventory.php 2014-10-26 22:21:21 +09:00
db8ac0b9cb Merge pull request #2225 from PEMapModder/falling-sand
Update FallingBlock to new Anvil formats, possible fix for #2189
2014-10-25 17:58:47 +02:00
ee4f416d93 Fix FallingBlock.php 2014-10-25 18:15:47 +08:00
8feea721e3 Merge pull request #2223 from Falkirks/set-armour-fix
Fix various get and set armour in PlayerInventory
2014-10-25 12:13:28 +02:00
8e7077ff4b Update FallingBlock to new Anvil formats, possible fix for #2189
I don't have time to test yet, so I am not sure if it does fix it.
2014-10-25 12:26:57 +08:00
4f4a6e7446 Fixes get and set armour 2014-10-24 17:11:59 -07:00
1fc066fc37 Updated time steps from x2.5 to x1.25 2014-10-24 12:12:01 +02:00
b565844062 Merge branch 'master' into 0.10 2014-10-24 12:07:35 +02:00
be948f99cc Fixed #2207 Server crashing if players are closed before logging in 2014-10-24 12:06:55 +02:00
5cb428e5cc Updated build number 2014-10-23 17:23:59 +02:00
d2f4a14d66 Merge branch 'master' into 0.10 2014-10-23 17:21:24 +02:00
516bb37a50 Removed some direct type checks on Entity/Tile->closed 2014-10-21 19:28:29 +02:00
580ade9092 Possible fix for entities not closing correctly 2014-10-21 19:26:16 +02:00
8f7dfe0b71 Removed extra ; from if, fixes #2205 2014-10-21 18:37:29 +02:00
5310ba3ae6 Fixed crash when doing var_dump() of anything that contains the Server object 2014-10-20 13:06:53 +02:00
ef97efcd96 Added explosion death message 2014-10-20 13:00:03 +02:00
30c3718ea8 Improved Explosion item drop position 2014-10-20 12:58:05 +02:00
5437567e95 Merge branch 'master' into 0.10 2014-10-20 12:53:14 +02:00
e3e97a4205 Improved Player->onGround checking 2014-10-20 12:52:00 +02:00
fec387d2ec Fixed entities not being pushed out of blocks 2014-10-20 12:37:17 +02:00
481e2b08ee Removed debug call 2014-10-20 12:05:40 +02:00
15de0eece7 Improved inventory and window allocation, fixes #2200 2014-10-20 09:48:11 +02:00
2f8267aa1e Improved Level object deallocation 2014-10-19 20:45:03 +02:00
f2b573c32f Fixed Level->getMetadata() and similar, removed extra references 2014-10-19 19:51:36 +02:00
34946faf94 Remove errors from Utils::getRandomBytes() 2014-10-19 13:44:38 +02:00
3b47513439 Return result directly on Server->getOfflinePlayer() 2014-10-19 02:49:58 +02:00
7d9a98ec6b Updated UseItemPacket 2014-10-18 23:42:41 +02:00
92facc94b9 Added new fences and fence gates to fuel types 2014-10-18 18:02:39 +02:00
d3327f450c Added different Fence Gates, new Fence Gate crafting recipes 2014-10-18 17:56:18 +02:00
570cab9c66 Added different Fences, new Fence crafting recipes 2014-10-18 17:44:24 +02:00
582ba100b0 Bumped protocol version to 19 2014-10-18 17:01:36 +02:00
4c0daa462d Merge branch 'master' into 0.10 2014-10-18 16:54:03 +02:00
2e6366868d Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-10-18 16:53:42 +02:00
245e9b4f18 Fixes inventory changes getting the wrong window, closes #2187 2014-10-18 16:53:06 +02:00
68e73d4e3a Merge pull request #2188 from aodzip/patch-1
Update Skeleton.php
2014-10-18 15:36:02 +02:00
684617d370 Update Skeleton.php
fixed a little wrong
2014-10-18 21:13:35 +08:00
a879104a6f Minecraft: PE version bump 2014-10-17 14:43:10 +02:00
05f71691fc Fixed AxisAlignedBB->setBB() 2014-10-17 09:57:42 +02:00
1c03c3afcf Decreased chunk ordering times 2014-10-17 09:57:18 +02:00
94e9485be9 Improved broadcast packet encoding 2014-10-17 09:36:47 +02:00
9cb27e26ef Fixed #2183 2014-10-16 22:01:32 +02:00
7760559be1 Improved chunk loading and order refresh times 2014-10-16 20:21:06 +02:00
163a37ee23 Optimized Player->orderChunks() and chunk sending ordering algorithm 2014-10-16 14:54:55 +02:00
c73a3e53be Added extra Entity metadata 2014-10-16 12:49:45 +02:00
8637b7f5a3 Fixed Tasks deleting their Timings reports 2014-10-16 12:49:26 +02:00
747fdab389 Fixed Inventory->removeItem() 2014-10-16 12:16:23 +02:00
204915450f Do not wrap text if unknown characters are found. 2014-10-15 18:38:14 +02:00
500a690cd0 Throw CRITICAL error message on unhandled Exception on commands instead of crashing 2014-10-15 18:35:42 +02:00
d473ce13ee Throw CRITICAL error message on unhandled Exception on plugin events instead of crashing 2014-10-15 18:35:30 +02:00
1adf53a81e Fixed error_handler trace generation on higher debug levels 2014-10-15 17:58:03 +02:00
ed942100ec Do not block when killing workers 2014-10-15 17:49:08 +02:00
8abe95309c Fixed RegionLoader not creating default index on first load 2014-10-15 16:59:31 +02:00
5dc5aba42c Match Player pickup area with Minecraft 2014-10-15 14:57:12 +02:00
bda6f03e15 Added BlockUpdateEvent 2014-10-15 13:07:10 +02:00
69d132401e Fixes entities not being saved and tile entities having an incorrect field, closes #1661 2014-10-15 12:15:17 +02:00
e3a9db5d8f Implemented saving modified chunks 2014-10-15 11:42:58 +02:00
b71a4701d9 Fixed player using an invalid spawn chunk 2014-10-15 11:40:41 +02:00
9b85abd75e Micro-optimizations 2014-10-15 10:44:01 +02:00
7b7b91ea0d Fixed Entity updates not firing 2014-10-15 10:13:49 +02:00
18f6bad48d Implemented scheduled and partial entity updates 2014-10-14 22:49:35 +02:00
fbe548c611 RakLib update, PING/PONG handling 2014-10-14 16:13:32 +02:00
4e793199fa Deprecated EntityMoveEvent 2014-10-14 16:11:10 +02:00
43a97c407d New PlayerMoveEvent, improved player movement event firing 2014-10-14 16:10:50 +02:00
07dcbdb9b0 Fixed Level->getNearbyEntities(), fixes item drops not being picked up 2014-10-14 16:03:14 +02:00
60ca24fe0e Updated PluginManager event deprecation message 2014-10-14 14:11:58 +02:00
6e8144d5d9 Improved player movement event firing & corrections 2014-10-14 00:11:17 +02:00
464afb949e Increased Player->forceMovement check radius 2014-10-13 23:44:28 +02:00
823dc933b8 Improved Entity extinguish operations and packet spam 2014-10-13 23:44:11 +02:00
883f93cc8c Improved item drop spawning 2014-10-13 22:45:04 +02:00
b26ee09f76 Removed a bunch of TODO and fixed item drops on block update 2014-10-13 18:54:34 +02:00
1eec333501 Save block bounding boxes, improves block cache 2014-10-13 18:38:00 +02:00
5448a48f67 Fixed Level->getCollidingEntities() 2014-10-13 18:36:13 +02:00
a10ad42a13 Removed Generic block class 2014-10-13 18:12:34 +02:00
da23cf685d Added PlayerBucketEvent and children, improved Bucket usage and Liquid placing 2014-10-13 18:04:40 +02:00
79e4b3e3a9 Removed old Player->timeout property 2014-10-12 17:12:59 +02:00
8472349caf Improved global block cache 2014-10-12 17:02:27 +02:00
96b61fbb92 Made Wheat crops extend Crop class 2014-10-12 16:20:30 +02:00
6246ad19c4 Added global block cache 2014-10-12 16:16:19 +02:00
9b69cc4288 Removed debug code 2014-10-12 15:40:14 +02:00
114153ae97 Added EntityBlockChangeEvent 2014-10-12 13:37:45 +02:00
ebb844fa52 Removed unused code, fixed undefined variables 2014-10-11 22:22:51 +02:00
bf89ea1cf6 Added BlockGrowEvent 2014-10-11 20:19:46 +02:00
4076fb4657 Added BlockSpreadEvent 2014-10-11 19:27:43 +02:00
312f377483 Added LeavesDecayEvent 2014-10-11 19:01:27 +02:00
0af3dfedd5 Improved Living entity ticking 2014-10-11 17:35:13 +02:00
6f1f201c41 Workaround for entities glitching through the floor on the client-side 2014-10-11 17:02:41 +02:00
48f591e5ce Removed workaround on flying check due to physics calculation fix, closes #2169 2014-10-11 16:43:14 +02:00
7f85e37540 Worked on scheduler 2014-10-11 16:36:38 +02:00
341717c89d Increased Player->stepHeight to 0.6, closes #2156 2014-10-11 16:36:17 +02:00
afdf7bc2b9 Added proper TextWrap width 2014-10-11 00:17:31 +02:00
24c76acf30 Submodule update 2014-10-11 00:04:17 +02:00
baf06dc363 Revert "Use Collectable class on AsyncTask, removed task collection workaround on ServerScheduler"
This reverts commit 0dba14074a.
2014-10-11 00:03:46 +02:00
645c00b2f7 Added TextWrapper 2014-10-11 00:01:53 +02:00
0dd46c835c Made ExplosionPrimeEvent accept setting block breaking settings 2014-10-10 22:39:06 +02:00
0dba14074a Use Collectable class on AsyncTask, removed task collection workaround on ServerScheduler 2014-10-10 20:53:28 +02:00
8b585fd9f7 Deprecated Level->getSpawn() in favor of Level->getSpawnLocation() 2014-10-10 11:43:54 +02:00
9ede8177df Fixed Entity->getLineOfSight() 2014-10-10 09:53:58 +02:00
13ec046f0d Removed old OS detection code 2014-10-09 19:37:23 +02:00
5c4e7b6ee0 Added Living->getTargetBlock(), Living->getLineOfSight(), Vector3 side constants, Vector3::getOppositeSide() 2014-10-09 17:57:25 +02:00
6424934df6 Fixed EntityCombustEvent children using a different handlerList 2014-10-09 14:40:52 +02:00
b2ac959083 Added FurnaceSmeltEvent 2014-10-09 12:47:42 +02:00
c67d4dae7b Added FurnaceBurnEvent 2014-10-09 12:36:57 +02:00
22ad75c5a0 Update fuel duration to ticks 2014-10-09 12:21:14 +02:00
b45ef8928c Added Tile->getBlock() method 2014-10-09 12:14:39 +02:00
eccf7b08d2 Added PlayerDeathEvent methods for inventory keeping 2014-10-09 11:06:05 +02:00
94eb9e35e2 Improved liquid performance, update RakLib 2014-10-08 23:24:39 +02:00
79bf1f12f2 API 1.6.0 2014-10-08 17:39:43 +02:00
10b33546ef Added PlayerBedEnterEvent and PlayerBedLeaveEvent 2014-10-08 17:37:11 +02:00
c52dc58d6f Added ProjectileHitEvent 2014-10-08 17:04:35 +02:00
62af784d37 Removed unused imports 2014-10-08 17:00:23 +02:00
aa010b7dea Added ProjectileLaunchEvent 2014-10-08 16:58:17 +02:00
4a3163b4c8 Added ItemSpawnEvent 2014-10-08 16:53:13 +02:00
c750a204e6 Added ItemDespawnEvent 2014-10-08 16:51:10 +02:00
3313981d54 Fixed issues with Entity::heal() method 2014-10-08 16:46:21 +02:00
57f7d57c76 Added ExplosionPrimeEvent 2014-10-08 16:45:55 +02:00
64bf293c69 Improved EntityShootBowEvent 2014-10-08 16:36:43 +02:00
7b09edf048 Improved EntityRegainHealthEvent 2014-10-08 16:28:40 +02:00
4346773e25 Added EntityDamageByBlockEvent (child of EntityDamageEvent) 2014-10-08 16:13:18 +02:00
b0c314526d Added EntityCombustEvent and childs 2014-10-08 15:51:27 +02:00
dd140ce018 Fixed arrow damage not getting overridden by the event result 2014-10-08 15:38:58 +02:00
08aa7808cf Updated RakLib, better player join 2014-10-08 10:45:37 +02:00
582c165479 Implemented Explosion and PrimedTNT, closes #2139 2014-10-07 17:46:01 +02:00
5fb205493a Spawnable->spawnToAll() now uses the actual chunk instead of the entire level to spawn 2014-10-07 12:50:53 +02:00
e346d245e2 Merge pull request #2166 from PocketMine/query-event-implementation
Query event implementation
2014-10-07 11:46:55 +02:00
4fece32ca8 API 1.5.0 2014-10-07 11:02:22 +02:00
0b79d74a2f Implemented QueryRegenerateEvent 2014-10-07 11:02:05 +02:00
b83c6fbfa3 Added Vine blocks, closes #2162 2014-10-07 10:18:02 +02:00
dda9c598f1 Added new Tool type selection constants 2014-10-07 10:16:05 +02:00
8769d2bcd1 Unload entities from chunks, possible fix for #2157, fixes #2165 2014-10-07 09:27:18 +02:00
3b7ece3363 Do not spawn dead entities to players, fixes #2157, possible fix for #2165 2014-10-07 09:24:19 +02:00
b6025e3f2b Removed selectors on Player->sendMessage() 2014-10-06 16:45:11 +02:00
35de331b74 Fixed Level->getCollidingEntities() when called with a null Entity 2014-10-06 13:18:05 +02:00
de11cce154 Improved entity ticking 2014-10-06 13:10:59 +02:00
d53ba52d32 Removed parse errors from AutoReporting 2014-10-06 12:12:54 +02:00
9db2fe40eb Fixed player datta not getting saved, use fall distance on fly calculation 2014-10-06 12:02:36 +02:00
57bb8f14fa Fixed Player movement collision checks 2014-10-06 11:47:28 +02:00
761cd59514 Implemented flying protection 2014-10-06 11:22:59 +02:00
4c2a1c8684 Implement crop growth levels properly, fixes #2002, closes #2160 2014-10-06 09:34:40 +02:00
31bb6d1a68 Changed base block classes to abstract, closes #2159 2014-10-06 09:27:44 +02:00
cd65179aef Fixes #2155 2014-10-06 12:07:48 +10:30
9abd2c63f4 Improved initial chunk loading, do not skip near chunks, fixes world loading getting stuck 2014-10-06 00:45:02 +02:00
376e359577 Moved connected flag up in the Player disconnect process 2014-10-05 22:51:20 +02:00
571e2f8895 Revert "Option to disable hitbox calculation"
This reverts commit fae330d499.
2014-10-05 16:32:49 +02:00
7106ea87e6 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-10-05 16:32:27 +02:00
6b65b68ebc Possible fix for #1661 2014-10-05 16:32:15 +02:00
d4c75ce68a Trim system timezone output 2014-10-05 17:40:17 +10:30
fae330d499 Option to disable hitbox calculation 2014-10-04 20:07:37 -05:00
5e03e157ad Fixed #2153 2014-10-04 23:16:35 +02:00
b0c40dc1ab Fixed Server->unloadLevel() not removing objects from memory 2014-10-04 20:56:27 +02:00
6840589f4e Fix trailing newline 2014-10-04 18:28:42 +02:00
19e4aaa16a Merge pull request #2151 from sekjun9878/master
Timezone for Windows and IP Geolocation TZdata
2014-10-05 01:51:44 +09:30
e0a7944faa Re-use timezone offset parsing 2014-10-05 01:43:33 +09:30
eeda22d0ba Add portable linux timezone detection for incompatible linux distributions. 2014-10-05 01:29:07 +09:30
769f1effb0 Cleaner timezone parsing for Linux and add support for Macs 2014-10-05 01:05:00 +09:30
42c7322273 Reliable timezone detection using systeminfo for Windows and additional IP Geolocation-based detection. Added a warning message for when auto-detection fails. Fixes #2015. 2014-10-05 00:32:01 +09:30
c8cf6b715e Merge pull request #2150 from PEMapModder/patch-2
Fixed PlayerChatEvent::setRecipients() being ignored
2014-10-04 14:49:14 +02:00
41f94f7385 Fixed PlayerChatEvent::setRecipients() being useless 2014-10-04 20:10:12 +08:00
602bdf27a5 Compatibility with pthreads > 2.0.8 2014-10-02 16:58:37 +02:00
539fa232f8 Added individual object timings to Entities / Tile Entities 2014-09-30 16:09:21 +02:00
f8378c09ba Fixed entities getting OnGround default to true 2014-09-30 13:13:31 +02:00
69fb7ae525 Update RakLib, fixes server locking when shutting down 2014-09-30 09:52:50 +02:00
ee8ad6f92a Implement Armor changes as Transactions 2014-09-30 09:37:58 +02:00
f888acbd7c Send PlayerArmorEquipmentPacket instead of ContainerSetContentPacket with id 0x78 2014-09-29 23:43:52 +02:00
215691f1c4 Update RakLib 2014-09-29 23:23:11 +02:00
1252dd65a9 Improved PlayerInventory->setItemInHand() $source call, fixed Tool durability 2014-09-29 17:53:53 +02:00
762c27affe Added armor change $source parameter 2014-09-29 17:50:48 +02:00
706e1099a1 Update raklib 2014-09-29 16:46:19 +02:00
9cd66dc969 Some changes 2014-09-29 16:37:56 +02:00
5b6b789ab3 Improved exponentiation 2014-09-29 13:24:25 +02:00
85ff696ae5 Improved Chunk entity loading 2014-09-29 13:14:14 +02:00
25f8e8318b Fixed Anvil levels duplicating saved entities 2014-09-29 13:09:13 +02:00
61d84c73d0 Implemented Arrow pick up 2014-09-29 13:05:18 +02:00
f5822c6de8 Improved entity movement updates 2014-09-29 12:59:01 +02:00
b0bd927545 Improved entity base ticks 2014-09-29 12:55:10 +02:00
fde61b7d21 Improved single-threaded chunk generation efficiency 2014-09-29 12:48:11 +02:00
886ad8442c Fixed #2055 Extra packet data sent on armor change 2014-09-28 17:31:44 +02:00
7b5869bea8 RakLib submodule update 2014-09-28 16:35:24 +02:00
3063863c65 RakLib update 2014-09-28 16:06:27 +02:00
0dfaa19380 Fixed invalid spawn position setting for plugins 2014-09-28 15:19:09 +02:00
7fea29e874 Updated pthreads version on Travis-CI 2014-09-28 12:50:03 +02:00
2ded2013bf Fixed auto-save configuration, made it global 2014-09-28 10:50:43 +02:00
aa27c28e65 Force new player position on spawn 2014-09-28 01:14:03 +02:00
05a81bebf4 Fixed server crash when Tile Entities / Entities were loaded and requested the same chunk 2014-09-28 00:39:49 +02:00
ce91f2943a Fixed Double Chests 2014-09-28 00:39:11 +02:00
1d8562fb8c Allow setting the player spawnpoint via events before PlayerJoinEvent 2014-09-28 00:14:08 +02:00
1dfb17b932 Fixed #2126 Items drop twice from tile entities 2014-09-27 14:31:41 +02:00
16384c2b20 Improved Player generation queue 2014-09-27 10:31:02 +02:00
48041b2f19 Basic entity motion on water 2014-09-27 00:09:38 +02:00
529bf743db Added torch drop 2014-09-26 23:07:43 +02:00
48bc919a33 Added Liquid flow 2014-09-26 16:56:10 +02:00
474091c013 Improved Level block update scheduling for repeated updates 2014-09-26 16:55:34 +02:00
666e5553c2 Fixed Level->scheduleUpdate() tick calculation 2014-09-26 16:04:51 +02:00
ae6f532b1d Partial Liquid flow 2014-09-26 13:25:52 +02:00
b231eba803 Fixed E_NOTICE error on player movement 2014-09-26 13:23:47 +02:00
82d903733d Fixed #2121 2014-09-26 11:34:06 +02:00
8e2903da86 API version 1.4.1 2014-09-26 11:19:30 +02:00
d720113ac9 Added non-threaded chunk generation, toggleable on pocketmine.yml 2014-09-26 11:18:46 +02:00
5db45222c6 Deprecated Level->getChunkAt() in favor of Level->getChunk() 2014-09-26 10:31:32 +02:00
2975509d0f Improved chunk unload queue, possible fix for #1661 2014-09-25 23:03:56 +02:00
7e49d073fa Improved player movement, check once per tick 2014-09-24 16:58:22 +02:00
ef3674a296 Possible fix for #1661 2014-09-24 16:47:53 +02:00
6cb7e36f8a Improved knockback motion 2014-09-24 16:17:04 +02:00
b88f19bb74 Improved Level::getSafeSpawn() 2014-09-23 20:16:16 +02:00
8c3fcf0798 Send player metadata on respawn 2014-09-23 20:14:01 +02:00
6b312a7826 Fixed players getting Suffocation damage inside transparent blocks 2014-09-23 19:50:44 +02:00
9907e84eee Torches can now be crafted using charcoal 2014-09-23 19:36:30 +02:00
01f299a7f1 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-09-23 15:54:59 +02:00
91f20f6789 Add valid position difference back to Player entities 2014-09-23 15:54:48 +02:00
4c1edc3f7e Re-order RFC section 2014-09-23 20:32:39 +09:30
5fd1e271c5 Merge pull request #2112 from PocketMine/rfc-rfc-and-voting
RFC and Voting
2014-09-22 15:46:03 +02:00
593b0497b0 Fixed #1750 cannot place slabs against blocks 2014-09-22 11:58:15 +02:00
0907aedcef Fixed Entity/Block issues on negative coordinates, closes #2100 2014-09-22 11:48:39 +02:00
0a29e66b62 Fixed #2114 Removed Player collisions with other entities 2014-09-22 11:26:12 +02:00
3cc4afbcd6 Possible fix for #1920 2014-09-22 11:21:54 +02:00
b3ae6eae04 Added RFC ready status, added new label to label list 2014-09-22 09:30:14 +02:00
3b56b536b6 Changed RFC label 2014-09-22 08:46:03 +02:00
9258281546 Fixed missing whitespace 2014-09-21 21:18:37 +02:00
e7897be7cd Merge pull request #2113 from tnpxxsheepdog/rfc-rfc-and-voting
Update CONTRIBUTING.md
2014-09-21 21:08:18 +02:00
5ff01de413 Update CONTRIBUTING.md
Smoothed out wording, fix grammar.
2014-09-21 15:05:08 -04:00
f191ada405 Fixed text typo 2014-09-21 18:33:34 +02:00
addd74d09e Fix typo, added PR: Request for Comments label 2014-09-21 17:51:35 +02:00
4e9d2d0a7f Added 'RFC and Voting' to CONTRIBUTING.md 2014-09-21 17:45:58 +02:00
d04e994d1b Added TPS load to /status 2014-09-21 12:18:51 +02:00
3d870629f2 Fixed ifconfig command typo 2014-09-21 12:18:26 +02:00
8dbe834dc3 Submodule update 2014-09-21 12:18:10 +02:00
36d8100e17 Protect against \0 attacks on name checking 2014-09-20 18:26:17 +02:00
b880bf13f8 Documented tool usage in Level::useBreakOn() 2014-09-20 18:25:53 +02:00
1ac08ce404 Fixed Utils::getUniqueID() on Linux due to /proc/cpuinfo 2014-09-20 12:39:57 +02:00
689b2ea877 Fixed #2104 Can't place blocks where non-solid entities exist 2014-09-20 11:10:46 +02:00
d1f22ee395 Block more player actions when dead, closes #2102 2014-09-19 20:19:27 +02:00
056ed4802f Send project name on usage 2014-09-19 15:08:40 +02:00
bcb65e9a48 Send build number on usage 2014-09-19 15:07:48 +02:00
5404ba77d0 Throw exception when Server::dispatchCommand() is called with an invalid CommandSender 2014-09-19 10:30:35 +02:00
ae54426836 Fixed date_default_timezone_set E_NOTICE 2014-09-19 10:26:44 +02:00
ee7d84dfbd Fixed T_DOUBLE_COLON 2014-09-19 09:48:02 +02:00
3e1ea23036 Fixed CallbackTask name 2014-09-19 09:46:38 +02:00
d312d2a143 Possible fix for #2046, removed embedded class names 2014-09-19 09:44:58 +02:00
8c627bd0af Remove level locks, possible fix for #2046 2014-09-18 11:44:16 +02:00
6fb7170556 Handle force parameter properly on Level::unload() 2014-09-18 11:38:03 +02:00
50f5c6d8ed RakLib patches 2014-09-18 09:22:52 +02:00
f9d5c5bd37 Improved event checking on PlayerInteractEvent 2014-09-16 17:49:44 +02:00
45dbb3f828 Improved block collision check 2014-09-16 12:02:33 +02:00
8a8a95480e Added Cactus damage 2014-09-16 12:02:18 +02:00
34139c7efe Added more death messages 2014-09-16 11:51:43 +02:00
f0e7713dce Added suffocation, drowning damage. Closes #1908 2014-09-16 11:51:31 +02:00
3ba099b309 Cobweb, Ladders and Water won't cause fall damage 2014-09-16 10:52:00 +02:00
c4a0c759dc Show fire to other clients 2014-09-16 10:48:56 +02:00
e9a2f88847 Added Fire, Lava damage 2014-09-16 10:42:29 +02:00
e608acbd1c Improved Player last damage check 2014-09-16 10:42:01 +02:00
42033da08b Fixed #2035 Invalid Fence Gate bounding box 2014-09-16 00:47:04 +02:00
69ab0d433b Removed old trigger_error() 2014-09-16 00:42:36 +02:00
44a30b7fac Added forced position strong check for Player 2014-09-16 00:32:03 +02:00
50b2f55583 Increased movement error range 2014-09-15 23:53:08 +02:00
da084d6908 Fixed door bounding boxes, closes#2075 2014-09-15 23:40:26 +02:00
7d51bc0004 Possible fix for #2077 2014-09-15 22:14:05 +02:00
87dbc18452 Removed position revert message on plugin event cancelled 2014-09-15 20:32:42 +02:00
5b8d4bba11 Fixed issues with placing doors 2014-09-15 20:32:27 +02:00
bb4c54106a Added temporal workaround for pthreads version check 2014-09-15 18:55:15 +02:00
1617b2509e Fixed plugin-related crash 2014-09-15 12:09:30 +02:00
ec293ebd9e Merge pull request #2071 from PocketMine/pthreads-fix
Removed pthreads workarounds, new pthreads version
2014-09-15 10:16:35 +02:00
9f9422f0ed Added Player->forceMovement check on teleport 2014-09-15 01:16:13 +02:00
da715e48e2 Bumped pthreads version 2014-09-13 12:07:04 +02:00
702b2e539c Update RakLib 2014-09-13 12:01:11 +02:00
63fc229c12 Enabled default PHP GC on generator thread 2014-09-12 15:57:02 +02:00
c71689a919 Optimized server sleep times 2014-09-12 15:56:21 +02:00
09428bc8c7 Merge branch 'master' into pthreads-fix 2014-09-12 13:32:53 +02:00
6c7e16d9d4 Added Permission/Permissible calculation timings 2014-09-12 13:08:59 +02:00
315ea2ea3c 64-bit Random optimizations 2014-09-12 12:58:21 +02:00
83eb9f778a Level generators can be set in server.properties 2014-09-12 01:05:32 +02:00
7923c40b33 Removed as Vector3 on Flat generator 2014-09-12 00:12:52 +02:00
d298adabad Merge branch 'master' into pthreads-fix 2014-09-11 22:06:10 +02:00
cfcf515f62 Added type hint to BlockEvent::getBlock() 2014-09-11 21:57:56 +02:00
b5deae7ba0 Added synchronization to GenerationThread::pushMainToThreadPacket() 2014-09-11 19:18:14 +02:00
d991c32435 Fixed Generator Thread as specified on krakjoe/pthreads#349 2014-09-11 19:10:25 +02:00
dbd1f3f96e Use pthreads interface on Chunk Generation THread, remove IPC sockets, improve performance 2014-09-11 18:05:14 +02:00
0bd7ab9def Added .mailmap file, fixes duplicated commiter names 2014-09-11 17:41:07 +02:00
665c275bb7 New improved RakLib version with pthreads changes 2014-09-11 17:18:54 +02:00
7ef2708fca Permission & interface optimization 2014-09-11 16:43:11 +02:00
78b4223795 Added PermissionAttachment::unsetPermissions(), PermissionAttachment::clearPermissions() 2014-09-11 12:43:53 +02:00
0328b4c5f5 Added PermissionAttachment::setPermissions()
This allows bulk permission without recalculating the new permissions until all everything is set. Permission plugins that set a big amount of nodes may want to use this method.
2014-09-11 12:39:01 +02:00
4624dfb472 Fixed Permissible::setPermission() not using the correct order on replacement 2014-09-11 12:17:03 +02:00
fba12c6ddf Fixed EntityMoveEvent not being cancelled correctly on players 2014-09-10 20:06:30 +02:00
60011a5ecf Fixed PermissionAttachment not recalculating its Permissible permissions 2014-09-10 20:05:41 +02:00
f4ae58dda2 Removed pthreads workarounds 2014-09-10 15:11:56 +02:00
8c939feed9 Added Pumpkin & Lit Pumpkin rotation, closes 2014-09-10 12:36:05 +02:00
02ca227085 Normalized Player pitch/yaw 2014-09-10 12:23:23 +02:00
1174b0c45c Added binary reading optimizations, faster 64-bit reading 2014-09-10 12:13:15 +02:00
8940360df4 Possible fix for #2061 2014-09-10 10:43:24 +02:00
bb34e06754 Fix division by zero when the server goes too fast 2014-09-09 19:13:35 +02:00
e06092cb99 Added Server::getTickUsage() 2014-09-09 18:46:20 +02:00
57373b8c5e TPS measurement improvement, moved interface handling to tick 2014-09-09 18:07:27 +02:00
317c6788a6 Updated RakLib path 2014-09-08 10:11:43 +02:00
0a4e0e3228 Fixed Item drop delay 2014-09-08 07:40:19 +02:00
d8c492de4a Merge pull request #2062 from Yosshi999/patch1
Fixed HeldItem were swapped in mining
2014-09-08 07:37:24 +02:00
05d59d587b Merge pull request #2063 from Yosshi999/patch2
Fixed Player's slot[0] disappears on loging in
2014-09-08 07:37:16 +02:00
7d387fe6aa Fixed TravisTest output 2014-09-07 19:54:13 +02:00
4f7a6a06be Fixed TravisTest pipes 2014-09-07 19:47:31 +02:00
344c84cfa6 Added --disable-readline CLI argument 2014-09-07 19:42:36 +02:00
bd721a13a3 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-09-07 19:33:01 +02:00
92b0b4d43c Implemented basic Travis-CI test 2014-09-07 19:32:21 +02:00
d0b0fbf992 Merge pull request #2064 from PEMapModder/patch-2
Fixed wrong cases
2014-09-07 09:02:54 +02:00
ab334e6962 Fixed wrong cases
I know this doesn't matter at all, but it is ugly in IDEs.
2014-09-07 13:21:05 +08:00
1ad6438e60 Fixed Player's slot[0] disappears on loging in 2014-09-07 11:37:54 +09:00
4ecec42c9d Fixed HeldItem were swapped in mining 2014-09-07 11:29:17 +09:00
84e62598ce Implemented attack cooldown 2014-09-06 16:52:52 +02:00
ad7acb93b6 Added cactus neighbour block check 2014-09-05 11:16:24 +02:00
ac4b4b08fd Fixed Level::setBlock() old calls 2014-09-05 11:00:13 +02:00
d3c308c5a8 Fixed possible Player crash on save 2014-09-05 10:50:19 +02:00
98e0583f34 Implemented Falling Sand 2014-09-05 10:50:06 +02:00
020351e20f Fixed #2052 2014-09-05 09:02:45 +02:00
f140fef52d Possible fix for level save issues, related to #1985 #1982 #1758 2014-09-04 12:37:27 +02:00
9980a0780a Fixed Server::getTicksPerSecond() 2014-09-04 12:22:16 +02:00
352497d88c Improves server ticking.
As I was lying in my bed, I came to a solution for the tick problem.
While remembering how most of the time the server is sleeping,
and how the TPS drops once costly operations are ticked,
I reviewed mentally that part of the code, Server::tick().

Then I saw it: I was setting the next execution time
using the time after it was executed as the base, but it should
have been done using the tick start time - that way if something takes
longer, the server will catch up and won't drop the TPS
until the CPU hits its limit.

I got up, got to my computer, and checked that function.
It was exactly as I saw in a near-dream state, so I fixed it
and tested things if they worked right.

Now I'm fully awake and I can't sleep anymore, so I wrote this.
2014-09-04 01:04:09 +02:00
ba08bfaa45 Do not report E_PARSE or E_COMPILE_ERROR crashes 2014-09-03 13:38:24 +02:00
dea4513c34 Possible fix for #2041 2014-09-03 11:55:49 +02:00
0eac084aa7 Added extra documentation to Level::setBlock() 2014-09-03 11:44:30 +02:00
e17ecf5795 Improved Arrow / Item movement 2014-09-03 10:55:14 +02:00
e94ddcabe0 Fixed dropped items going too fast 2014-09-01 23:37:31 +02:00
acf7eb1ce9 Remove scheduled updates from entities 2014-09-01 23:30:35 +02:00
dcfb7a7ac4 Fixed #2037 2014-09-01 17:47:28 +02:00
97c87aa8fa Added __debugInfo() to Server and Level 2014-09-01 17:37:28 +02:00
11f684d803 Improved CallbackTask timings data 2014-09-01 12:44:52 +02:00
ff48eb3d4d Added better Entity/Tile scheduled updates 2014-09-01 11:59:46 +02:00
e047b6a870 Fixed bows not getting damaged 2014-09-01 11:43:48 +02:00
c5626bae34 Do not set Level to null, closes #2032 2014-09-01 11:29:44 +02:00
3eac08f5ba Possible fix for #2027, properly check Player onGround flag 2014-09-01 02:32:16 +02:00
cc2555bb88 Fixed crash when chests are closed with viewers 2014-09-01 02:26:23 +02:00
705e4da789 Tick entities on Level, show correct timing reports 2014-09-01 01:56:13 +02:00
9b7a94b5ee Fixed timings ticks getting reset 2014-09-01 01:50:28 +02:00
bcdb6d8c2e Fixed timings name 2014-09-01 01:28:42 +02:00
eff63a661e Player creative check refactor 2014-08-31 10:49:20 +02:00
5a756d215d Fixed creative players dropping their inventory 2014-08-31 10:45:38 +02:00
422262d585 Fixed infinite Entity recursion on chunk load 2014-08-31 01:06:53 +02:00
b761a97660 Fixed crash due to class name conflict 2014-08-31 01:05:15 +02:00
7579cd763a Added Trapdoor bounding box 2014-08-30 23:57:57 +02:00
6bc5f60011 Added Cobble Wall bounding box 2014-08-30 23:52:06 +02:00
3eb8ca0d13 Added Soul Sand bounding box 2014-08-30 23:47:39 +02:00
a23352be88 Added Ladder bounding box 2014-08-30 23:45:08 +02:00
fa5f00a1ff Added Cake bounding boxe 2014-08-30 23:42:07 +02:00
d3a05adede Added Doors bounding boxes 2014-08-30 23:38:56 +02:00
f9182bd0f8 Added Iron bars bounding box 2014-08-30 23:30:10 +02:00
edad52c6ea Added Glass Pane bounding box 2014-08-30 23:30:01 +02:00
cd5e16f017 Added Fence Gate bounding box 2014-08-30 23:20:59 +02:00
310a7d6c04 Added Fence bounding box 2014-08-30 23:18:37 +02:00
ccea26c978 Added Farmland bounding box 2014-08-30 23:07:55 +02:00
cf542ac73a Added End Portal frame bounding box 2014-08-30 23:06:50 +02:00
3bf39df255 Added cactus bounding box 2014-08-30 23:06:27 +02:00
910e5e6181 Added stairs bounding box 2014-08-30 23:01:33 +02:00
a396b8c220 Fixed #2021 2014-08-30 21:45:32 +02:00
ec1fe6a083 Fixed EntityShootBowEventEvent crash 2014-08-30 19:07:17 +02:00
706c97b9b1 Made shooting bow use its durability 2014-08-30 18:46:09 +02:00
a04516a879 Added EntityShootBowEvent, made bow require an arrow 2014-08-30 18:43:32 +02:00
0f6dfd39b8 Made EntityDamageByEntityEvent call EntityDamageEvent handlers 2014-08-30 18:41:00 +02:00
36ee6d9966 Added arrow and suicide death messages 2014-08-30 18:30:39 +02:00
23793e0fc4 Added check for invalid entity attack 2014-08-30 18:24:24 +02:00
3409d332e7 Added survival check to movements 2014-08-30 17:57:30 +02:00
ca1b67a675 hmm 2014-08-30 17:07:50 +02:00
f5eed4f12b Disable RakLib port checking by default 2014-08-30 16:14:09 +02:00
7a10f91330 Fixed entity partial block moving 2014-08-30 15:31:22 +02:00
6477f4f077 Added Wooden Slab bounding box 2014-08-30 02:14:48 +02:00
3731e74696 Added Slab bounding box 2014-08-30 02:14:24 +02:00
c774e4c203 Added Carpet bounding box 2014-08-30 02:09:15 +02:00
d4907a2688 Added Chest bounding box 2014-08-30 02:07:50 +02:00
793520926b Added Bed bounding box 2014-08-30 02:06:46 +02:00
bf839e821c Added proper arrows and damage 2014-08-30 01:22:46 +02:00
7aeacf2705 Fixed armor crafting recipes 2014-08-29 14:49:41 +02:00
fc62c91c90 Fixed double physics calculation 2014-08-29 13:33:59 +02:00
98dd7f8c15 Use Entity::move() as player movement, protect against noclip cheat 2014-08-29 13:33:25 +02:00
7a1d25617f Fixed physics sneak flag 2014-08-29 13:02:08 +02:00
69b3ef326b Merge pull request #1994 from PocketMine/nbt-array
Added NBT <-> PHP array/type conversion methods
2014-08-29 12:17:10 +02:00
fadff2cc5b Removed debug code 2014-08-28 23:59:18 +02:00
43a0ef433e API version bump 2014-08-28 23:44:19 +02:00
9a1e7ca83c Implemented NBT::getArray() and NBT::setArray() 2014-08-28 23:43:04 +02:00
b9111b6f52 Fixed #1992 2014-08-28 23:19:44 +02:00
be70121f3a Renamed Item\Block to Item\ItemBlock 2014-08-28 22:28:32 +02:00
e2986992c7 Fixed AxisAlignedBB infinite expansion 2014-08-28 21:11:49 +02:00
9fb46d8fe8 Fixed entity physics 2014-08-28 18:26:37 +02:00
eab86f5f90 Replaced array() with [] 2014-08-28 17:04:22 +02:00
2f2afe2336 Fixed #1966 Face Lit Pumkins correctly 2014-08-28 11:00:41 +02:00
f7de1ede3f Made PocketMine loader backwards-compatible 2014-08-27 21:30:36 +02:00
812ae09a06 Merge branch 'php-5.6' 2014-08-27 21:24:52 +02:00
e473cd5e67 Improved unloaded tile entity handling 2014-08-27 18:18:33 +02:00
9e5e4fb362 Fixed possible Level::getBlock() crash 2014-08-27 18:11:23 +02:00
afa98866e0 Fixed Item after-clone behaviour 2014-08-27 18:11:02 +02:00
90fa40de34 Added entity id names 2014-08-27 17:42:38 +02:00
e6234c4c4d Removed cli_set_process_title() check 2014-08-27 12:45:14 +02:00
8f66d03d99 Improved Item::get() 2014-08-27 12:43:54 +02:00
8e9da9c84e Improved safe_var_dump(), Inventory::addItem() Inventory::removeItem() using argument unpacking 2014-08-27 12:29:04 +02:00
759d7e2545 Initial PHP 5.6 features support 2014-08-27 12:21:01 +02:00
f4b92bcdfc Fixed #1980 2014-08-27 11:41:00 +02:00
f7e2d31f0a Check player online status, closes #1983 2014-08-27 11:28:49 +02:00
e0fc3784ad Throw exception when saving an already-closed player, closes #1981 2014-08-26 22:02:43 +02:00
bf5630dc0d Fixed #1926 Teleport to non-generated chunks 2014-08-26 16:45:51 +02:00
472431752b Dropped items and arrows get deleted on Y < 0 2014-08-26 16:19:45 +02:00
c40f9f65a5 Optimize imports 2014-08-26 11:54:24 +02:00
f74af12914 Improved chunk ticking, enabled again. Disable it setting chunk-ticking.per-tick to 0 2014-08-26 11:52:45 +02:00
d169734781 Improved chunk sending 2014-08-26 11:50:51 +02:00
35b86af2af Fixed furnace achievement check 2014-08-26 10:56:33 +02:00
706bc8e8db Fixed undefined index on furnace recipes 2014-08-26 00:05:40 +02:00
b542c5b9bd Added Furnace progress fire 2014-08-26 00:05:18 +02:00
69800c6d79 Fixed #1911 Implemented FurnaceInventory callback 2014-08-26 00:03:16 +02:00
ea9fc3c72e Fixed #1879 Tile entities were not saved on chunk unload 2014-08-26 00:02:20 +02:00
8b90281355 Fixed #1953 Increased item PickupDelay to 2.5 seconds 2014-08-25 23:38:35 +02:00
92cabced97 Ctrl+C handling and kill signals are working again 2014-08-25 23:24:18 +02:00
cb645fa288 Moved spl to PocketMine-SPL 2014-08-25 21:02:33 +02:00
bda597a71e Moved spl to PocketMine-SPL 2014-08-25 20:54:53 +02:00
d6a0e284e3 Workaround BaseChunk::setBlock() recursion issues 2014-08-25 17:08:02 +02:00
1795c8c5e3 Fixed Chests/Furnaces not dropping contents when broken 2014-08-25 16:59:04 +02:00
c3b1b59118 Fixed #1970 Breaking blocks does not remove tile entities 2014-08-25 16:55:52 +02:00
a0df0a8fff Fixed player fall damage 2014-08-25 16:53:20 +02:00
049103ab7a Improved Block selection and construction performance 2014-08-25 16:39:47 +02:00
84c63c48ca Improved NBT IntArray read/write 2014-08-25 16:28:46 +02:00
20e11bd408 Improved player onGround collision check 2014-08-25 15:48:12 +02:00
456760b334 Removed unloaded chunk check 2014-08-25 15:43:48 +02:00
46e502430e Added teleport flag to MovePlayerPacket, improves player movement 2014-08-25 13:01:39 +02:00
87b800ebb9 Fixed #1967 Glowstone dust -> Glowstone recipe 2014-08-25 11:33:47 +02:00
9fdafb87b4 Fixed #1962 Fake client-side player entities 2014-08-24 23:12:12 +02:00
1fcfef20b0 Implemented beds 2014-08-24 20:34:24 +02:00
6109505786 Implemented correct time offsets and speed 2014-08-24 20:34:06 +02:00
764937dda4 Fixed #1961 2014-08-24 18:08:14 +02:00
8bf36315ae Updated RakLib 2014-08-24 17:21:05 +02:00
1ea0531ec7 Added RakLib port checking option 2014-08-24 17:16:37 +02:00
c47e359262 Updated blocks bounding boxes 2014-08-24 16:30:56 +02:00
f0f9bccb4b Fixed #1960 2014-08-24 15:57:13 +02:00
214dcef1ea Improved Air block collision check 2014-08-24 15:55:34 +02:00
4edadd764c Improved Level::getBlock() 2014-08-24 14:30:43 +02:00
01ebe74974 Performance improvements in blocks and Entities 2014-08-24 14:08:17 +02:00
84ce5f1c73 Performance improvements in NBT reading/writing 2014-08-24 13:59:37 +02:00
93a2bd36e0 Require PHP >= 5.5 2014-08-24 13:33:03 +02:00
fdd59e4506 Fixed default memory-limit values 2014-08-23 20:14:41 +02:00
9b86b1d45b Added --enable-profiler parameter to use with @krakjoe profiler 2014-08-23 20:14:04 +02:00
1a38003bc4 Fixed /version 2014-08-22 19:39:24 +02:00
60ea4d0e96 Removed hardcoded Server name from source 2014-08-22 18:31:17 +02:00
6077190a62 Deprecated Server::loadPlugin(Plugin) in favor of Server::enablePlugin(Plugin) 2014-08-22 17:43:29 +02:00
57299b9a29 Fixed #1948 /whitelist list is now working 2014-08-22 13:23:56 +02:00
bb08da701b Fixed header logo in PR #1944 2014-08-22 11:30:15 +02:00
ee593fe5e4 Merge pull request #1944 from PEMapModder/patch-2
Cleaned Mycelium.php and fixed its potential crash
2014-08-22 11:22:10 +02:00
e8b1b0fab6 Cleaned Mycelium.php and fixed its potential crash
Crash report: http://crash.pocketmine.net/view/27500
2014-08-22 11:05:47 +08:00
764 changed files with 37567 additions and 15613 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/*

9
.gitmodules vendored
View File

@ -6,3 +6,12 @@
path = src/raklib
url = https://github.com/PocketMine/RakLib.git
branch = master
[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

5
.mailmap Normal file
View File

@ -0,0 +1,5 @@
Shoghi Cervantes <shoghicp@gmail.com>
Shoghi Cervantes <shoghicp@gmail.com> Shoghi Cervantes <shoghicp@pocketmine.net>
Brandon V <brandon15811@gmail.com>
Michael Yoo <sekjun9878@gmail.com> Michael Yoo <michael@yoo.id.au>
Michael Yoo <sekjun9878@gmail.com> Michael Yoo <sekjun9878@sekjun9878.info>

View File

@ -1,23 +1,21 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
branches:
except:
- Core-Rewrite
- master
- 0.9.0
- master
before_script:
- pecl install channel://pecl.php.net/pthreads-2.0.4
- echo | pecl install channel://pecl.php.net/yaml-1.1.1
- mkdir plugins
- 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 src/tests/ServerSuiteTest.php --no-wizard
- php tests/TravisTest.php
notifications:
email: false
webhooks: http://n.tkte.ch/h/214/wsNvmG43-ncxUVRrFPwSM-r0
#webhooks: http://n.tkte.ch/h/214/wsNvmG43-ncxUVRrFPwSM-r0

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
@ -72,6 +72,19 @@ class ExampleClass{
}
```
### RFC and Voting
* These are big Pull Requests or contributions that change important behavior.
* RFCs will be tagged with the *PR: RFC* label
* A vote will be held once the RFC is ready. All users can vote commenting on the Pull Request
* Comments MUST use "Yes" or "No" on the FIRST sentence to signify the vote, except when they don't want it to be counted.
* If your comment is a voting comment, specify the reason of your vote or it won't be counted.
* After voting has been closed, no further votes will be counted.
* An RFC will be rejected if less than 50% + 1 (simple majority) has voted Yes.
* If the RFC is approved, Team Members have the final word on its implementation or rejection.
* RFCs with complex voting options will specify the vote percentage or other details.
## Bug Tracking for Collaborators
### Labels
@ -91,6 +104,7 @@ Category labels are prefixed by `C:`. Multiple category labels may be applied to
Pull Requests are prefixed by `PR:`. Only one label may be applied for a Pull Request.
- PR: Bug Fix - This label is applied when the Pull Request fixes a bug.
- PR: Contribution - This label is applied when the Pull Request contributes code to PocketMine-MP such as a new feature or an improvement.
- PR: RFC - Request for Comments
#### Status
Status labels show the status of the issue. Multiple status labels may be applied.

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;
/**
@ -30,86 +31,87 @@ abstract class Achievement{
/**
* @var array[]
*/
public static $list = array(
public static $list = [
/*"openInventory" => array(
"name" => "Taking Inventory",
"requires" => [],
),*/
"mineWood" => array(
"mineWood" => [
"name" => "Getting Wood",
"requires" => array( //"openInventory",
),
),
"buildWorkBench" => array(
"requires" => [ //"openInventory",
],
],
"buildWorkBench" => [
"name" => "Benchmarking",
"requires" => array(
"requires" => [
"mineWood",
),
),
"buildPickaxe" => array(
],
],
"buildPickaxe" => [
"name" => "Time to Mine!",
"requires" => array(
"requires" => [
"buildWorkBench",
),
),
"buildFurnace" => array(
],
],
"buildFurnace" => [
"name" => "Hot Topic",
"requires" => array(
"requires" => [
"buildPickaxe",
),
),
"acquireIron" => array(
],
],
"acquireIron" => [
"name" => "Acquire hardware",
"requires" => array(
"requires" => [
"buildFurnace",
),
),
"buildHoe" => array(
],
],
"buildHoe" => [
"name" => "Time to Farm!",
"requires" => array(
"requires" => [
"buildWorkBench",
),
),
"makeBread" => array(
],
],
"makeBread" => [
"name" => "Bake Bread",
"requires" => array(
"requires" => [
"buildHoe",
),
),
"bakeCake" => array(
],
],
"bakeCake" => [
"name" => "The Lie",
"requires" => array(
"requires" => [
"buildHoe",
),
),
"buildBetterPickaxe" => array(
],
],
"buildBetterPickaxe" => [
"name" => "Getting an Upgrade",
"requires" => array(
"requires" => [
"buildPickaxe",
),
),
"buildSword" => array(
],
],
"buildSword" => [
"name" => "Time to Strike!",
"requires" => array(
"requires" => [
"buildWorkBench",
),
),
"diamonds" => array(
],
],
"diamonds" => [
"name" => "DIAMONDS!",
"requires" => array(
"requires" => [
"acquireIron",
),
),
],
],
);
];
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;
@ -120,10 +122,10 @@ abstract class Achievement{
public static function add($achievementId, $achievementName, array $requires = []){
if(!isset(Achievement::$list[$achievementId])){
Achievement::$list[$achievementId] = array(
Achievement::$list[$achievementId] = [
"name" => $achievementName,
"requires" => $requires,
);
];
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

@ -0,0 +1,26 @@
<?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;
class CompatibleClassLoader extends \BaseClassLoader{
}

View File

@ -14,7 +14,7 @@
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
@ -22,6 +22,7 @@
namespace pocketmine;
use pocketmine\network\protocol\Info;
use pocketmine\plugin\PluginBase;
use pocketmine\plugin\PluginLoadOrder;
use pocketmine\utils\Utils;
use pocketmine\utils\VersionString;
@ -41,9 +42,12 @@ 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("PocketMine-MP Crash Dump " . date("D M j H:i:s T Y", $this->time));
$this->addLine($this->server->getName() . " Crash Dump " . date("D M j H:i:s T Y", $this->time));
$this->addLine();
$this->baseCrash();
$this->generalData();
@ -136,8 +140,8 @@ class CrashDump{
$error = $lastExceptionError;
}else{
$error = (array) error_get_last();
$error["trace"] = getTrace(4);
$errorConversion = array(
$error["trace"] = @getTrace(3);
$errorConversion = [
E_ERROR => "E_ERROR",
E_WARNING => "E_WARNING",
E_PARSE => "E_PARSE",
@ -153,7 +157,7 @@ class CrashDump{
E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
E_DEPRECATED => "E_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED",
);
];
$error["fullFile"] = $error["file"];
$error["file"] = cleanPath($error["file"]);
$error["type"] = isset($errorConversion[$error["type"]]) ? $errorConversion[$error["type"]] : $error["type"];
@ -179,7 +183,7 @@ class CrashDump{
$this->addLine("THIS CRASH WAS CAUSED BY A PLUGIN");
$this->data["plugin"] = true;
$reflection = new \ReflectionClass("pocketmine\\plugin\\PluginBase");
$reflection = new \ReflectionClass(PluginBase::class);
$file = $reflection->getProperty("file");
$file->setAccessible(true);
foreach($this->server->getPluginManager()->getPlugins() as $plugin){
@ -228,7 +232,7 @@ class CrashDump{
$this->data["general"]["zend"] = zend_version();
$this->data["general"]["php_os"] = PHP_OS;
$this->data["general"]["os"] = Utils::getOS();
$this->addLine("PocketMine-MP version: " . $version->get(false) . " #" . $version->getNumber() . " [Protocol " . Info::CURRENT_PROTOCOL . "; API " . API_VERSION . "]");
$this->addLine("PocketMine-MP version: " . $version->get(false) . " #" . $version->getBuild() . " [Protocol " . Info::CURRENT_PROTOCOL . "; API " . API_VERSION . "]");
$this->addLine("Git commit: " . GIT_COMMIT);
$this->addLine("uname -a: " . php_uname("a"));
$this->addLine("PHP Version: " . phpversion());

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):
@ -65,22 +65,36 @@ namespace {
}
namespace pocketmine {
use LogLevel;
use pocketmine\utils\Binary;
use pocketmine\utils\MainLogger;
use pocketmine\utils\ServerKiller;
use pocketmine\utils\Terminal;
use pocketmine\utils\Utils;
use pocketmine\wizard\Installer;
use raklib\RakLib;
const VERSION = "Alpha_1.4dev";
const API_VERSION = "1.3.0";
const CODENAME = "絶好(Zekkou)ケーキ(Cake)";
const MINECRAFT_VERSION = "v0.9.5 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.
* Most of them are hacks to fix date-related bugs, or basic functions used after this
* This is the only non-class based file on this project.
* Enjoy it as much as I did writing it. I don't want to do it again.
*/
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")){
@ -89,56 +103,20 @@ namespace pocketmine {
exit(1);
}
if(!class_exists("SplClassLoader", false)){
require_once(\pocketmine\PATH . "src/spl/SplClassLoader.php");
if(!class_exists("ClassLoader", false)){
require_once(\pocketmine\PATH . "src/spl/ClassLoader.php");
require_once(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
require_once(\pocketmine\PATH . "src/pocketmine/CompatibleClassLoader.php");
}
$autoloader = new \SplClassLoader();
$autoloader->setMode(\SplAutoloader::MODE_DEBUG);
$autoloader->add("pocketmine", [
\pocketmine\PATH . "src"
]);
$autoloader = new CompatibleClassLoader();
$autoloader->addPath(\pocketmine\PATH . "src");
$autoloader->addPath(\pocketmine\PATH . "src" . DIRECTORY_SEPARATOR . "spl");
$autoloader->register(true);
if(!class_exists("raklib\\RakLib", false)){
require(\pocketmine\PATH . "src/raklib/raklib/RakLib.php");
}
RakLib::bootstrap($autoloader);
//Startup code. Do not look at it, it can harm you. Most of them are hacks to fix date-related bugs, or basic functions used after this
set_time_limit(0); //Who set it to 30 seconds?!?!
if(ini_get("date.timezone") == ""){ //No Timezone set
date_default_timezone_set("GMT");
if(strpos(" " . strtoupper(php_uname("s")), " WIN") !== false){
$time = time();
$time -= $time % 60;
//TODO: Parse different time & date formats by region. ¬¬ world
//Example: USA
@exec("time.exe /T", $hour);
$i = array_map("intval", explode(":", trim($hour[0])));
@exec("date.exe /T", $date);
$j = array_map("intval", explode(substr($date[0], 2, 1), trim($date[0])));
$offset = round((mktime($i[0], $i[1], 0, $j[1], $j[0], $j[2]) - $time) / 60) * 60;
}else{
@exec("date +%s", $t);
$offset = round((intval(trim($t[0])) - time()) / 60) * 60;
}
$daylight = (int) date("I");
$d = timezone_name_from_abbr("", $offset, $daylight);
@ini_set("date.timezone", $d);
date_default_timezone_set($d);
}else{
$d = @date_default_timezone_get();
if(strpos($d, "/") === false){
$d = timezone_name_from_abbr($d);
@ini_set("date.timezone", $d);
date_default_timezone_set($d);
}
}
gc_enable();
error_reporting(-1);
ini_set("allow_url_fopen", 1);
@ -146,18 +124,194 @@ 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("", array("enable-ansi", "disable-ansi", "data:", "plugins:", "no-wizard"));
$opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-profiler"]);
define("pocketmine\\DATA", isset($opts["data"]) ? realpath($opts["data"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
define("pocketmine\\PLUGIN_PATH", isset($opts["plugins"]) ? realpath($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", ((strpos(strtoupper(php_uname("s")), "WIN") === false or isset($opts["enable-ansi"])) and !isset($opts["disable-ansi"])));
Terminal::init();
define('pocketmine\ANSI', Terminal::hasFormattingCodes());
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")){
if(($timezone = detect_system_timezone()) and date_default_timezone_set($timezone)){
//Success! Timezone has already been set and validated in the if statement.
//This here is just for redundancy just in case some program wants to read timezone data from the ini.
ini_set("date.timezone", $timezone);
}else{
//If system timezone detection fails or timezone is an invalid value.
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'])
){
//Again, for redundancy.
ini_set("date.timezone", $ip_geolocation_data['timezone']);
}else{
ini_set("date.timezone", "UTC");
date_default_timezone_set("UTC");
$logger->warning("Timezone could not be automatically determined. An incorrect timezone will result in incorrect timestamps on console logs. It has been set to \"UTC\" by default. You can change it on the php.ini file.");
}
}
}else{
/*
* 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.
*/
$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);
}
}
function detect_system_timezone(){
switch(Utils::getOS()){
case 'win':
$regex = '/(UTC)(\+*\-*\d*\d*\:*\d*\d*)/';
/*
* wmic timezone get Caption
* Get the timezone offset
*
* Sample Output var_dump
* array(3) {
* [0] =>
* string(7) "Caption"
* [1] =>
* string(20) "(UTC+09:30) Adelaide"
* [2] =>
* string(0) ""
* }
*/
exec("wmic timezone get Caption", $output);
$string = trim(implode("\n", $output));
//Detect the Time Zone string
preg_match($regex, $string, $matches);
if(!isset($matches[2])){
return false;
}
$offset = $matches[2];
if($offset == ""){
return "UTC";
}
return parse_offset($offset);
break;
case 'linux':
// Ubuntu / Debian.
if(file_exists('/etc/timezone')){
$data = file_get_contents('/etc/timezone');
if($data){
return trim($data);
}
}
// RHEL / CentOS
if(file_exists('/etc/sysconfig/clock')){
$data = parse_ini_file('/etc/sysconfig/clock');
if(!empty($data['ZONE'])){
return trim($data['ZONE']);
}
}
//Portable method for incompatible linux distributions.
$offset = trim(exec('date +%:z'));
if($offset == "+00:00"){
return "UTC";
}
return parse_offset($offset);
break;
case 'mac':
if(is_link('/etc/localtime')){
$filename = readlink('/etc/localtime');
if(strpos($filename, '/usr/share/zoneinfo/') === 0){
$timezone = substr($filename, 20);
return trim($timezone);
}
}
return false;
break;
default:
return false;
break;
}
}
/**
* @param string $offset In the format of +09:00, +02:00, -04:00 etc.
*
* @return string
*/
function parse_offset($offset){
//Make signed offsets unsigned for date_parse
if(strpos($offset, '-') !== false){
$negative_offset = true;
$offset = str_replace('-', '', $offset);
}else{
if(strpos($offset, '+') !== false){
$negative_offset = false;
$offset = str_replace('+', '', $offset);
}else{
return false;
}
}
$parsed = date_parse($offset);
$offset = $parsed['hour'] * 3600 + $parsed['minute'] * 60 + $parsed['second'];
//After date_parse is done, put the sign back
if($negative_offset == true){
$offset = -abs($offset);
}
//And then, look the offset up.
//timezone_name_from_abbr is not used because it returns false on some(most) offsets because it's mapping function is weird.
//That's been a bug in PHP since 2008!
foreach(timezone_abbreviations_list() as $zones){
foreach($zones as $timezone){
if($timezone['offset'] == $offset){
return $timezone['timezone_id'];
}
}
}
return false;
}
if(isset($opts["enable-profiler"])){
if(function_exists("profiler_enable")){
\profiler_enable();
$logger->notice("Execution is being profiled");
}else{
$logger->notice("No profiler found. Please install https://github.com/krakjoe/profiler");
}
}
function kill($pid){
switch(Utils::getOS()){
case "win":
@ -166,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")){
@ -191,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;
@ -204,62 +380,8 @@ namespace pocketmine {
return rtrim(str_replace(["\\", ".php", "phar://", rtrim(str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PATH), "/"), rtrim(str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PLUGIN_PATH), "/")], ["/", "", "", "", ""], $path), "/");
}
function error_handler($errno, $errstr, $errfile, $errline, $trace = null){
global $lastError;
if(error_reporting() === 0){ //@ error-control
return false;
}
$errorConversion = array(
E_ERROR => "E_ERROR",
E_WARNING => "E_WARNING",
E_PARSE => "E_PARSE",
E_NOTICE => "E_NOTICE",
E_CORE_ERROR => "E_CORE_ERROR",
E_CORE_WARNING => "E_CORE_WARNING",
E_COMPILE_ERROR => "E_COMPILE_ERROR",
E_COMPILE_WARNING => "E_COMPILE_WARNING",
E_USER_ERROR => "E_USER_ERROR",
E_USER_WARNING => "E_USER_WARNING",
E_USER_NOTICE => "E_USER_NOTICE",
E_STRICT => "E_STRICT",
E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
E_DEPRECATED => "E_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED",
);
$type = ($errno === E_ERROR or $errno === E_WARNING or $errno === E_USER_ERROR or $errno === E_USER_WARNING) ? LogLevel::ERROR : LogLevel::NOTICE;
$errno = isset($errorConversion[$errno]) ? $errorConversion[$errno] : $errno;
if(($pos = strpos($errstr, "\n")) !== false){
$errstr = substr($errstr, 0, $pos);
}
$logger = MainLogger::getLogger();
$oldFile = $errfile;
$errfile = cleanPath($errfile);
$logger->log($type, "An $errno error happened: \"$errstr\" in \"$errfile\" at line $errline");
foreach(($trace = getTrace($trace === null ? 3 : 0, $trace)) as $i => $line){
$logger->debug($line);
}
$lastError = [
"type" => $type,
"message" => $errstr,
"fullFile" => $oldFile,
"file" => $errfile,
"line" => $errline,
"trace" => $trace
];
return true;
}
set_error_handler("\\pocketmine\\error_handler", E_ALL);
$errors = 0;
if(version_compare("5.4.0", PHP_VERSION) > 0){
$logger->critical("Use PHP >= 5.4.0");
++$errors;
}
if(php_sapi_name() !== "cli"){
$logger->critical("You must run PocketMine-MP using the CLI.");
++$errors;
@ -274,8 +396,8 @@ namespace pocketmine {
if(substr_count($pthreads_version, ".") < 2){
$pthreads_version = "0.$pthreads_version";
}
if(version_compare($pthreads_version, "2.0.4") < 0){
$logger->critical("pthreads >= 2.0.4 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;
}
@ -293,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;
}
@ -326,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));
@ -339,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.");
}
@ -349,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();
if($thread->isRunning() or !$thread->join()){
$thread->detach();
}
}elseif($thread instanceof Worker){
$thread->kill();
sleep(1);
if($thread->isRunning() or !$thread->join()){
$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 & ~PTHREADS_INHERIT_CLASSES);
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 & ~PTHREADS_INHERIT_CLASSES);
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,15 +22,35 @@
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){
return array(
array($this->id, 0, 1),
);
return [
[$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,30 +21,59 @@
namespace pocketmine\block;
use pocketmine\math\AxisAlignedBB;
use pocketmine\item\Item;
/**
* Air block
*/
class Air extends Transparent{
public function __construct(){
parent::__construct(self::AIR, 0, "Air");
$this->isActivable = false;
$this->breakable = false;
$this->isFlowable = true;
$this->isTransparent = true;
$this->isReplaceable = true;
$this->isPlaceable = false;
$this->hasPhysics = false;
$this->isSolid = false;
$this->isFullBlock = true;
$this->hardness = 0;
protected $id = self::AIR;
protected $meta = 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 new AxisAlignedBB(0, 0, 0, 0, 0, 0);
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

@ -22,25 +22,52 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\network\protocol\ChatPacket;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
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(){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 0.5625,
$this->z + 1
);
}
public function onActivate(Item $item, Player $player = null){
/*if($player instanceof Player and Server::getInstance()->api->time->getPhase($this->getLevel()) !== "night"){
$pk = new ChatPacket;
$pk->message = "You can only sleep at night";
$player->dataPacket($pk);
$time = $this->getLevel()->getTime() % Level::TIME_FULL;
$isNight = ($time >= Level::TIME_NIGHT and $time < Level::TIME_SUNRISE);
if($player instanceof Player and !$isNight){
$player->sendMessage(TextFormat::GRAY . "You can only sleep at night");
return true;
}*/
}
$blockNorth = $this->getSide(2); //Gets the blocks around them
$blockSouth = $this->getSide(3);
@ -49,27 +76,25 @@ 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;
}elseif($player instanceof Player){
$pk = new ChatPacket;
$pk->message = "This bed is incomplete";
$player->dataPacket($pk);
}else{
if($player instanceof Player){
$player->sendMessage(TextFormat::GRAY . "This bed is incomplete");
}
return true;
}
}
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;
@ -77,20 +102,20 @@ 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){
$faces = array(
if($down->isTransparent() === false){
$faces = [
0 => 3,
1 => 4,
2 => 2,
3 => 5,
);
];
$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, false, true);
$this->getLevel()->setBlock($next, Block::get($this->id, $meta | 0x08), true, false, true);
$this->getLevel()->setBlock($block, Block::get($this->id, $meta), true, true);
$this->getLevel()->setBlock($next, Block::get($this->id, $meta | 0x08), true, true);
return true;
}
@ -106,35 +131,35 @@ 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
$this->getLevel()->setBlock($blockNorth, new Air(), true, false, true);
}elseif($blockSouth->getID() === $this->id and $blockSouth->meta !== 0x08){
$this->getLevel()->setBlock($blockSouth, new Air(), true, false, true);
}elseif($blockEast->getID() === $this->id and $blockEast->meta !== 0x08){
$this->getLevel()->setBlock($blockEast, new Air(), true, false, true);
}elseif($blockWest->getID() === $this->id and $blockWest->meta !== 0x08){
$this->getLevel()->setBlock($blockWest, new Air(), true, false, true);
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){
$this->getLevel()->setBlock($blockSouth, new Air(), true, true);
}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){
$this->getLevel()->setBlock($blockWest, new Air(), true, true);
}
}else{ //Bottom Part of Bed
if($blockNorth->getID() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockNorth, new Air(), true, false, true);
}elseif($blockSouth->getID() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockSouth, new Air(), true, false, true);
}elseif($blockEast->getID() === $this->id and ($blockEast->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockEast, new Air(), true, false, true);
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
$this->getLevel()->setBlock($blockWest, new Air(), true, false, true);
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){
$this->getLevel()->setBlock($blockSouth, new Air(), true, true);
}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){
$this->getLevel()->setBlock($blockWest, new Air(), true, true);
}
}
$this->getLevel()->setBlock($this, new Air(), true, false, true);
$this->getLevel()->setBlock($this, new Air(), true, true);
return true;
}
public function getDrops(Item $item){
return array(
array(Item::BED, 0, 1),
);
return [
[Item::BED, 0, 1],
];
}
}

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

@ -22,70 +22,26 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
class Beetroot extends Flowable{
class Beetroot extends Crops{
protected $id = self::BEETROOT_BLOCK;
public function __construct($meta = 0){
parent::__construct(self::BEETROOT_BLOCK, $meta, "Beetroot Block");
$this->isActivable = true;
$this->hardness = 0;
$this->meta = $meta;
}
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){
$this->getLevel()->setBlock($block, $this, true, false, true);
return true;
}
return false;
}
public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
$this->meta = 0x07;
$this->getLevel()->setBlock($this, $this, true, false, true);
$item->count--;
return true;
}
return false;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //TODO: Replace with common break method
$this->getLevel()->dropItem($this, Item::get(Item::BEETROOT_SEEDS, 0, 1));
$this->getLevel()->setBlock($this, new Air(), false, false, true);
return Level::BLOCK_UPDATE_NORMAL;
}
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if(mt_rand(0, 2) == 1){
if($this->meta < 0x07){
++$this->meta;
$this->getLevel()->setBlock($this, $this, true, false, true);
return Level::BLOCK_UPDATE_RANDOM;
}
}else{
return Level::BLOCK_UPDATE_RANDOM;
}
}
return false;
public function getName(){
return "Beetroot Block";
}
public function getDrops(Item $item){
$drops = [];
if($this->meta >= 0x07){
$drops[] = array(Item::BEETROOT, 0, 1);
$drops[] = array(Item::BEETROOT_SEEDS, 0, mt_rand(0, 3));
$drops[] = [Item::BEETROOT, 0, 1];
$drops[] = [Item::BEETROOT_SEEDS, 0, mt_rand(0, 3)];
}else{
$drops[] = array(Item::BEETROOT_SEEDS, 0, 1);
$drops[] = [Item::BEETROOT_SEEDS, 0, 1];
}
return $drops;

View File

@ -22,15 +22,35 @@
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){
return array(
array($this->id, 0, 1),
);
return [
[$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,35 +22,37 @@
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){
return array(
array(Item::BRICKS_BLOCK, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::BRICKS_BLOCK, 0, 1],
];
}else{
return [];
}

View File

@ -26,16 +26,25 @@ 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){ //Replace with common break method
$this->getLevel()->dropItem($this, Item::get($this->id));
$this->getLevel()->setBlock($this, new Air(), false, false, true);
if($this->getSide(0)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}
@ -46,12 +55,17 @@ 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){
$this->getLevel()->setBlock($block, $this, true, false, true);
if($down->isTransparent() === false){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
return false;
}
public function getBoundingBox(){
return null;
}
}

View File

@ -22,46 +22,79 @@
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){
$faces = array(
$faces = [
0 => 4,
1 => 2,
2 => 5,
3 => 3,
);
];
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
$this->getLevel()->setBlock($block, $this, true, false, true);
$nbt = new Compound(false, array(
new Enum("Items", []),
new String("id", Tile::FURNACE),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
));
$this->getLevel()->setBlock($block, $this, true, true);
$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);
new Furnace($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt);
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;
}
public function onBreak(Item $item){
$this->getLevel()->setBlock($this, new Air(), true, true, true);
$this->getLevel()->setBlock($this, new Air(), true, true);
return true;
}
@ -73,18 +106,24 @@ class BurningFurnace extends Solid{
if($t instanceof Furnace){
$furnace = $t;
}else{
$nbt = new Compound(false, array(
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 = new Furnace($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt);
$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,36 +133,10 @@ 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){
$drops[] = array(Item::FURNACE, 0, 1);
}
$t = $this->getLevel()->getTile($this);
if($t instanceof Furnace){
for($s = 0; $s < $t->getInventory()->getSize(); ++$s){
$slot = $t->getInventory()->getItem($s);
if($slot->getID() > Item::AIR and $slot->getCount() > 0){
$drops[] = array($slot->getID(), $slot->getDamage(), $slot->getCount());
}
}
if($item->isPickaxe() >= Tool::TIER_WOODEN){
$drops[] = [Item::FURNACE, 0, 1];
}
return $drops;

View File

@ -21,45 +21,85 @@
namespace pocketmine\block;
use pocketmine\entity\Entity;
use pocketmine\event\block\BlockGrowEvent;
use pocketmine\event\entity\EntityDamageByBlockEvent;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\Vector3 as Vector3;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\Player;
use pocketmine\Server;
class Cactus extends Transparent{
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 + 0.0625,
$this->z + 0.0625,
$this->x + 0.9375,
$this->y + 0.9375,
$this->z + 0.9375
);
}
public function onEntityCollide(Entity $entity){
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_CONTACT, 1);
$entity->attack($ev->getFinalDamage(), $ev);
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0);
if($down->getID() !== self::SAND and $down->getID() !== self::CACTUS){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), false);
$this->getLevel()->dropItem($this, Item::get($this->id));
return Level::BLOCK_UPDATE_NORMAL;
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->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){
$this->getLevel()->setBlock($b, new Cactus(), true, false, true);
break;
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);
}
}
}
$this->meta = 0;
$this->getLevel()->setBlock($this, $this, false);
$this->getLevel()->setBlock($this, $this);
}else{
++$this->meta;
$this->getLevel()->setBlock($this, $this, false);
$this->getLevel()->setBlock($this, $this);
}
return Level::BLOCK_UPDATE_RANDOM;
}
}
@ -68,13 +108,13 @@ 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){
$this->getLevel()->setBlock($this, $this, true, false, 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;
}
@ -84,8 +124,8 @@ class Cactus extends Transparent{
}
public function getDrops(Item $item){
return array(
array($this->id, 0, 1),
);
return [
[$this->id, 0, 1],
];
}
}

View File

@ -21,23 +21,52 @@
namespace pocketmine\block;
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;
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(){
$f = (1 + $this->getDamage() * 2) / 16;
return new AxisAlignedBB(
$this->x + $f,
$this->y,
$this->z + 0.0625,
$this->x + 1 - 0.0625,
$this->y + 0.5,
$this->z + 1 - 0.0625
);
}
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){
$this->getLevel()->setBlock($block, $this, true, false, true);
if($down->getId() !== self::AIR){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
@ -47,8 +76,8 @@ 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
$this->getLevel()->setBlock($this, new Air(), true, false, true);
if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), true);
return Level::BLOCK_UPDATE_NORMAL;
}
@ -62,19 +91,39 @@ class Cake extends Transparent{
}
public function onActivate(Item $item, Player $player = null){
if($player instanceof Player and $player->getHealth() < 20){
++$this->meta;
$player->heal(3, "cake");
if($this->meta >= 0x06){
$this->getLevel()->setBlock($this, new Air(), true, false, true);
}else{
$this->getLevel()->setBlock($this, $this, true, false, 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

@ -23,12 +23,27 @@ namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
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 = array(
$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",
@ -45,17 +60,26 @@ class Carpet extends Flowable{
13 => "Green Carpet",
14 => "Red Carpet",
15 => "Black Carpet",
];
return $names[$this->meta & 0x0f];
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 0.0625,
$this->z + 1
);
$this->name = $names[$this->meta];
$this->hardness = 0;
$this->isFullBlock = false;
$this->isSolid = 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::AIR){
$this->getLevel()->setBlock($block, $this, true, false, true);
if($down->getId() !== self::AIR){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
@ -65,9 +89,8 @@ class Carpet extends Flowable{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ //TODO: Replace with common break method
$this->getLevel()->dropItem($this, Item::get($this->id, $this->meta, 1));
$this->getLevel()->setBlock($this, new Air(), true, false, true);
if($this->getSide(0)->getId() === self::AIR){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@ -22,70 +22,25 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
class Carrot extends Flowable{
class Carrot extends Crops{
protected $id = self::CARROT_BLOCK;
public function __construct($meta = 0){
parent::__construct(self::CARROT_BLOCK, $meta, "Carrot Block");
$this->isActivable = true;
$this->hardness = 0;
$this->meta = $meta;
}
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){
$this->getLevel()->setBlock($block, $this, true, false, true);
return true;
}
return false;
}
public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
$this->meta = 0x07;
$this->getLevel()->setBlock($this, $this, true, false, true);
$item->count--;
return true;
}
return false;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
//TODO
//Server::getInstance()->api->entity->drop($this, Item::get(CARROT, 0, 1));
$this->getLevel()->setBlock($this, new Air(), false, false, true);
return Level::BLOCK_UPDATE_NORMAL;
}
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if(mt_rand(0, 2) == 1){
if($this->meta < 0x07){
++$this->meta;
$this->getLevel()->setBlock($this, $this, true, false, true);
return Level::BLOCK_UPDATE_RANDOM;
}
}else{
return Level::BLOCK_UPDATE_RANDOM;
}
}
return false;
public function getName(){
return "Carrot Block";
}
public function getDrops(Item $item){
$drops = [];
if($this->meta >= 0x07){
$drops[] = array(Item::CARROT, 0, mt_rand(1, 4));
$drops[] = [Item::CARROT, 0, mt_rand(1, 4)];
}else{
$drops[] = array(Item::CARROT, 0, 1);
$drops[] = [Item::CARROT, 0, 1];
}
return $drops;

View File

@ -22,34 +22,61 @@
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,
$this->z + 0.0625,
$this->x + 0.9375,
$this->y + 0.9475,
$this->z + 0.9375
);
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$faces = array(
$faces = [
0 => 4,
1 => 2,
2 => 5,
3 => 3,
);
];
$chest = false;
$chest = null;
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
for($side = 2; $side <= 5; ++$side){
@ -68,18 +95,29 @@ class Chest extends Transparent{
}
}
$this->getLevel()->setBlock($block, $this, true, false, true);
$nbt = new Compound(false, array(
new Enum("Items", []),
new String("id", Tile::CHEST),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
));
$this->getLevel()->setBlock($block, $this, true, true);
$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);
$tile = new TileChest($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt);
if($chest instanceof TileChest){
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){
$chest->pairWith($tile);
$tile->pairWith($chest);
}
@ -92,7 +130,7 @@ class Chest extends Transparent{
if($t instanceof TileChest){
$t->unpair();
}
$this->getLevel()->setBlock($this, new Air(), true, true, true);
$this->getLevel()->setBlock($this, new Air(), true, true);
return true;
}
@ -100,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;
}
@ -109,19 +147,24 @@ class Chest extends Transparent{
if($t instanceof TileChest){
$chest = $t;
}else{
$nbt = new Compound(false, array(
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 = new TileChest($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt);
$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->gamemode & 0x01) === 0x01){
if($player->isCreative()){
return true;
}
$player->addWindow($chest->getInventory());
@ -131,19 +174,8 @@ class Chest extends Transparent{
}
public function getDrops(Item $item){
$drops = array(
array($this->id, 0, 1),
);
$t = $this->getLevel()->getTile($this);
if($t instanceof TileChest){
for($s = 0; $s < $t->getRealInventory()->getSize(); ++$s){
$slot = $t->getRealInventory()->getItem($s);
if($slot->getID() > Item::AIR and $slot->getCount() > 0){
$drops[] = array($slot->getID(), $slot->getDamage(), $slot->getCount());
}
}
}
return $drops;
return [
[$this->id, 0, 1],
];
}
}

View File

@ -22,16 +22,31 @@
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){
return array(
array(Item::CLAY, 0, 4),
);
return [
[Item::CLAY, 0, 4],
];
}
}

View File

@ -22,35 +22,33 @@
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){
return array(
array(Item::COAL_BLOCK, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::COAL_BLOCK, 0, 1],
];
}else{
return [];
}

View File

@ -22,35 +22,33 @@
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){
return array(
array(Item::COAL, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::COAL, 0, 1],
];
}else{
return [];
}

View File

@ -22,35 +22,33 @@
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){
return array(
array(Item::COBBLESTONE, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::COBBLESTONE, 0, 1],
];
}else{
return [];
}

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

@ -21,17 +21,40 @@
namespace pocketmine\block;
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class Cobweb extends Flowable{
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->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

@ -0,0 +1,96 @@
<?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\event\block\BlockGrowEvent;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
use pocketmine\Server;
abstract class Crops extends Flowable{
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){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
return false;
}
public function onActivate(Item $item, Player $player = null){
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
$block = clone $this;
$block->meta += mt_rand(2, 5);
if($block->meta > 7){
$block->meta = 7;
}
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($this, $ev->getNewState(), true, true);
}
$item->count--;
return true;
}
return false;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if(mt_rand(0, 2) == 1){
if($this->meta < 0x07){
$block = clone $this;
++$block->meta;
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($this, $ev->getNewState(), true, true);
}else{
return Level::BLOCK_UPDATE_RANDOM;
}
}
}else{
return Level::BLOCK_UPDATE_RANDOM;
}
}
return false;
}
}

View File

@ -26,15 +26,22 @@ 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 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){
$this->getLevel()->setBlock($block, $this, true, false, true);
if($down->getId() === 2 or $down->getId() === 3 or $down->getId() === 60){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
@ -44,10 +51,8 @@ class Dandelion extends Flowable{
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
//TODO
//Server::getInstance()->api->entity->drop($this, Item::get($this->id));
$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

@ -22,15 +22,27 @@
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){
return array(
array($this->id, 0, 1),
);
return [
[$this->id, 0, 1],
];
}
}

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,16 +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 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,29 +22,33 @@
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){
return array(
array(Item::DIAMOND_BLOCK, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::DIAMOND_BLOCK, 0, 1],
];
}else{
return [];
}

View File

@ -22,29 +22,33 @@
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){
return array(
array(Item::DIAMOND, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::DIAMOND, 0, 1],
];
}else{
return [];
}

View File

@ -22,19 +22,37 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\Player;
class Dirt extends Solid{
protected $id = self::DIRT;
public function __construct(){
parent::__construct(self::DIRT, 0, "Dirt");
$this->isActivable = true;
$this->hardness = 2.5;
}
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);
$this->getLevel()->setBlock($this, Block::get(Item::FARMLAND, 0), true, false, true);
$this->getLevel()->setBlock($this, Block::get(Item::FARMLAND, 0), true);
return true;
}

View File

@ -23,20 +23,189 @@ namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\network\protocol\LevelEventPacket;
use pocketmine\level\sound\DoorSound;
use pocketmine\math\AxisAlignedBB;
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();
$isUp = ($damage & 0x08) > 0;
if($isUp){
$down = $this->getSide(Vector3::SIDE_DOWN)->getDamage();
$up = $damage;
}else{
$down = $damage;
$up = $this->getSide(Vector3::SIDE_UP)->getDamage();
}
$isRight = ($up & 0x01) > 0;
return $down & 0x07 | ($isUp ? 8 : 0) | ($isRight ? 0x10 : 0);
}
protected function recalculateBoundingBox(){
$f = 0.1875;
$damage = $this->getFullDamage();
$bb = new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 2,
$this->z + 1
);
$j = $damage & 0x03;
$isOpen = (($damage & 0x04) > 0);
$isRight = (($damage & 0x10) > 0);
if($j === 0){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + $f
);
}else{
$bb->setBounds(
$this->x,
$this->y,
$this->z + 1 - $f,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}
}else{
$bb->setBounds(
$this->x,
$this->y,
$this->z,
$this->x + $f,
$this->y + 1,
$this->z + 1
);
}
}elseif($j === 1){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x + 1 - $f,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}else{
$bb->setBounds(
$this->x,
$this->y,
$this->z,
$this->x + $f,
$this->y + 1,
$this->z + 1
);
}
}else{
$bb->setBounds(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + $f
);
}
}elseif($j === 2){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
$this->z + 1 - $f,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}else{
$bb->setBounds(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + $f
);
}
}else{
$bb->setBounds(
$this->x + 1 - $f,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}
}elseif($j === 3){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
$this->z,
$this->x + $f,
$this->y + 1,
$this->z + 1
);
}else{
$bb->setBounds(
$this->x + 1 - $f,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}
}else{
$bb->setBounds(
$this->x,
$this->y,
$this->z + 1 - $f,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}
}
return $bb;
}
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);
@ -53,26 +222,26 @@ 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;
$face = array(
$face = [
0 => 3,
1 => 4,
2 => 2,
3 => 5,
);
];
$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->getLevel()->setBlock($blockUp, Block::get($this->id, $metaUp), true, false, true); //Top
$this->meta = $player->getDirection() & 0x03;
$this->getLevel()->setBlock($block, $this, true, false, true); //Bottom
$this->setDamage($player->getDirection() & 0x03);
$this->getLevel()->setBlock($block, $this, true, true); //Bottom
$this->getLevel()->setBlock($blockUp, $b = Block::get($this->getId(), $metaUp), true); //Top
return true;
}
@ -80,58 +249,46 @@ 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){
$this->getLevel()->setBlock($down, new Air(), true, false, true);
if($down->getId() === $this->getId()){
$this->getLevel()->setBlock($down, new Air(), true);
}
}else{
$up = $this->getSide(1);
if($up->getID() === $this->id){
$this->getLevel()->setBlock($up, new Air(), true, false, true);
if($up->getId() === $this->getId()){
$this->getLevel()->setBlock($up, new Air(), true);
}
}
$this->getLevel()->setBlock($this, new Air(), true, false, true);
$this->getLevel()->setBlock($this, new Air(), true);
return true;
}
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, false, 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;
}
return false;
}else{
$this->meta ^= 0x04;
$this->getLevel()->setBlock($this, $this, true, false, true);
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
$this->getLevel()->setBlock($this, $this, 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;

View File

@ -23,29 +23,35 @@ 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 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, false, true);
return true;
}
return false;
public function canBeReplaced(){
return true;
}
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){ //TODO: Replace with common break method
$this->getLevel()->dropItem($this, Item::get($this->id, 0, 1));
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;
@ -54,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 = array(
$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,33 +49,16 @@ class DoubleSlab extends Solid{
4 => "Brick",
5 => "Stone Brick",
6 => "Quartz",
);
$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;
}
7 => "Nether Brick",
];
return "DoubleTag " . $names[$this->meta & 0x07] . " Slab";
}
public function getDrops(Item $item){
if($item->isPickaxe() >= 1){
return array(
array(Item::SLAB, $this->meta & 0x07, 2),
);
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::SLAB, $this->meta & 0x07, 2],
];
}else{
return [];
}

View File

@ -22,43 +22,42 @@
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 = array(
$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",
);
$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;
}
6 => "",
7 => ""
];
return "DoubleTag " . $names[$this->meta & 0x07] . " Wooden Slab";
}
public function getDrops(Item $item){
return array(
array(Item::WOOD_SLAB, $this->meta & 0x07, 2),
);
return [
[Item::WOOD_SLAB, $this->meta & 0x07, 2],
];
}
}

View File

@ -22,29 +22,33 @@
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){
return array(
array(Item::EMERALD_BLOCK, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::EMERALD_BLOCK, 0, 1],
];
}else{
return [];
}

View File

@ -22,29 +22,33 @@
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){
return array(
array(Item::EMERALD, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::EMERALD, 0, 1],
];
}else{
return [];
}

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

@ -0,0 +1,66 @@
<?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\math\AxisAlignedBB;
class EndPortalFrame extends Solid{
protected $id = self::END_PORTAL_FRAME;
public function __construct($meta = 0){
$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(){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + (($this->getDamage() & 0x04) > 0 ? 1 : 0.8125),
$this->z + 1
);
}
}

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

@ -21,19 +21,51 @@
namespace pocketmine\block;
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\level\Level;
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;
class Fallable extends Solid{
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
$this->hasPhysics = true;
}
abstract class Fallable extends Solid{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$ret = $this->getLevel()->setBlock($this, $this, true, false, true);
$ret = $this->getLevel()->setBlock($this, $this, true, true);
return $ret;
}
public function onUpdate($type){
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 ListTag("Motion", [
new DoubleTag("", 0),
new DoubleTag("", 0),
new DoubleTag("", 0)
]),
"Rotation" => new ListTag("Rotation", [
new FloatTag("", 0),
new FloatTag("", 0)
]),
"TileID" => new IntTag("TileID", $this->getId()),
"Data" => new ByteTag("Data", $this->getDamage()),
]));
$fall->spawnToAll();
}
}
}
}

View File

@ -22,16 +22,43 @@
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,
$this->z,
$this->x + 1,
$this->y + 0.9375,
$this->z + 1
);
}
public function getDrops(Item $item){
return array(
array(Item::DIRT, 0, 1),
);
return [
[Item::DIRT, 0, 1],
];
}
}

View File

@ -21,12 +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, "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(){
$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));
$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 + $w,
$this->y,
$this->z + $n,
$this->x + $e,
$this->y + 1.5,
$this->z + $s
);
}
public function canConnect(Block $block){
return ($block instanceof Fence or $block instanceof FenceGate) ? true : $block->isSolid() and !$block->isTransparent();
}
}

View File

@ -22,54 +22,93 @@
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, "Fence Gate");
$this->isActivable = true;
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
$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;
}
protected function recalculateBoundingBox(){
if(($this->getDamage() & 0x04) > 0){
return null;
}
$i = ($this->getDamage() & 0x03);
if($i === 2 and $i === 0){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z + 0.375,
$this->x + 1,
$this->y + 1.5,
$this->z + 0.625
);
}else{
return new AxisAlignedBB(
$this->x + 0.375,
$this->y,
$this->z,
$this->x + 0.625,
$this->y + 1.5,
$this->z + 1
);
}
$this->hardness = 15;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$faces = array(
$faces = [
0 => 3,
1 => 0,
2 => 1,
3 => 2,
);
];
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03;
$this->getLevel()->setBlock($block, $this, true, false, true);
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
public function getDrops(Item $item){
return array(
array($this->id, 0, 1),
);
return [
[$this->id, 0, 1],
];
}
public function onActivate(Item $item, Player $player = null){
$faces = array(
$faces = [
0 => 3,
1 => 0,
2 => 1,
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, false, true);
$this->getLevel()->setBlock($this, $this, true);
$this->level->addSound(new DoorSound($this));
return true;
}
}
}

View File

@ -22,10 +22,11 @@
namespace pocketmine\block;
class NetherReactor extends Solid{
public function __construct($meta = 0){
parent::__construct(self::NETHER_REACTOR, $meta, "Nether Reactor");
$this->isActivable = true;
}
class FenceGateAcacia extends FenceGate{
protected $id = self::FENCE_GATE_ACACIA;
public function getName(){
return "Acacia Fence Gate";
}
}

View File

@ -0,0 +1,32 @@
<?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 FenceGateBirch extends FenceGate{
protected $id = self::FENCE_GATE_BIRCH;
public function getName(){
return "Birch Fence Gate";
}
}

View File

@ -0,0 +1,32 @@
<?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 FenceGateDarkOak extends FenceGate{
protected $id = self::FENCE_GATE_DARK_OAK;
public function getName(){
return "Dark Oak Fence Gate";
}
}

View File

@ -0,0 +1,32 @@
<?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 FenceGateJungle extends FenceGate{
protected $id = self::FENCE_GATE_JUNGLE;
public function getName(){
return "Jungle Fence Gate";
}
}

View File

@ -0,0 +1,32 @@
<?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 FenceGateSpruce extends FenceGate{
protected $id = self::FENCE_GATE_SPRUCE;
public function getName(){
return "Spruce Fence Gate";
}
}

View File

@ -21,16 +21,58 @@
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;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Server;
class Fire extends Flowable{
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 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){
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());
}
}
public function getDrops(Item $item){
@ -41,18 +83,25 @@ 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;
}
}
$this->getLevel()->setBlock($this, new Air(), true, false, true);
$this->getLevel()->setBlock($this, new Air(), true);
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, false, 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,11 +22,27 @@
namespace pocketmine\block;
class Flowable extends Transparent{
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
$this->isFlowable = true;
$this->isFullBlock = false;
$this->isSolid = false;
abstract class Flowable extends Transparent{
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

@ -23,9 +23,16 @@ namespace pocketmine\block;
use pocketmine\item\Item;
class EndPortal extends Solid{
class FlowerPot extends Transparent{
protected $id = self::FLOWER_POT_BLOCK;
public function __construct($meta = 0){
parent::__construct(self::END_PORTAL, $meta, "End Portal");
$this->hardness = 18000000;
$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

@ -1,77 +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;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
class Generic extends Block{
/**
* @param int $id
* @param int $meta
* @param string $name
*/
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
return $this->getLevel()->setBlock($this, $this, true, false, true);
}
public function isBreakable(Item $item){
return $this->breakable;
}
public function onBreak(Item $item){
return $this->getLevel()->setBlock($this, new Air(), true, false, true);
}
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)){
$data = array(
"x" => $this->x + 0.5,
"y" => $this->y + 0.5,
"z" => $this->z + 0.5,
"Tile" => $this->id,
);
/*$this->getLevel()->setBlock($this, new Air(), false, false, true);
//TODO
//$e = $server->api->entity->add($this->getLevel(), ENTITY_FALLING, FALLING_SAND, $data);
//$e->spawnToAll();
$server->api->block->blockUpdateAround(clone $this, Level::BLOCK_UPDATE_NORMAL, 1);*/
}
return false;
}
return false;
}
public function onActivate(Item $item, Player $player = null){
return $this->isActivable;
}
}

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,11 +22,25 @@
namespace pocketmine\block;
class GlassPane extends Transparent{
use pocketmine\item\Item;
class GlassPane extends Thin{
protected $id = self::GLASS_PANE;
public function __construct(){
parent::__construct(self::GLASS_PANE, 0, "Glass Pane");
$this->isFullBlock = false;
$this->isSolid = false;
}
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 array(
array(Item::REDSTONE_DUST, 0, mt_rand(4, 5)),
);
}else{
return [];
}
}
}

View File

@ -22,16 +22,35 @@
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){
return array(
array(Item::GLOWSTONE_DUST, 0, mt_rand(2, 4)),
);
return [
[Item::GLOWSTONE_DUST, 0, mt_rand(2, 4)],
];
}
}

View File

@ -22,29 +22,33 @@
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){
return array(
array(Item::GOLD_BLOCK, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::GOLD_BLOCK, 0, 1],
];
}else{
return [];
}

View File

@ -22,29 +22,33 @@
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){
return array(
array(Item::GOLD_ORE, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_IRON){
return [
[Item::GOLD_ORE, 0, 1],
];
}else{
return [];
}

View File

@ -21,18 +21,38 @@
namespace pocketmine\block;
use pocketmine\event\block\BlockSpreadEvent;
use pocketmine\item\Item;
use pocketmine\level\generator\object\TallGrass;
use pocketmine\item\Tool;
use pocketmine\level\generator\object\TallGrass as TallGrassObject;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\Player;
use pocketmine\Server;
use pocketmine\utils\Random;
class Grass extends Solid{
protected $id = self::GRASS;
public function __construct(){
parent::__construct(self::GRASS, 0, "Grass");
$this->isActivable = true;
$this->hardness = 3;
}
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){
@ -43,33 +63,44 @@ 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()->getBlockIdAt($x, $y, $z);
if($block === Block::DIRT){
$block = $this->getLevel()->getBlock(new Vector3($x, $y, $z));
if($block->getSide(1) instanceof Transparent){
$this->getLevel()->setBlock($block, new Grass());
$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());
}
}
}
}
}
}
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--;
TallGrass::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2);
TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2);
return true;
}elseif($item->isHoe()){
$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,23 +22,38 @@
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){
if(mt_rand(1, 10) === 1){
return array(
array(Item::FLINT, 0, 1),
);
return [
[Item::FLINT, 0, 1],
];
}
return array(
array(Item::GRAVEL, 0, 1),
);
return [
[Item::GRAVEL, 0, 1],
];
}
}

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,31 +25,41 @@ 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){
$faces = array(
$faces = [
0 => 0,
1 => 0,
2 => 0b1000,
3 => 0b1000,
4 => 0b0100,
5 => 0b0100,
);
];
$this->meta = ($this->meta & 0x03) | $faces[$face];
$this->getLevel()->setBlock($block, $this, true, false, true);
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
public function getDrops(Item $item){
return array(
array($this->id, 0, 1),
);
return [
[$this->id, 0, 1],
];
}
}

View File

@ -22,36 +22,34 @@
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){
$this->getLevel()->setBlock($this, new Water(), true, false, true);
$this->getLevel()->setBlock($this, new Water(), true);
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,31 +22,33 @@
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){
return array(
array(Item::IRON_BLOCK, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_STONE){
return [
[Item::IRON_BLOCK, 0, 1],
];
}else{
return [];
}

View File

@ -21,12 +21,38 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class IronBars extends Thin{
protected $id = self::IRON_BARS;
class IronBars extends Transparent{
public function __construct(){
parent::__construct(self::IRON_BARS, 0, "Iron Bars");
$this->isFullBlock = false;
$this->isSolid = false;
}
}
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,36 +22,33 @@
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){
return array(
array(Item::IRON_DOOR, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[Item::IRON_DOOR, 0, 1],
];
}else{
return [];
}

View File

@ -22,31 +22,33 @@
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){
return array(
array(Item::IRON_ORE, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_STONE){
return [
[Item::IRON_ORE, 0, 1],
];
}else{
return [];
}

View File

@ -0,0 +1,41 @@
<?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\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,15 +22,27 @@
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){
return array(
array($this->id, 0, 1),
);
return [
[$this->id, 0, 1],
];
}
}

View File

@ -21,29 +21,99 @@
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{
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->resetFallDistance();
$entity->onGround = true;
}
protected function recalculateBoundingBox(){
$f = 0.125;
if($this->meta === 2){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z + 1 - $f,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}elseif($this->meta === 3){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + $f
);
}elseif($this->meta === 4){
return new AxisAlignedBB(
$this->x + 1 - $f,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}elseif($this->meta === 5){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + $f,
$this->y + 1,
$this->z + 1
);
}
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
if($target->isTransparent === false){
$faces = array(
if($target->isTransparent() === false){
$faces = [
2 => 2,
3 => 3,
4 => 4,
5 => 5,
);
];
if(isset($faces[$face])){
$this->meta = $faces[$face];
$this->getLevel()->setBlock($block, $this, true, false, true);
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
@ -54,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;
@ -64,9 +134,13 @@ class Ladder extends Transparent{
return false;
}
public function getToolType(){
return Tool::TYPE_AXE;
}
public function getDrops(Item $item){
return array(
array($this->id, 0, 1),
);
return [
[$this->id, 0, 1],
];
}
}

View File

@ -22,31 +22,33 @@
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){
return array(
array(Item::LAPIS_BLOCK, 0, 1),
);
if($item->isPickaxe() >= Tool::TIER_STONE){
return [
[Item::LAPIS_BLOCK, 0, 1],
];
}else{
return [];
}

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