mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
Compare commits
417 Commits
Author | SHA1 | Date | |
---|---|---|---|
0c91d568b4 | |||
35fabc7765 | |||
b5a98a993f | |||
0840ba8067 | |||
274cf58ccf | |||
1bce5d0bc2 | |||
0d5d5e21a8 | |||
a145e18c1e | |||
d1ca779c1a | |||
abbb8bbf55 | |||
86c7870427 | |||
48080b7f90 | |||
b216fb8910 | |||
d3171d6a8e | |||
c063a4da29 | |||
cc79dfa64c | |||
d6b9950901 | |||
1815fe5b46 | |||
3e993250d8 | |||
1163ac1d7a | |||
9a51ba697a | |||
32ad9d0c1a | |||
3d840e969d | |||
d1b70bd400 | |||
29f002b32c | |||
da17ade575 | |||
f0c36f3413 | |||
77d8f133f1 | |||
43ebb23085 | |||
e198c8fa8b | |||
cc3285c8fe | |||
305c63ba4d | |||
acaa0e33b0 | |||
f63857deed | |||
eda3d9b5e4 | |||
c3872619cd | |||
39cc590829 | |||
f347345bb3 | |||
bb05cfb36c | |||
7d5c3c9b46 | |||
cff2d37add | |||
447477c5fb | |||
abdbb2bf0e | |||
783c13926f | |||
45329ddf67 | |||
20af789963 | |||
93cb9390e0 | |||
0aed7f86f5 | |||
bf44bd016d | |||
04e4a36653 | |||
7439e1971d | |||
b961b4e003 | |||
d9eac8fc0a | |||
aeeee5eb53 | |||
13994055d9 | |||
247875e3d5 | |||
ee60a7bc36 | |||
348c2a599b | |||
562b47a1e5 | |||
4e060bc13f | |||
2807f14fcd | |||
f0539f4898 | |||
63d7e7b811 | |||
4da06078ed | |||
8a6381c3fa | |||
d0d61597c7 | |||
7a2a4e2aa3 | |||
e41a2c0792 | |||
11a6e04a28 | |||
70b1ac856d | |||
d724374d1a | |||
a19143cae7 | |||
1be6783c34 | |||
092edc9d43 | |||
2ba8eac27f | |||
25ff90b2c6 | |||
b912ae78bc | |||
677d43028a | |||
7bfb55ec9a | |||
2f61d42518 | |||
dbb669b156 | |||
4d0e8741fe | |||
53dc6e2050 | |||
807b860cfe | |||
d756500928 | |||
7ef27a1a21 | |||
6b4d8b91c6 | |||
8f5eb7ef37 | |||
0ea9a08963 | |||
18a1bfe4dd | |||
2d3562c687 | |||
cb40484a2e | |||
e75a08a5a3 | |||
95dfff727e | |||
d55889d85f | |||
99f65f19ac | |||
581eeee01d | |||
17341d7406 | |||
04c0cd142d | |||
7a747d6f93 | |||
e93d034a4e | |||
5a08a10448 | |||
622f93df45 | |||
b788982d60 | |||
26faf4a952 | |||
670bf2b9d1 | |||
f5491346ce | |||
73d3f9f7f7 | |||
d874be99a6 | |||
1767cbe80d | |||
64fbf5025a | |||
aaa01bb6f8 | |||
50d71809e1 | |||
6839712394 | |||
9b5ae7ec75 | |||
94eb64c2be | |||
3fae57508b | |||
a883c35fd0 | |||
740398282f | |||
9d14bc54d6 | |||
bd69c66d03 | |||
c58a1bf9b7 | |||
59c310b914 | |||
790fcc4ebb | |||
5430f19e7a | |||
1cf4cf8614 | |||
55cccff850 | |||
03e70e68f4 | |||
7c52b4c93d | |||
3f31dbde57 | |||
1bfd6f2a90 | |||
c7a5b8b0b4 | |||
11fc16617a | |||
77a4393c7b | |||
f714ed6e90 | |||
7fc45bc5c3 | |||
ab4b1be363 | |||
3c7f68dc1e | |||
15fa1056b7 | |||
feac2df088 | |||
4c2015fd0f | |||
16482e6a95 | |||
ae9115ad0d | |||
6b090d653c | |||
012f015e7d | |||
6925451f3f | |||
46054803d5 | |||
a9f99240b5 | |||
a16b44ea12 | |||
cd48d8272c | |||
6d09460abc | |||
0ca07ad075 | |||
60b183b0d9 | |||
dbf4054b1f | |||
82e4ef6d48 | |||
d0d300a6f8 | |||
6161155660 | |||
2a5561fcd1 | |||
5d531b56db | |||
3568c7b1c7 | |||
862c844759 | |||
42954c1d72 | |||
4c5f6eb1b7 | |||
02bc43b440 | |||
5832f42783 | |||
7c1f038f20 | |||
a42f68d3cf | |||
b6f3f6120b | |||
96d3f4f78b | |||
6756203aec | |||
adb78679c5 | |||
b60731607d | |||
0058bfcd23 | |||
9f31b479e1 | |||
eb161f8e1c | |||
80f8a27094 | |||
341c480e13 | |||
971ad04299 | |||
025b72e2f2 | |||
cf538afb84 | |||
7ff91337ad | |||
63e5867727 | |||
c38779f1fd | |||
14bae72dd5 | |||
f35b43613d | |||
3d0fa10437 | |||
76e5ea385b | |||
5a351d3caf | |||
bb93d4f8de | |||
66818e178a | |||
f782a478c4 | |||
c06b4830d1 | |||
6d64ef8d74 | |||
c5498bb3fa | |||
59334d652f | |||
5c81da9b1e | |||
b08affc4c6 | |||
cb49f1e835 | |||
f6a0f4aa82 | |||
de09c8c082 | |||
0ac87989dc | |||
13ea984b12 | |||
3878f58847 | |||
d7a35a5302 | |||
d850a84d0d | |||
22d9260a3b | |||
3c90ed13b9 | |||
396efbac7e | |||
00644dd529 | |||
c2c210e25a | |||
86c4e936cb | |||
3b103dcd62 | |||
48dfc5b232 | |||
39360f127a | |||
25890e76e2 | |||
810bdeb965 | |||
b6b3dcc1aa | |||
e0818e7e52 | |||
d0c4463773 | |||
7521160f53 | |||
4f5190e3f8 | |||
3c941dd992 | |||
89f457b397 | |||
2bdbb9794c | |||
898009a91b | |||
793f93afdb | |||
64506ea3ae | |||
4a35516441 | |||
74b9922a28 | |||
088fbf65b1 | |||
fa70127241 | |||
fc76d04dcb | |||
15ae323bcb | |||
353bae87a7 | |||
dc7be3fd52 | |||
f28a0740a0 | |||
df990fb47a | |||
98ca28d96e | |||
db896b9faf | |||
76c234e4e6 | |||
2ef3962028 | |||
1e5941c98c | |||
9ca7c0c883 | |||
b4a8f8391b | |||
142d750b9f | |||
948b0b4cbc | |||
d6b596a8ac | |||
eab2d4d704 | |||
8114551600 | |||
8e1d1993c5 | |||
82bf5f6193 | |||
76a86e51f7 | |||
d1e803685a | |||
0a884aa5fb | |||
c410e676b3 | |||
8f1f5fde47 | |||
0f268df2e0 | |||
86108e7010 | |||
5ea448ef36 | |||
389e7767d1 | |||
4c268acc00 | |||
e34a4f6b98 | |||
3925e598d6 | |||
383ec8a8e3 | |||
95313e0a90 | |||
e9a87978a6 | |||
612e9e162c | |||
fdc3faadc9 | |||
9644e72acf | |||
2c678dcf0d | |||
7bd9a2b2e0 | |||
5c26deb517 | |||
8fcb44de7d | |||
bd2e7db3b9 | |||
f4480c07ee | |||
c09e2301c8 | |||
8e9f787d33 | |||
89833b3b68 | |||
a10a656a5d | |||
2659ed8d91 | |||
9c01ecbe7e | |||
6a55021779 | |||
6ada261b04 | |||
14a6779e08 | |||
cce99b07af | |||
c3d80d711d | |||
1a8b33dafe | |||
baa094a2d1 | |||
f2ff510597 | |||
562179bdd6 | |||
5c12bee874 | |||
99606bbe23 | |||
a1d50de12e | |||
4252c5914b | |||
0659d2fbef | |||
10612acace | |||
1d810f8aeb | |||
414104851a | |||
c0bed03a2a | |||
d25c84acff | |||
55994e08db | |||
6f5d4d6b80 | |||
df1ef7fe0c | |||
20a25a69df | |||
faca610594 | |||
91603dc2d6 | |||
af90e18b18 | |||
ab5b4d112b | |||
a30b1fb6d5 | |||
20b4723728 | |||
d1ced0ffc6 | |||
2164dbae67 | |||
6c92a2e88b | |||
97deadc59f | |||
0c3b136a8d | |||
79b7e08e60 | |||
2540dacdd7 | |||
f1078e3909 | |||
2f43b054de | |||
23b5d64535 | |||
9afa0e5483 | |||
4eaea54b0e | |||
6b51bf4a80 | |||
cba8d86c4f | |||
2e834c8f5c | |||
f9873e9108 | |||
074baf7e1c | |||
2e0dd574e0 | |||
e16d8e31af | |||
3c93a57397 | |||
e2e927b328 | |||
a8dab25201 | |||
3de2b7969e | |||
8f486ea65d | |||
6b971b1761 | |||
6f36fa504b | |||
8e73842a93 | |||
e71e18fc88 | |||
e1bacb5c6d | |||
44697e784a | |||
65529ff2ce | |||
c346c45d42 | |||
c433fad0a7 | |||
8fad5a6e30 | |||
7a6f279825 | |||
10b72c895d | |||
d520928888 | |||
27767e7ddb | |||
243c12de7c | |||
372545e47e | |||
8913b48700 | |||
6ee4a0e090 | |||
8bd8da4bc6 | |||
9ba4144a71 | |||
9da7c6af27 | |||
109312284c | |||
51934614bc | |||
9e89f65094 | |||
9562711b84 | |||
30b49e0d22 | |||
a975868fc3 | |||
b38b932845 | |||
43cb19ebca | |||
769cc91543 | |||
278f37d3e0 | |||
02a6ca84a9 | |||
b8703d5dff | |||
37c2d78731 | |||
b7663e5815 | |||
1d0ffa06f8 | |||
768cfe3953 | |||
2822465f33 | |||
5da48f429f | |||
dbd0d04549 | |||
0f92ec6d2a | |||
791b4d8ef3 | |||
0b7ff6f2e7 | |||
af092b01e1 | |||
d811217755 | |||
d7f86f0240 | |||
5fe1d2e396 | |||
ddbb5363ef | |||
d3704bfae4 | |||
07f034d2da | |||
331ae5498f | |||
eebd90ec42 | |||
8e47a40b4c | |||
0f9fdf6442 | |||
5364e4de68 | |||
1099e2044b | |||
80d48161d3 | |||
fbe8485696 | |||
a150f39b02 | |||
71d17c50d6 | |||
3a18bdd6a0 | |||
96857c65b6 | |||
9826abd83e | |||
48c8c2a8c3 | |||
c83b7d9b69 | |||
c66dc7b273 | |||
5bf7350ee5 | |||
636cc1c199 | |||
62b6405371 | |||
9ecf23d3ee | |||
187f36fe38 | |||
dc89b48354 | |||
e6d1c1dfbc | |||
5a8812b1dc | |||
4b8e4123af | |||
45a4252c26 | |||
feaaa925a7 | |||
5221db1178 | |||
47321114eb | |||
a27c9409f1 | |||
854f851525 | |||
9003b38be3 | |||
a6a93f822f |
@ -4,3 +4,7 @@ root = yes
|
||||
[*]
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
|
||||
[*.yml]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
8
.github/FUNDING.yml
vendored
Normal file
8
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: pocketminemp
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
custom: https://github.com/pmmp/PocketMine-MP#donate
|
48
.github/ISSUE_TEMPLATE.md
vendored
48
.github/ISSUE_TEMPLATE.md
vendored
@ -1,48 +0,0 @@
|
||||
### Issue description
|
||||
<!---
|
||||
THIS ISSUE TRACKER IS FOR BUG REPORTING, NOT FOR HELP & SUPPORT. If you need help, use the links below.
|
||||
- http://pmmp.readthedocs.io/en/rtfd/ - Documentation
|
||||
- https://forums.pmmp.io - PMMP Forums
|
||||
|
||||
Any issues requesting updates to new versions of MCPE will be treated as spam.
|
||||
Please do not create issues for missing/un-implemented gameplay features - they will be closed.
|
||||
-->
|
||||
|
||||
<!--- Write a short description about the issue -->
|
||||
|
||||
<!--- If you are reporting a regression or unexpected behaviour, please include the below information: -->
|
||||
- Expected result: What were you expecting to happen?
|
||||
- Actual result: What actually happened?
|
||||
|
||||
### 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
|
||||
|
||||
NOTE: LATEST is not a valid version. PocketMine-MP version should include Jenkins build number and/or git commit hash.
|
||||
|
||||
NO support whatsoever will be provided for third-party modified variants of PocketMine-MP. Issues relating to third-party modifications will be closed as spam.
|
||||
|
||||
Note that 32-bit platforms are no longer supported by PocketMine-MP and issues concerning 32-bit platforms will be closed.
|
||||
-->
|
||||
* PocketMine-MP: <!-- LATEST IS NOT A VALID VERSION -->
|
||||
* PHP:
|
||||
* Server OS:
|
||||
* Game version: PE/Win10 (delete as appropriate)
|
||||
|
||||
### Plugins
|
||||
- Test on a clean server without plugins: is the issue reproducible without any plugins loaded?
|
||||
|
||||
If the issue is **not** reproducible without plugins:
|
||||
- Have you asked for help on our forums before creating an issue?
|
||||
- Can you provide sample, *minimal* reproducing code for the issue? If so, paste it in the bottom section
|
||||
- Paste your list of plugins here (use the 'plugins' command in PocketMine-MP)
|
||||
|
||||
### Crashdump, backtrace or other files
|
||||
- Do not paste crashdumps into an issue - please use our Crash Archive at https://crash.pmmp.io for submitting crash reports to not spam the issue tracker. Add links to your reports in the Crash Archive here.
|
||||
- Please use gist or anything else to add other files and add links here
|
||||
|
||||
* ...
|
19
.github/ISSUE_TEMPLATE/api-change-request.md
vendored
Normal file
19
.github/ISSUE_TEMPLATE/api-change-request.md
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
name: API change request
|
||||
about: Suggest a change, addition or removal to the plugin API
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--- tell us what you want -->
|
||||
## Description
|
||||
|
||||
|
||||
<!--- explain why you want this and why it's a good idea -->
|
||||
## Justification
|
||||
|
||||
|
||||
<!--- (optional) describe alternative methods you've explored to achieve your goal -->
|
||||
## Alternative methods
|
36
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
36
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Unexpected non-crash behaviour (except missing gameplay features)
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
### Issue description
|
||||
|
||||
- Expected result: What were you expecting to happen?
|
||||
- Actual result: What actually happened?
|
||||
|
||||
### Steps to reproduce the issue
|
||||
1. ...
|
||||
2. ...
|
||||
|
||||
### OS and versions
|
||||
<!-- try the `version` command | LATEST IS NOT A VALID VERSION -->
|
||||
* PocketMine-MP:
|
||||
* PHP:
|
||||
* Server OS:
|
||||
* Game version: PE/Win10 (delete as appropriate)
|
||||
|
||||
### Plugins
|
||||
<!--- use the `plugins` command and paste the output below -->
|
||||
|
||||
- If you remove all plugins, does the issue still occur?
|
||||
- If the issue is **not** reproducible without plugins:
|
||||
- Have you asked for help on our forums before creating an issue?
|
||||
- Can you provide sample, *minimal* reproducing code for the issue? If so, paste it in the bottom section
|
||||
|
||||
### Crashdump, backtrace or other files
|
||||
<!--- Submit crashdumps at https://crash.pmmp.io and paste a link -->
|
||||
<!--- Use gist or anything else to add other files and add links here -->
|
15
.github/ISSUE_TEMPLATE/crash.md
vendored
Normal file
15
.github/ISSUE_TEMPLATE/crash.md
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
name: Crash
|
||||
about: Report a crash in PocketMine-MP (not plugins)
|
||||
title: Server crashed
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--- submit crashdump files to https://crash.pmmp.io -->
|
||||
<!--- or, copy the data between ===BEGIN CRASH DUMP=== and ===END CRASH DUMP and paste it on a site like https://pastebin.com -->
|
||||
Link to crashdump:
|
||||
|
||||
<!--- write additional information about the crash to help us find the problem -->
|
||||
### Additional comments (optional)
|
14
.github/ISSUE_TEMPLATE/help---support.md
vendored
Normal file
14
.github/ISSUE_TEMPLATE/help---support.md
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
name: Help & support
|
||||
about: We don't accept support requests here. Try the links on the README.
|
||||
title: ''
|
||||
labels: Support request
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
We don't accept support requests on the issue tracker. Please try the following links instead:
|
||||
|
||||
Documentation: http://pmmp.rtfd.io
|
||||
Forums: https://forums.pmmp.io
|
||||
Discord: https://discord.gg/bmSAZBG
|
12
.github/ISSUE_TEMPLATE/security-dos-vulnerability.md
vendored
Normal file
12
.github/ISSUE_TEMPLATE/security-dos-vulnerability.md
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
name: Security/DoS vulnerability
|
||||
about: 'Bug or exploit that can be used to attack servers (hint: don''t report it
|
||||
on a public issue tracker)'
|
||||
title: ''
|
||||
labels: 'Auto: Spam'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Please DO NOT report security vulnerabilities here.
|
||||
Instead, send an email to team@pmmp.io or contact a developer directly, IN PRIVATE.
|
6
.github/support.yml
vendored
6
.github/support.yml
vendored
@ -5,7 +5,11 @@ supportLabel: "Support request"
|
||||
# Comment to post on issues marked as support requests. Add a link
|
||||
# to a support page, or set to `false` to disable
|
||||
supportComment: >
|
||||
This issue tracker is not a support forum. Please use the [forums](https://forums.pmmp.io) for support.
|
||||
Thanks, but this issue tracker is not intended for support requests. Please read the guidelines on [submitting an issue](https://github.com/pmmp/PocketMine-MP/blob/master/CONTRIBUTING.md#creating-an-issue).
|
||||
|
||||
|
||||
[Docs](https://pmmp.rtfd.io) | [Discord](https://discord.gg/bmSAZBG) | [Forums](https://forums.pmmp.io)
|
||||
|
||||
# Whether to close issues marked as support requests
|
||||
close: true
|
||||
# Whether to lock issues marked as support requests
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,6 +12,7 @@ server.properties
|
||||
/pocketmine.yml
|
||||
memory_dumps/*
|
||||
resource_packs/
|
||||
server.lock
|
||||
|
||||
# Common IDEs
|
||||
.idea/
|
||||
|
5
.gitmodules
vendored
5
.gitmodules
vendored
@ -2,7 +2,7 @@
|
||||
path = src/pocketmine/lang/locale
|
||||
url = https://github.com/pmmp/PocketMine-Language.git
|
||||
[submodule "tests/preprocessor"]
|
||||
path = tests/preprocessor
|
||||
path = build/preprocessor
|
||||
url = https://github.com/pmmp/preprocessor.git
|
||||
[submodule "tests/plugins/PocketMine-DevTools"]
|
||||
path = tests/plugins/PocketMine-DevTools
|
||||
@ -10,3 +10,6 @@
|
||||
[submodule "src/pocketmine/resources/vanilla"]
|
||||
path = src/pocketmine/resources/vanilla
|
||||
url = https://github.com/pmmp/BedrockData.git
|
||||
[submodule "build/php"]
|
||||
path = build/php
|
||||
url = https://github.com/pmmp/php-build-scripts.git
|
||||
|
54
README.md
54
README.md
@ -1,45 +1,33 @@
|
||||
# [](https://pmmp.io)
|
||||
|
||||
__A highly customisable, open source server software for Minecraft: Bedrock Edition written in PHP__
|
||||
<p align="center">
|
||||
<a href="https://pmmp.io"><img src="http://cdn.pocketmine.net/img/PocketMine-MP-h.png"></img></a><br>
|
||||
<b>A highly customisable, open source server software for Minecraft: Bedrock Edition written in PHP</b>
|
||||
</p>
|
||||
|
||||
[](https://travis-ci.org/pmmp/PocketMine-MP)
|
||||
|
||||
### Setup, help & support, FAQs
|
||||
Head over to the [documentation site](http://pmmp.readthedocs.org/).
|
||||
If you don't find what you're looking for there, [talk to a human](#discussion). Please do not use our issue tracker for support requests.
|
||||
## Getting started
|
||||
- [Documentation](http://pmmp.readthedocs.org/)
|
||||
- [Installation instructions](https://pmmp.readthedocs.io/en/rtfd/installation.html)
|
||||
- [Docker image](https://hub.docker.com/r/pmmp/pocketmine-mp)
|
||||
- [Plugin repository](https://poggit.pmmp.io/plugins)
|
||||
|
||||
### Discussion
|
||||
## Discussion/Help
|
||||
- [Forums](https://forums.pmmp.io/)
|
||||
- [Community Discord](https://discord.gg/bmSAZBG)
|
||||
- [StackOverflow](https://stackoverflow.com/tags/pocketmine)
|
||||
|
||||
### Plugins
|
||||
There are a very wide range of already-written plugins available which you can use to customise your server. Check out [Poggit](https://poggit.pmmp.io), or just search GitHub.
|
||||
|
||||
### For developers
|
||||
## For developers
|
||||
* [Latest API documentation](https://jenkins.pmmp.io/job/PocketMine-MP-doc/doxygen/) - Doxygen documentation generated from development
|
||||
* [DevTools](https://github.com/pmmp/PocketMine-DevTools/) - A development tools plugin for creating plugins.
|
||||
* [DevTools](https://github.com/pmmp/PocketMine-DevTools/) - Development tools plugin for creating plugins
|
||||
* [ExamplePlugin](https://github.com/pmmp/ExamplePlugin/) - Example plugin demonstrating some basic API features
|
||||
* [Contributing Guidelines](CONTRIBUTING.md)
|
||||
|
||||
### Can I contribute?
|
||||
Yes you can! Contributions are welcomed provided that they comply with our [Contributing Guidelines](CONTRIBUTING.md). Please ensure you read the relevant sections of the guidelines carefully before making a Pull Request or opening an Issue.
|
||||
|
||||
### Where can I get the latest .phar?
|
||||
- Latest release builds can be found in our [GitHub releases](https://github.com/pmmp/PocketMine-MP/releases).
|
||||
- Latest bleeding-edge development builds (and other builds in the build job channels) can be found on our [Jenkins server](https://jenkins.pmmp.io/).
|
||||
|
||||
**Note: Please avoid development builds unless there is no other alternative for what you need.** Development builds are subject to changes at any time without notice, and it is likely that your server or plugins might break without warning.
|
||||
## Donate
|
||||
- Bitcoin Cash (BCH): `qq3r46hn6ljnhnqnfwxt5pg3g447eq9jhvw5ddfear`
|
||||
- Bitcoin (BTC): `171u8K9e4FtU6j3e5sqNoxKUgEw9qWQdRV`
|
||||
- [Patreon](https://www.patreon.com/pocketminemp)
|
||||
|
||||
## Licensing information
|
||||
|
||||
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.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
This project is licensed under LGPL-3.0. Please see the [LICENSE](/LICENSE) file for details.
|
||||
|
||||
pmmp/PocketMine are not affiliated with Mojang. All brands and trademarks belong to their respective owners. PocketMine-MP is not a Mojang-approved software, nor is it associated with Mojang.
|
||||
|
81
build/make-release.php
Normal file
81
build/make-release.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\build_script;
|
||||
|
||||
use pocketmine\utils\VersionString;
|
||||
use function dirname;
|
||||
use function fgets;
|
||||
use function file_get_contents;
|
||||
use function file_put_contents;
|
||||
use function preg_quote;
|
||||
use function preg_replace;
|
||||
use function sleep;
|
||||
use function sprintf;
|
||||
use function system;
|
||||
use const pocketmine\BASE_VERSION;
|
||||
use const STDIN;
|
||||
|
||||
require_once dirname(__DIR__) . '/src/pocketmine/VersionInfo.php';
|
||||
require_once dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
if(isset($argv[1])){
|
||||
$currentVer = new VersionString($argv[1]);
|
||||
}else{
|
||||
$currentVer = new VersionString(BASE_VERSION);
|
||||
}
|
||||
$nextVer = new VersionString(sprintf(
|
||||
"%u.%u.%u",
|
||||
$currentVer->getMajor(),
|
||||
$currentVer->getMinor(),
|
||||
$currentVer->getPatch() + 1
|
||||
));
|
||||
|
||||
function replaceVersion(string $versionInfoPath, string $newVersion, bool $isDev) : void{
|
||||
$versionInfo = file_get_contents($versionInfoPath);
|
||||
$versionInfo = preg_replace(
|
||||
$pattern = '/^const BASE_VERSION = "(\d+)\.(\d+)\.(\d+)(?:-(.*))?";$/m',
|
||||
'const BASE_VERSION = "' . $newVersion . '";',
|
||||
$versionInfo
|
||||
);
|
||||
$versionInfo = preg_replace(
|
||||
'/^const IS_DEVELOPMENT_BUILD = (?:true|false);$/m',
|
||||
'const IS_DEVELOPMENT_BUILD = ' . ($isDev ? 'true' : 'false'). ';',
|
||||
$versionInfo
|
||||
);
|
||||
file_put_contents($versionInfoPath, $versionInfo);
|
||||
}
|
||||
$versionInfoPath = dirname(__DIR__) . '/src/pocketmine/VersionInfo.php';
|
||||
replaceVersion($versionInfoPath, $currentVer->getBaseVersion(), false);
|
||||
|
||||
echo "please add appropriate notes to the changelog and press enter...";
|
||||
fgets(STDIN);
|
||||
system('git add "' . dirname(__DIR__) . '/changelogs"');
|
||||
system('git commit -m "Release ' . $currentVer->getBaseVersion() . '" --include "' . $versionInfoPath . '"');
|
||||
system('git tag ' . $currentVer->getBaseVersion());
|
||||
replaceVersion($versionInfoPath, $nextVer->getBaseVersion(), true);
|
||||
system('git add "' . $versionInfoPath . '"');
|
||||
system('git commit -m "' . $nextVer->getBaseVersion() . ' is next" --include "' . $versionInfoPath . '"');
|
||||
echo "pushing changes in 10 seconds\n";
|
||||
sleep(10);
|
||||
system('git push origin HEAD ' . $currentVer->getBaseVersion());
|
1
build/php
Submodule
1
build/php
Submodule
Submodule build/php added at 8666ae5add
1
build/preprocessor
Submodule
1
build/preprocessor
Submodule
Submodule build/preprocessor added at b01f50c50e
182
changelogs/1.3.md
Normal file
182
changelogs/1.3.md
Normal file
@ -0,0 +1,182 @@
|
||||
# 1.3.3
|
||||
- Minecraft: Pocket Edition alpha 0.7.2 compatible!
|
||||
- Unicode support
|
||||
- Fixed /difficulty command
|
||||
- Fixed a few flying kicks
|
||||
- Fixed async. operations thread
|
||||
- Added whitelist enabled property to Query
|
||||
|
||||
# 1.3.4
|
||||
**This is a compatibility update for Minecraft: Pocket Edition v0.7.3 alpha.**
|
||||
|
||||
Double chests do not work yet, we will fix more bugs and add them when MCPE 0.7.4 is released. There were too many bugs in 0.7.3 to test double chests properly.
|
||||
|
||||
#### Including in this release:
|
||||
- Fixed armor crash
|
||||
- Fixed ghost armor
|
||||
- Fixed packets being received after player disconnection
|
||||
- Fixed player count bug
|
||||
- Added compatibility with encrypted login
|
||||
- Fixed flying check on fences
|
||||
- Fixed players connecting with empty usernames
|
||||
- Fixed several crashes related to Items
|
||||
- Added temporal water flowing. Really buggy
|
||||
- Automatic recovery of index-corrupted maps
|
||||
- Fixed hotbar reset when changing armor
|
||||
- Fixed some hotbar reset bugs on block placement
|
||||
- Added basic tool durability and breaking
|
||||
- Chests now have opening/closing animation.
|
||||
- Fixed /difficulty
|
||||
- In-game player list is now handled correctly
|
||||
- Player entities are saved in all worlds to remove join/leave spam
|
||||
- Quartz slabs
|
||||
|
||||
# 1.3.5
|
||||
#### Including in this release:
|
||||
- Fixed block durability (blocks being replaced)
|
||||
- Added armor replacing (changing the armor while you have other)
|
||||
- Added proper Player object cleanups as a fix to a memory leak
|
||||
|
||||
# 1.3.7
|
||||
**This update is compatible with Minecraft: Pocket Edition v0.7.4 alpha.** Older versions won't work.
|
||||
|
||||
In Minecraft: PE 0.7.4 you can add External servers directly. [How to add servers](https://github.com/PocketMine/PocketMine-MP/wiki/How-to-add-servers)
|
||||
|
||||

|
||||
|
||||
### Changelog
|
||||
- **Updated for 0.7.4 alpha**
|
||||
- **New API version 10**
|
||||
- Adds Tile methods
|
||||
- Changes message events to use new Minecraft protocol
|
||||
- Added Level::getSafeSpawn()
|
||||
- Linux now uses PHP 5.5.3
|
||||
- Removed water updating
|
||||
- Fixes for Player teleporting
|
||||
- Removed invalid Cookie and fish items
|
||||
- Fixed Stone brick and quartz slab recipes
|
||||
- Shears now are used to drop leaves
|
||||
- Fixed a crash on Windows XP
|
||||
- Cake is removed when the bottom block is broken
|
||||
- Added new NBT parser/writer
|
||||
- Fixed chests and furnaces drops when broken.
|
||||
- Fixed signs not spawning on world load
|
||||
- Fixed actions not being deleted (memory leak)
|
||||
- Chests now are spawned correctly
|
||||
- Double chests
|
||||
- Added random x,z offset to item drops
|
||||
|
||||
# 1.3.8
|
||||
This release consists of a few bugfixes and several features added. It is compatible with MCPE 0.7.4 and 0.7.5
|
||||
|
||||
**Changelog:**
|
||||
- No API changes
|
||||
- Fixed x,y,z indexes when opening a Furnace
|
||||
- Fixed invalid fix for CPU usage limiter on idle
|
||||
- Fixed cross-compiling
|
||||
- Fixed some Stonecutter recipes
|
||||
- Fixed a few items stack sizes
|
||||
- Fixed TimeAPI bugs
|
||||
- Forces position on teleport, blocks fast teleport mods
|
||||
- Fixed some blocks havin a send lag on place/break
|
||||
- Fixed Sign Posts not deleting the Tile data when broken by update
|
||||
- Fixed Ice converting to Water on creative mode
|
||||
- Added beds
|
||||
- Added scheduled teleport on spawn to fix spawning underground
|
||||
- Added date to console logs
|
||||
|
||||
# 1.3.9
|
||||
This release is compatible with MCPE 0.7.4 and 0.7.5.
|
||||
|
||||
**Changelog:**
|
||||
- Fixed server crash related to beds
|
||||
- Player movement is less laggy
|
||||
- Added new text formatting system for future updates
|
||||
- New Terminal Emulator for Windows
|
||||
- More colors! Less warnings!
|
||||
|
||||
# 1.3.10
|
||||
**Changelog:**
|
||||
- Added door sounds
|
||||
- Fixed bed sleeping position offset
|
||||
- Added explosions
|
||||
- Flint & Steel on Creative Mode (replaces Eggs)
|
||||
- Changed the Sword and Hoe to the diamond tier on the Creative inventory
|
||||
- Fixed colors on MacOS
|
||||
- Water flow
|
||||
- Fixed Windows console input not being accepted when using special keys
|
||||
- Added a way to disable console colors
|
||||
- Updated PHP to 5.5.6, pthreads to 0.0.55, and cURL
|
||||
- Armor drops
|
||||
- Fixed plugin issues
|
||||
- Fixed some block drops
|
||||
- Fixed a crash when @all is used in console, and only usable for OPs
|
||||
- Fixed some issues regarding teleporting
|
||||
- deop no longer op the player again
|
||||
|
||||
# 1.3.11
|
||||
And here it comes the stable release for **MCPE v0.8.1 alpha**. We decided to remove the improved networking that was delaying this release, but you should see it in the next one. Minecarts couldn't be added for the same reason as mobs, but we will try to implement "fake" minecarts that behave correctly inside rails, but not outside of them.
|
||||
|
||||
Starting with this release, all PocketMine-MP versions will be given a codename. This one received the codename 「甘いビートルート」_(Amai Beetroot)_.
|
||||
|
||||
**Changelog:**
|
||||
- Fixed existing Packets of Death
|
||||
- Fixed lots of bugs related to crafting
|
||||
- Fixed block placement bugs
|
||||
- Redstone ore drops redstone dust
|
||||
- Sideway logs
|
||||
- Sponges
|
||||
- Added new wooden planks & stairs
|
||||
- Added iron bars, cobblestone walls and pumpkins
|
||||
- Added carpets, hay bales and coal blocks
|
||||
- Added potatoes, carrots and beetroots
|
||||
- Additional tall grass drops
|
||||
- Achievements
|
||||
- Added multiple orders for _/gamemode_ command
|
||||
- Chat plugins can work with each other #975
|
||||
- Fixed internal world chunks bug
|
||||
- Private messages are now hidden on console except when the console is the target/origin
|
||||
- PHP plugins are now loaded with include()
|
||||
- Fixed plugin paths
|
||||
- Added source SHA1 sum to crash reports
|
||||
- Added Level::startTime() and Level::stopTime()
|
||||
- Fixed server not being able to start on several OS when offline
|
||||
- More small fixes and small additions
|
||||
|
||||
For more information, check the [complete changelog](https://github.com/PocketMine/PocketMine-MP/compare/Alpha_1.3.10...Alpha_1.3.11).
|
||||
|
||||
# 1.3.12
|
||||
Before starting to rewrite even more parts of the code, we are releasing the last version of the Alpha_1.3.x Amai Beetroot「甘いビートルート」. Next one will be Alpha_1.4 with more rewrite!
|
||||
We have included the new Event API that will be used on the next release, but now it is only used to hook on packets.
|
||||
|
||||
**API Changelog:**
|
||||
- **Full network rewrite.** Plugins can work with packets easily now.
|
||||
- **New Event API,** only implemented for packets right now.
|
||||
- Added player.block.place.bypass and player.block.break.bypass
|
||||
- Level included in data for event item.drop
|
||||
- Added Utils::getUniqueID()
|
||||
- **Added default support in PHP binaries for MySQLi**
|
||||
- Removed Spyc
|
||||
- Call Plugin::__destruct() on PluginAPI::__destruct()
|
||||
- Added more OS detection on Utils::getOS()
|
||||
|
||||
**Changelog:**
|
||||
- New set-up wizard in multiple languages. Help translate it to more languages on http://translate.pocketmine.net/
|
||||
- Updated pthreads and PHP binaries
|
||||
- New font for MinTTY console on Windows
|
||||
- Send partial hotbar history
|
||||
- Fixed Tile saving indexes
|
||||
- Fixed a few teleport bugs
|
||||
- Improved crash dumps
|
||||
- Increased apple health restore
|
||||
- Fixed players being invincible after death
|
||||
- Fixed Level::unloadChunk() not using saveEnabled
|
||||
- Show player name on bad username kick
|
||||
- Fixed item duplication on void #1100
|
||||
- OPs can bypass the player limit
|
||||
- Fixed item replacing on furnace #1114
|
||||
- Fixed multiple small bugs #1058 #1032 #854 #823 #1135 #1150 #1172 #1173 #486 #466 #483
|
||||
- Fixed PHP compilation on 64-bit linux #519 #861 #940 #505 #590 #761 #129
|
||||
- Included OPCache to optimize opcodes
|
||||
|
||||
If you are on Linux, you can use `wget -q -O - http://cdn.pocketmine.net/installer.sh | bash -s - -v Alpha_1.3.12` to update. If you are on a MacOS, use `curl -sL http://cdn.pocketmine.net/installer.sh | bash -s - -v Alpha_1.3.12`
|
1278
changelogs/1.4.md
Normal file
1278
changelogs/1.4.md
Normal file
File diff suppressed because it is too large
Load Diff
72
changelogs/1.6.md
Normal file
72
changelogs/1.6.md
Normal file
@ -0,0 +1,72 @@
|
||||
# 1.6.1dev-87
|
||||
**For Minecraft PE 0.16.0.5 alpha**
|
||||
|
||||
**THIS IS A PRE RELEASE. Do not use it in production unless you are sure you know what you are doing.**
|
||||
|
||||
Only changes since the 1.6dev tag will be documented here. Changes between 1.4.1 and 1.6dev are far too extensive to document effectively.
|
||||
|
||||
## Core
|
||||
- New RNG, based on XorShift128 from the php-random library. This fixes issue with repeating terrain on 32-bit systems. _Note however that new generation into existing worlds will not be seamless._
|
||||
- Block and Item IDs have been moved to interfaces for better consistency
|
||||
- Better method for synchronisation of client/server time (less packet spam)
|
||||
- Utils::getRandomBytes() has been deprecated in favour of php7's random_bytes() function.
|
||||
- `<player>.dat` saving/reading can now be disabled in `pocketmine.yml` (set `player.save-player-data` to `false`)
|
||||
|
||||
## Gameplay/game features
|
||||
- Added Flower Pots
|
||||
- Containers can now be opened in creative
|
||||
- Trapdoors can now be placed without a supporting block
|
||||
|
||||
## API
|
||||
|
||||
This release has API changes, bumping the version to 2.1.0.
|
||||
|
||||
### Entity metadata (0.16)
|
||||
|
||||
Many changes have been made to entity metadata. Many true/false data properties are now entity status flags, such as NoAI, NametagVisible and various others. Entity status flags can be set using:
|
||||
`$entity->setDataFlag(Entity::DATA_FLAGS, Entity::INSERT_DATA_FLAG_NAME, true/false);`
|
||||
|
||||
**Breaking** changes are detailed here. Additions are not documented. https://gist.github.com/dktapps/76b291b7a861762b54f7a8b834389883
|
||||
|
||||
**NOTE: It's strongly recommended to use provided API methods where possible instead of tampering with metadata directly.**
|
||||
|
||||
### AsyncTask API additions
|
||||
- Main thread local storage: Developers can pass any data including objects to the constructor of AsyncTask such that the data can be retrieved after the AsyncTask completes using the new `AsyncTask::fetchLocal()` method, or use the `AsyncTask::peekLocal()` method to get the data without removing it.
|
||||
- Progress updates: Developers can use the new `AsyncTask::publishProgress() method and override`AsyncTask::onProgressUpdated()` to handle AsyncTask progress information in the main thread.
|
||||
|
||||
Refer to #1 and #100 for details.
|
||||
|
||||
### WeakPosition
|
||||
|
||||
WeakPosition was added in 1.6.1 to fix bugs with unloading levels which have player spawn points set in them. This type of position holds a level ID instead of a direct reference. Use this when your position may outlive the level it is in.
|
||||
|
||||
### Removal of Item/NBT circular dependency
|
||||
|
||||
Refer to #121 for details.
|
||||
|
||||
### Other
|
||||
- Added Player->sendWhisper() (#73).
|
||||
- Removed LargeExplodeParticle due to incorrect name - use HugeExplodeParticle. Added HugeExplodeSeedParticle and BlockForceFieldParticle (7314aaf7f7bdae582f674c085c7ae879985bf847)
|
||||
|
||||
## Fixes
|
||||
- Fixed the infamous hotbar spaz bug
|
||||
- Creative/spectator inventory now sends correctly
|
||||
- Fixed spectator flight controls
|
||||
- Fixed issues with items going past the end of the regular inventory
|
||||
- Fixed furnace client crashes
|
||||
- Fixed inventory windows for anvils and enchanting tables
|
||||
- Fixed kicked for walking on lily pads (#blameshoghicp)
|
||||
- Fixed a nasty entity-related memory leak on chunk unload
|
||||
- Fixed sleeping players floating above beds and teleportation of sleeping players.
|
||||
- Fixed a bug in Level::updateAround() where only one block would update
|
||||
- Fixed some slab placement issues (#31)
|
||||
- Fixed crash loading 1.11 worlds (#32)
|
||||
- Fixed broken `--disable-readline` command-line option (#34)
|
||||
- Fixed world unload crash when players have spawnpoints set in that world (#24)
|
||||
- Fixed start.sh detection of system PHP binaries (#66)
|
||||
- Fixed anvil rotation when placed and variant drops (d696049a0ad5e3b878a8f902e4ef75f19ec8cecc)
|
||||
- /timings command is now more verbose about paste errors (#95)
|
||||
- Fixed server crash at shutdown when RCON is enabled (#101)
|
||||
- Fixed server name is always "Minecraft: PE Server" when running setup wizard (92bd1a755d4b171b687538db83893b9bd9c70420)
|
||||
- Fixed CraftItemEvent->getInput() does not return used items (7eb9530346e953d1555623ff871086f85447b6c6)
|
||||
- Fixed useless ServerKiller (#122)
|
1155
changelogs/3.0-alpha.md
Normal file
1155
changelogs/3.0-alpha.md
Normal file
File diff suppressed because it is too large
Load Diff
264
changelogs/3.0.md
Normal file
264
changelogs/3.0.md
Normal file
@ -0,0 +1,264 @@
|
||||
**For Minecraft: Bedrock Edition 1.4.0**
|
||||
|
||||
Plugin scheduler rewrite, RCON rewrite, performance improvements, improved idle memory usage
|
||||
|
||||
**While this release is nominally not an alpha, it is still not feature complete and does not include all gameplay features. Please do not create issues for missing gameplay features.**
|
||||
|
||||
This build has breaking API changes.
|
||||
This release is the first to use the new merged versioning system. The PocketMine-MP version and the API version are now one and the same.
|
||||
|
||||
Please use our issue tracker to report bugs.
|
||||
|
||||
# 3.0.0
|
||||
## Core
|
||||
### General
|
||||
- This release introduces a new dependency library called `Snooze`, which PocketMine-MP utilizes for managing notifications between threads. This library is currently utilized by command reading, RCON and RakLib, allowing faster response times to commands, reduced network latency, and better performance due to lack of need for polling.
|
||||
- Fixed race condition causing `ServerKiller` to sometimes kill the server for no reason on shutdown.
|
||||
|
||||
### Dependency libraries
|
||||
Requires the following libraries:
|
||||
- [`pocketmine/raklib` `^0.12.0`](https://github.com/pmmp/RakLib/releases/0.12.0)
|
||||
- [`pocketmine/spl` `^0.3.0`](https://github.com/pmmp/SPL/releases/0.3.0)
|
||||
- [`pocketmine/binaryutils` `^0.1.0`](https://github.com/pmmp/BinaryUtils/releases/0.1.0)
|
||||
- [`pocketmine/nbt` `^0.2.0`](https://github.com/pmmp/NBT/releases/0.2.0)
|
||||
- [`pocketmine/math` `^0.2.0`](https://github.com/pmmp/Math/releases/0.2.0)
|
||||
- [`pocketmine/snooze` `^0.1.0`](https://github.com/pmmp/Snooze/releases/0.1.0)
|
||||
|
||||
These libraries may individually have changes which are not recorded here. See their independent repository releases for their changelogs.
|
||||
|
||||
### Async pooling
|
||||
- Async workers are now started dynamically when they are needed only, instead of being started immediately on startup. This allows reducing idle memory usage.
|
||||
- AsyncPool now appropriately shuts down the workers when instructed to, instead of leaving it up to the ThreadManager to clean it up. This eliminates debug messages of shutting down async workers on server shutdown.
|
||||
- Default maximum async worker memory limit has been lowered from 1024MB to 256MB.
|
||||
- Async workers are now started using the options `PTHREADS_INHERIT_CONSTANTS | PTHREADS_INHERIT_INI`, which reduces idle memory wastage and works around some bugs in pthreads.
|
||||
|
||||
### Entities
|
||||
- Fixed entities not being despawned when flagged, if they weren't scheduled for an update.
|
||||
|
||||
### Levels
|
||||
- Seed handling is now always consistent between `pocketmine.yml` and `server.properties`.
|
||||
- Fixed generation bugs in imported LevelDB worlds where the classpath was saved into level.dat.
|
||||
- Generators for levels are no longer created on the main thread, reducing memory usage.
|
||||
|
||||
### Plugins
|
||||
- Plugin data is now stored under `<data dir>/plugin_data` by default on new installations, instead of in `<plugins dir>`. This behaviour does not affect existing installations by default - if you want to enable it, set `plugins.legacy-data-dir` to `false` in `pocketmine.yml`.
|
||||
|
||||
### RCON
|
||||
RCON has been almost completely rewritten in this release.
|
||||
- Now event-driven (using Snooze) instead of poll-based, improving performance.
|
||||
- Fixed segmentation fault when stopping the server with RCON enabled.
|
||||
|
||||
## API
|
||||
**WARNING: Dependency library API changes are not listed here. See their individual release notes for changes (linked above in the Core section).**
|
||||
|
||||
### API versioning changes for plugins
|
||||
The way that the API versioning is done has changed. Now the API version is synonymous with the PocketMine-MP version.
|
||||
Plugin compatibility is determined by the following:
|
||||
- Take the base version, and strip any metadata (everything after the `+` sign, for example `3.0.0+dev.1191` becomes `3.0.0`).
|
||||
- Assert that:
|
||||
- The major versions is the same
|
||||
- The server's minor version is greater than or equal to the plugin's
|
||||
- The server's patch version is greater than or equal to the plugin's
|
||||
|
||||
Currently there is no support for locking version by metadata, although this could be implemented if it is a wanted feature.
|
||||
|
||||
### General
|
||||
- `Server->getCodename()` and `\pocketmine\CODENAME` have been removed.
|
||||
- Added API method `Server->getTickSleeper()`, which returns a `\pocketmine\snooze\SleeperHandler` instance.
|
||||
- `Server->getIp()` now returns `0.0.0.0` if not set.
|
||||
|
||||
### Block
|
||||
- Added `Block->getXpDropForTool()`.
|
||||
|
||||
### Entity
|
||||
- Calling `scheduleUpdate()` on an `Entity` after it has been `close()`d will now cause an exception to be thrown.
|
||||
- `Entity->motionX`, `Entity->motionY` `Entity->motionZ` have been removed in favour of an `Entity->motion` `Vector3` field. This also applies for the `lastMotion` fields.
|
||||
- `Entity->isInsideOfWater()` has been renamed to `isUnderwater()`.
|
||||
|
||||
### Events
|
||||
- Added support for `@softDepend` annotation on event handlers, which allows the event handler to not be registered if the dependency plugin is not loaded.
|
||||
- Added support for `@notHandler` annotation for `Listener` methods to indicate that such methods are not event handlers.
|
||||
- Typehints have been applied to the events API to PHP 7.2 standards.
|
||||
- Fixed preventing effect expiry using `EntityEffectRemoveEvent` not being reflected on the client.
|
||||
- `EntityDamageEvent` API has significant changes. The general purpose of this is to split up base damage from modifiers.
|
||||
- Added methods `getBaseDamage()`, `setBaseDamage()`, `getOriginalBaseDamage()`, `getModifiers()`, `getOriginalModifiers()`
|
||||
- `setDamage()` renamed to `setModifier()`, and type parameter is now mandatory
|
||||
- `getDamage()` renamed to `getModifier()`, and type parameter is now mandatory
|
||||
- `getOriginalDamage()` renamed to `getOriginalModifier()`, and type parameter is now mandatory
|
||||
- Removed `MODIFIER_BASE` constant
|
||||
- Constructors now accept: `float baseDamage`, `float[] modifiers` instead of just `float[] modifiers`
|
||||
- Added `BlockBreakEvent->getXpDropAmount()` and `BlockBreakEvent->setXpDropAmount()`.
|
||||
|
||||
### Inventory
|
||||
- `InventoryTransaction->getCreationTime()` has been removed.
|
||||
- `EntityInventoryChangeEvent` and `EntityArmorChangeEvent` are no longer fired during entity inventory intialization.
|
||||
|
||||
### Item
|
||||
- Methods `isPickaxe()`, `isAxe()`, `isSword()`, `isShovel()`, `isHoe()`, `isShears()` have been removed. These should be replaced with `instanceof` checks for the relevant classes.
|
||||
- Removed `Item->useOn()`. This has been superseded by new methods used for handling durability changes.
|
||||
- Added hooks `Item->onDestroyBlock()` and `Item->onAttackEntity()`. These are called when a player uses the item to destroy a block or attack an entity respectively. This is used in the core code for updating durability.
|
||||
- `Item->pop()` now accepts an optional count parameter.
|
||||
- `Enchantment` now has separated primary items (which can be enchanted directly) and secondary items (which can be enchanted on an anvil). The constructor of `Enchantment` has been updated to reflect this.
|
||||
- Removed `Enchantment->getSlot()` and `Enchantment->hasSlot()`.
|
||||
- Added `Enchantment->getPrimaryItemFlags()`, `Enchantment->hasPrimaryItemFlag()`, `Enchantment->getSecondaryItemFlags()` and `Enchantment->hasSecondaryItemFlag()`
|
||||
|
||||
### Level
|
||||
- `Biome` classes have been moved to `pocketmine\level\biome` namespace. This is in preparation for future work on Levels which requires biome information (such as weather conditions).
|
||||
- `WeakPosition` has been removed.
|
||||
- Added `Level->getBiome()`.
|
||||
- `Level->getSafeSpawn()` now always returns a `Position` instance.
|
||||
- `Level->getBlockExtraData()` and `Level->setBlockExtraData()` have been removed (as well as their associated `Chunk` methods).
|
||||
- `ChunkManager->isInWorld()` now accepts integers instead of floats.
|
||||
- Added `SubChunkIteratorManager->invalidate()`.
|
||||
|
||||
#### Generator
|
||||
- `BiomeSelector` has been refactored to make it simpler and more robust.
|
||||
- Generator-management methods `registerDefaultGenerators()`, `addGenerator()`, `getGeneratorList()`, `getGenerator()`, and `getGeneratorName()` have been moved from `Generator` to a new `GeneratorManager` class.
|
||||
- Static noise functions in the `Generator` base class have been moved to `Noise` instance methods.
|
||||
- Added static method `Generator::convertSeed()`, which converts an int or string into a numeric seed for generation.
|
||||
|
||||
### Network
|
||||
- `SourceInterface->process()` no longer returns a value.
|
||||
|
||||
### Plugin
|
||||
- `PluginBase->getResources()` now returns an associative array where the index is the path to the resource relative to the plugin's `resources` directory.
|
||||
- `PluginLoader`s have been almost completely rewritten to make them simpler and more robust.
|
||||
- `PluginManager->registerInterface()` does not return anything, and now accepts a `PluginLoader` instance instead of a `string`.
|
||||
- `PluginLoader`:
|
||||
- `getPluginFilters()`, `enablePlugin()` and `disablePlugin()` are removed.
|
||||
- `loadPlugin()` responsibilities are now solely confined to doing whatever is necessary to make the plugin's classes visible by the server, and does not emit log messages or check for data directories.
|
||||
- Added method `getAccessProtocol()` which determines what prefix to apply to the plugin path to access the files inside it (for example `phar://`).
|
||||
- `PluginBase->init()` and `PluginBase->isInitialized()` have been removed.
|
||||
- `Plugin` interface now declares a signature for the constructor which implementations must comply with.
|
||||
- `Plugin` interface now declares `setEnabled()`.
|
||||
- It is now possible to create a custom `Plugin` implementation without requiring a custom `PluginLoader`.
|
||||
|
||||
### Scheduler
|
||||
This release features major changes to how plugin task scheduling works.
|
||||
- Removed `Server->getScheduler()`. All plugins now have their own scheduler which is accessible using `Plugin->getScheduler()`. Aside from being syntactically more concise and pleasant, this also allows much more effective management of tasks when plugins are disabled.
|
||||
- Removed `PluginTask` class, because it's now unnecessary. Previously it was required to allow the server to delete tasks associated with a plugin when the plugin was disabled. With plugin-owned schedulers, this is no longer a requirement. Plugins may now utilize the `Task` class as a base if they like.
|
||||
- Added `Server->getAsyncPool()`. Since the global scheduler does not exist any more, it does not manage the server's `AsyncPool` any more. Additionally, `ServerScheduler` was previously bloated by a lot of `AsyncTask` related methods, which are now not necessary because direct access to `AsyncPool` is granted instead.
|
||||
- `ServerScheduler`:
|
||||
- `ServerScheduler` has been renamed to `TaskScheduler` since it is now a general-purpose task scheduler which is non-dependent on the user. This allows much greater flexibility and also makes it possible to unit-test.
|
||||
- All `AsyncTask`/`AsyncPool` related methods have been removed - the task scheduler does not manage the async pool anymore.
|
||||
- Calls to `Server->getScheduler()->scheduleAsyncTask()` should be replaced with `Server->getAsyncPool()->submitTask()`.
|
||||
- Calls to `Server->getScheduler()->scheduleAsyncTaskToWorker()` should be replaced with and `Server->getAsyncPool()->submitTaskToWorker()`.
|
||||
|
||||
### Tile
|
||||
- Calling `scheduleUpdate()` on a `Tile` after it has been `close()`d will now cause an exception to be thrown.
|
||||
- Tile NBT is now ephemeral and is not retained after creating the tile.
|
||||
- `Tile->namedtag` has been removed.
|
||||
- `Tile->saveNBT()` now returns a new `CompoundTag` containing saved data.
|
||||
- Added new protected methods `Tile->readSaveData()` and `Tile->writeSaveData()`. These should be overridden to add or read tile-specific data, instead of overriding `saveNBT()` and `__construct()`.
|
||||
|
||||
### Utils
|
||||
- Added `MainLogger->getFormat()` and `MainLogger->setFormat()` to allow manipulating console output format.
|
||||
|
||||
## Gameplay
|
||||
### General
|
||||
- Fixed a range of block collision issues stemming from off-by-one errors when fetching areas.
|
||||
|
||||
### Blocks
|
||||
- Fixed a crash which occurred when leaving a bed which was broken and replaced during sleep.
|
||||
- Fixed dark oak and acacia saplings growing into oak trees - now they will not grow at all (they need to be implemented).
|
||||
- Saplings now take light level into account when trying to grow.
|
||||
- Ores and other blocks now drop experience when broken with an appropriate tool.
|
||||
|
||||
### Entities
|
||||
- Fixed dropped items not being correctly destroyed by fire, cacti and other damage sources.
|
||||
|
||||
### Generation
|
||||
- Grass no longer generates as the top layer of ground cover in river biomes.
|
||||
- Ocean biomes now use gravel instead of grass+dirt for ground cover.
|
||||
- Reduced maximum elevation of plains biomes to make them less bumpy.
|
||||
- Snow layers and other can-be-flowed-into blocks no longer generate underwater.
|
||||
|
||||
### Items
|
||||
- Buckets are no longer able to delete any block by replacing it with water.
|
||||
- Dried Kelp, Bleach, Nautilus Shell and Heart of the Sea items are registered (although crafting recipes for these are not yet available).
|
||||
- Implemented `Vanishing` enchantment.
|
||||
- Implemented Totems.
|
||||
|
||||
### World
|
||||
- Fixed explosions sometimes leaving behind air blocks with non-zero damage values.
|
||||
|
||||
# 3.0.1
|
||||
- Fixed error when players move things around in the crafting grid after plugins cancel `PlayerInteractEvent` on crafting tables.
|
||||
|
||||
# 3.0.2
|
||||
- Fixed memory dumps not showing private properties of parent classes.
|
||||
- Fixed a memory leak when cancelling all tasks in the `TaskScheduler`.
|
||||
- Fixed scheduled task timings showing `Unknown` as the plugin name.
|
||||
|
||||
# 3.0.3
|
||||
- Fixed possible crash in Sign when placed by a plugin.
|
||||
- Fixed slightly-damaged and very-damaged anvils dropping incorrect items.
|
||||
- `Living->applyPostDamageEffects()` is no longer called if the mob died from an attack.
|
||||
- Cooldown for mob attack is now reset prior to applying post-damage effects.
|
||||
- Added constant `ItemIds::MUTTON` to resolve crashes using PC worlds.
|
||||
- Fixed emerald ore not dropping XP when broken with a valid tool.
|
||||
- Fixed mobs getting crazy vertical knockback if attacked while airborne.
|
||||
- Fixed XP orbs continuing to follow dead players.
|
||||
|
||||
# 3.0.4
|
||||
- Fixed RCON spamming the console when a client does not disconnect correctly.
|
||||
- Fixed dropping chunk cache unnecessarily when no blocks need to be updated on a chunk.
|
||||
- Fixed outdated block updates getting sent on chunks replaced using `setBlock()`.
|
||||
|
||||
# 3.0.5
|
||||
- Fixed not being able to place blocks where a player died and has not yet respawned (#2265).
|
||||
- Fixed mob death animation not being played when `Entity->kill()` is called directly or `/kill` is used.
|
||||
- Fixed viewers of different halves of double chests not seeing changes made by viewers who opened the other half (#2261).
|
||||
- Fixed bugs setting items into wrong indexes when double chest halves have differently sized inventories.
|
||||
- Fixed `getConfig()` crashing when called when the plugin's data directory doesn't exist.
|
||||
- Fixed a possible exploit with keychain signing for XBL login.
|
||||
|
||||
# 3.0.6
|
||||
- Fixed invalid keys in `.properties` config files being considered as invalid strings.
|
||||
- Fixed whitespace between key and value `key = value` being invalid in `.properties` config files.
|
||||
- Fixed a bug in exception message when an invalid permission type is written for a command in plugin.yml.
|
||||
- Properly fixed newline issues when parsing event handler annotations - `@notHandler` will now work as expected when CRLF line endings are used.
|
||||
- Fixed `PluginManager->registerEvents()` registering functions as event handlers declared by parent classes which are not `Listener` instances (#2293).
|
||||
|
||||
# 3.0.7
|
||||
- Fixed setting spawn points in un-generated chunks causing the player to fall out of the world.
|
||||
- Fixed spawn protection deactivating when there are no ops set (this was an unwanted/unexpected feature, so it's considered a bug).
|
||||
- Fixed cursor items not getting dropped when closing the inventory or dying.
|
||||
- Fixed more issues with blocks with invalid metadata appearing as update! blocks.
|
||||
- `Entity->setNameTagAlwaysVisible()` now works (although nametags will still not be shown if the entity is invisible, due to a behavioural change in Minecraft PE).
|
||||
- Fixed errors passing zero motions to projectiles in some cases.
|
||||
|
||||
# 3.0.8
|
||||
- Fixed player on-ground state not updating when moving horizontally. This allowed fly hacks with the built in anti-cheat, and also affected some third party anti-cheat plugins due to the effect on `inAirTicks`.
|
||||
- Fixed knockback. PC 1.9-style knockback was mistakenly introduced in 3.0.3. This has now been reverted back to the old 1.8-style behaviour.
|
||||
|
||||
# 3.0.9
|
||||
- Cleaned up odd behaviour of `/kill` due to old broken code.
|
||||
- Fixed patch level check for plugin APIs not allowing lesser patch versions on greater minor versions.
|
||||
- Fixed `/timings paste`. This now reports directly to the timings host instead of using Ubuntu Pastebin.
|
||||
- Minor code cleanups in various places.
|
||||
- Zip resource packs will now give slightly less useless errors - errors for broken manifest have been separated from those with fields missing, and now reports why decoding failed if it failed.
|
||||
|
||||
# 3.0.10
|
||||
- Syntax error crashdumps will no longer be reported to the crash archive.
|
||||
- Chunk sending is now fault-tolerant. Before this release, any error on a worker during async chunk sending (such as memory errors caused by pthreads) would cause that chunk to never get sent, resulting in invisible and missing chunks. Levels will now attempt to retry chunk prepare when a task crashes, which should fix most invisible chunk bugs.
|
||||
- `MainLogger` now logs exception stack traces in a synchronized block to ensure that they are coherent when log messages are emitted from multiple threads at once.
|
||||
- `AsyncTask->isCrashed()` now returns `true` if a fatal error occurred during the task execution.
|
||||
|
||||
# 3.0.11
|
||||
- `DropItemAction` will now consider itself invalid if attempting to drop a null item.
|
||||
- Fixed leaking globally broadcasted Level packets when no players are on the server.
|
||||
- Fixed title bar not being cleared on server stop on some terminals.
|
||||
- Fixed `FallingBlock` saving corrupted data.
|
||||
- Fixed the structure of `GuiDataPickItemPacket`.
|
||||
- Cleaned up some code in `OfflinePlayer`.
|
||||
- Splash potions no longer apply effects to dead (but not yet respawned) players.
|
||||
- Coal ore no longer drops XP when mined with a silk touch tool.
|
||||
- Item entities now cannot be picked up when a negative pickup delay is used.
|
||||
|
||||
# 3.0.12
|
||||
- `Config` keys which are considered bools by YAML 1.1 will no longer be transformed into 1 or 0.
|
||||
- Fixed painting motives not getting saved.
|
||||
- Fixed cacti spewing items when placed in some invalid locations.
|
||||
- Fixed entity fire damage not applying in the void.
|
||||
- Fixed entities not getting updated appropriately in some conditions.
|
68
changelogs/3.1.md
Normal file
68
changelogs/3.1.md
Normal file
@ -0,0 +1,68 @@
|
||||
**For Minecraft: Bedrock Edition 1.5.0**
|
||||
|
||||
### Note
|
||||
Plugins compatible with any previous 3.x.y version will also run on this build and do not need API bumps. Plugin developers should **only** update their required API to this version if you need the changes in this build.
|
||||
|
||||
**This build contains changes to the **protocol** which are not covered by the API version. To lock your plugin to a specific protocol version, declare the `mcpe-protocol` attribute in your `plugin.yml`.
|
||||
|
||||
# 3.1.0
|
||||
- Support for Minecraft: Bedrock Edition version 1.5.0
|
||||
|
||||
# 3.1.1
|
||||
- Fixed player on-ground state not updating when moving horizontally. This allowed fly hacks with the built in anti-cheat, and also affected some third party anti-cheat plugins due to the effect on `inAirTicks`.
|
||||
- Fixed knockback. PC 1.9-style knockback was mistakenly introduced in 3.0.3. This has now been reverted back to the old 1.8-style behaviour.
|
||||
|
||||
# 3.1.2
|
||||
- Cleaned up odd behaviour of `/kill` due to old broken code.
|
||||
- Fixed patch level check for plugin APIs not allowing lesser patch versions on greater minor versions.
|
||||
- Fixed `/timings paste`. This now reports directly to the timings host instead of using Ubuntu Pastebin.
|
||||
- Minor code cleanups in various places.
|
||||
- Zip resource packs will now give slightly less useless errors - errors for broken manifest have been separated from those with fields missing, and now reports why decoding failed if it failed.
|
||||
- Added constant `Entity::DATA_FLAG_SHOW_TRIDENT_ROPE`.
|
||||
|
||||
# 3.1.3
|
||||
- Syntax error crashdumps will no longer be reported to the crash archive.
|
||||
- Chunk sending is now fault-tolerant. Before this release, any error on a worker during async chunk sending (such as memory errors caused by pthreads) would cause that chunk to never get sent, resulting in invisible and missing chunks. Levels will now attempt to retry chunk prepare when a task crashes, which should fix most invisible chunk bugs.
|
||||
- `MainLogger` now logs exception stack traces in a synchronized block to ensure that they are coherent when log messages are emitted from multiple threads at once.
|
||||
- `AsyncTask->isCrashed()` now returns `true` if a fatal error occurred during the task execution.
|
||||
|
||||
# 3.1.4
|
||||
- `DropItemAction` will now consider itself invalid if attempting to drop a null item.
|
||||
- Fixed leaking globally broadcasted Level packets when no players are on the server.
|
||||
- Fixed title bar not being cleared on server stop on some terminals.
|
||||
- Fixed `FallingBlock` saving corrupted data.
|
||||
- Fixed the structure of `GuiDataPickItemPacket`.
|
||||
- Cleaned up some code in `OfflinePlayer`.
|
||||
- Splash potions no longer apply effects to dead (but not yet respawned) players.
|
||||
- Coal ore no longer drops XP when mined with a silk touch tool.
|
||||
- Item entities now cannot be picked up when a negative pickup delay is used.
|
||||
- Fixed extra byte at the end of `PlayerSkinPacket` not being read (1.5 protocol change that somehow got lost).
|
||||
|
||||
# 3.1.5
|
||||
- `Config` keys which are considered bools by YAML 1.1 will no longer be transformed into 1 or 0.
|
||||
- Fixed painting motives not getting saved.
|
||||
- Fixed cacti spewing items when placed in some invalid locations.
|
||||
- Fixed entity fire damage not applying in the void.
|
||||
- Fixed entities not getting updated appropriately in some conditions.
|
||||
|
||||
# 3.1.6
|
||||
- Fixed players disconnected during login verification getting leaked and not destroyed correctly.
|
||||
- Updated NBT dependency to 0.2.1 to receive bug fixes (see https://github.com/pmmp/NBT/releases/tag/0.2.1).
|
||||
|
||||
# 3.1.7
|
||||
- Errors thrown during level tick will now crash the server instead of spamming the console.
|
||||
- Fixed arrows despawning too soon after hitting the ground.
|
||||
- Fixed projectiles despawning before colliding if they were airborne for > 60 seconds.
|
||||
|
||||
# 3.1.8
|
||||
- Fixed levels unloaded during an earlier level's tick on the same tick causing a crash.
|
||||
- PermissibleBase->clearPermissions() now properly unsubscribes from all permissions.
|
||||
- Fixed incorrect break check for standing torch.
|
||||
- Fixed drops for brewing stand.
|
||||
- Fixed block picking brewing stand, bed, double slab, cake, farmland, and mob heads giving the wrong items.
|
||||
- Fixed blocks not placing correctly when clicking on redstone ore.
|
||||
- Fixed unknown PC items in tile inventories crashing the server - now they'll be quietly removed instead.
|
||||
- Fixed server freezing when eating chorus fruit from high altitude.
|
||||
- `readline` is now disabled by default on Windows and must be explicitly enabled with `--enable-readline` due to thread-safety issues.
|
||||
- Fixed server crash when trying to use non-implemented splash potions.
|
||||
- Removed incorrect maximum region file size cap which may have caused some worlds to be incorrectly detected as corrupted.
|
121
changelogs/3.2.md
Normal file
121
changelogs/3.2.md
Normal file
@ -0,0 +1,121 @@
|
||||
**For Minecraft: Bedrock Edition 1.6.0**
|
||||
|
||||
This is a minor feature release, including support for Minecraft Bedrock 1.6.0, some new minor gameplay features and some API deprecations and additions.
|
||||
|
||||
### Note
|
||||
Plugins compatible with any previous 3.x.y version will also run on this build and do not need API bumps.
|
||||
|
||||
However, some API features have been deprecated in this version. Plugin developers do not need to do anything about these deprecations immediately, however they may raise harmless warnings if used.
|
||||
|
||||
Features marked **`@deprecated`** are **recommended** not to be used, but will continue to work for any future 3.x.y versions. They will be removed in the next major release (4.0).
|
||||
|
||||
# 3.2.0
|
||||
### Core
|
||||
- `Level` generators are now registered only when needed instead of as soon as a worker starts. This drastically reduces memory consumption on servers with lots of workers.
|
||||
- Async workers are now garbage-collected along with everything else on the default schedule. Idle workers with 0 queued tasks will be shutdown and removed from the pool to reduce memory usage.
|
||||
- UPnP error messages are now more informative of troubleshooting steps.
|
||||
- Errors are no longer caught in cases where they are unrecoverable.
|
||||
|
||||
### API
|
||||
#### Entity
|
||||
- Arrow pickup mode can now be controlled via `Arrow->setPickupMode()`. This accepts one of three `Arrow` constants: `PICKUP_NONE`, `PICKUP_ANY`, `PICKUP_CREATIVE`.
|
||||
- Added new API methods `Projectile->getBaseDamage()` and `Projectile->setBaseDamage()`.
|
||||
- Added new API methods `Entity->getScoreTag()` and `Entity->setScoreTag()`.
|
||||
|
||||
#### Events
|
||||
- The `Listener` interface has now received in-depth documentation about its behaviour and uses. See the top of the `Listener` class to read it.
|
||||
- It is now possible to declare `@ignoreCancelled` on an event handler without specifying `true` or `false`. If no value is found, `true` will be assumed.
|
||||
- `ServerCommandEvent` and `RemoteServerCommandEvent` are now **`@deprecated`** and their usage discouraged. A new generic `CommandEvent` has been introduced in its place, which allows capturing commands from any type of command sender. This was done in response to difficulties of code duplication when wanting to intercept commands from both console and players.
|
||||
- `EntityDamageEvent`
|
||||
- Added `MODIFIER_WEAPON_ENCHANTMENTS` constant for attack damage bonuses due to enchantments like Sharpness.
|
||||
- Added new API methods `getAttackCooldown()` and `setAttackCooldown()` to allow controlling Living entities attack cooldown times (default 10 ticks).
|
||||
- `PlayerDeathEvent`: Added new static method `deriveMessage()`.
|
||||
- `PlayerKickEvent`: Added new method `setReason()`.
|
||||
|
||||
#### Forms
|
||||
- Added a new `pocketmine\form\Form` interface. Implementing this interface permits custom form implementations to make use of `Player->sendForm()`, eliminating the need to handle packets directly and also solving the form ID collision problem.
|
||||
|
||||
#### Items
|
||||
- `Item` and `ItemFactory` now support negative item IDs (needed for future extended blocks support).
|
||||
- Updated `ItemIds` interface with new constants.
|
||||
|
||||
#### Permission
|
||||
- Added a new `PermissionManager` class which encapsulates all of the permission-management functionality originally bloating `PluginManager`. The API is identical to that of `PluginManager`'s permission API. All methods moved to `PermissionManager` have **`@deprecated`** redirects remaining behind in `PluginManager`, which will be removed in the next major release (4.0).
|
||||
|
||||
#### Plugin
|
||||
- `PluginBase->getConfig()` will now automatically save the default config if it does not already exist.
|
||||
- Plugin data directories will now be automatically created on plugin load, eliminating the need for boilerplate `@mkdir($this->getDataFolder())` calls at the top of every plugin.
|
||||
|
||||
#### Tile
|
||||
- `Tile::createNBT()` will now throw a `BadMethodCallException` when called directly.
|
||||
|
||||
#### Utils
|
||||
- `Utils::getURL()`, `Utils::postURL()`, `Utils::simpleCurl()` and `Utils::getIP()` have been moved to a new `pocketmine\utils\Internet` class. The original methods are **`@deprecated`** and will be removed for the next major version (4.0).
|
||||
- Removed the ability for `Config` to be asynchronously saved. This was discussed for removal because of various problems that it causes. It was deemed not worth fixing since `Config` saving should not be significant enough to cause problems anyway. See #2298 for details.
|
||||
|
||||
#### Server
|
||||
- Deprecated `level` parameter of `findEntity()`. This parameter was premature optimization. Code using it will continue to work as before.
|
||||
|
||||
### Gameplay
|
||||
#### General
|
||||
- Air bubbles are now regenerated at the same speed as vanilla UpdateAquatic, instead of instantly when leaving water.
|
||||
- Implemented Conduit Power effect.
|
||||
|
||||
#### Enchantments
|
||||
- Implemented the following enchantments: Thorns, Sharpness, Knockback, Fire Aspect, Power, Punch, Flame, Infinity, Mending.
|
||||
|
||||
#### Items
|
||||
- Added the following new items: `Scute`
|
||||
|
||||
# 3.2.1
|
||||
- Fixed `VerifyLoginTask` completion bug when players get disconnected prior to the task completing.
|
||||
- Fixed client crash issue due to outdated runtime ID mappings.
|
||||
|
||||
# 3.2.2
|
||||
- Updated NBT dependency to 0.2.1 to receive bug fixes (see https://github.com/pmmp/NBT/releases/tag/0.2.1).
|
||||
|
||||
# 3.2.3
|
||||
- Errors thrown during level tick will now crash the server instead of spamming the console.
|
||||
- Fixed arrows despawning too soon after hitting the ground.
|
||||
- Fixed projectiles despawning before colliding if they were airborne for > 60 seconds.
|
||||
- Fixed crash related to Flame enchantment when the player shooting the arrow was on fire.
|
||||
|
||||
# 3.2.4
|
||||
- Fixed levels unloaded during an earlier level's tick on the same tick causing a crash.
|
||||
- PermissibleBase->clearPermissions() now properly unsubscribes from all permissions.
|
||||
- Fixed incorrect break check for standing torch.
|
||||
- Fixed drops for brewing stand.
|
||||
- Fixed block picking brewing stand, bed, double slab, cake, farmland, and mob heads giving the wrong items.
|
||||
- Fixed blocks not placing correctly when clicking on redstone ore.
|
||||
- Fixed unknown PC items in tile inventories crashing the server - now they'll be quietly removed instead.
|
||||
- Fixed server freezing when eating chorus fruit from high altitude.
|
||||
- `readline` is now disabled by default on Windows and must be explicitly enabled with `--enable-readline` due to thread-safety issues.
|
||||
- Fixed server crash when trying to use non-implemented splash potions.
|
||||
- Removed incorrect maximum region file size cap which may have caused some worlds to be incorrectly detected as corrupted.
|
||||
|
||||
# 3.2.5
|
||||
- `Player->sendForm()` now throws a proper exception when failing to JSON-encode `Form` objects given to it.
|
||||
- Fixed crash when handling later packets in a batch when an earlier packet triggered termination of the player's connection.
|
||||
- Fixed a race condition causing progress updates in `AsyncTasks` to be lost when published near completion.
|
||||
- Fixed bad decoding for some packets with unsupported structures.
|
||||
- Crash dumps no longer report 20 empty lines when an error occurs in `eval()`'d code.
|
||||
- `pocketmine/nbt` dependency updated to `0.2.2` to fix bugs (see NBT repo for changelog).
|
||||
|
||||
# 3.2.6
|
||||
- Chunk ticking no longer occurs in chunks which have an adjacent unloaded chunks, fixing things like grass ticking triggering unintentional chunk loading.
|
||||
- Fixed some lighting propagation issues where step count is the same but light level is different.
|
||||
- Fixed full-chunk light repopulation producing broken lighting when the generator hasn't been registered on a worker.
|
||||
- Fixed a missing field in `MoveEntityDeltaPacket`.
|
||||
- Added client-sided rate limiting for crashdump reporting to mitigate involuntary DDoS of the crash archive.
|
||||
- Fixed a bug in `start.cmd` where quotes would appear around the "couldn't find installation" message.
|
||||
|
||||
# 3.2.7
|
||||
- Added a network-layer check for item NBT size to avoid unexplained client-sided crashes due to length overflow.
|
||||
- Fixed some desync bugs with double chests when one half of a double chest is unloaded.
|
||||
- Anonymous class timings will now have a cleaned path for the identifier relative to the plugins directory.
|
||||
- Anonymous class timings now render correctly on timings.pmmp.io.
|
||||
- Fixed empty garbage subchunks not getting removed from long-life chunks.
|
||||
- `start.ps1`, `start.sh` and `start.cmd` no longer recognize source-code installations. Since source-code installations should only be used by developers who know what they are doing anyway, this was considered unwise to keep.
|
||||
- Fixed a bug/oversight in network chunk preparation that caused chunk prepare to be 4x slower than necessary.
|
||||
- `Chunk->fastSerialize()` now doesn't serialize useless data (data is omitted based on chunk flags). This significantly reduces the amount of useless data getting copied for generation, population and light calculation.
|
||||
- `TaskHandler->cancel()` was incorrectly marked as `@internal` in 2014. This has been fixed. Plugin developers should in fact prefer `TaskHandler->cancel()` since it does not require a task to have a circular dependency on its own executor.
|
44
changelogs/3.3.md
Normal file
44
changelogs/3.3.md
Normal file
@ -0,0 +1,44 @@
|
||||
**For Minecraft: Bedrock Edition 1.7.0**
|
||||
|
||||
### Note
|
||||
Plugins compatible with any previous 3.x.y version will also run on these releases and do not need API bumps. Plugin developers should **only** update their required API to this version if you need the bug fixes in this build.
|
||||
|
||||
# 3.3.0
|
||||
- Compatibility with Minecraft: Bedrock Edition 1.7.0
|
||||
- Removed compatibility with 1.6.0
|
||||
- `Player->sendForm()` now throws a proper exception when failing to JSON-encode `Form` objects given to it.
|
||||
- Fixed crash when handling later packets in a batch when an earlier packet triggered termination of the player's connection.
|
||||
- Fixed a race condition causing progress updates in `AsyncTasks` to be lost when published near completion.
|
||||
- Fixed bad decoding for some packets with unsupported structures.
|
||||
- Crash dumps no longer report 20 empty lines when an error occurs in `eval()`'d code.
|
||||
- `pocketmine/nbt` dependency updated to `0.2.2` to fix bugs (see NBT repo for changelog).
|
||||
|
||||
# 3.3.1
|
||||
- Chunk ticking no longer occurs in chunks which have an adjacent unloaded chunks, fixing things like grass ticking triggering unintentional chunk loading.
|
||||
- Fixed some lighting propagation issues where step count is the same but light level is different.
|
||||
- Fixed full-chunk light repopulation producing broken lighting when the generator hasn't been registered on a worker.
|
||||
- Fixed a missing field in `MoveEntityDeltaPacket`.
|
||||
- Added client-sided rate limiting for crashdump reporting to mitigate involuntary DDoS of the crash archive.
|
||||
- Fixed a bug in `start.cmd` where quotes would appear around the "couldn't find installation" message.
|
||||
|
||||
# 3.3.2
|
||||
- Added a network-layer check for item NBT size to avoid unexplained client-sided crashes due to length overflow.
|
||||
- Fixed some desync bugs with double chests when one half of a double chest is unloaded.
|
||||
- Anonymous class timings will now have a cleaned path for the identifier relative to the plugins directory.
|
||||
- Anonymous class timings now render correctly on timings.pmmp.io.
|
||||
- Fixed empty garbage subchunks not getting removed from long-life chunks.
|
||||
- `start.ps1`, `start.sh` and `start.cmd` no longer recognize source-code installations. Since source-code installations should only be used by developers who know what they are doing anyway, this was considered unwise to keep.
|
||||
- Fixed a bug/oversight in network chunk preparation that caused chunk prepare to be 4x slower than necessary.
|
||||
- `Chunk->fastSerialize()` now doesn't serialize useless data (data is omitted based on chunk flags). This significantly reduces the amount of useless data getting copied for generation, population and light calculation.
|
||||
- `TaskHandler->cancel()` was incorrectly marked as `@internal` in 2014. This has been fixed. Plugin developers should in fact prefer `TaskHandler->cancel()` since it does not require a task to have a circular dependency on its own executor.
|
||||
|
||||
# 3.3.3
|
||||
- Development build error messages are now more user friendly.
|
||||
- Fixed meta-only changes not getting saved correctly in `SubChunk->setBlock()`.
|
||||
- Server will now sleep for up to 120 seconds on a crash if the uptime was less than 120 seconds. This delay is intended to reduce crash archive spam and can be skipped by the user if attended by pressing CTRL+C.
|
||||
- Fixed preprocessed builds sometimes having `new ` calls treated as function calls.
|
||||
- Fixed a rare corruption case where player data could be written incorrectly due to a race condition.
|
||||
- `DataPacket` will now throw errors when attempting to read/write nonexisting fields to make it easier to debug protocol change errors.
|
||||
|
||||
# 3.3.4
|
||||
- Fixed an undefined `DataPacket` field making the previous release unusable.
|
97
changelogs/3.4.md
Normal file
97
changelogs/3.4.md
Normal file
@ -0,0 +1,97 @@
|
||||
**For Minecraft: Bedrock Edition 1.7.0**
|
||||
|
||||
This is a cumulative minor release featuring performance improvements, memory usage improvements, some new minor gameplay features, some API deprecations and additions, and significant changes to error handling.
|
||||
|
||||
### Note
|
||||
Plugins compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
|
||||
|
||||
However, some API features have been deprecated in this version. Plugin developers do not need to do anything about these deprecations immediately, however they may raise harmless warnings if used.
|
||||
|
||||
Features marked **`@deprecated`** are **recommended** not to be used, but will continue to work for any future 3.x.y versions. They will be removed in the next major release (4.0).
|
||||
|
||||
# 3.4.0
|
||||
## Core changes
|
||||
### Performance & memory improvements
|
||||
- Entity `EXHAUSTION` attribute is no longer synced to the client, which reduces network traffic for survival players and reduces client-sided lag.
|
||||
- A redundant call was removed from an `Event` call hot path which improves event calling performance by ~15% per event handler executed.
|
||||
- Light updates are now batched together and executed on the end of each tick. The effects of this are noticeable when setting a large number of blocks in a close area - significant performance improvements should be noticeable for world editors (the ones that didn't disable light updates) and liquid flow is now significantly less expensive.
|
||||
- Internal enhancements have been made to subchunk light array interfacing to reduce branching and improve access performance.
|
||||
- Memory usage of most chunks has dropped by ~30-40% due to some improvements to internal storage of unlit subchunks. In real terms this translates to ~30% memory usage reduction for a freshly generated world.
|
||||
|
||||
### Error handling
|
||||
The most notable core change in this release revolves around error handling. Internals have been cleaned up substantially to improve the server behaviour under occurrence of unexpected behaviour. The goal of this is to improve consistency and quality while reducing undefined runtime behaviour.
|
||||
The following changes have been made:
|
||||
- Throwing **unexpected** `Throwable`s in the following cases will now cause a server crash (except on network (this will be changed in the future)):
|
||||
- Event handlers
|
||||
- `Task->onRun()` on a scheduler
|
||||
- `AsyncTask->onCompletion()`
|
||||
- `Command->execute()` and `CommandExecutor->onCommand()`
|
||||
- Unexpected `Throwable`s thrown during packet handling will now cause the target player to be disconnected with an `Internal server error` message.
|
||||
|
||||
### Other changes
|
||||
- Anti-flight has been removed, along with the `allow-flight` directive in `server.properties`.
|
||||
- Server language is now controlled by the `language` directive in `server.properties`.
|
||||
- Added `unban` and `unban-ip` as aliases of `pardon` and `pardon-ip` commands respectively.
|
||||
|
||||
## API changes
|
||||
### Block
|
||||
- `BlockSpreadEvent` is now fired when lava or water tries to flow into a block.
|
||||
- `BlockFormEvent` is now fired when lava and water collide to form cobblestone, obsidian or stone.
|
||||
|
||||
### Event
|
||||
- Added new method `Event->call()`. This should be used instead of `PluginManager->callEvent()` in plugins only supporting 3.4+.
|
||||
- `PluginManager->callEvent()` has been `@deprecated`.
|
||||
|
||||
### Level
|
||||
- Attempting to unload a level during its tick will now throw an `InvalidStateException`.
|
||||
- Added the following new methods:
|
||||
- `Level->broadcastPacketToViewers()`
|
||||
- `Level->getViewersForPosition()`
|
||||
- `Level->broadcastGlobalPacket()`
|
||||
- `Level->getChunkAtPosition()`
|
||||
- `Level->isInLoadedTerrain()`
|
||||
- `Level->addGlobalPacket()` has been `@deprecated`.
|
||||
- `LightUpdate` now allows calling `setAndUpdateLight()` for the same position multiple times (needed for light update batching).
|
||||
|
||||
### Permission
|
||||
- `Permission::getByName()` now throws an exception on invalid values instead of silently returning `DEFAULT_FALSE`. This may cause new errors to appear if your plugins had broken permission defaults in `plugin.yml`.
|
||||
|
||||
### Player
|
||||
- `addWindow()` now has stricter validity checks and will now throw exceptions in the following cases: No window IDs left to use, and when a forced window ID collides with an existing window.
|
||||
- The public `$speed` field has been removed (this was only used by anti-cheat which has now been removed).
|
||||
|
||||
### Scheduler
|
||||
- `AsyncTask->setResult()` has had the `$serialize` parameter removed - now it will automatically serialize (or not) as appropriate.
|
||||
- Added a new `ClosureTask` which allows concisely scheduling closure execution on a `TaskScheduler`.
|
||||
- `TaskScheduler->__construct()` `$logger` parameter has been `@deprecated` and will be removed in a future major version.
|
||||
|
||||
### Server
|
||||
- Added new method `Server->hasOfflinePlayerData(string $name) : bool`.
|
||||
- `Server->getAllowFlight()` has been `@deprecated`.
|
||||
|
||||
### Utils
|
||||
- `Config->save()` will no longer catch unexpected exceptions thrown while encoding data.
|
||||
|
||||
## Gameplay changes
|
||||
### Blocks
|
||||
- Rail connectivity has been implemented for normal, powered, detector and activator rails (but there are currently no minecarts).
|
||||
|
||||
# 3.4.1
|
||||
- Updated crashdump format to be compatible with newest CA. This version or newer is required if you want to be able to submit crashdumps to crash.pmmp.io.
|
||||
|
||||
# 3.4.2
|
||||
- `DataPacket` errors when writing to undefined fields are now more clear.
|
||||
- Fixed trees being able to overwrite the log parts of other trees.
|
||||
- Fixed `Player->sendForm()` not working during `PlayerJoinEvent`.
|
||||
- `Entity->setScale()` now explicitly requires a scale larger than 0.
|
||||
- Adding invisible `FloatingTextParticle` to a level no longer causes an error.
|
||||
|
||||
# 3.4.3
|
||||
- Fixed burning TNT setting hurt entities on fire when exploding.
|
||||
- `~` relative coordinates now work in the `/particle` command.
|
||||
- Various boring fixes to error stack trace reporting.
|
||||
- `Level->setChunk()` no longer deletes tiles and entities when replacing a chunk with itself.
|
||||
- Fixed a generator race condition causing rare appearances of half-trees on the client in freshly generated terrain.
|
||||
- `Attribute->resetToDefault()` now fits the default per the min/max bounds, fixing crashes when the bounds are changed to exclude the default.
|
||||
- Fixed a crash with LevelDB worlds when the `TAG_2D_MAPS` tag is missing.
|
||||
- Fixed `Utils::getCoreCount()` crashing on some Debian variants.
|
149
changelogs/3.5.md
Normal file
149
changelogs/3.5.md
Normal file
@ -0,0 +1,149 @@
|
||||
**For Minecraft: Bedrock Edition 1.8.0**
|
||||
|
||||
### Note
|
||||
Plugins compatible with any previous 3.x.y version will also run on these releases and do not need API bumps. Plugin developers should **only** update their required API to this version if you need the changes in this build.
|
||||
|
||||
# 3.5.0
|
||||
- Compatibility with Minecraft: Bedrock Edition 1.8.0
|
||||
- Removed compatibility with 1.7.0
|
||||
|
||||
# 3.5.1
|
||||
- Fixed internal server errors when attempting to craft.
|
||||
- `DataPacket` errors when writing to undefined fields are now more clear.
|
||||
- Fixed trees being able to overwrite the log parts of other trees.
|
||||
- Fixed `Player->sendForm()` not working during `PlayerJoinEvent`.
|
||||
- `Entity->setScale()` now explicitly requires a scale larger than 0.
|
||||
- Adding invisible `FloatingTextParticle` to a level no longer causes an error.
|
||||
|
||||
# 3.5.2
|
||||
- Updated some misc protocol magic numbers.
|
||||
- Fixed burning TNT setting hurt entities on fire when exploding.
|
||||
- `~` relative coordinates now work in the `/particle` command.
|
||||
- Various boring fixes to error stack trace reporting.
|
||||
- `Level->setChunk()` no longer deletes tiles and entities when replacing a chunk with itself.
|
||||
- Fixed a generator race condition causing rare appearances of half-trees on the client in freshly generated terrain.
|
||||
- `Attribute->resetToDefault()` now fits the default per the min/max bounds, fixing crashes when the bounds are changed to exclude the default.
|
||||
- Fixed a crash with LevelDB worlds when the `TAG_2D_MAPS` tag is missing.
|
||||
- Fixed `Utils::getCoreCount()` crashing on some Debian variants.
|
||||
|
||||
# 3.5.3
|
||||
- Rewritten documentation of `PlayerPreLoginEvent`, `PlayerLoginEvent` and `PlayerJoinEvent`. They are now much more detailed and no longer misleading.
|
||||
- Chest items block-picked from double chests will no longer place chests that crash the server when opened.
|
||||
- Ender chests now make the correct sounds when opening and closing.
|
||||
- Fixed Sign errors when a buggy or malicious client sent broken NBT with the wrong tags or wrong number of lines.
|
||||
- Resource packs with comments in the manifest will now load correctly. (MOJANG!!!)
|
||||
- Placement of unknown blocks is now disallowed. This solves a range of problems with invalid blocks in the world, such as #2260 .
|
||||
- Errors thrown during `PlayerQuitEvent` or other `Player->close()` errors will now crash the server instead of causing cryptic bugs later on.
|
||||
- Fixed large chunks (>= 1044476 bytes) becoming corrupted when saved in Region-based worlds - now an exception is thrown instead.
|
||||
- Reduced the range of exceptions caught during chunk loading. Now, only chunk corruption errors are caught, and anything else will produce a crash.
|
||||
- Removed catch-all block on chunk saving. Unexpected errors thrown during chunk save will now create a crash.
|
||||
- Fixed some asserts in packet decode methods.
|
||||
- `Attribute` now throws exceptions with more informative messages on errors.
|
||||
- Properly handled some remaining `Uninitialized string offset` bugs when decoding packets.
|
||||
- Fixed chunk updates taking several seconds to show up on the client. This bug was most apparent during generation and some world editing tools using asynchronous tasks.
|
||||
- Fixed CPU waste ordering chunks for non-moving players.
|
||||
|
||||
# 3.5.4
|
||||
### Fixes
|
||||
- Fixed server crash when a block update occurs on a torch with corrupted metadata.
|
||||
- Added a hack to mitigate client-side right-click spam bug. This mostly eliminates spam of `PlayerInteractEvent` on right-click.
|
||||
- Players will no longer see commands they don't have permission to use in client-sided hints when typing a `/` in the chat window.
|
||||
- `Event->isCancelled()` and `Event->setCancelled()` now throw more informative errors.
|
||||
- Errors thrown during a network interface processing will now _actually_ crash the server.
|
||||
|
||||
### API changes
|
||||
- Deprecated `NetworkInterfaceCrashEvent`. Nobody should have been using this anyway.
|
||||
- Deprecated `Network->processInterface()`
|
||||
- Deprecated `SourceInterface->emergencyShutdown()`
|
||||
|
||||
# 3.5.5
|
||||
- Mobs no longer spawn with their heads facing a different direction to their bodies.
|
||||
- Added a console message when the crash strangler sleeps to stop crash spam.
|
||||
- Fixed crash in `/title` command `times` subcommand when not enough arguments were passed.
|
||||
- AsyncWorkers will now not be shut down on GC unless they have not been used for the last 5 minutes. This reduces lag spikes on garbage collection.
|
||||
- Fixed some unhandled error cases in `AddEntityPacket` encoding.
|
||||
- Fixed `LogicException` descendents being thrown from some packet decoding methods when encountering bad userdata.
|
||||
- Player network inventory transaction processing now catches more specific errors.
|
||||
- Fixed missing decode for `TakeItemEntityPacket`.
|
||||
- Fixed `/gc` and `/status` truncating memory statistics - now they report to 0.01 precision.
|
||||
- Global functions and constants are now imported to improve performance.
|
||||
- Fixed a typo in `pocketmine.command.op.take` description.
|
||||
- Ice no longer creates water when a creative player breaks it.
|
||||
- `spawn-mobs` and `spawn-animals` no longer appear in generated `server.properties` on a newly-installed server.
|
||||
- Added a hack to disable pre-spawn client-sided movement.
|
||||
- Assertions enabled warning now always shows when `zend.assertions` is not `-1`. The config option to disable this warning has been removed.
|
||||
- `/status`,`/dumpmemory` and `/gc` are now enabled by default. The `debug.commands` config option has been removed.
|
||||
- Crash dumps are now more thorough at catching plugin-related crashes.
|
||||
|
||||
# 3.5.6
|
||||
- Fixed `#`-commenting properties in `.properties` files not working.
|
||||
- `pocketmine.yml` now permits writing `worldname:` with no generation settings in the `worlds` section to force a world to be loaded.
|
||||
- Fixed Bow force being too low - now it's consistent with Minecraft Java (but not with Bedrock due to a vanilla bug).
|
||||
- Fixed `recursion detected` bug when encoding crashdumps in some cases.
|
||||
- Items with too-large NBT tags on network will now have their tags ignored when sending over network, instead of crashing the server. This is a workaround for a protocol bug which will be addressed in a future Minecraft release.
|
||||
- `/enchant` no longer crashes the server when out-of-bounds enchantment levels are used.
|
||||
- Fixed some crashes loading Region-based worlds when encountering unexpected EOF.
|
||||
- `Entity->fireTicks` is now protected (but accessible by magic method for BC purposes) and will now throw an exception when written to if the value is > 32767 or < 0.
|
||||
- Fixed Signs asserting on corrupted world data with more than 4 lines of text per sign.
|
||||
|
||||
# 3.5.7
|
||||
- Fixed several bugs in RCON packet receive that would allow an attacker to block or crash the RCON thread, denying service to other legitimate RCON clients.
|
||||
- Fixed RCON connections not working (timing out with no response) on some platforms.
|
||||
- Logins are now permitted to have up to 60 seconds clock drift on the `nbf` and `exp` timestamps in the login JWT.
|
||||
- Fixed XP orbs following players who switched to a location spatially nearby in a different world.
|
||||
- `Player->removeWindow()` now throws `InvalidArgumentException` instead of `BadMethodCallException` when trying to non-forcefully remove a fixed window ID.
|
||||
|
||||
# 3.5.8
|
||||
- Fixed player XP not dropping if a player was fast enough to respawn.
|
||||
- Player XP drop amount now matches vanilla (7x level points, incurs some loss of points for higher levels)
|
||||
- Fixed Doxygen configuration including test sources.
|
||||
- Improved performance of block-cache accesses.
|
||||
- Improved performance of random block-ticking.
|
||||
- Closure tasks will now show the correctly formatted name on timings.
|
||||
- Fixed a crash when a local update happens next to an `ItemFrame` with invalid metadata.
|
||||
- Fixed player being subscribed to broadcast permissions too early when permissions are modified before spawn.
|
||||
- Block-picking is now disallowed on unknown blocks.
|
||||
- Internal IP detection now works correctly on all platforms.
|
||||
- Fixed UPnP portforwarding not working correctly when multiple network adapters are installed.
|
||||
- Starting or stopping flight now resets fall distance and in-air ticks.
|
||||
- Fixed falling causing starvation.
|
||||
- Fixed crops consuming bone meal when fully grown.
|
||||
- Users are no longer able to avoid agreeing to the license by restarting the server.
|
||||
- Explosions no longer create broken double chests which crash the server. Existing chests affected by this bug will continue to crash. This will be addressed in a future release.
|
||||
- Cactus and sugarcane no longer grow through non-air blocks.
|
||||
- Fixed a memory leak in `setChunk()` when the `unload` parameter is true.
|
||||
- Generator will now crash if preset is invalid, instead of producing unexpected results.
|
||||
|
||||
# 3.5.9
|
||||
- Fixed a `setChunk()` bug introduced by 3.5.8.
|
||||
- Applied a hack to disable client-sided automatic regeneration.
|
||||
- `Level->getChunkPlayers()` is now deprecated.
|
||||
|
||||
# 3.5.10
|
||||
- Some internal `Level` functions are now correctly marked `@internal`.
|
||||
- Fixed splash potion distance being measured from player feet instead of eye height.
|
||||
- Fixed tall grass being unplaceable on dirt.
|
||||
- A debug message is now recorded when a chunk is loaded with no associated loaders.
|
||||
- Composer dependencies have been updated to fix bugs in some dependencies.
|
||||
|
||||
# 3.5.11
|
||||
- Fixed crashing when items with negative IDs are found in the inventory (caused by downgrading from dev builds).
|
||||
- Updated creative inventory and crafting recipes.
|
||||
|
||||
# 3.5.12
|
||||
- Fixed crash when too-large values are given to `/effect` for duration.
|
||||
- `/op` and other commands no longer crash when an invalid player name is given.
|
||||
- Startup time no longer includes the time spent in the setup wizard.
|
||||
- `TextFormat::clean()` is now UTF-8 aware, and will scrub any invalid UTF-8 characters from the given string.
|
||||
- Fixed `TextFormat::clean()` not fully removing ANSI escape codes in some cases.
|
||||
- Fixed Korean command arguments failing to parse.
|
||||
- `Sign->setText()` and `Sign->setLine()` now enforce that the given text must be UTF-8 text, or an exception will be thrown.
|
||||
- Sign text is now processed by `mb_scrub()` immediately after loading to remove invalid UTF-8 characters that could crash the client.
|
||||
- `Human->exhaust()` no longer underflows when the hunger attribute has a fractional value.
|
||||
|
||||
# 3.5.13
|
||||
- Added a hack to disable client sided AI for non-moving entities. This fixes items floating in water despite it not being implemented server-side yet.
|
||||
- Fixed max health not working as expected on respawn if changed by plugins.
|
||||
- Fixed Item Frame hardness (0.25 instead of 0).
|
||||
- Fire Aspect tools will now light TNT when right-clicked with.
|
||||
- Fixed incorrect nullable typehints on `TaskScheduler` return values.
|
65
changelogs/3.6.md
Normal file
65
changelogs/3.6.md
Normal file
@ -0,0 +1,65 @@
|
||||
**For Minecraft: Bedrock Edition 1.9.0**
|
||||
|
||||
### Note
|
||||
Plugins compatible with any previous 3.x.y version will also run on these releases and do not need API bumps. Plugin developers should **only** update their required API to this version if you need the changes in this build.
|
||||
|
||||
This changelog **does not account for protocol changes**. If your plugin uses the protocol, you're not shielded by API change constraints.
|
||||
|
||||
# 3.6.0
|
||||
- Compatibility with Minecraft: Bedrock Edition 1.9.0
|
||||
- Removed compatibility with 1.8.0
|
||||
- `Item->getCompoundTag()` is now `@deprecated`.
|
||||
- `Item->setCompoundTag()` now accepts NULL as a possible value.
|
||||
- `ItemFactory::fromString()` now accepts NULL for the `tags` parameter.
|
||||
|
||||
# 3.6.1
|
||||
- Fixed crashing when items with negative IDs are found in the inventory (caused by downgrading from dev builds).
|
||||
- Updated creative inventory and crafting recipes.
|
||||
- Fixed handling for some new blocks which magically appeared without appropriate implementations (extra meta values).
|
||||
|
||||
# 3.6.2
|
||||
- Fixed client-sided crash when upper-case letters appear in command names.
|
||||
- Fixed crash when too-large values are given to `/effect` for duration.
|
||||
- `/op` and other commands no longer crash when an invalid player name is given.
|
||||
- Startup time no longer includes the time spent in the setup wizard.
|
||||
- `TextFormat::clean()` is now UTF-8 aware, and will scrub any invalid UTF-8 characters from the given string.
|
||||
- Fixed `TextFormat::clean()` not fully removing ANSI escape codes in some cases.
|
||||
- Fixed Korean command arguments failing to parse.
|
||||
- `Sign->setText()` and `Sign->setLine()` now enforce that the given text must be UTF-8 text, or an exception will be thrown.
|
||||
- Sign text is now processed by `mb_scrub()` immediately after loading to remove invalid UTF-8 characters that could crash the client.
|
||||
- `Human->exhaust()` no longer underflows when the hunger attribute has a fractional value.
|
||||
|
||||
# 3.6.3
|
||||
- Added a hack to disable client sided AI for non-moving entities. This fixes items floating in water despite it not being implemented server-side yet.
|
||||
- Fixed max health not working as expected on respawn if changed by plugins.
|
||||
- Fixed Item Frame hardness (0.25 instead of 0).
|
||||
- Fire Aspect tools will now light TNT when right-clicked with.
|
||||
- Fixed incorrect nullable typehints on `TaskScheduler` return values.
|
||||
|
||||
# 3.6.4
|
||||
- `NetworkStackLatencyPacket` unhandled debug has been silenced.
|
||||
- Fixed `Player->removeWindow()` removing GUI or crashing clients when removing a window which was not added.
|
||||
- Fixed packed ice dropping itself when mined without a silk touch pickaxe.
|
||||
- Fixed players not taking fall damage when falling off the side of a ladder when their AABB was intersecting with the ladder's full block area.
|
||||
- Fixed arrows reloaded from disk never despawning.
|
||||
- Fixed player XP not dropping on death.
|
||||
- Fixed player's held slot being out of sync when respawning.
|
||||
- Fixed items with different NBT being considered stackable in some cases by `BaseInventory->canAddItem()`.
|
||||
|
||||
# 3.6.5
|
||||
- Fixed stdout silence on crash if a crash occurs when PHP output buffering is enabled.
|
||||
- Fixed `RegionLoader` considering a range of invalid chunk coordinates as valid.
|
||||
- Fixed `RegionLoader` causing region header corruption when an oversized chunk was discovered. This was causing entire regions to be discarded next time they were freshly loaded.
|
||||
- Fixed performance issue loading old LevelDB worlds (from before MCPE 1.0) due to unmodified chunks being converted every time they were loaded.
|
||||
- Added new debug messages when a world takes too long (longer than 50ms) to complete a tick.
|
||||
- Debug messages are now logged when autosave kicks in (with time measurements), which helps debugging unexplained lag spikes.
|
||||
- Level "auto tick rate" anti-feature and its associated `pocketmine.yml` settings have been removed (see #2665). The settings will persist in old configurations, but will be ignored by this version and future versions.
|
||||
- The `/save-all` command now outputs custom (non-vanilla) messages informing the user how long it took to complete autosaving.
|
||||
- The word `level` has been replaced with `world` (where appropriate) throughout language strings and general user interface messages.
|
||||
|
||||
# 3.6.6
|
||||
- Fixed protocol argument types for commands.
|
||||
- Autosave debug message will now report in milliseconds when the time taken is less than 1 second.
|
||||
- Flatworld presets now allow `*` as a multiplier symbol (fixes PC compatibility).
|
||||
- Network runtimeIDs for blocks are now randomized to prevent things (like plugins) relying on them.
|
||||
- Updated NBT dependency to 0.2.7 for some bug fixes.
|
33
changelogs/3.7.md
Normal file
33
changelogs/3.7.md
Normal file
@ -0,0 +1,33 @@
|
||||
**For Minecraft: Bedrock Edition 1.10.0**
|
||||
|
||||
### Note
|
||||
Plugins compatible with any previous 3.x.y version will also run on these releases and do not need API bumps. Plugin developers should **only** update their required API to this version if you need the changes in this build.
|
||||
|
||||
This changelog **does not account for protocol changes**. If your plugin uses the protocol, you're not shielded by API change constraints.
|
||||
|
||||
# 3.7.0
|
||||
- Compatibility with Minecraft: Bedrock Edition 1.10.0
|
||||
- Removed compatibility with 1.9.0
|
||||
|
||||
# 3.7.1
|
||||
- Fixed protocol argument types for commands.
|
||||
- Autosave debug message will now report in milliseconds when the time taken is less than 1 second.
|
||||
- Flatworld presets now allow `*` as a multiplier symbol (fixes PC compatibility).
|
||||
- Network runtimeIDs for blocks are now randomized to prevent things (like plugins) relying on them.
|
||||
- Updated NBT dependency to 0.2.7 for some bug fixes.
|
||||
|
||||
# 3.7.2
|
||||
- Fixed a memory leak when `PlayerLoginEvent` is cancelled.
|
||||
- Fixed permissions `pocketmine.command.ban.list`, `pocketmine.command.difficulty`, `pocketmine.command.whitelist.enable` and `pocketmine.command.whitelist.disable` always being granted to operators.
|
||||
- Fixed some commands outputting `commands.generic.permission` instead of the proper message when running commands that the sender doesn't have permission to use.
|
||||
- Worlds with unknown generator types will now refuse to load instead of getting incorrect terrain generation ruining them.
|
||||
- `TextFormat::tokenize()` no longer corrupts Unicode sequences.
|
||||
- `TextFormat::clean()` now removes non-printable Unicode code points in the private-use area.
|
||||
- Running two servers in the same data directory is no longer allowed and will gracefully halt instead of corrupting your data.
|
||||
- Sign text length is now soft-capped at 1000 characters.
|
||||
|
||||
# 3.7.3
|
||||
- World save timings now include saves that are triggered by chunk unloading.
|
||||
- Fixed several network denial-of-service bugs.
|
||||
- A warning is now emitted when the `ChunkUtils` extension is not loaded.
|
||||
- Moved version constants to a separate `VersionInfo` file for easier parsing and handling.
|
69
changelogs/3.8.md
Normal file
69
changelogs/3.8.md
Normal file
@ -0,0 +1,69 @@
|
||||
**For Minecraft: Bedrock Edition 1.11.0**
|
||||
|
||||
### Note
|
||||
Plugins compatible with any previous 3.x.y version will also run on these releases and do not need API bumps. Plugin developers should **only** update their required API to this version if you need the changes in this build.
|
||||
|
||||
This changelog **does not account for protocol changes**. If your plugin uses the protocol, you're not shielded by API change constraints.
|
||||
|
||||
# 3.8.0
|
||||
- Compatibility with Minecraft: Bedrock Edition 1.11.0
|
||||
- Removed compatibility with 1.10.0
|
||||
|
||||
# 3.8.1
|
||||
- Fixed furnace smelting recipes not working.
|
||||
- Reduced legacy hacks dealing with `BatchPacket` to fix possible ID collisions.
|
||||
- Reduced release phar size by minifying JSON data blobs.
|
||||
- Moved some MCPE-specific JSON blobs to submodule.
|
||||
|
||||
# 3.8.2
|
||||
- Fixed --enable-ansi and --disable-ansi not being respected on threads.
|
||||
- Fixed a crash that could occur when decoding `AvailableCommandsPacket`.
|
||||
- Fixed a crash when loading worlds with entities with missing `Motion` NBT tag.
|
||||
- Fixed a crash when world time overflows signed int64 max.
|
||||
- Fixed world generators and providers being registered too late (this was causing plugin issues).
|
||||
- Updated RakLib version to get a security fix.
|
||||
- Fixed errors when custom clients fill the wrong information in `ResourcePackClientResponsePacket`.
|
||||
- Fixed `setImmobile()` getting overridden directly after `PlayerJoinEvent`.
|
||||
- Fixed air being breakable by creative players.
|
||||
- Fixed performance loss caused by bugs in the preprocessor.
|
||||
|
||||
# 3.8.3
|
||||
- Fixed infinite recursion when using `Entity->close()` during `EntityDespawnEvent`.
|
||||
- Fixed crash reports caused by folder plugins being reported to the crash archive.
|
||||
- Fixed spawning entities on unloaded chunks during spawn sequence (possible client crash cause).
|
||||
- Fixed `/time query` output message.
|
||||
- Fixed `Server->hasOfflinePlayerData()` being case-sensitive.
|
||||
- Improved error messages for skin validation in some places.
|
||||
- Fixed classic stonecutter hardness.
|
||||
- Fixed iron trapdoors being considered a valid furnace fuel.
|
||||
- Fixed apple dropping from leaves happening less frequently than intended.
|
||||
- Fixed tall plants like sunflower being replaceable by the top half.
|
||||
|
||||
# 3.8.4
|
||||
- Plugin load order is now randomised to remove the ability to implicitly depend on filesystem-specific ordering.
|
||||
- Packet logging in debug messages now uses base64 instead of hex (uses less space).
|
||||
- Array and string size are now shown in error stack trace logs.
|
||||
- Stack traces now render a maximum of 80 characters when making string parameters printable.
|
||||
- Improved documentation for some transaction classes.
|
||||
- Action order in inventory transactions is now randomised to prevent dependencies on any accidental or client-dependent ordering. Since the transaction system is specifically designed to avoid depending on order, this does not affect any core functionality.
|
||||
|
||||
# 3.8.5
|
||||
- Moved preprocessor to build/ directory.
|
||||
- Added documentation for `Server->getPlayer()`, `Server->getPlayerExact()` and `Server->matchPlayer()`.
|
||||
- `server.lock` now contains the PID of the currently-running server.
|
||||
- PID of server is now reported in the error message when attempting to run two servers from the same data directory at once.
|
||||
- Fixed sluggish playercount updating on MOTD.
|
||||
- Added new MultiRecipe UUIDs.
|
||||
- Added an extra field to `StartGamePacket` to resolve minor incompatibility issues on different 1.11.x patch versions.
|
||||
|
||||
# 3.8.6
|
||||
- Fixed `Entity->isNameTagAlwaysVisible()` not working.
|
||||
- Log messages are now cleaned of invalid UTF-8 sequences before emitting them.
|
||||
- Fixed negative integers being considered as strings for world seeds.
|
||||
- Fixed out-of-bounds access on invalid inventory data in player data saves.
|
||||
- Fixed crash when custom liquids have flow decays which aren't factors of 4.
|
||||
- Fixed `Entity->noDamageTicks` not working when the entity had no previous damage cause.
|
||||
|
||||
# 3.8.7
|
||||
- Improved documentation of `Player->getDisplayName()` and `Player::isValidUserName()`.
|
||||
- Fixed a bug in `SetScorePacket` decoding causing the entry list to always be empty.
|
107
changelogs/3.9.md
Normal file
107
changelogs/3.9.md
Normal file
@ -0,0 +1,107 @@
|
||||
**For Minecraft: Bedrock Edition 1.12.0**
|
||||
|
||||
### Note about API versions
|
||||
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
|
||||
Plugin developers should **only** update their required API to this version if you need the changes in this build.
|
||||
|
||||
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
|
||||
|
||||
# 3.9.0
|
||||
- Added support for Minecraft: Bedrock Edition 1.12.0
|
||||
- Removed compatibility with 1.11.0
|
||||
|
||||
## Protocol
|
||||
- The following classes in the `\pocketmine\network\mcpe\protocol` namespace have been renamed:
|
||||
- `AddEntityPacket` -> `AddActorPacket`
|
||||
- `AddItemEntityPacket` -> `AddItemActorPacket`
|
||||
- `AvailableEntityIdentifiersPacket` -> `AvailableActorIdentifiersPacket`
|
||||
- `BlockEntityDataPacket` -> `BlockActorDataPacket`
|
||||
- `EntityEventPacket` -> `ActorEventPacket`
|
||||
- `EntityFallPacket` -> `ActorFallPacket`
|
||||
- `EntityPickRequestPacket` -> `ActorPickRequestPacket`
|
||||
- `MoveEntityAbsolutePacket` -> `MoveActorAbsolutePacket`
|
||||
- `MoveEntityDeltaPacket` -> `MoveActorDeltaPacket`
|
||||
- `RemoveEntityPacket` -> `RemoveActorPacket`
|
||||
- `SetEntityDataPacket` -> `SetActorDataPacket`
|
||||
- `SetEntityLinkPacket` -> `SetActorLinkPacket`
|
||||
- `SetEntityMotionPacket` -> `SetActorMotionPacket`
|
||||
- `TakeItemEntityPacket` -> `TakeItemActorPacket`
|
||||
- The following classes in the `\pocketmine\network\mcpe\protocol` namespace have been removed:
|
||||
- `FullChunkDataPacket`
|
||||
- The following classes in the `\pocketmine\network\mcpe\protocol` namespace have been added:
|
||||
- `AddEntityPacket` (not to be confused with the old one)
|
||||
- `ClientCacheBlobStatusPacket`
|
||||
- `ClientCacheMissResponsePacket`
|
||||
- `ClientCacheStatusPacket`
|
||||
- `LevelChunkPacket`
|
||||
- `RemoveEntityPacket` (not to be confused with the old one)
|
||||
- `StructureTemplateDataExportRequestPacket`
|
||||
- `StructureTemplateDataExportResponsePacket`
|
||||
|
||||
# 3.9.1
|
||||
- Fixed resource packs not working on 1.12 clients.
|
||||
- Fixed some particles displaying incorrectly (some still don't render at all).
|
||||
- Fixed `Entity->setFireTicks()` with a value of `0` setting the on-fire flag.
|
||||
- Silenced a debug message which appeared every time a player right-clicked a block.
|
||||
- Updated constants for `LevelSoundEventPacket`.
|
||||
|
||||
# 3.9.2
|
||||
- Logger warnings for illegal player movements have been lowered to debug.
|
||||
- TNT explosions now start from the center instead of the base. This fixes unexpected results when TNT is lit on top of obsidian.
|
||||
- Fixed the `loadbefore` directive in `plugin.yml` sometimes being ignored.
|
||||
- Fixed `Item->setCustomName()` with an empty string leaving behind an empty tag.
|
||||
- Fixed incorrect positioning of bucket empty sound.
|
||||
- Fixed some incorrect tag parsing in `/give` involving quoted numbers.
|
||||
|
||||
# 3.9.3
|
||||
- Fixed a memory leak on async task removal in error conditions.
|
||||
- Fixed scheduled block updates (for example liquid) triggering chunk reloading. This could cause a significant performance issue in some conditions.
|
||||
- Fixed some minor cosmetic issues in documentation.
|
||||
|
||||
# 3.9.4
|
||||
- Fixed a memory leak when scheduled updates were pending on a chunk being unloaded.
|
||||
- Fixed plugin detection in crashdumps. Previously `src/pocketmine` anywhere in the path would cause the error to be considered a core crash, regardless of the preceding path.
|
||||
- Fixed entity metadata types for 1.12. The SLOT type was removed and a COMPOUND_TAG type added. This change involves changes to internal API which may break plugins. **See the warning at the top of this changelog about API versioning.**
|
||||
- Fixed random and base populator amounts of trees and tallgrass never being initialized. This bug had no obvious effect, but may have become a problem in future PHP versions.
|
||||
- The following internal methods have been marked as `@deprecated` and documentation warnings added:
|
||||
- `Entity->getBlocksAround()`
|
||||
- `Entity->despawnFrom()`
|
||||
- `Entity->despawnFromAll()`
|
||||
- Fixed plugin `softdepend` not influencing load order when a soft-depended plugin had an unresolved soft dependency of its own.
|
||||
- Fixed endless falling of sand on top of fences.
|
||||
|
||||
# 3.9.5
|
||||
- Fixed some issues with multiple consecutive commas inside quotes in form responses.
|
||||
- Fixed server crash when the manifest json does not contain a json object in a resource pack.
|
||||
- Ender pearls no longer collide with blocks that do not have any collision boxes.
|
||||
|
||||
# 3.9.6
|
||||
- Updated Composer dependencies to their latest versions.
|
||||
- Prevent clients repeating the resource pack sequence. This fixes error spam with bugged 1.12 clients.
|
||||
- `Internet::simpleCurl()` now includes the PocketMine-MP version in the user-agent string.
|
||||
- Spawn protection is now disabled by default in the setup wizard.
|
||||
- Default difficulty is now NORMAL(2) instead of EASY(1).
|
||||
- Fixed crashing on corrupted world manifest and unsupported world formats.
|
||||
- Fixed `/transferserver` being usable without appropriate permissions.
|
||||
- `RegionLoader->removeChunk()` now writes the region header as appropriate.
|
||||
- Fixed performance issue when loading large regions (bug in header validation).
|
||||
- Fixed skin geometry being removed when the JSON contained comments.
|
||||
- Added new constants to `EventPacket`.
|
||||
- Added encode/decode for `StructureTemplateDataExportRequestPacket` and `StructureTemplateDataExportResponsePacket`.
|
||||
- Fixed broken type asserts in `LevelChunkPacket::withCache()` and `ClientCacheMissResponsePacket::create()`.
|
||||
- `types\CommandParameter` field `byte1` has been renamed to `flags`.
|
||||
- Cleaned up public interface of `AvailableCommandsPacket`, removing fields which exposed details of the encoding scheme.
|
||||
- Improved documentation for the following API methods:
|
||||
- `pocketmine\item\Item`:
|
||||
- `addCreativeItem()`
|
||||
- `removeCreativeItem()`
|
||||
- `clearCreativeItems()`
|
||||
- `pocketmine\level\Explosion`:
|
||||
- `explodeA()`
|
||||
- `explodeB()`
|
||||
- Fixed various cosmetic documentation inconsistencies in the core and dependencies.
|
||||
|
||||
# 3.9.7
|
||||
- Fixed a crash that could occur during timezone detection.
|
||||
- Squid no longer spin around constantly in enclosed spaces. Their performance impact is reduced.
|
||||
- Cleaned up the bootstrap file.
|
@ -17,17 +17,17 @@
|
||||
"ext-openssl": "*",
|
||||
"ext-pcre": "*",
|
||||
"ext-phar": "*",
|
||||
"ext-pthreads": ">=3.1.7dev",
|
||||
"ext-pthreads": "~3.2.0",
|
||||
"ext-reflection": "*",
|
||||
"ext-sockets": "*",
|
||||
"ext-spl": "*",
|
||||
"ext-yaml": ">=2.0.0",
|
||||
"ext-zip": "*",
|
||||
"ext-zlib": ">=1.2.11",
|
||||
"pocketmine/raklib": "^0.12.0",
|
||||
"pocketmine/raklib": "^0.12.5",
|
||||
"pocketmine/spl": "^0.3.0",
|
||||
"pocketmine/binaryutils": "^0.1.0",
|
||||
"pocketmine/nbt": "^0.2.1",
|
||||
"pocketmine/binaryutils": "^0.1.9",
|
||||
"pocketmine/nbt": "^0.2.10",
|
||||
"pocketmine/math": "^0.2.0",
|
||||
"pocketmine/snooze": "^0.1.0",
|
||||
"daverandom/callback-validator": "dev-master",
|
||||
|
61
composer.lock
generated
61
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "d3fb809caf4d5a5c99054f47f28ff271",
|
||||
"content-hash": "377d9e0ab5f1a9a4ef9b664706d26f5b",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/json-comment",
|
||||
@ -92,16 +92,16 @@
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/binaryutils",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pmmp/BinaryUtils.git",
|
||||
"reference": "3403751da9d39853b43426085cd242173baadd2b"
|
||||
"reference": "435f2ee265bce75ef1aa9563f9b60ff36d705e80"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pmmp/BinaryUtils/zipball/3403751da9d39853b43426085cd242173baadd2b",
|
||||
"reference": "3403751da9d39853b43426085cd242173baadd2b",
|
||||
"url": "https://api.github.com/repos/pmmp/BinaryUtils/zipball/435f2ee265bce75ef1aa9563f9b60ff36d705e80",
|
||||
"reference": "435f2ee265bce75ef1aa9563f9b60ff36d705e80",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -119,23 +119,23 @@
|
||||
],
|
||||
"description": "Classes and methods for conveniently handling binary data",
|
||||
"support": {
|
||||
"source": "https://github.com/pmmp/BinaryUtils/tree/0.1.7",
|
||||
"source": "https://github.com/pmmp/BinaryUtils/tree/0.1.10",
|
||||
"issues": "https://github.com/pmmp/BinaryUtils/issues"
|
||||
},
|
||||
"time": "2019-01-07T15:59:50+00:00"
|
||||
"time": "2019-10-21T14:40:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/math",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pmmp/Math.git",
|
||||
"reference": "b755d3fb7025c4ddb7d9d6df0ba7e0b65125e51c"
|
||||
"reference": "68be8a79fd0169043ef514797c304517cb8a6071"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pmmp/Math/zipball/b755d3fb7025c4ddb7d9d6df0ba7e0b65125e51c",
|
||||
"reference": "b755d3fb7025c4ddb7d9d6df0ba7e0b65125e51c",
|
||||
"url": "https://api.github.com/repos/pmmp/Math/zipball/68be8a79fd0169043ef514797c304517cb8a6071",
|
||||
"reference": "68be8a79fd0169043ef514797c304517cb8a6071",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -153,30 +153,30 @@
|
||||
],
|
||||
"description": "PHP library containing math related code used in PocketMine-MP",
|
||||
"support": {
|
||||
"source": "https://github.com/pmmp/Math/tree/0.2.2",
|
||||
"source": "https://github.com/pmmp/Math/tree/0.2.3",
|
||||
"issues": "https://github.com/pmmp/Math/issues"
|
||||
},
|
||||
"time": "2019-01-04T15:42:36+00:00"
|
||||
"time": "2019-10-21T14:35:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/nbt",
|
||||
"version": "0.2.5",
|
||||
"version": "0.2.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pmmp/NBT.git",
|
||||
"reference": "0b290fa0f5b44835ebeea8146c9ac960cac833f5"
|
||||
"reference": "78784b93632c51f0fad0719b2d6ffe072529db6d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pmmp/NBT/zipball/0b290fa0f5b44835ebeea8146c9ac960cac833f5",
|
||||
"reference": "0b290fa0f5b44835ebeea8146c9ac960cac833f5",
|
||||
"url": "https://api.github.com/repos/pmmp/NBT/zipball/78784b93632c51f0fad0719b2d6ffe072529db6d",
|
||||
"reference": "78784b93632c51f0fad0719b2d6ffe072529db6d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-zlib": "*",
|
||||
"php": ">=7.2.0",
|
||||
"php-64bit": "*",
|
||||
"pocketmine/binaryutils": "^0.1.0"
|
||||
"pocketmine/binaryutils": "^0.1.9"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@ -194,33 +194,33 @@
|
||||
],
|
||||
"description": "PHP library for working with Named Binary Tags",
|
||||
"support": {
|
||||
"source": "https://github.com/pmmp/NBT/tree/0.2.5",
|
||||
"source": "https://github.com/pmmp/NBT/tree/0.2.11",
|
||||
"issues": "https://github.com/pmmp/NBT/issues"
|
||||
},
|
||||
"time": "2019-01-07T17:28:16+00:00"
|
||||
"time": "2019-10-21T14:50:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/raklib",
|
||||
"version": "0.12.1",
|
||||
"version": "0.12.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pmmp/RakLib.git",
|
||||
"reference": "334b469f2d0f070f17902d7ac584bea7c6149dc6"
|
||||
"reference": "874db2d3c24117db2221c1e4550380478aeea852"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/334b469f2d0f070f17902d7ac584bea7c6149dc6",
|
||||
"reference": "334b469f2d0f070f17902d7ac584bea7c6149dc6",
|
||||
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/874db2d3c24117db2221c1e4550380478aeea852",
|
||||
"reference": "874db2d3c24117db2221c1e4550380478aeea852",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-bcmath": "*",
|
||||
"ext-pthreads": ">=3.1.7dev",
|
||||
"ext-pthreads": "~3.2.0",
|
||||
"ext-sockets": "*",
|
||||
"php": ">=7.2.0",
|
||||
"php-64bit": "*",
|
||||
"php-ipv6": "*",
|
||||
"pocketmine/binaryutils": "^0.1.0",
|
||||
"pocketmine/binaryutils": "^0.1.9",
|
||||
"pocketmine/snooze": "^0.1.0",
|
||||
"pocketmine/spl": "^0.3.0"
|
||||
},
|
||||
@ -235,10 +235,10 @@
|
||||
],
|
||||
"description": "A RakNet server implementation written in PHP",
|
||||
"support": {
|
||||
"source": "https://github.com/pmmp/RakLib/tree/0.12.1",
|
||||
"source": "https://github.com/pmmp/RakLib/tree/0.12",
|
||||
"issues": "https://github.com/pmmp/RakLib/issues"
|
||||
},
|
||||
"time": "2019-01-04T14:23:37+00:00"
|
||||
"time": "2019-07-22T14:38:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/snooze",
|
||||
@ -302,7 +302,7 @@
|
||||
],
|
||||
"description": "Standard library files required by PocketMine-MP and related projects",
|
||||
"support": {
|
||||
"source": "https://github.com/pmmp/SPL/tree/0.3.2"
|
||||
"source": "https://github.com/pmmp/SPL/tree/master"
|
||||
},
|
||||
"time": "2018-08-12T15:17:39+00:00"
|
||||
}
|
||||
@ -311,7 +311,6 @@
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {
|
||||
"ext-pthreads": 20,
|
||||
"daverandom/callback-validator": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
@ -329,7 +328,7 @@
|
||||
"ext-openssl": "*",
|
||||
"ext-pcre": "*",
|
||||
"ext-phar": "*",
|
||||
"ext-pthreads": ">=3.1.7dev",
|
||||
"ext-pthreads": "~3.2.0",
|
||||
"ext-reflection": "*",
|
||||
"ext-sockets": "*",
|
||||
"ext-spl": "*",
|
||||
|
File diff suppressed because it is too large
Load Diff
10
doxygen/index.md
Normal file
10
doxygen/index.md
Normal file
@ -0,0 +1,10 @@
|
||||
## PocketMine-MP API Documentation
|
||||
|
||||
This site contains auto-generated API documentation for PocketMine-MP (and dependencies which are not outsourced). Documentation here is regenerated for every release.
|
||||
|
||||
This site can be accessed via https://apidoc.pmmp.io.
|
||||
|
||||
### Additional developer resources
|
||||
- [DevTools](https://github.com/pmmp/PocketMine-DevTools/) - Development tools plugin for creating plugins
|
||||
- [ExamplePlugin](https://github.com/pmmp/ExamplePlugin/) - Example plugin demonstrating some basic API features
|
||||
- [DeveloperDocs](https://github.com/pmmp/DeveloperDocs/) - Reference, guides and specifications for the PocketMine-MP API
|
@ -291,7 +291,7 @@ class CrashDump{
|
||||
|
||||
private function determinePluginFromFile(string $filePath, bool $crashFrame) : bool{
|
||||
$frameCleanPath = Utils::cleanPath($filePath); //this will be empty in phar stub
|
||||
if($frameCleanPath !== "" and strpos($frameCleanPath, "src/pocketmine/") === false and strpos($frameCleanPath, "vendor/pocketmine/") === false and file_exists($filePath)){
|
||||
if(strpos($frameCleanPath, "plugins") === 0 and file_exists($filePath)){
|
||||
$this->addLine();
|
||||
if($crashFrame){
|
||||
$this->addLine("THIS CRASH WAS CAUSED BY A PLUGIN");
|
||||
@ -333,7 +333,7 @@ class CrashDump{
|
||||
$this->data["general"]["php_os"] = PHP_OS;
|
||||
$this->data["general"]["os"] = Utils::getOS();
|
||||
$this->addLine($this->server->getName() . " version: " . $version->getFullVersion(true) . " [Protocol " . ProtocolInfo::CURRENT_PROTOCOL . "]");
|
||||
$this->addLine("Git commit: " . GIT_COMMIT);
|
||||
$this->addLine("Git commit: " . \pocketmine\GIT_COMMIT);
|
||||
$this->addLine("uname -a: " . php_uname("a"));
|
||||
$this->addLine("PHP Version: " . phpversion());
|
||||
$this->addLine("Zend version: " . zend_version());
|
||||
|
@ -26,6 +26,7 @@ namespace pocketmine;
|
||||
use pocketmine\block\Bed;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\block\UnknownBlock;
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\entity\Effect;
|
||||
@ -98,19 +99,20 @@ use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\DoubleTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\network\mcpe\PlayerNetworkSessionAdapter;
|
||||
use pocketmine\network\mcpe\protocol\ActorEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\AdventureSettingsPacket;
|
||||
use pocketmine\network\mcpe\protocol\AnimatePacket;
|
||||
use pocketmine\network\mcpe\protocol\AvailableActorIdentifiersPacket;
|
||||
use pocketmine\network\mcpe\protocol\AvailableCommandsPacket;
|
||||
use pocketmine\network\mcpe\protocol\AvailableEntityIdentifiersPacket;
|
||||
use pocketmine\network\mcpe\protocol\BatchPacket;
|
||||
use pocketmine\network\mcpe\protocol\BlockEntityDataPacket;
|
||||
use pocketmine\network\mcpe\protocol\BiomeDefinitionListPacket;
|
||||
use pocketmine\network\mcpe\protocol\BlockActorDataPacket;
|
||||
use pocketmine\network\mcpe\protocol\BlockPickRequestPacket;
|
||||
use pocketmine\network\mcpe\protocol\BookEditPacket;
|
||||
use pocketmine\network\mcpe\protocol\ChunkRadiusUpdatedPacket;
|
||||
use pocketmine\network\mcpe\protocol\ContainerClosePacket;
|
||||
use pocketmine\network\mcpe\protocol\DataPacket;
|
||||
use pocketmine\network\mcpe\protocol\DisconnectPacket;
|
||||
use pocketmine\network\mcpe\protocol\EntityEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\InteractPacket;
|
||||
use pocketmine\network\mcpe\protocol\InventoryTransactionPacket;
|
||||
use pocketmine\network\mcpe\protocol\ItemFrameDropItemPacket;
|
||||
@ -185,6 +187,7 @@ use function min;
|
||||
use function preg_match;
|
||||
use function round;
|
||||
use function spl_object_hash;
|
||||
use function sqrt;
|
||||
use function strlen;
|
||||
use function strpos;
|
||||
use function strtolower;
|
||||
@ -208,7 +211,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
public const VIEW = Player::SPECTATOR;
|
||||
|
||||
/**
|
||||
* Checks a supplied username and checks it is valid.
|
||||
* Validates the given username.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
@ -258,6 +261,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
/** @var bool */
|
||||
public $loggedIn = false;
|
||||
|
||||
/** @var bool */
|
||||
private $resourcePacksDone = false;
|
||||
|
||||
/** @var bool */
|
||||
public $spawned = false;
|
||||
|
||||
@ -390,7 +396,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
public function isBanned() : bool{
|
||||
return $this->server->getNameBans()->isBanned($this->iusername);
|
||||
return $this->server->getNameBans()->isBanned($this->username);
|
||||
}
|
||||
|
||||
public function setBanned(bool $value){
|
||||
@ -403,14 +409,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
public function isWhitelisted() : bool{
|
||||
return $this->server->isWhitelisted($this->iusername);
|
||||
return $this->server->isWhitelisted($this->username);
|
||||
}
|
||||
|
||||
public function setWhitelisted(bool $value){
|
||||
if($value){
|
||||
$this->server->addWhitelist($this->iusername);
|
||||
$this->server->addWhitelist($this->username);
|
||||
}else{
|
||||
$this->server->removeWhitelist($this->iusername);
|
||||
$this->server->removeWhitelist($this->username);
|
||||
}
|
||||
}
|
||||
|
||||
@ -475,8 +481,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
public function setFlying(bool $value){
|
||||
$this->flying = $value;
|
||||
$this->sendSettings();
|
||||
if($this->flying !== $value){
|
||||
$this->flying = $value;
|
||||
$this->resetFallDistance();
|
||||
$this->sendSettings();
|
||||
}
|
||||
}
|
||||
|
||||
public function isFlying() : bool{
|
||||
@ -688,14 +697,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
$this->perm->recalculatePermissions();
|
||||
|
||||
if($this->hasPermission(Server::BROADCAST_CHANNEL_USERS)){
|
||||
$permManager->subscribeToPermission(Server::BROADCAST_CHANNEL_USERS, $this);
|
||||
}
|
||||
if($this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)){
|
||||
$permManager->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this);
|
||||
}
|
||||
|
||||
if($this->spawned){
|
||||
if($this->hasPermission(Server::BROADCAST_CHANNEL_USERS)){
|
||||
$permManager->subscribeToPermission(Server::BROADCAST_CHANNEL_USERS, $this);
|
||||
}
|
||||
if($this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)){
|
||||
$permManager->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this);
|
||||
}
|
||||
|
||||
$this->sendCommandData();
|
||||
}
|
||||
}
|
||||
@ -715,7 +724,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
$data = new CommandData();
|
||||
$data->commandName = $command->getName();
|
||||
//TODO: commands containing uppercase letters in the name crash 1.9.0 client
|
||||
$data->commandName = strtolower($command->getName());
|
||||
$data->commandDescription = $this->server->getLanguage()->translateString($command->getDescription());
|
||||
$data->flags = 0;
|
||||
$data->permission = 0;
|
||||
@ -793,7 +803,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the "friendly" name to display of this player to use in the chat.
|
||||
* Returns the "friendly" display name of this player to use in the chat.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -1058,6 +1068,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
return; //avoid player spawning twice (this can only happen on 3.x with a custom malicious client)
|
||||
}
|
||||
$this->spawned = true;
|
||||
$this->setImmobile(false);
|
||||
|
||||
if($this->hasPermission(Server::BROADCAST_CHANNEL_USERS)){
|
||||
PermissionManager::getInstance()->subscribeToPermission(Server::BROADCAST_CHANNEL_USERS, $this);
|
||||
@ -1076,10 +1087,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$this->server->broadcastMessage($ev->getJoinMessage());
|
||||
}
|
||||
|
||||
$this->setImmobile(false);
|
||||
$this->noDamageTicks = 60;
|
||||
|
||||
foreach($this->usedChunks as $index => $c){
|
||||
foreach($this->usedChunks as $index => $hasSent){
|
||||
if(!$hasSent){
|
||||
continue; //this will happen when the chunk is ready to send
|
||||
}
|
||||
Level::getXZ($index, $chunkX, $chunkZ);
|
||||
foreach($this->level->getChunkEntities($chunkX, $chunkZ) as $entity){
|
||||
if($entity !== $this and !$entity->isClosed() and $entity->isAlive() and !$entity->isFlaggedForDespawn()){
|
||||
@ -1409,19 +1422,17 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
$this->allowFlight = $this->isCreative();
|
||||
if($this->isSpectator()){
|
||||
$this->flying = true;
|
||||
$this->setFlying(true);
|
||||
$this->keepMovement = true;
|
||||
$this->despawnFromAll();
|
||||
}else{
|
||||
$this->keepMovement = $this->allowMovementCheats;
|
||||
if($this->isSurvival()){
|
||||
$this->flying = false;
|
||||
$this->setFlying(false);
|
||||
}
|
||||
$this->spawnToAll();
|
||||
}
|
||||
|
||||
$this->resetFallDistance();
|
||||
|
||||
$this->namedtag->setInt("playerGameType", $this->gamemode);
|
||||
if(!$client){ //Gamemode changed by server, do not send for client changes
|
||||
$this->sendGamemode();
|
||||
@ -1588,7 +1599,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
* If you must tamper with this code, be aware that this can cause very nasty results. Do not waste our time
|
||||
* asking for help if you suffer the consequences of messing with this.
|
||||
*/
|
||||
$this->server->getLogger()->warning($this->getName() . " moved too fast, reverting movement");
|
||||
$this->server->getLogger()->debug($this->getName() . " moved too fast, reverting movement");
|
||||
$this->server->getLogger()->debug("Old position: " . $this->asVector3() . ", new position: " . $this->newPosition);
|
||||
$revert = true;
|
||||
}elseif(!$this->level->isInLoadedTerrain($newPos) or !$this->level->isChunkGenerated($newPos->getFloorX() >> 4, $newPos->getFloorZ() >> 4)){
|
||||
@ -1613,7 +1624,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
if(!$ev->isCancelled()){
|
||||
$revert = true;
|
||||
$this->server->getLogger()->warning($this->getServer()->getLanguage()->translateString("pocketmine.player.invalidMove", [$this->getName()]));
|
||||
$this->server->getLogger()->debug($this->getServer()->getLanguage()->translateString("pocketmine.player.invalidMove", [$this->getName()]));
|
||||
$this->server->getLogger()->debug("Old position: " . $this->asVector3() . ", new position: " . $this->newPosition);
|
||||
}
|
||||
}
|
||||
@ -1647,7 +1658,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}else{
|
||||
$this->broadcastMovement();
|
||||
|
||||
$distance = $from->distance($to);
|
||||
$distance = sqrt((($from->x - $to->x) ** 2) + (($from->z - $to->z) ** 2));
|
||||
//TODO: check swimming (adds 0.015 exhaustion in MCPE)
|
||||
if($this->isSprinting()){
|
||||
$this->exhaust(0.1 * $distance, PlayerExhaustEvent::CAUSE_SPRINTING);
|
||||
@ -1678,6 +1689,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$this->newPosition = null;
|
||||
}
|
||||
|
||||
public function fall(float $fallDistance) : void{
|
||||
if(!$this->flying){
|
||||
parent::fall($fallDistance);
|
||||
}
|
||||
}
|
||||
|
||||
public function jump() : void{
|
||||
(new PlayerJumpEvent($this))->call();
|
||||
parent::jump();
|
||||
@ -1920,7 +1937,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!$this->server->isWhitelisted($this->iusername) and $this->kick("Server is white-listed", false)){
|
||||
if(!$this->server->isWhitelisted($this->username) and $this->kick("Server is white-listed", false)){
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2042,6 +2059,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
public function handleResourcePackClientResponse(ResourcePackClientResponsePacket $packet) : bool{
|
||||
if($this->resourcePacksDone){
|
||||
return false;
|
||||
}
|
||||
switch($packet->status){
|
||||
case ResourcePackClientResponsePacket::STATUS_REFUSED:
|
||||
//TODO: add lang strings for this
|
||||
@ -2050,7 +2070,13 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
case ResourcePackClientResponsePacket::STATUS_SEND_PACKS:
|
||||
$manager = $this->server->getResourcePackManager();
|
||||
foreach($packet->packIds as $uuid){
|
||||
$pack = $manager->getPackById(substr($uuid, 0, strpos($uuid, "_"))); //dirty hack for mojang's dirty hack for versions
|
||||
//dirty hack for mojang's dirty hack for versions
|
||||
$splitPos = strpos($uuid, "_");
|
||||
if($splitPos !== false){
|
||||
$uuid = substr($uuid, 0, $splitPos);
|
||||
}
|
||||
|
||||
$pack = $manager->getPackById($uuid);
|
||||
if(!($pack instanceof ResourcePack)){
|
||||
//Client requested a resource pack but we don't have it available on the server
|
||||
$this->close("", "disconnectionScreen.resourcePack", true);
|
||||
@ -2077,6 +2103,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$this->dataPacket($pk);
|
||||
break;
|
||||
case ResourcePackClientResponsePacket::STATUS_COMPLETED:
|
||||
$this->resourcePacksDone = true;
|
||||
$this->completeLoginSequence();
|
||||
break;
|
||||
default:
|
||||
@ -2090,6 +2117,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
/** @var float[] $pos */
|
||||
$pos = $this->namedtag->getListTag("Pos")->getAllValues();
|
||||
$this->level->registerChunkLoader($this, ((int) floor($pos[0])) >> 4, ((int) floor($pos[2])) >> 4, true);
|
||||
$this->usedChunks[Level::chunkHash(((int) floor($pos[0])) >> 4, ((int) floor($pos[2])) >> 4)] = false;
|
||||
|
||||
parent::__construct($this->level, $this->namedtag);
|
||||
$ev = new PlayerLoginEvent($this, "Plugin reason");
|
||||
@ -2136,7 +2164,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$pk->worldName = $this->server->getMotd();
|
||||
$this->dataPacket($pk);
|
||||
|
||||
$this->sendDataPacket(new AvailableEntityIdentifiersPacket());
|
||||
$this->sendDataPacket(new AvailableActorIdentifiersPacket());
|
||||
$this->sendDataPacket(new BiomeDefinitionListPacket());
|
||||
|
||||
$this->level->sendTime($this);
|
||||
|
||||
@ -2257,14 +2286,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function handleEntityEvent(EntityEventPacket $packet) : bool{
|
||||
public function handleEntityEvent(ActorEventPacket $packet) : bool{
|
||||
if(!$this->spawned or !$this->isAlive()){
|
||||
return true;
|
||||
}
|
||||
$this->doCloseInventory();
|
||||
|
||||
switch($packet->event){
|
||||
case EntityEventPacket::EATING_ITEM:
|
||||
case ActorEventPacket::EATING_ITEM:
|
||||
if($packet->data === 0){
|
||||
return false;
|
||||
}
|
||||
@ -2714,6 +2743,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
public function handleBlockPickRequest(BlockPickRequestPacket $packet) : bool{
|
||||
$block = $this->level->getBlockAt($packet->blockX, $packet->blockY, $packet->blockZ);
|
||||
if($block instanceof UnknownBlock){
|
||||
return true;
|
||||
}
|
||||
|
||||
$item = $block->getPickedItem();
|
||||
if($packet->addUserData){
|
||||
@ -2830,6 +2862,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
case PlayerActionPacket::ACTION_STOP_SWIMMING:
|
||||
//TODO: handle this when it doesn't spam every damn tick (yet another spam bug!!)
|
||||
break;
|
||||
case PlayerActionPacket::ACTION_INTERACT_BLOCK: //ignored (for now)
|
||||
break;
|
||||
default:
|
||||
$this->server->getLogger()->debug("Unhandled/unknown player action type " . $packet->action . " from " . $this->getName());
|
||||
return false;
|
||||
@ -2938,8 +2972,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$ev->call();
|
||||
if($ev->isCancelled()){
|
||||
$this->sendSettings();
|
||||
}else{
|
||||
}else{ //don't use setFlying() here, to avoid feedback loops
|
||||
$this->flying = $ev->isFlying();
|
||||
$this->resetFallDistance();
|
||||
}
|
||||
|
||||
$handled = true;
|
||||
@ -2955,7 +2990,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
return $handled;
|
||||
}
|
||||
|
||||
public function handleBlockEntityData(BlockEntityDataPacket $packet) : bool{
|
||||
public function handleBlockEntityData(BlockActorDataPacket $packet) : bool{
|
||||
if(!$this->spawned or !$this->isAlive()){
|
||||
return true;
|
||||
}
|
||||
@ -2969,7 +3004,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$t = $this->level->getTile($pos);
|
||||
if($t instanceof Spawnable){
|
||||
$nbt = new NetworkLittleEndianNBTStream();
|
||||
$compound = $nbt->read($packet->namedtag);
|
||||
$_ = 0;
|
||||
$compound = $nbt->read($packet->namedtag, false, $_, 512);
|
||||
|
||||
if(!($compound instanceof CompoundTag)){
|
||||
throw new \InvalidArgumentException("Expected " . CompoundTag::class . " in block entity NBT, got " . (is_object($compound) ? get_class($compound) : gettype($compound)));
|
||||
@ -3020,6 +3056,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
public function handleResourcePackChunkRequest(ResourcePackChunkRequestPacket $packet) : bool{
|
||||
if($this->resourcePacksDone){
|
||||
return false;
|
||||
}
|
||||
$manager = $this->server->getResourcePackManager();
|
||||
$pack = $manager->getPackById($packet->packId);
|
||||
if(!($pack instanceof ResourcePack)){
|
||||
@ -3285,7 +3324,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the title duration settings.
|
||||
* Resets the title duration settings to defaults and removes any existing titles.
|
||||
*/
|
||||
public function resetTitles(){
|
||||
$pk = new SetTitlePacket();
|
||||
@ -3355,7 +3394,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$pk->needsTranslation = true;
|
||||
$pk->message = $this->server->getLanguage()->translateString($message, $parameters, "pocketmine.");
|
||||
foreach($parameters as $i => $p){
|
||||
$parameters[$i] = $this->server->getLanguage()->translateString($p, $parameters, "pocketmine.");
|
||||
$parameters[$i] = $this->server->getLanguage()->translateString($p, [], "pocketmine.");
|
||||
}
|
||||
$pk->parameters = $parameters;
|
||||
}else{
|
||||
@ -3613,7 +3652,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
if($this->inventory !== null){
|
||||
$this->inventory->setHeldItemIndex(0, false); //This is already handled when sending contents, don't send it twice
|
||||
$this->inventory->setHeldItemIndex(0);
|
||||
$this->inventory->clearAll();
|
||||
}
|
||||
if($this->armorInventory !== null){
|
||||
@ -3621,8 +3660,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: allow this number to be manipulated during PlayerDeathEvent
|
||||
$this->level->dropExperience($this, $this->getXpDropAmount());
|
||||
$this->setXpAndProgress(0, 0);
|
||||
|
||||
if($ev->getDeathMessage() != ""){
|
||||
$this->server->broadcast($ev->getDeathMessage(), Server::BROADCAST_CHANNEL_USERS);
|
||||
$this->server->broadcastMessage($ev->getDeathMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3881,17 +3924,17 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
* @param Inventory $inventory
|
||||
* @param bool $force Forces removal of permanent windows such as normal inventory, cursor
|
||||
*
|
||||
* @throws \BadMethodCallException if trying to remove a fixed inventory window without the `force` parameter as true
|
||||
* @throws \InvalidArgumentException if trying to remove a fixed inventory window without the `force` parameter as true
|
||||
*/
|
||||
public function removeWindow(Inventory $inventory, bool $force = false){
|
||||
$id = $this->windows[$hash = spl_object_hash($inventory)] ?? null;
|
||||
|
||||
if($id !== null and !$force and isset($this->permanentWindows[$id])){
|
||||
throw new \BadMethodCallException("Cannot remove fixed window $id (" . get_class($inventory) . ") from " . $this->getName());
|
||||
throw new \InvalidArgumentException("Cannot remove fixed window $id (" . get_class($inventory) . ") from " . $this->getName());
|
||||
}
|
||||
|
||||
$inventory->close($this);
|
||||
if($id !== null){
|
||||
$inventory->close($this);
|
||||
unset($this->windows[$hash], $this->windowIndex[$id], $this->permanentWindows[$id]);
|
||||
}
|
||||
}
|
||||
|
@ -36,10 +36,7 @@ namespace pocketmine {
|
||||
use pocketmine\utils\VersionString;
|
||||
use pocketmine\wizard\SetupWizard;
|
||||
|
||||
const NAME = "PocketMine-MP";
|
||||
const BASE_VERSION = "3.5.6";
|
||||
const IS_DEVELOPMENT_BUILD = false;
|
||||
const BUILD_NUMBER = 0;
|
||||
require_once __DIR__ . '/VersionInfo.php';
|
||||
|
||||
const MIN_PHP_VERSION = "7.2.0";
|
||||
|
||||
@ -60,18 +57,18 @@ namespace pocketmine {
|
||||
if(version_compare(MIN_PHP_VERSION, PHP_VERSION) > 0){
|
||||
//If PHP version isn't high enough, anything below might break, so don't bother checking it.
|
||||
return [
|
||||
\pocketmine\NAME . " requires PHP >= " . MIN_PHP_VERSION . ", but you have PHP " . PHP_VERSION . "."
|
||||
"PHP >= " . MIN_PHP_VERSION . " is required, but you have PHP " . PHP_VERSION . "."
|
||||
];
|
||||
}
|
||||
|
||||
$messages = [];
|
||||
|
||||
if(PHP_INT_SIZE < 8){
|
||||
$messages[] = "Running " . \pocketmine\NAME . " with 32-bit systems/PHP is no longer supported. Please upgrade to a 64-bit system, or use a 64-bit PHP binary if this is a 64-bit system.";
|
||||
$messages[] = "32-bit systems/PHP are no longer supported. Please upgrade to a 64-bit system, or use a 64-bit PHP binary if this is a 64-bit system.";
|
||||
}
|
||||
|
||||
if(php_sapi_name() !== "cli"){
|
||||
$messages[] = "You must run " . \pocketmine\NAME . " using the CLI.";
|
||||
$messages[] = "Only PHP CLI is supported.";
|
||||
}
|
||||
|
||||
$extensions = [
|
||||
@ -105,8 +102,8 @@ namespace pocketmine {
|
||||
if(substr_count($pthreads_version, ".") < 2){
|
||||
$pthreads_version = "0.$pthreads_version";
|
||||
}
|
||||
if(version_compare($pthreads_version, "3.1.7dev") < 0){
|
||||
$messages[] = "pthreads >= 3.1.7dev is required, while you have $pthreads_version.";
|
||||
if(version_compare($pthreads_version, "3.2.0") < 0){
|
||||
$messages[] = "pthreads >= 3.2.0 is required, while you have $pthreads_version.";
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,148 +121,181 @@ namespace pocketmine {
|
||||
return $messages;
|
||||
}
|
||||
|
||||
if(!empty($messages = check_platform_dependencies())){
|
||||
echo PHP_EOL;
|
||||
$binary = version_compare(PHP_VERSION, "5.4") >= 0 ? PHP_BINARY : "unknown";
|
||||
critical_error("Selected PHP binary ($binary) does not satisfy some requirements.");
|
||||
foreach($messages as $m){
|
||||
echo " - $m" . PHP_EOL;
|
||||
function emit_performance_warnings(\Logger $logger){
|
||||
if(extension_loaded("xdebug")){
|
||||
$logger->warning("Xdebug extension is enabled. This has a major impact on performance.");
|
||||
}
|
||||
if(!extension_loaded("pocketmine_chunkutils")){
|
||||
$logger->warning("ChunkUtils extension is missing. Anvil-format worlds will experience degraded performance.");
|
||||
}
|
||||
if(((int) ini_get('zend.assertions')) !== -1){
|
||||
$logger->warning("Debugging assertions are enabled. This may degrade performance. To disable them, set `zend.assertions = -1` in php.ini.");
|
||||
}
|
||||
if(\Phar::running(true) === ""){
|
||||
$logger->warning("Non-packaged installation detected. This will degrade autoloading speed and make startup times longer.");
|
||||
}
|
||||
critical_error("Please recompile PHP with the needed configuration, or refer to the installation instructions at http://pmmp.rtfd.io/en/rtfd/installation.html.");
|
||||
echo PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
unset($messages);
|
||||
|
||||
error_reporting(-1);
|
||||
|
||||
if(\Phar::running(true) !== ""){
|
||||
define('pocketmine\PATH', \Phar::running(true) . "/");
|
||||
}else{
|
||||
define('pocketmine\PATH', dirname(__FILE__, 3) . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
$opts = getopt("", ["bootstrap:"]);
|
||||
if(isset($opts["bootstrap"])){
|
||||
$bootstrap = realpath($opts["bootstrap"]) ?: $opts["bootstrap"];
|
||||
}else{
|
||||
$bootstrap = \pocketmine\PATH . 'vendor/autoload.php';
|
||||
}
|
||||
define('pocketmine\COMPOSER_AUTOLOADER_PATH', $bootstrap);
|
||||
|
||||
if(\pocketmine\COMPOSER_AUTOLOADER_PATH !== false and is_file(\pocketmine\COMPOSER_AUTOLOADER_PATH)){
|
||||
require_once(\pocketmine\COMPOSER_AUTOLOADER_PATH);
|
||||
}else{
|
||||
critical_error("Composer autoloader not found at " . $bootstrap);
|
||||
critical_error("Please install/update Composer dependencies or use provided builds.");
|
||||
exit(1);
|
||||
function set_ini_entries(){
|
||||
ini_set("allow_url_fopen", '1');
|
||||
ini_set("display_errors", '1');
|
||||
ini_set("display_startup_errors", '1');
|
||||
ini_set("default_charset", "utf-8");
|
||||
ini_set('assert.exception', '1');
|
||||
}
|
||||
|
||||
set_error_handler([Utils::class, 'errorExceptionHandler']);
|
||||
|
||||
/*
|
||||
* We now use the Composer autoloader, but this autoloader is still for loading plugins.
|
||||
*/
|
||||
$autoloader = new \BaseClassLoader();
|
||||
$autoloader->register(false);
|
||||
|
||||
set_time_limit(0); //Who set it to 30 seconds?!?!
|
||||
|
||||
ini_set("allow_url_fopen", '1');
|
||||
ini_set("display_errors", '1');
|
||||
ini_set("display_startup_errors", '1');
|
||||
ini_set("default_charset", "utf-8");
|
||||
|
||||
ini_set("memory_limit", '-1');
|
||||
define('pocketmine\START_TIME', microtime(true));
|
||||
|
||||
define('pocketmine\RESOURCE_PATH', \pocketmine\PATH . 'src' . DIRECTORY_SEPARATOR . 'pocketmine' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR);
|
||||
|
||||
$opts = getopt("", ["data:", "plugins:", "no-wizard"]);
|
||||
|
||||
define('pocketmine\DATA', isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : realpath(getcwd()) . DIRECTORY_SEPARATOR);
|
||||
define('pocketmine\PLUGIN_PATH', isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : realpath(getcwd()) . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
|
||||
|
||||
if(!file_exists(\pocketmine\DATA)){
|
||||
mkdir(\pocketmine\DATA, 0777, true);
|
||||
}
|
||||
|
||||
//Logger has a dependency on timezone
|
||||
$tzError = Timezone::init();
|
||||
|
||||
$logger = new MainLogger(\pocketmine\DATA . "server.log");
|
||||
$logger->registerStatic();
|
||||
|
||||
foreach($tzError as $e){
|
||||
$logger->warning($e);
|
||||
}
|
||||
unset($tzError);
|
||||
|
||||
if(extension_loaded("xdebug")){
|
||||
$logger->warning(PHP_EOL . PHP_EOL . PHP_EOL . "\tYou are running " . \pocketmine\NAME . " with xdebug enabled. This has a major impact on performance." . PHP_EOL . PHP_EOL);
|
||||
}
|
||||
|
||||
if(\Phar::running(true) === ""){
|
||||
$logger->warning("Non-packaged " . \pocketmine\NAME . " installation detected. Consider using a phar in production for better performance.");
|
||||
}
|
||||
|
||||
$version = new VersionString(\pocketmine\BASE_VERSION, \pocketmine\IS_DEVELOPMENT_BUILD, \pocketmine\BUILD_NUMBER);
|
||||
define('pocketmine\VERSION', $version->getFullVersion(true));
|
||||
|
||||
$gitHash = str_repeat("00", 20);
|
||||
|
||||
if(\Phar::running(true) === ""){
|
||||
if(Utils::execute("git rev-parse HEAD", $out) === 0 and $out !== false and strlen($out = trim($out)) === 40){
|
||||
$gitHash = trim($out);
|
||||
if(Utils::execute("git diff --quiet") === 1 or Utils::execute("git diff --cached --quiet") === 1){ //Locally-modified
|
||||
$gitHash .= "-dirty";
|
||||
function server(){
|
||||
if(!empty($messages = check_platform_dependencies())){
|
||||
echo PHP_EOL;
|
||||
$binary = version_compare(PHP_VERSION, "5.4") >= 0 ? PHP_BINARY : "unknown";
|
||||
critical_error("Selected PHP binary ($binary) does not satisfy some requirements.");
|
||||
foreach($messages as $m){
|
||||
echo " - $m" . PHP_EOL;
|
||||
}
|
||||
critical_error("Please recompile PHP with the needed configuration, or refer to the installation instructions at http://pmmp.rtfd.io/en/rtfd/installation.html.");
|
||||
echo PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
}else{
|
||||
$phar = new \Phar(\Phar::running(false));
|
||||
$meta = $phar->getMetadata();
|
||||
if(isset($meta["git"])){
|
||||
$gitHash = $meta["git"];
|
||||
unset($messages);
|
||||
|
||||
error_reporting(-1);
|
||||
set_ini_entries();
|
||||
@define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1);
|
||||
|
||||
if(\Phar::running(true) !== ""){
|
||||
define('pocketmine\PATH', \Phar::running(true) . "/");
|
||||
}else{
|
||||
define('pocketmine\PATH', dirname(__FILE__, 3) . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
}
|
||||
|
||||
define('pocketmine\GIT_COMMIT', $gitHash);
|
||||
$opts = getopt("", ["bootstrap:"]);
|
||||
if(isset($opts["bootstrap"])){
|
||||
$bootstrap = realpath($opts["bootstrap"]) ?: $opts["bootstrap"];
|
||||
}else{
|
||||
$bootstrap = \pocketmine\PATH . 'vendor/autoload.php';
|
||||
}
|
||||
define('pocketmine\COMPOSER_AUTOLOADER_PATH', $bootstrap);
|
||||
|
||||
if(\pocketmine\COMPOSER_AUTOLOADER_PATH !== false and is_file(\pocketmine\COMPOSER_AUTOLOADER_PATH)){
|
||||
require_once(\pocketmine\COMPOSER_AUTOLOADER_PATH);
|
||||
}else{
|
||||
critical_error("Composer autoloader not found at " . $bootstrap);
|
||||
critical_error("Please install/update Composer dependencies or use provided builds.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1);
|
||||
@ini_set("opcache.mmap_base", bin2hex(random_bytes(8))); //Fix OPCache address errors
|
||||
set_error_handler([Utils::class, 'errorExceptionHandler']);
|
||||
|
||||
$exitCode = 0;
|
||||
do{
|
||||
if(!file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])){
|
||||
$installer = new SetupWizard();
|
||||
if(!$installer->run()){
|
||||
$exitCode = -1;
|
||||
break;
|
||||
$version = new VersionString(\pocketmine\BASE_VERSION, \pocketmine\IS_DEVELOPMENT_BUILD, \pocketmine\BUILD_NUMBER);
|
||||
define('pocketmine\VERSION', $version->getFullVersion(true));
|
||||
|
||||
$gitHash = str_repeat("00", 20);
|
||||
|
||||
if(\Phar::running(true) === ""){
|
||||
if(Utils::execute("git rev-parse HEAD", $out) === 0 and $out !== false and strlen($out = trim($out)) === 40){
|
||||
$gitHash = trim($out);
|
||||
if(Utils::execute("git diff --quiet") === 1 or Utils::execute("git diff --cached --quiet") === 1){ //Locally-modified
|
||||
$gitHash .= "-dirty";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$phar = new \Phar(\Phar::running(false));
|
||||
$meta = $phar->getMetadata();
|
||||
if(isset($meta["git"])){
|
||||
$gitHash = $meta["git"];
|
||||
}
|
||||
}
|
||||
|
||||
ThreadManager::init();
|
||||
new Server($autoloader, $logger, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
|
||||
define('pocketmine\GIT_COMMIT', $gitHash);
|
||||
|
||||
$logger->info("Stopping other threads");
|
||||
define('pocketmine\RESOURCE_PATH', \pocketmine\PATH . 'src' . DIRECTORY_SEPARATOR . 'pocketmine' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR);
|
||||
|
||||
$killer = new ServerKiller(8);
|
||||
$killer->start(PTHREADS_INHERIT_NONE);
|
||||
usleep(10000); //Fixes ServerKiller not being able to start on single-core machines
|
||||
$opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-ansi", "disable-ansi"]);
|
||||
|
||||
if(ThreadManager::getInstance()->stopAll() > 0){
|
||||
if(\pocketmine\DEBUG > 1){
|
||||
echo "Some threads could not be stopped, performing a force-kill" . PHP_EOL . PHP_EOL;
|
||||
}
|
||||
Utils::kill(getmypid());
|
||||
define('pocketmine\DATA', isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : realpath(getcwd()) . DIRECTORY_SEPARATOR);
|
||||
define('pocketmine\PLUGIN_PATH', isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : realpath(getcwd()) . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
|
||||
|
||||
if(!file_exists(\pocketmine\DATA)){
|
||||
mkdir(\pocketmine\DATA, 0777, true);
|
||||
}
|
||||
}while(false);
|
||||
|
||||
$logger->shutdown();
|
||||
$logger->join();
|
||||
define('pocketmine\LOCK_FILE', fopen(\pocketmine\DATA . 'server.lock', "a+b"));
|
||||
if(!flock(\pocketmine\LOCK_FILE, LOCK_EX | LOCK_NB)){
|
||||
//wait for a shared lock to avoid race conditions if two servers started at the same time - this makes sure the
|
||||
//other server wrote its PID and released exclusive lock before we get our lock
|
||||
flock(\pocketmine\LOCK_FILE, LOCK_SH);
|
||||
$pid = stream_get_contents(\pocketmine\LOCK_FILE);
|
||||
critical_error("Another " . \pocketmine\NAME . " instance (PID $pid) is already using this folder (" . realpath(\pocketmine\DATA) . ").");
|
||||
critical_error("Please stop the other server first before running a new one.");
|
||||
exit(1);
|
||||
}
|
||||
ftruncate(\pocketmine\LOCK_FILE, 0);
|
||||
fwrite(\pocketmine\LOCK_FILE, (string) getmypid());
|
||||
fflush(\pocketmine\LOCK_FILE);
|
||||
flock(\pocketmine\LOCK_FILE, LOCK_SH); //prevent acquiring an exclusive lock from another process, but allow reading
|
||||
|
||||
echo Terminal::$FORMAT_RESET . PHP_EOL;
|
||||
//Logger has a dependency on timezone
|
||||
$tzError = Timezone::init();
|
||||
|
||||
exit($exitCode);
|
||||
if(isset($opts["enable-ansi"])){
|
||||
Terminal::init(true);
|
||||
}elseif(isset($opts["disable-ansi"])){
|
||||
Terminal::init(false);
|
||||
}else{
|
||||
Terminal::init();
|
||||
}
|
||||
|
||||
$logger = new MainLogger(\pocketmine\DATA . "server.log");
|
||||
$logger->registerStatic();
|
||||
|
||||
foreach($tzError as $e){
|
||||
$logger->warning($e);
|
||||
}
|
||||
unset($tzError);
|
||||
|
||||
emit_performance_warnings($logger);
|
||||
|
||||
$exitCode = 0;
|
||||
do{
|
||||
if(!file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])){
|
||||
$installer = new SetupWizard();
|
||||
if(!$installer->run()){
|
||||
$exitCode = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: move this to a Server field
|
||||
define('pocketmine\START_TIME', microtime(true));
|
||||
ThreadManager::init();
|
||||
|
||||
/*
|
||||
* We now use the Composer autoloader, but this autoloader is still for loading plugins.
|
||||
*/
|
||||
$autoloader = new \BaseClassLoader();
|
||||
$autoloader->register(false);
|
||||
|
||||
new Server($autoloader, $logger, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
|
||||
|
||||
$logger->info("Stopping other threads");
|
||||
|
||||
$killer = new ServerKiller(8);
|
||||
$killer->start(PTHREADS_INHERIT_NONE);
|
||||
usleep(10000); //Fixes ServerKiller not being able to start on single-core machines
|
||||
|
||||
if(ThreadManager::getInstance()->stopAll() > 0){
|
||||
$logger->debug("Some threads could not be stopped, performing a force-kill");
|
||||
Utils::kill(getmypid());
|
||||
}
|
||||
}while(false);
|
||||
|
||||
$logger->shutdown();
|
||||
$logger->join();
|
||||
|
||||
echo Terminal::$FORMAT_RESET . PHP_EOL;
|
||||
|
||||
exit($exitCode);
|
||||
}
|
||||
|
||||
\pocketmine\server();
|
||||
}
|
||||
|
@ -112,7 +112,6 @@ use function array_sum;
|
||||
use function asort;
|
||||
use function assert;
|
||||
use function base64_encode;
|
||||
use function bin2hex;
|
||||
use function class_exists;
|
||||
use function count;
|
||||
use function define;
|
||||
@ -122,9 +121,7 @@ use function file_exists;
|
||||
use function file_get_contents;
|
||||
use function file_put_contents;
|
||||
use function filemtime;
|
||||
use function floor;
|
||||
use function function_exists;
|
||||
use function gc_collect_cycles;
|
||||
use function get_class;
|
||||
use function getmypid;
|
||||
use function getopt;
|
||||
@ -143,6 +140,7 @@ use function max;
|
||||
use function microtime;
|
||||
use function min;
|
||||
use function mkdir;
|
||||
use function ob_end_flush;
|
||||
use function pcntl_signal;
|
||||
use function pcntl_signal_dispatch;
|
||||
use function preg_replace;
|
||||
@ -295,15 +293,6 @@ class Server{
|
||||
/** @var int */
|
||||
public $networkCompressionLevel = 7;
|
||||
|
||||
/** @var bool */
|
||||
private $autoTickRate = true;
|
||||
/** @var int */
|
||||
private $autoTickRateLimit = 20;
|
||||
/** @var bool */
|
||||
private $alwaysTickPlayers = false;
|
||||
/** @var int */
|
||||
private $baseTickRate = 1;
|
||||
|
||||
/** @var int */
|
||||
private $autoSaveTicker = 0;
|
||||
/** @var int */
|
||||
@ -604,7 +593,7 @@ class Server{
|
||||
* @return int
|
||||
*/
|
||||
public function getDifficulty() : int{
|
||||
return $this->getConfigInt("difficulty", 1);
|
||||
return $this->getConfigInt("difficulty", Level::DIFFICULTY_NORMAL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -809,6 +798,7 @@ class Server{
|
||||
* @return bool
|
||||
*/
|
||||
public function hasOfflinePlayerData(string $name) : bool{
|
||||
$name = strtolower($name);
|
||||
return file_exists($this->getDataPath() . "players/$name.dat");
|
||||
}
|
||||
|
||||
@ -902,6 +892,11 @@ class Server{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an online player whose name begins with or equals the given string (case insensitive).
|
||||
* The closest match will be returned, or null if there are no online matches.
|
||||
*
|
||||
* @see Server::getPlayerExact()
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Player|null
|
||||
@ -927,6 +922,8 @@ class Server{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an online player with the given name (case insensitive), or null if not found.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Player|null
|
||||
@ -943,6 +940,9 @@ class Server{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of online players whose names contain with the given string (case insensitive).
|
||||
* If an exact match is found, only that match is returned.
|
||||
*
|
||||
* @param string $partialName
|
||||
*
|
||||
* @return Player[]
|
||||
@ -1056,7 +1056,7 @@ class Server{
|
||||
*/
|
||||
public function unloadLevel(Level $level, bool $forceUnload = false) : bool{
|
||||
if($level === $this->getDefaultLevel() and !$forceUnload){
|
||||
throw new \InvalidStateException("The default level cannot be unloaded while running, please switch levels.");
|
||||
throw new \InvalidStateException("The default world cannot be unloaded while running, please switch worlds.");
|
||||
}
|
||||
|
||||
return $level->unload($forceUnload);
|
||||
@ -1082,7 +1082,7 @@ class Server{
|
||||
*/
|
||||
public function loadLevel(string $name) : bool{
|
||||
if(trim($name) === ""){
|
||||
throw new LevelException("Invalid empty level name");
|
||||
throw new LevelException("Invalid empty world name");
|
||||
}
|
||||
if($this->isLevelLoaded($name)){
|
||||
return true;
|
||||
@ -1102,15 +1102,29 @@ class Server{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @see LevelProvider::__construct() */
|
||||
$level = new Level($this, $name, new $providerClass($path));
|
||||
try{
|
||||
/**
|
||||
* @var LevelProvider $provider
|
||||
* @see LevelProvider::__construct()
|
||||
*/
|
||||
$provider = new $providerClass($path);
|
||||
}catch(LevelException $e){
|
||||
$this->logger->error($this->getLanguage()->translateString("pocketmine.level.loadError", [$name, $e->getMessage()]));
|
||||
return false;
|
||||
}
|
||||
try{
|
||||
GeneratorManager::getGenerator($provider->getGenerator(), true);
|
||||
}catch(\InvalidArgumentException $e){
|
||||
$this->logger->error($this->getLanguage()->translateString("pocketmine.level.loadError", [$name, "Unknown generator \"" . $provider->getGenerator() . "\""]));
|
||||
return false;
|
||||
}
|
||||
|
||||
$level = new Level($this, $name, $provider);
|
||||
|
||||
$this->levels[$level->getId()] = $level;
|
||||
|
||||
(new LevelLoadEvent($level))->call();
|
||||
|
||||
$level->setTickRate($this->baseTickRate);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1142,7 +1156,7 @@ class Server{
|
||||
if(($providerClass = LevelProviderManager::getProviderByName($this->getProperty("level-settings.default-format", "pmanvil"))) === null){
|
||||
$providerClass = LevelProviderManager::getProviderByName("pmanvil");
|
||||
if($providerClass === null){
|
||||
throw new \InvalidStateException("Default level provider has not been registered");
|
||||
throw new \InvalidStateException("Default world provider has not been registered");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1154,8 +1168,6 @@ class Server{
|
||||
$level = new Level($this, $name, new $providerClass($path));
|
||||
$this->levels[$level->getId()] = $level;
|
||||
|
||||
$level->setTickRate($this->baseTickRate);
|
||||
|
||||
(new LevelInitEvent($level))->call();
|
||||
|
||||
(new LevelLoadEvent($level))->call();
|
||||
@ -1523,7 +1535,7 @@ class Server{
|
||||
"force-gamemode" => false,
|
||||
"hardcore" => false,
|
||||
"pvp" => true,
|
||||
"difficulty" => 1,
|
||||
"difficulty" => Level::DIFFICULTY_NORMAL,
|
||||
"generator-settings" => "",
|
||||
"level-name" => "world",
|
||||
"level-seed" => "",
|
||||
@ -1553,12 +1565,6 @@ class Server{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((int) ini_get('zend.assertions')) !== -1){
|
||||
$this->logger->warning("Debugging assertions are enabled, this may impact on performance. To disable them, set `zend.assertions = -1` in php.ini.");
|
||||
}
|
||||
|
||||
ini_set('assert.exception', '1');
|
||||
|
||||
if($this->logger instanceof MainLogger){
|
||||
$this->logger->setLogDebug(\pocketmine\DEBUG > 1);
|
||||
}
|
||||
@ -1593,11 +1599,6 @@ class Server{
|
||||
}
|
||||
$this->networkCompressionAsync = (bool) $this->getProperty("network.async-compression", true);
|
||||
|
||||
$this->autoTickRate = (bool) $this->getProperty("level-settings.auto-tick-rate", true);
|
||||
$this->autoTickRateLimit = (int) $this->getProperty("level-settings.auto-tick-rate-limit", 20);
|
||||
$this->alwaysTickPlayers = (bool) $this->getProperty("level-settings.always-tick-players", false);
|
||||
$this->baseTickRate = (int) $this->getProperty("level-settings.base-tick-rate", 1);
|
||||
|
||||
$this->doTitleTick = ((bool) $this->getProperty("console.title-tick", true)) && Terminal::hasFormattingCodes();
|
||||
|
||||
|
||||
@ -1696,12 +1697,17 @@ class Server{
|
||||
Entity::init();
|
||||
Tile::init();
|
||||
BlockFactory::init();
|
||||
BlockFactory::registerStaticRuntimeIdMappings();
|
||||
Enchantment::init();
|
||||
ItemFactory::init();
|
||||
Item::initCreativeItems();
|
||||
Biome::init();
|
||||
|
||||
LevelProviderManager::init();
|
||||
if(extension_loaded("leveldb")){
|
||||
$this->logger->debug($this->getLanguage()->translateString("pocketmine.debug.enable"));
|
||||
}
|
||||
GeneratorManager::registerDefaultGenerators();
|
||||
|
||||
$this->craftingManager = new CraftingManager();
|
||||
|
||||
$this->resourceManager = new ResourcePackManager($this->getDataPath() . "resource_packs" . DIRECTORY_SEPARATOR, $this->logger);
|
||||
@ -1713,7 +1719,7 @@ class Server{
|
||||
|
||||
register_shutdown_function([$this, "crashDump"]);
|
||||
|
||||
$this->queryRegenerateTask = new QueryRegenerateEvent($this, 5);
|
||||
$this->queryRegenerateTask = new QueryRegenerateEvent($this);
|
||||
|
||||
$this->pluginManager->loadPlugins($this->pluginPath);
|
||||
|
||||
@ -1723,13 +1729,6 @@ class Server{
|
||||
|
||||
$this->network->registerInterface(new RakLibInterface($this));
|
||||
|
||||
LevelProviderManager::init();
|
||||
if(extension_loaded("leveldb")){
|
||||
$this->logger->debug($this->getLanguage()->translateString("pocketmine.debug.enable"));
|
||||
}
|
||||
|
||||
GeneratorManager::registerDefaultGenerators();
|
||||
|
||||
foreach((array) $this->getProperty("worlds", []) as $name => $options){
|
||||
if($options === null){
|
||||
$options = [];
|
||||
@ -2038,7 +2037,7 @@ class Server{
|
||||
}
|
||||
|
||||
public function reload(){
|
||||
$this->logger->info("Saving levels...");
|
||||
$this->logger->info("Saving worlds...");
|
||||
|
||||
foreach($this->levels as $level){
|
||||
$level->save();
|
||||
@ -2116,7 +2115,7 @@ class Server{
|
||||
$player->close($player->getLeaveMessage(), $this->getProperty("settings.shutdown-message", "Server closed"));
|
||||
}
|
||||
|
||||
$this->getLogger()->debug("Unloading all levels");
|
||||
$this->getLogger()->debug("Unloading all worlds");
|
||||
foreach($this->getLevels() as $level){
|
||||
$this->unloadLevel($level, true);
|
||||
}
|
||||
@ -2148,9 +2147,6 @@ class Server{
|
||||
$this->network->unregisterInterface($interface);
|
||||
}
|
||||
}
|
||||
|
||||
$this->getLogger()->debug("Collecting cycles");
|
||||
gc_collect_cycles();
|
||||
}catch(\Throwable $e){
|
||||
$this->logger->logException($e);
|
||||
$this->logger->emergency("Crashed while crashing, killing process");
|
||||
@ -2204,6 +2200,7 @@ class Server{
|
||||
|
||||
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.defaultGameMode", [self::getGamemodeString($this->getGamemode())]));
|
||||
|
||||
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.donate", [TextFormat::AQUA . "https://patreon.com/pocketminemp" . TextFormat::RESET]));
|
||||
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.startFinished", [round(microtime(true) - \pocketmine\START_TIME, 3)]));
|
||||
|
||||
$this->tickProcessor();
|
||||
@ -2221,6 +2218,7 @@ class Server{
|
||||
* @param array|null $trace
|
||||
*/
|
||||
public function exceptionHandler(\Throwable $e, $trace = null){
|
||||
while(@ob_end_flush()){}
|
||||
global $lastError;
|
||||
|
||||
if($trace === null){
|
||||
@ -2252,6 +2250,7 @@ class Server{
|
||||
}
|
||||
|
||||
public function crashDump(){
|
||||
while(@ob_end_flush()){}
|
||||
if(!$this->isRunning){
|
||||
return;
|
||||
}
|
||||
@ -2283,6 +2282,7 @@ class Server{
|
||||
$p = $this->pluginManager->getPlugin($plugin);
|
||||
if($p instanceof Plugin and !($p->getPluginLoader() instanceof PharPluginLoader)){
|
||||
$this->logger->debug("Not sending crashdump due to caused by non-phar plugin");
|
||||
$report = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2432,8 +2432,6 @@ class Server{
|
||||
foreach($this->players as $p){
|
||||
if(!$p->loggedIn and ($tickTime - $p->creationTime) >= 10){
|
||||
$p->close("", "Login timeout");
|
||||
}elseif($this->alwaysTickPlayers and $p->spawned){
|
||||
$p->onUpdate($currentTick);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2443,32 +2441,13 @@ class Server{
|
||||
// Level unloaded during the tick of a level earlier in this loop, perhaps by plugin
|
||||
continue;
|
||||
}
|
||||
if($level->getTickRate() > $this->baseTickRate and --$level->tickRateCounter > 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
$levelTime = microtime(true);
|
||||
$level->doTick($currentTick);
|
||||
$tickMs = (microtime(true) - $levelTime) * 1000;
|
||||
$level->tickRateTime = $tickMs;
|
||||
|
||||
if($this->autoTickRate){
|
||||
if($tickMs < 50 and $level->getTickRate() > $this->baseTickRate){
|
||||
$level->setTickRate($r = $level->getTickRate() - 1);
|
||||
if($r > $this->baseTickRate){
|
||||
$level->tickRateCounter = $level->getTickRate();
|
||||
}
|
||||
$this->getLogger()->debug("Raising level \"{$level->getName()}\" tick rate to {$level->getTickRate()} ticks");
|
||||
}elseif($tickMs >= 50){
|
||||
if($level->getTickRate() === $this->baseTickRate){
|
||||
$level->setTickRate(max($this->baseTickRate + 1, min($this->autoTickRateLimit, (int) floor($tickMs / 50))));
|
||||
$this->getLogger()->debug(sprintf("Level \"%s\" took %gms, setting tick rate to %d ticks", $level->getName(), (int) round($tickMs, 2), $level->getTickRate()));
|
||||
}elseif(($tickMs / $level->getTickRate()) >= 50 and $level->getTickRate() < $this->autoTickRateLimit){
|
||||
$level->setTickRate($level->getTickRate() + 1);
|
||||
$this->getLogger()->debug(sprintf("Level \"%s\" took %gms, setting tick rate to %d ticks", $level->getName(), (int) round($tickMs, 2), $level->getTickRate()));
|
||||
}
|
||||
$level->tickRateCounter = $level->getTickRate();
|
||||
}
|
||||
if($tickMs >= 50){
|
||||
$this->getLogger()->debug(sprintf("World \"%s\" took too long to tick: %gms (%g ticks)", $level->getName(), $tickMs, round($tickMs / 50, 2)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2559,7 +2538,7 @@ class Server{
|
||||
if(strlen($payload) > 2 and substr($payload, 0, 2) === "\xfe\xfd" and $this->queryHandler instanceof QueryHandler){
|
||||
$this->queryHandler->handle($interface, $address, $port, $payload);
|
||||
}else{
|
||||
$this->logger->debug("Unhandled raw packet from $address $port: " . bin2hex($payload));
|
||||
$this->logger->debug("Unhandled raw packet from $address $port: " . base64_encode($payload));
|
||||
}
|
||||
}catch(\Throwable $e){
|
||||
$this->logger->logException($e);
|
||||
@ -2608,20 +2587,19 @@ class Server{
|
||||
$this->currentTPS = 20;
|
||||
$this->currentUse = 0;
|
||||
|
||||
($this->queryRegenerateTask = new QueryRegenerateEvent($this))->call();
|
||||
|
||||
$this->network->updateName();
|
||||
$this->network->resetStatistics();
|
||||
}
|
||||
|
||||
if(($this->tickCounter & 0b111111111) === 0){
|
||||
($this->queryRegenerateTask = new QueryRegenerateEvent($this, 5))->call();
|
||||
if($this->queryHandler !== null){
|
||||
$this->queryHandler->regenerateInfo();
|
||||
}
|
||||
}
|
||||
|
||||
if($this->autoSave and ++$this->autoSaveTicker >= $this->autoSaveTicks){
|
||||
$this->autoSaveTicker = 0;
|
||||
$this->getLogger()->debug("[Auto Save] Saving worlds...");
|
||||
$start = microtime(true);
|
||||
$this->doAutoSave();
|
||||
$time = (microtime(true) - $start);
|
||||
$this->getLogger()->debug("[Auto Save] Save completed in " . ($time >= 1 ? round($time, 3) . "s" : round($time * 1000) . "ms"));
|
||||
}
|
||||
|
||||
if($this->sendUsageTicker > 0 and --$this->sendUsageTicker === 0){
|
||||
|
@ -28,7 +28,7 @@ namespace pocketmine;
|
||||
*/
|
||||
abstract class Thread extends \Thread{
|
||||
|
||||
/** @var \ClassLoader */
|
||||
/** @var \ClassLoader|null */
|
||||
protected $classLoader;
|
||||
/** @var string|null */
|
||||
protected $composerAutoloaderPath;
|
||||
|
27
src/pocketmine/VersionInfo.php
Normal file
27
src/pocketmine/VersionInfo.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?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;
|
||||
|
||||
const NAME = "PocketMine-MP";
|
||||
const BASE_VERSION = "3.9.7";
|
||||
const IS_DEVELOPMENT_BUILD = false;
|
||||
const BUILD_NUMBER = 0;
|
@ -28,7 +28,7 @@ namespace pocketmine;
|
||||
*/
|
||||
abstract class Worker extends \Worker{
|
||||
|
||||
/** @var \ClassLoader */
|
||||
/** @var \ClassLoader|null */
|
||||
protected $classLoader;
|
||||
/** @var string|null */
|
||||
protected $composerAutoloaderPath;
|
||||
|
@ -36,9 +36,11 @@ use pocketmine\math\RayTraceResult;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\metadata\Metadatable;
|
||||
use pocketmine\metadata\MetadataValue;
|
||||
use pocketmine\network\mcpe\protocol\types\RuntimeBlockMapping;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\plugin\Plugin;
|
||||
use function array_merge;
|
||||
use function get_class;
|
||||
use const PHP_INT_MAX;
|
||||
|
||||
class Block extends Position implements BlockIds, Metadatable{
|
||||
@ -67,7 +69,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
/** @var int|null */
|
||||
protected $itemId;
|
||||
|
||||
/** @var AxisAlignedBB */
|
||||
/** @var AxisAlignedBB|null */
|
||||
protected $boundingBox = null;
|
||||
|
||||
|
||||
@ -116,7 +118,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
* @return int
|
||||
*/
|
||||
public function getRuntimeId() : int{
|
||||
return BlockFactory::toStaticRuntimeId($this->getId(), $this->getDamage());
|
||||
return RuntimeBlockMapping::toStaticRuntimeId($this->getId(), $this->getDamage());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -268,6 +270,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
* @param Item $item
|
||||
*
|
||||
* @return float
|
||||
* @throws \InvalidArgumentException if the item efficiency is not a positive number
|
||||
*/
|
||||
public function getBreakTime(Item $item) : float{
|
||||
$base = $this->getHardness();
|
||||
@ -279,7 +282,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
|
||||
$efficiency = $item->getMiningEfficiency($this);
|
||||
if($efficiency <= 0){
|
||||
throw new \RuntimeException("Item efficiency is invalid");
|
||||
throw new \InvalidArgumentException(get_class($item) . " has invalid mining efficiency: expected >= 0, got $efficiency");
|
||||
}
|
||||
|
||||
$base /= $efficiency;
|
||||
|
@ -25,9 +25,7 @@ namespace pocketmine\block;
|
||||
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\level\Position;
|
||||
use function file_get_contents;
|
||||
use function json_decode;
|
||||
use function max;
|
||||
use pocketmine\network\mcpe\protocol\types\RuntimeBlockMapping;
|
||||
use function min;
|
||||
|
||||
/**
|
||||
@ -52,15 +50,6 @@ class BlockFactory{
|
||||
/** @var \SplFixedArray<float> */
|
||||
public static $blastResistance = null;
|
||||
|
||||
/** @var int[] */
|
||||
public static $staticRuntimeIdMap = [];
|
||||
|
||||
/** @var int[] */
|
||||
public static $legacyIdMap = [];
|
||||
|
||||
/** @var int */
|
||||
private static $lastRuntimeId = 0;
|
||||
|
||||
/**
|
||||
* Initializes the block factory. By default this is called only once on server start, however you may wish to use
|
||||
* this if you need to reset the block factory back to its original defaults for whatever reason.
|
||||
@ -171,7 +160,7 @@ class BlockFactory{
|
||||
self::registerBlock(new Cake());
|
||||
//TODO: REPEATER_BLOCK
|
||||
//TODO: POWERED_REPEATER
|
||||
//TODO: INVISIBLEBEDROCK
|
||||
self::registerBlock(new InvisibleBedrock());
|
||||
self::registerBlock(new Trapdoor());
|
||||
//TODO: MONSTER_EGG
|
||||
self::registerBlock(new StoneBricks());
|
||||
@ -319,13 +308,13 @@ class BlockFactory{
|
||||
self::registerBlock(new Stonecutter());
|
||||
self::registerBlock(new GlowingObsidian());
|
||||
self::registerBlock(new NetherReactor());
|
||||
//TODO: INFO_UPDATE
|
||||
//TODO: INFO_UPDATE2
|
||||
self::registerBlock(new InfoUpdate(Block::INFO_UPDATE, 0, "update!"));
|
||||
self::registerBlock(new InfoUpdate(Block::INFO_UPDATE2, 0, "ate!upd"));
|
||||
//TODO: MOVINGBLOCK
|
||||
//TODO: OBSERVER
|
||||
//TODO: STRUCTURE_BLOCK
|
||||
|
||||
//TODO: RESERVED6
|
||||
self::registerBlock(new Reserved6(Block::RESERVED6, 0, "reserved6"));
|
||||
|
||||
for($id = 0, $size = self::$fullList->getSize() >> 4; $id < $size; ++$id){
|
||||
if(self::$fullList[$id << 4] === null){
|
||||
@ -427,16 +416,9 @@ class BlockFactory{
|
||||
return $b !== null and !($b instanceof UnknownBlock);
|
||||
}
|
||||
|
||||
public static function registerStaticRuntimeIdMappings() : void{
|
||||
/** @var mixed[] $runtimeIdMap */
|
||||
$runtimeIdMap = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "runtimeid_table.json"), true);
|
||||
foreach($runtimeIdMap as $k => $obj){
|
||||
self::registerMapping($k, $obj["id"], $obj["data"]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @deprecated
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $meta
|
||||
@ -444,15 +426,11 @@ class BlockFactory{
|
||||
* @return int
|
||||
*/
|
||||
public static function toStaticRuntimeId(int $id, int $meta = 0) : int{
|
||||
/*
|
||||
* try id+meta first
|
||||
* if not found, try id+0 (strip meta)
|
||||
* if still not found, return update! block
|
||||
*/
|
||||
return self::$staticRuntimeIdMap[($id << 4) | $meta] ?? self::$staticRuntimeIdMap[$id << 4] ?? self::$staticRuntimeIdMap[BlockIds::INFO_UPDATE << 4];
|
||||
return RuntimeBlockMapping::toStaticRuntimeId($id, $meta);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @internal
|
||||
*
|
||||
* @param int $runtimeId
|
||||
@ -460,13 +438,6 @@ class BlockFactory{
|
||||
* @return int[] [id, meta]
|
||||
*/
|
||||
public static function fromStaticRuntimeId(int $runtimeId) : array{
|
||||
$v = self::$legacyIdMap[$runtimeId];
|
||||
return [$v >> 4, $v & 0xf];
|
||||
}
|
||||
|
||||
private static function registerMapping(int $staticRuntimeId, int $legacyId, int $legacyMeta) : void{
|
||||
self::$staticRuntimeIdMap[($legacyId << 4) | $legacyMeta] = $staticRuntimeId;
|
||||
self::$legacyIdMap[$staticRuntimeId] = ($legacyId << 4) | $legacyMeta;
|
||||
self::$lastRuntimeId = max(self::$lastRuntimeId, $staticRuntimeId);
|
||||
return RuntimeBlockMapping::fromStaticRuntimeId($runtimeId);
|
||||
}
|
||||
}
|
||||
|
@ -96,9 +96,12 @@ class Cactus extends Transparent{
|
||||
if($b->getId() === self::AIR){
|
||||
$ev = new BlockGrowEvent($b, BlockFactory::get(Block::CACTUS));
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
|
||||
if($ev->isCancelled()){
|
||||
break;
|
||||
}
|
||||
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->meta = 0;
|
||||
|
@ -46,7 +46,7 @@ class Carpet extends Flowable{
|
||||
}
|
||||
|
||||
public function getName() : string{
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Carpet";
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->getVariant()) . " Carpet";
|
||||
}
|
||||
|
||||
protected function recalculateBoundingBox() : ?AxisAlignedBB{
|
||||
|
@ -30,6 +30,18 @@ use pocketmine\math\Vector3;
|
||||
class CobblestoneWall extends Transparent{
|
||||
public const NONE_MOSSY_WALL = 0;
|
||||
public const MOSSY_WALL = 1;
|
||||
public const GRANITE_WALL = 2;
|
||||
public const DIORITE_WALL = 3;
|
||||
public const ANDESITE_WALL = 4;
|
||||
public const SANDSTONE_WALL = 5;
|
||||
public const BRICK_WALL = 6;
|
||||
public const STONE_BRICK_WALL = 7;
|
||||
public const MOSSY_STONE_BRICK_WALL = 8;
|
||||
public const NETHER_BRICK_WALL = 9;
|
||||
public const END_STONE_BRICK_WALL = 10;
|
||||
public const PRISMARINE_WALL = 11;
|
||||
public const RED_SANDSTONE_WALL = 12;
|
||||
public const RED_NETHER_BRICK_WALL = 13;
|
||||
|
||||
protected $id = self::COBBLESTONE_WALL;
|
||||
|
||||
@ -50,11 +62,23 @@ class CobblestoneWall extends Transparent{
|
||||
}
|
||||
|
||||
public function getName() : string{
|
||||
if($this->meta === 0x01){
|
||||
return "Mossy Cobblestone Wall";
|
||||
}
|
||||
|
||||
return "Cobblestone Wall";
|
||||
static $names = [
|
||||
self::NONE_MOSSY_WALL => "Cobblestone",
|
||||
self::MOSSY_WALL => "Mossy Cobblestone",
|
||||
self::GRANITE_WALL => "Granite",
|
||||
self::DIORITE_WALL => "Diorite",
|
||||
self::ANDESITE_WALL => "Andesite",
|
||||
self::SANDSTONE_WALL => "Sandstone",
|
||||
self::BRICK_WALL => "Brick",
|
||||
self::STONE_BRICK_WALL => "Stone Brick",
|
||||
self::MOSSY_STONE_BRICK_WALL => "Mossy Stone Brick",
|
||||
self::NETHER_BRICK_WALL => "Nether Brick",
|
||||
self::END_STONE_BRICK_WALL => "End Stone Brick",
|
||||
self::PRISMARINE_WALL => "Prismarine",
|
||||
self::RED_SANDSTONE_WALL => "Red Sandstone",
|
||||
self::RED_NETHER_BRICK_WALL => "Red Nether Brick"
|
||||
];
|
||||
return ($names[$this->getVariant()] ?? "Unknown") . " Wall";
|
||||
}
|
||||
|
||||
protected function recalculateBoundingBox() : ?AxisAlignedBB{
|
||||
|
@ -35,7 +35,7 @@ class Concrete extends Solid{
|
||||
}
|
||||
|
||||
public function getName() : string{
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Concrete";
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->getVariant()) . " Concrete";
|
||||
}
|
||||
|
||||
public function getHardness() : float{
|
||||
|
@ -34,7 +34,7 @@ class ConcretePowder extends Fallable{
|
||||
}
|
||||
|
||||
public function getName() : string{
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Concrete Powder";
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->getVariant()) . " Concrete Powder";
|
||||
}
|
||||
|
||||
public function getHardness() : float{
|
||||
|
@ -43,7 +43,7 @@ abstract class Crops extends Flowable{
|
||||
|
||||
|
||||
public function onActivate(Item $item, Player $player = null) : bool{
|
||||
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
||||
if($this->meta < 7 and $item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
||||
$block = clone $this;
|
||||
$block->meta += mt_rand(2, 5);
|
||||
if($block->meta > 7){
|
||||
|
@ -39,7 +39,7 @@ class DoublePlant extends Flowable{
|
||||
}
|
||||
|
||||
public function canBeReplaced() : bool{
|
||||
return $this->meta === 2 or $this->meta === 3; //grass or fern
|
||||
return $this->getVariant() === 2 or $this->getVariant() === 3; //grass or fern
|
||||
}
|
||||
|
||||
public function getName() : string{
|
||||
@ -95,11 +95,11 @@ class DoublePlant extends Flowable{
|
||||
}
|
||||
|
||||
public function getToolType() : int{
|
||||
return ($this->meta === 2 or $this->meta === 3) ? BlockToolType::TYPE_SHEARS : BlockToolType::TYPE_NONE;
|
||||
return ($this->getVariant() === 2 or $this->getVariant() === 3) ? BlockToolType::TYPE_SHEARS : BlockToolType::TYPE_NONE;
|
||||
}
|
||||
|
||||
public function getToolHarvestLevel() : int{
|
||||
return ($this->meta === 2 or $this->meta === 3) ? 1 : 0; //only grass or fern require shears
|
||||
return ($this->getVariant() === 2 or $this->getVariant() === 3) ? 1 : 0; //only grass or fern require shears
|
||||
}
|
||||
|
||||
public function getDrops(Item $item) : array{
|
||||
|
@ -56,7 +56,7 @@ class Flower extends Flowable{
|
||||
self::TYPE_PINK_TULIP => "Pink Tulip",
|
||||
self::TYPE_OXEYE_DAISY => "Oxeye Daisy"
|
||||
];
|
||||
return $names[$this->meta] ?? "Unknown";
|
||||
return $names[$this->getVariant()] ?? "Unknown";
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
||||
|
31
src/pocketmine/block/InfoUpdate.php
Normal file
31
src/pocketmine/block/InfoUpdate.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class InfoUpdate extends Solid{
|
||||
|
||||
public function getHardness() : float{
|
||||
return 1;
|
||||
}
|
||||
}
|
51
src/pocketmine/block/InvisibleBedrock.php
Normal file
51
src/pocketmine/block/InvisibleBedrock.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\item\Item;
|
||||
|
||||
class InvisibleBedrock extends Transparent{
|
||||
|
||||
protected $id = self::INVISIBLE_BEDROCK;
|
||||
|
||||
public function __construct(){
|
||||
|
||||
}
|
||||
|
||||
public function getName() : string{
|
||||
return "Invisible Bedrock";
|
||||
}
|
||||
|
||||
public function getHardness() : float{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public function getBlastResistance() : float{
|
||||
return 18000000;
|
||||
}
|
||||
|
||||
public function isBreakable(Item $item) : bool{
|
||||
return false;
|
||||
}
|
||||
}
|
@ -44,4 +44,8 @@ class IronTrapdoor extends Trapdoor{
|
||||
public function getToolHarvestLevel() : int{
|
||||
return TieredTool::TIER_WOODEN;
|
||||
}
|
||||
|
||||
public function getFuelTime() : int{
|
||||
return 0; //TODO: remove this hack on 4.0
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ class ItemFrame extends Flowable{
|
||||
2 => Vector3::SIDE_NORTH,
|
||||
3 => Vector3::SIDE_SOUTH
|
||||
];
|
||||
if(!$this->getSide($sides[$this->meta])->isSolid()){
|
||||
if(isset($sides[$this->meta]) and !$this->getSide($sides[$this->meta])->isSolid()){
|
||||
$this->level->useBreakOn($this);
|
||||
}
|
||||
}
|
||||
@ -112,4 +112,8 @@ class ItemFrame extends Flowable{
|
||||
public function isAffectedBySilkTouch() : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getHardness() : float{
|
||||
return 0.25;
|
||||
}
|
||||
}
|
||||
|
@ -58,8 +58,10 @@ class Ladder extends Transparent{
|
||||
}
|
||||
|
||||
public function onEntityCollide(Entity $entity) : void{
|
||||
$entity->resetFallDistance();
|
||||
$entity->onGround = true;
|
||||
if($entity->asVector3()->floor()->distanceSquared($this) < 1){ //entity coordinates must be inside block
|
||||
$entity->resetFallDistance();
|
||||
$entity->onGround = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected function recalculateBoundingBox() : ?AxisAlignedBB{
|
||||
|
@ -188,7 +188,7 @@ class Leaves extends Transparent{
|
||||
}
|
||||
|
||||
public function canDropApples() : bool{
|
||||
return $this->meta === self::OAK;
|
||||
return $this->getVariant() === self::OAK;
|
||||
}
|
||||
|
||||
public function getFlameEncouragement() : int{
|
||||
|
@ -44,6 +44,6 @@ class Leaves2 extends Leaves{
|
||||
}
|
||||
|
||||
public function canDropApples() : bool{
|
||||
return $this->meta === self::DARK_OAK;
|
||||
return $this->getVariant() === self::DARK_OAK;
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ use pocketmine\level\sound\FizzSound;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Vector3;
|
||||
use function array_fill;
|
||||
use function intdiv;
|
||||
use function lcg_value;
|
||||
use function min;
|
||||
|
||||
@ -372,7 +373,7 @@ abstract class Liquid extends Transparent{
|
||||
*/
|
||||
private function getOptimalFlowDirections() : array{
|
||||
$flowCost = array_fill(0, 4, 1000);
|
||||
$maxCost = 4 / $this->getFlowDecayPerBlock();
|
||||
$maxCost = intdiv(4, $this->getFlowDecayPerBlock());
|
||||
for($j = 0; $j < 4; ++$j){
|
||||
$x = $this->x;
|
||||
$y = $this->y;
|
||||
|
@ -46,4 +46,6 @@ class NoteBlock extends Solid{
|
||||
public function getToolType() : int{
|
||||
return BlockToolType::TYPE_AXE;
|
||||
}
|
||||
|
||||
//TODO
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\item\Item;
|
||||
|
||||
class PackedIce extends Solid{
|
||||
|
||||
protected $id = self::PACKED_ICE;
|
||||
@ -46,4 +48,8 @@ class PackedIce extends Solid{
|
||||
public function getToolType() : int{
|
||||
return BlockToolType::TYPE_PICKAXE;
|
||||
}
|
||||
|
||||
public function getDropsForCompatibleTool(Item $item) : array{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class Quartz extends Solid{
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
||||
if($this->meta !== self::NORMAL){
|
||||
if($this->getVariant() !== self::NORMAL){
|
||||
$this->meta = PillarRotationHelper::getMetaFromFace($this->meta, $face);
|
||||
}
|
||||
return $this->getLevel()->setBlock($blockReplace, $this, true, true);
|
||||
|
31
src/pocketmine/block/Reserved6.php
Normal file
31
src/pocketmine/block/Reserved6.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class Reserved6 extends Solid{
|
||||
|
||||
public function getHardness() : float{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -40,7 +40,7 @@ class Sand extends Fallable{
|
||||
}
|
||||
|
||||
public function getName() : string{
|
||||
if($this->meta === 0x01){
|
||||
if($this->getVariant() === 0x01){
|
||||
return "Red Sand";
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ abstract class Slab extends Transparent{
|
||||
}
|
||||
}else{ //TODO: collision
|
||||
if($blockReplace->getId() === $this->id){
|
||||
if($blockReplace->getVariant() === $this->meta){
|
||||
if($blockReplace->getVariant() === $this->getVariant()){
|
||||
$this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->getDoubleSlabId(), $this->getVariant()), true);
|
||||
|
||||
return true;
|
||||
|
@ -30,6 +30,6 @@ class StainedClay extends HardenedClay{
|
||||
protected $id = self::STAINED_CLAY;
|
||||
|
||||
public function getName() : string{
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Stained Clay";
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->getVariant()) . " Stained Clay";
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,6 @@ class StainedGlass extends Glass{
|
||||
protected $id = self::STAINED_GLASS;
|
||||
|
||||
public function getName() : string{
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Stained Glass";
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->getVariant()) . " Stained Glass";
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,6 @@ class StainedGlassPane extends GlassPane{
|
||||
protected $id = self::STAINED_GLASS_PANE;
|
||||
|
||||
public function getName() : string{
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Stained Glass Pane";
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->getVariant()) . " Stained Glass Pane";
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ abstract class Stair extends Transparent{
|
||||
2 => 1,
|
||||
3 => 3
|
||||
];
|
||||
$this->meta = $faces[$player->getDirection()] & 0x03;
|
||||
$this->meta = $player !== null ? $faces[$player->getDirection()] & 0x03 : 0;
|
||||
if(($clickVector->y > 0.5 and $face !== Vector3::SIDE_UP) or $face === Vector3::SIDE_DOWN){
|
||||
$this->meta |= 0x04; //Upside-down stairs
|
||||
}
|
||||
|
@ -26,6 +26,12 @@ namespace pocketmine\block;
|
||||
class StoneSlab2 extends StoneSlab{
|
||||
public const TYPE_RED_SANDSTONE = 0;
|
||||
public const TYPE_PURPUR = 1;
|
||||
public const TYPE_PRISMARINE = 2;
|
||||
public const TYPE_DARK_PRISMARINE = 3;
|
||||
public const TYPE_PRISMARINE_BRICKS = 4;
|
||||
public const TYPE_MOSSY_COBBLESTONE = 5;
|
||||
public const TYPE_SMOOTH_SANDSTONE = 6;
|
||||
public const TYPE_RED_NETHER_BRICK = 7;
|
||||
|
||||
protected $id = self::STONE_SLAB2;
|
||||
|
||||
@ -36,7 +42,13 @@ class StoneSlab2 extends StoneSlab{
|
||||
public function getName() : string{
|
||||
static $names = [
|
||||
self::TYPE_RED_SANDSTONE => "Red Sandstone",
|
||||
self::TYPE_PURPUR => "Purpur"
|
||||
self::TYPE_PURPUR => "Purpur",
|
||||
self::TYPE_PRISMARINE => "Prismarine",
|
||||
self::TYPE_DARK_PRISMARINE => "Dark Prismarine",
|
||||
self::TYPE_PRISMARINE_BRICKS => "Prismarine Bricks",
|
||||
self::TYPE_MOSSY_COBBLESTONE => "Mossy Cobblestone",
|
||||
self::TYPE_SMOOTH_SANDSTONE => "Smooth Sandstone",
|
||||
self::TYPE_RED_NETHER_BRICK => "Red Nether Brick"
|
||||
];
|
||||
|
||||
return (($this->meta & 0x08) > 0 ? "Upper " : "") . ($names[$this->getVariant()] ?? "") . " Slab";
|
||||
|
@ -37,6 +37,10 @@ class Stonecutter extends Solid{
|
||||
return "Stonecutter";
|
||||
}
|
||||
|
||||
public function getHardness() : float{
|
||||
return 3.5;
|
||||
}
|
||||
|
||||
public function getToolType() : int{
|
||||
return BlockToolType::TYPE_PICKAXE;
|
||||
}
|
||||
|
@ -50,9 +50,11 @@ class Sugarcane extends Flowable{
|
||||
if($b->getId() === self::AIR){
|
||||
$ev = new BlockGrowEvent($b, BlockFactory::get(Block::SUGARCANE_BLOCK));
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
|
||||
if($ev->isCancelled()){
|
||||
break;
|
||||
}
|
||||
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ namespace pocketmine\block;
|
||||
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\entity\projectile\Arrow;
|
||||
use pocketmine\item\Durable;
|
||||
use pocketmine\item\enchantment\Enchantment;
|
||||
use pocketmine\item\FlintSteel;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\Vector3;
|
||||
@ -51,8 +53,10 @@ class TNT extends Solid{
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player = null) : bool{
|
||||
if($item instanceof FlintSteel){
|
||||
$item->applyDamage(1);
|
||||
if($item instanceof FlintSteel or $item->hasEnchantment(Enchantment::FIRE_ASPECT)){
|
||||
if($item instanceof Durable){
|
||||
$item->applyDamage(1);
|
||||
}
|
||||
$this->ignite();
|
||||
return true;
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ class TallGrass extends Flowable{
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||
if($down->getId() === self::GRASS){
|
||||
$down = $this->getSide(Vector3::SIDE_DOWN)->getId();
|
||||
if($down === self::GRASS or $down === self::DIRT){
|
||||
$this->getLevel()->setBlock($blockReplace, $this, true);
|
||||
|
||||
return true;
|
||||
|
@ -43,7 +43,7 @@ class Wool extends Solid{
|
||||
}
|
||||
|
||||
public function getName() : string{
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Wool";
|
||||
return ColorBlockMetaHelper::getColorFromMeta($this->getVariant()) . " Wool";
|
||||
}
|
||||
|
||||
public function getBreakTime(Item $item) : float{
|
||||
|
@ -26,6 +26,7 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace pocketmine\command;
|
||||
|
||||
use pocketmine\command\utils\CommandException;
|
||||
use pocketmine\lang\TextContainer;
|
||||
use pocketmine\lang\TranslationContainer;
|
||||
use pocketmine\permission\PermissionManager;
|
||||
@ -92,6 +93,7 @@ abstract class Command{
|
||||
* @param string[] $args
|
||||
*
|
||||
* @return mixed
|
||||
* @throws CommandException
|
||||
*/
|
||||
abstract public function execute(CommandSender $sender, string $commandLabel, array $args);
|
||||
|
||||
|
@ -141,6 +141,7 @@ class CommandReader extends Thread{
|
||||
case self::TYPE_STREAM:
|
||||
//stream_select doesn't work on piped streams for some reason
|
||||
$r = [self::$stdin];
|
||||
$w = $e = null;
|
||||
if(($count = stream_select($r, $w, $e, 0, 200000)) === 0){ //nothing changed in 200000 microseconds
|
||||
return true;
|
||||
}elseif($count === false){ //stream error
|
||||
|
@ -74,14 +74,14 @@ class FormattedCommandAlias extends Command{
|
||||
$index = strpos($formatString, '$');
|
||||
while($index !== false){
|
||||
$start = $index;
|
||||
if($index > 0 and $formatString{$start - 1} === "\\"){
|
||||
if($index > 0 and $formatString[$start - 1] === "\\"){
|
||||
$formatString = substr($formatString, 0, $start - 1) . substr($formatString, $start);
|
||||
$index = strpos($formatString, '$', $index);
|
||||
continue;
|
||||
}
|
||||
|
||||
$required = false;
|
||||
if($formatString{$index + 1} == '$'){
|
||||
if($formatString[$index + 1] == '$'){
|
||||
$required = true;
|
||||
|
||||
++$index;
|
||||
@ -91,7 +91,7 @@ class FormattedCommandAlias extends Command{
|
||||
|
||||
$argStart = $index;
|
||||
|
||||
while($index < strlen($formatString) and self::inRange(ord($formatString{$index}) - 48, 0, 9)){
|
||||
while($index < strlen($formatString) and self::inRange(ord($formatString[$index]) - 48, 0, 9)){
|
||||
++$index;
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ class FormattedCommandAlias extends Command{
|
||||
|
||||
$rest = false;
|
||||
|
||||
if($index < strlen($formatString) and $formatString{$index} === "-"){
|
||||
if($index < strlen($formatString) and $formatString[$index] === "-"){
|
||||
$rest = true;
|
||||
++$index;
|
||||
}
|
||||
|
@ -66,13 +66,13 @@ use pocketmine\command\defaults\VersionCommand;
|
||||
use pocketmine\command\defaults\WhitelistCommand;
|
||||
use pocketmine\command\utils\InvalidCommandSyntaxException;
|
||||
use pocketmine\Server;
|
||||
use function array_map;
|
||||
use function array_shift;
|
||||
use function count;
|
||||
use function explode;
|
||||
use function implode;
|
||||
use function min;
|
||||
use function str_getcsv;
|
||||
use function preg_match_all;
|
||||
use function stripslashes;
|
||||
use function strpos;
|
||||
use function strtolower;
|
||||
use function trim;
|
||||
@ -247,7 +247,16 @@ class SimpleCommandMap implements CommandMap{
|
||||
}
|
||||
|
||||
public function dispatch(CommandSender $sender, string $commandLine) : bool{
|
||||
$args = array_map("\stripslashes", str_getcsv($commandLine, " "));
|
||||
$args = [];
|
||||
preg_match_all('/"((?:\\\\.|[^\\\\"])*)"|(\S+)/u', $commandLine, $matches);
|
||||
foreach($matches[0] as $k => $_){
|
||||
for($i = 1; $i <= 2; ++$i){
|
||||
if($matches[$i][$k] !== ""){
|
||||
$args[$k] = stripslashes($matches[$i][$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$sentCommandLabel = "";
|
||||
$target = $this->matchCommand($sentCommandLabel, $args);
|
||||
|
||||
|
@ -53,6 +53,9 @@ class DeopCommand extends VanillaCommand{
|
||||
}
|
||||
|
||||
$name = array_shift($args);
|
||||
if(!Player::isValidUserName($name)){
|
||||
throw new InvalidCommandSyntaxException();
|
||||
}
|
||||
|
||||
$player = $sender->getServer()->getOfflinePlayer($name);
|
||||
$player->setOp(false);
|
||||
|
@ -83,7 +83,7 @@ class EffectCommand extends VanillaCommand{
|
||||
$amplification = 0;
|
||||
|
||||
if(count($args) >= 3){
|
||||
if(($d = $this->getBoundedInt($sender, $args[2], 0, INT32_MAX)) === null){
|
||||
if(($d = $this->getBoundedInt($sender, $args[2], 0, (int) (INT32_MAX / 20))) === null){
|
||||
return false;
|
||||
}
|
||||
$duration = $d * 20; //ticks
|
||||
|
@ -55,7 +55,7 @@ class KillCommand extends VanillaCommand{
|
||||
|
||||
if(count($args) === 1){
|
||||
if(!$sender->hasPermission("pocketmine.command.kill.other")){
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
||||
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -74,7 +74,7 @@ class KillCommand extends VanillaCommand{
|
||||
|
||||
if($sender instanceof Player){
|
||||
if(!$sender->hasPermission("pocketmine.command.kill.self")){
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
||||
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -53,6 +53,9 @@ class OpCommand extends VanillaCommand{
|
||||
}
|
||||
|
||||
$name = array_shift($args);
|
||||
if(!Player::isValidUserName($name)){
|
||||
throw new InvalidCommandSyntaxException();
|
||||
}
|
||||
|
||||
$player = $sender->getServer()->getOfflinePlayer($name);
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.op.success", [$player->getName()]));
|
||||
|
@ -26,6 +26,8 @@ namespace pocketmine\command\defaults;
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\lang\TranslationContainer;
|
||||
use function microtime;
|
||||
use function round;
|
||||
|
||||
class SaveCommand extends VanillaCommand{
|
||||
|
||||
@ -43,7 +45,8 @@ class SaveCommand extends VanillaCommand{
|
||||
return true;
|
||||
}
|
||||
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.save.start"));
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("pocketmine.save.start"));
|
||||
$start = microtime(true);
|
||||
|
||||
foreach($sender->getServer()->getOnlinePlayers() as $player){
|
||||
$player->save();
|
||||
@ -53,7 +56,7 @@ class SaveCommand extends VanillaCommand{
|
||||
$level->save(true);
|
||||
}
|
||||
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.save.success"));
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("pocketmine.save.success", [round(microtime(true) - $start, 3)]));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -108,13 +108,11 @@ class StatusCommand extends VanillaCommand{
|
||||
|
||||
foreach($server->getLevels() as $level){
|
||||
$levelName = $level->getFolderName() !== $level->getName() ? " (" . $level->getName() . ")" : "";
|
||||
$timeColor = ($level->getTickRate() > 1 or $level->getTickRateTime() > 40) ? TextFormat::RED : TextFormat::YELLOW;
|
||||
$tickRate = $level->getTickRate() > 1 ? " (tick rate " . $level->getTickRate() . ")" : "";
|
||||
$timeColor = $level->getTickRateTime() > 40 ? TextFormat::RED : TextFormat::YELLOW;
|
||||
$sender->sendMessage(TextFormat::GOLD . "World \"{$level->getFolderName()}\"$levelName: " .
|
||||
TextFormat::RED . number_format(count($level->getChunks())) . TextFormat::GREEN . " chunks, " .
|
||||
TextFormat::RED . number_format(count($level->getEntities())) . TextFormat::GREEN . " entities, " .
|
||||
TextFormat::RED . number_format(count($level->getTiles())) . TextFormat::GREEN . " tiles. " .
|
||||
"Time $timeColor" . round($level->getTickRateTime(), 2) . "ms" . $tickRate
|
||||
TextFormat::RED . number_format(count($level->getEntities())) . TextFormat::GREEN . " entities. " .
|
||||
"Time $timeColor" . round($level->getTickRateTime(), 2) . "ms"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class TimeCommand extends VanillaCommand{
|
||||
|
||||
if($args[0] === "start"){
|
||||
if(!$sender->hasPermission("pocketmine.command.time.start")){
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
||||
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -61,7 +61,7 @@ class TimeCommand extends VanillaCommand{
|
||||
return true;
|
||||
}elseif($args[0] === "stop"){
|
||||
if(!$sender->hasPermission("pocketmine.command.time.stop")){
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
||||
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -72,7 +72,7 @@ class TimeCommand extends VanillaCommand{
|
||||
return true;
|
||||
}elseif($args[0] === "query"){
|
||||
if(!$sender->hasPermission("pocketmine.command.time.query")){
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
||||
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -81,7 +81,7 @@ class TimeCommand extends VanillaCommand{
|
||||
}else{
|
||||
$level = $sender->getServer()->getDefaultLevel();
|
||||
}
|
||||
$sender->sendMessage(new TranslationContainer("commands.time.query", [$level->getTime()]));
|
||||
$sender->sendMessage($sender->getServer()->getLanguage()->translateString("commands.time.query", [$level->getTime()]));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ class TimeCommand extends VanillaCommand{
|
||||
|
||||
if($args[0] === "set"){
|
||||
if(!$sender->hasPermission("pocketmine.command.time.set")){
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
||||
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -111,7 +111,7 @@ class TimeCommand extends VanillaCommand{
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.time.set", [$value]));
|
||||
}elseif($args[0] === "add"){
|
||||
if(!$sender->hasPermission("pocketmine.command.time.add")){
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
||||
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -42,6 +42,10 @@ class TransferServerCommand extends VanillaCommand{
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, string $commandLabel, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($args) < 1){
|
||||
throw new InvalidCommandSyntaxException();
|
||||
}elseif(!($sender instanceof Player)){
|
||||
|
@ -65,7 +65,7 @@ abstract class VanillaCommand extends Command{
|
||||
* @return float
|
||||
*/
|
||||
protected function getRelativeDouble(float $original, CommandSender $sender, string $input, float $min = self::MIN_COORD, float $max = self::MAX_COORD) : float{
|
||||
if($input{0} === "~"){
|
||||
if($input[0] === "~"){
|
||||
$value = $this->getDouble($sender, substr($input, 1));
|
||||
|
||||
return $original + $value;
|
||||
|
@ -27,6 +27,7 @@ use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\command\utils\InvalidCommandSyntaxException;
|
||||
use pocketmine\lang\TranslationContainer;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\utils\TextFormat;
|
||||
use function count;
|
||||
use function implode;
|
||||
@ -94,6 +95,9 @@ class WhitelistCommand extends VanillaCommand{
|
||||
if($this->badPerm($sender, strtolower($args[0]))){
|
||||
return false;
|
||||
}
|
||||
if(!Player::isValidUserName($args[1])){
|
||||
throw new InvalidCommandSyntaxException();
|
||||
}
|
||||
switch(strtolower($args[0])){
|
||||
case "add":
|
||||
$sender->getServer()->getOfflinePlayer($args[1])->setWhitelisted(true);
|
||||
@ -111,9 +115,13 @@ class WhitelistCommand extends VanillaCommand{
|
||||
return true;
|
||||
}
|
||||
|
||||
private function badPerm(CommandSender $sender, string $perm) : bool{
|
||||
if(!$sender->hasPermission("pocketmine.command.whitelist.$perm")){
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
||||
private function badPerm(CommandSender $sender, string $subcommand) : bool{
|
||||
static $map = [
|
||||
"on" => "enable",
|
||||
"off" => "disable"
|
||||
];
|
||||
if(!$sender->hasPermission("pocketmine.command.whitelist." . ($map[$subcommand] ?? $subcommand))){
|
||||
$sender->sendMessage($sender->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -40,6 +40,11 @@ class Attribute{
|
||||
public const ATTACK_DAMAGE = 8;
|
||||
public const EXPERIENCE_LEVEL = 9;
|
||||
public const EXPERIENCE = 10;
|
||||
public const UNDERWATER_MOVEMENT = 11;
|
||||
public const LUCK = 12;
|
||||
public const FALL_DAMAGE = 13;
|
||||
public const HORSE_JUMP_STRENGTH = 14;
|
||||
public const ZOMBIE_SPAWN_REINFORCEMENTS = 15;
|
||||
|
||||
private $id;
|
||||
protected $minValue;
|
||||
@ -66,8 +71,11 @@ class Attribute{
|
||||
self::addAttribute(self::ATTACK_DAMAGE, "minecraft:attack_damage", 0.00, 340282346638528859811704183484516925440.00, 1.00, false);
|
||||
self::addAttribute(self::EXPERIENCE_LEVEL, "minecraft:player.level", 0.00, 24791.00, 0.00);
|
||||
self::addAttribute(self::EXPERIENCE, "minecraft:player.experience", 0.00, 1.00, 0.00);
|
||||
//TODO: minecraft:luck (for fishing?)
|
||||
//TODO: minecraft:fall_damage
|
||||
self::addAttribute(self::UNDERWATER_MOVEMENT, "minecraft:underwater_movement", 0.0, 340282346638528859811704183484516925440.0, 0.02);
|
||||
self::addAttribute(self::LUCK, "minecraft:luck", -1024.0, 1024.0, 0.0);
|
||||
self::addAttribute(self::FALL_DAMAGE, "minecraft:fall_damage", 0.0, 340282346638528859811704183484516925440.0, 1.0);
|
||||
self::addAttribute(self::HORSE_JUMP_STRENGTH, "minecraft:horse.jump_strength", 0.0, 2.0, 0.7);
|
||||
self::addAttribute(self::ZOMBIE_SPAWN_REINFORCEMENTS, "minecraft:zombie.spawn_reinforcements", 0.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,8 +23,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\entity;
|
||||
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use function assert;
|
||||
use function is_float;
|
||||
use function is_int;
|
||||
@ -140,25 +140,14 @@ class DataPropertyManager{
|
||||
$this->setPropertyValue($key, Entity::DATA_TYPE_STRING, $value, $force);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $key
|
||||
*
|
||||
* @return null|Item
|
||||
*/
|
||||
public function getItem(int $key) : ?Item{
|
||||
$value = $this->getPropertyValue($key, Entity::DATA_TYPE_SLOT);
|
||||
assert($value instanceof Item or $value === null);
|
||||
|
||||
public function getCompoundTag(int $key) : ?CompoundTag{
|
||||
$value = $this->getPropertyValue($key, Entity::DATA_TYPE_COMPOUND_TAG);
|
||||
assert($value instanceof CompoundTag or $value === null);
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $key
|
||||
* @param Item $value
|
||||
* @param bool $force
|
||||
*/
|
||||
public function setItem(int $key, Item $value, bool $force = false) : void{
|
||||
$this->setPropertyValue($key, Entity::DATA_TYPE_SLOT, $value, $force);
|
||||
public function setCompoundTag(int $key, CompoundTag $value, bool $force = false) : void{
|
||||
$this->setPropertyValue($key, Entity::DATA_TYPE_COMPOUND_TAG, $value, $force);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,12 +62,12 @@ use pocketmine\nbt\tag\DoubleTag;
|
||||
use pocketmine\nbt\tag\FloatTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\network\mcpe\protocol\AddEntityPacket;
|
||||
use pocketmine\network\mcpe\protocol\EntityEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\MoveEntityAbsolutePacket;
|
||||
use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetEntityDataPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetEntityMotionPacket;
|
||||
use pocketmine\network\mcpe\protocol\ActorEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\AddActorPacket;
|
||||
use pocketmine\network\mcpe\protocol\MoveActorAbsolutePacket;
|
||||
use pocketmine\network\mcpe\protocol\RemoveActorPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetActorDataPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetActorMotionPacket;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\plugin\Plugin;
|
||||
use pocketmine\Server;
|
||||
@ -102,11 +102,15 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
public const DATA_TYPE_INT = 2;
|
||||
public const DATA_TYPE_FLOAT = 3;
|
||||
public const DATA_TYPE_STRING = 4;
|
||||
public const DATA_TYPE_SLOT = 5;
|
||||
public const DATA_TYPE_COMPOUND_TAG = 5;
|
||||
public const DATA_TYPE_POS = 6;
|
||||
public const DATA_TYPE_LONG = 7;
|
||||
public const DATA_TYPE_VECTOR3F = 8;
|
||||
|
||||
/*
|
||||
* Readers beware: this isn't a nice list. Some of the properties have different types for different entities, and
|
||||
* are used for entirely different things.
|
||||
*/
|
||||
public const DATA_FLAGS = 0;
|
||||
public const DATA_HEALTH = 1; //int (minecart/boat)
|
||||
public const DATA_VARIANT = 2; //int
|
||||
@ -124,17 +128,21 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
public const DATA_PADDLE_TIME_RIGHT = 14; //float
|
||||
public const DATA_EXPERIENCE_VALUE = 15; //int (xp orb)
|
||||
public const DATA_MINECART_DISPLAY_BLOCK = 16; //int (id | (data << 16))
|
||||
public const DATA_HORSE_FLAGS = 16; //int
|
||||
/* 16 (byte) used by wither skull */
|
||||
public const DATA_MINECART_DISPLAY_OFFSET = 17; //int
|
||||
public const DATA_SHOOTER_ID = 17; //long (used by arrows)
|
||||
public const DATA_MINECART_HAS_DISPLAY = 18; //byte (must be 1 for minecart to show block inside)
|
||||
|
||||
//TODO: add more properties
|
||||
|
||||
public const DATA_HORSE_TYPE = 19; //byte
|
||||
/* 20 (unknown)
|
||||
* 21 (unknown) */
|
||||
public const DATA_CHARGE_AMOUNT = 22; //int8, used for ghasts and also crossbow charging
|
||||
public const DATA_ENDERMAN_HELD_ITEM_ID = 23; //short
|
||||
public const DATA_ENTITY_AGE = 24; //short
|
||||
|
||||
/* 26 (byte) player-specific flags
|
||||
* 27 (int) player "index"?
|
||||
* 28 (block coords) bed position */
|
||||
/* 25 (int) used by horse, (byte) used by witch */
|
||||
public const DATA_PLAYER_FLAGS = 26; //byte
|
||||
public const DATA_PLAYER_INDEX = 27; //int, used for marker colours and agent nametag colours
|
||||
public const DATA_PLAYER_BED_POSITION = 28; //blockpos
|
||||
public const DATA_FIREBALL_POWER_X = 29; //float
|
||||
public const DATA_FIREBALL_POWER_Y = 30;
|
||||
public const DATA_FIREBALL_POWER_Z = 31;
|
||||
@ -145,9 +153,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
public const DATA_POTION_AUX_VALUE = 36; //short
|
||||
public const DATA_LEAD_HOLDER_EID = 37; //long
|
||||
public const DATA_SCALE = 38; //float
|
||||
public const DATA_INTERACTIVE_TAG = 39; //string (button text)
|
||||
public const DATA_NPC_SKIN_ID = 40; //string
|
||||
public const DATA_URL_TAG = 41; //string
|
||||
public const DATA_HAS_NPC_COMPONENT = 39; //byte (???)
|
||||
public const DATA_NPC_SKIN_INDEX = 40; //string
|
||||
public const DATA_NPC_ACTIONS = 41; //string (maybe JSON blob?)
|
||||
public const DATA_MAX_AIR = 42; //short
|
||||
public const DATA_MARK_VARIANT = 43; //int
|
||||
public const DATA_CONTAINER_TYPE = 44; //byte (ContainerComponent)
|
||||
@ -195,12 +203,27 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
public const DATA_BOAT_BUBBLE_TIME = 86; //int (time in bubble column)
|
||||
public const DATA_PLAYER_AGENT_EID = 87; //long
|
||||
/* 88 (float) related to panda sitting
|
||||
* 89 (float) related to panda sitting
|
||||
* 90 (unknown) */
|
||||
* 89 (float) related to panda sitting */
|
||||
public const DATA_EAT_COUNTER = 90; //int (used by pandas)
|
||||
public const DATA_FLAGS2 = 91; //long (extended data flags)
|
||||
/* 92 (float) related to panda lying down
|
||||
* 93 (float) related to panda lying down */
|
||||
|
||||
public const DATA_AREA_EFFECT_CLOUD_DURATION = 94; //int
|
||||
public const DATA_AREA_EFFECT_CLOUD_SPAWN_TIME = 95; //int
|
||||
public const DATA_AREA_EFFECT_CLOUD_RADIUS_PER_TICK = 96; //float, usually negative
|
||||
public const DATA_AREA_EFFECT_CLOUD_RADIUS_CHANGE_ON_PICKUP = 97; //float
|
||||
public const DATA_AREA_EFFECT_CLOUD_PICKUP_COUNT = 98; //int
|
||||
public const DATA_INTERACTIVE_TAG = 99; //string (button text)
|
||||
public const DATA_TRADE_TIER = 100; //int
|
||||
public const DATA_MAX_TRADE_TIER = 101; //int
|
||||
public const DATA_TRADE_XP = 102; //int
|
||||
public const DATA_SKIN_ID = 103; //int ???
|
||||
/* 104 (int) related to wither */
|
||||
public const DATA_COMMAND_BLOCK_TICK_DELAY = 105; //int
|
||||
public const DATA_COMMAND_BLOCK_EXECUTE_ON_FIRST_TICK = 106; //byte
|
||||
public const DATA_AMBIENT_SOUND_INTERVAL_MIN = 107; //float
|
||||
public const DATA_AMBIENT_SOUND_INTERVAL_RANGE = 108; //float
|
||||
public const DATA_AMBIENT_SOUND_EVENT = 109; //string
|
||||
|
||||
public const DATA_FLAG_ONFIRE = 0;
|
||||
public const DATA_FLAG_SNEAKING = 1;
|
||||
@ -273,6 +296,26 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
public const DATA_FLAG_IN_SCAFFOLDING = 68;
|
||||
public const DATA_FLAG_OVER_SCAFFOLDING = 69;
|
||||
public const DATA_FLAG_FALL_THROUGH_SCAFFOLDING = 70;
|
||||
public const DATA_FLAG_BLOCKING = 71; //shield
|
||||
public const DATA_FLAG_DISABLE_BLOCKING = 72;
|
||||
//73 is set when a player is attacked while using shield, unclear on purpose
|
||||
//74 related to shield usage, needs further investigation
|
||||
public const DATA_FLAG_SLEEPING = 75;
|
||||
//76 related to sleeping, unclear usage
|
||||
public const DATA_FLAG_TRADE_INTEREST = 77;
|
||||
public const DATA_FLAG_DOOR_BREAKER = 78; //...
|
||||
public const DATA_FLAG_BREAKING_OBSTRUCTION = 79;
|
||||
public const DATA_FLAG_DOOR_OPENER = 80; //...
|
||||
public const DATA_FLAG_ILLAGER_CAPTAIN = 81;
|
||||
public const DATA_FLAG_STUNNED = 82;
|
||||
public const DATA_FLAG_ROARING = 83;
|
||||
public const DATA_FLAG_DELAYED_ATTACKING = 84;
|
||||
public const DATA_FLAG_AVOIDING_MOBS = 85;
|
||||
//86 used by RangedAttackGoal
|
||||
//87 used by NearestAttackableTargetGoal
|
||||
|
||||
public const DATA_PLAYER_FLAG_SLEEP = 1;
|
||||
public const DATA_PLAYER_FLAG_DEAD = 2; //TODO: CHECK
|
||||
|
||||
public static $entityCount = 1;
|
||||
/** @var Entity[] */
|
||||
@ -525,6 +568,8 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
/** @var bool */
|
||||
protected $constructed = false;
|
||||
|
||||
/** @var bool */
|
||||
private $closeInFlight = false;
|
||||
|
||||
public function __construct(Level $level, CompoundTag $nbt){
|
||||
$this->constructed = true;
|
||||
@ -556,6 +601,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
throw new \InvalidStateException("Cannot create entities in unloaded chunks");
|
||||
}
|
||||
|
||||
$this->motion = new Vector3(0, 0, 0);
|
||||
if($this->namedtag->hasTag("Motion", ListTag::class)){
|
||||
/** @var float[] $motion */
|
||||
$motion = $this->namedtag->getListTag("Motion")->getAllValues();
|
||||
@ -622,7 +668,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
* @return bool
|
||||
*/
|
||||
public function isNameTagAlwaysVisible() : bool{
|
||||
return $this->getGenericFlag(self::DATA_FLAG_ALWAYS_SHOW_NAMETAG);
|
||||
return $this->propertyManager->getByte(self::DATA_ALWAYS_SHOW_NAMETAG) === 1;
|
||||
}
|
||||
|
||||
|
||||
@ -1097,7 +1143,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
$this->setFireTicks($ticks);
|
||||
}
|
||||
|
||||
$this->setGenericFlag(self::DATA_FLAG_ONFIRE, true);
|
||||
$this->setGenericFlag(self::DATA_FLAG_ONFIRE, $this->isOnFire());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1164,6 +1210,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
}
|
||||
|
||||
protected function updateMovement(bool $teleport = false) : void{
|
||||
//TODO: hack for client-side AI interference: prevent client sided movement when motion is 0
|
||||
$this->setImmobile($this->motion->x == 0 and $this->motion->y == 0 and $this->motion->z == 0);
|
||||
|
||||
$diffPosition = ($this->x - $this->lastX) ** 2 + ($this->y - $this->lastY) ** 2 + ($this->z - $this->lastZ) ** 2;
|
||||
$diffRotation = ($this->yaw - $this->lastYaw) ** 2 + ($this->pitch - $this->lastPitch) ** 2;
|
||||
|
||||
@ -1192,7 +1241,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
}
|
||||
|
||||
protected function broadcastMovement(bool $teleport = false) : void{
|
||||
$pk = new MoveEntityAbsolutePacket();
|
||||
$pk = new MoveActorAbsolutePacket();
|
||||
$pk->entityRuntimeId = $this->id;
|
||||
$pk->position = $this->getOffsetPosition($this);
|
||||
|
||||
@ -1204,14 +1253,14 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
$pk->zRot = $this->yaw;
|
||||
|
||||
if($teleport){
|
||||
$pk->flags |= MoveEntityAbsolutePacket::FLAG_TELEPORT;
|
||||
$pk->flags |= MoveActorAbsolutePacket::FLAG_TELEPORT;
|
||||
}
|
||||
|
||||
$this->level->broadcastPacketToViewers($this, $pk);
|
||||
}
|
||||
|
||||
protected function broadcastMotion() : void{
|
||||
$pk = new SetEntityMotionPacket();
|
||||
$pk = new SetActorMotionPacket();
|
||||
$pk->entityRuntimeId = $this->id;
|
||||
$pk->motion = $this->getMotion();
|
||||
|
||||
@ -1632,7 +1681,8 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
|
||||
assert(abs($dx) <= 20 and abs($dy) <= 20 and abs($dz) <= 20, "Movement distance is excessive: dx=$dx, dy=$dy, dz=$dz");
|
||||
|
||||
$list = $this->level->getCollisionCubes($this, $this->level->getTickRate() > 1 ? $this->boundingBox->offsetCopy($dx, $dy, $dz) : $this->boundingBox->addCoord($dx, $dy, $dz), false);
|
||||
//TODO: bad hack here will cause unexpected behaviour under heavy lag
|
||||
$list = $this->level->getCollisionCubes($this, $this->level->getTickRateTime() > 50 ? $this->boundingBox->offsetCopy($dx, $dy, $dz) : $this->boundingBox->addCoord($dx, $dy, $dz), false);
|
||||
|
||||
foreach($list as $bb){
|
||||
$dy = $bb->calculateYOffset($this->boundingBox, $dy);
|
||||
@ -1732,6 +1782,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated WARNING: Despite what its name implies, this function DOES NOT return all the blocks around the entity.
|
||||
* Instead, it returns blocks which have reactions for an entity intersecting with them.
|
||||
*
|
||||
* @return Block[]
|
||||
*/
|
||||
public function getBlocksAround() : array{
|
||||
@ -1977,7 +2030,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
* @param Player $player
|
||||
*/
|
||||
protected function sendSpawnPacket(Player $player) : void{
|
||||
$pk = new AddEntityPacket();
|
||||
$pk = new AddActorPacket();
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->type = static::NETWORK_ID;
|
||||
$pk->position = $this->asVector3();
|
||||
@ -2021,13 +2074,16 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated WARNING: This function DOES NOT permanently hide the entity from the player. As soon as the entity or
|
||||
* player moves, the player will once again be able to see the entity.
|
||||
*
|
||||
* @param Player $player
|
||||
* @param bool $send
|
||||
*/
|
||||
public function despawnFrom(Player $player, bool $send = true) : void{
|
||||
if(isset($this->hasSpawned[$player->getLoaderId()])){
|
||||
if($send){
|
||||
$pk = new RemoveEntityPacket();
|
||||
$pk = new RemoveActorPacket();
|
||||
$pk->entityUniqueId = $this->id;
|
||||
$player->dataPacket($pk);
|
||||
}
|
||||
@ -2035,6 +2091,10 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated WARNING: This function DOES NOT permanently hide the entity from viewers. As soon as the entity or
|
||||
* player moves, viewers will once again be able to see the entity.
|
||||
*/
|
||||
public function despawnFromAll() : void{
|
||||
foreach($this->hasSpawned as $player){
|
||||
$this->despawnFrom($player);
|
||||
@ -2067,7 +2127,12 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
* WARNING: Entities are unusable after this has been executed!
|
||||
*/
|
||||
public function close() : void{
|
||||
if($this->closeInFlight){
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$this->closed){
|
||||
$this->closeInFlight = true;
|
||||
(new EntityDespawnEvent($this))->call();
|
||||
$this->closed = true;
|
||||
|
||||
@ -2086,6 +2151,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
|
||||
$this->namedtag = null;
|
||||
$this->lastDamageCause = null;
|
||||
$this->closeInFlight = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2143,7 +2209,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
$player = [$player];
|
||||
}
|
||||
|
||||
$pk = new SetEntityDataPacket();
|
||||
$pk = new SetActorDataPacket();
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->metadata = $data ?? $this->propertyManager->getAll();
|
||||
|
||||
@ -2160,7 +2226,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
}
|
||||
|
||||
public function broadcastEntityEvent(int $eventId, ?int $eventData = null, ?array $players = null) : void{
|
||||
$pk = new EntityEventPacket();
|
||||
$pk = new ActorEventPacket();
|
||||
$pk->entityRuntimeId = $this->id;
|
||||
$pk->event = $eventId;
|
||||
$pk->data = $eventData ?? 0;
|
||||
|
@ -46,8 +46,8 @@ use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\network\mcpe\protocol\ActorEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\AddPlayerPacket;
|
||||
use pocketmine\network\mcpe\protocol\EntityEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\PlayerListPacket;
|
||||
@ -60,6 +60,7 @@ use function array_merge;
|
||||
use function array_rand;
|
||||
use function array_values;
|
||||
use function ceil;
|
||||
use function in_array;
|
||||
use function max;
|
||||
use function min;
|
||||
use function mt_rand;
|
||||
@ -70,13 +71,6 @@ use const INT32_MIN;
|
||||
|
||||
class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
|
||||
public const DATA_PLAYER_FLAG_SLEEP = 1;
|
||||
public const DATA_PLAYER_FLAG_DEAD = 2; //TODO: CHECK
|
||||
|
||||
public const DATA_PLAYER_FLAGS = 26;
|
||||
|
||||
public const DATA_PLAYER_BED_POSITION = 28;
|
||||
|
||||
/** @var PlayerInventory */
|
||||
protected $inventory;
|
||||
|
||||
@ -105,18 +99,36 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
public function __construct(Level $level, CompoundTag $nbt){
|
||||
if($this->skin === null){
|
||||
$skinTag = $nbt->getCompoundTag("Skin");
|
||||
if($skinTag === null or !self::isValidSkin($skinTag->hasTag("Data", ByteArrayTag::class) ?
|
||||
$skinTag->getByteArray("Data") :
|
||||
$skinTag->getString("Data", "")
|
||||
)){
|
||||
if($skinTag === null){
|
||||
throw new \InvalidStateException((new \ReflectionClass($this))->getShortName() . " must have a valid skin set");
|
||||
}
|
||||
$this->skin = self::deserializeSkinNBT($skinTag); //this throws if the skin is invalid
|
||||
}
|
||||
|
||||
parent::__construct($level, $nbt);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CompoundTag $skinTag
|
||||
*
|
||||
* @return Skin
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected static function deserializeSkinNBT(CompoundTag $skinTag) : Skin{
|
||||
$skin = new Skin(
|
||||
$skinTag->getString("Name"),
|
||||
$skinTag->hasTag("Data", StringTag::class) ? $skinTag->getString("Data") : $skinTag->getByteArray("Data"), //old data (this used to be saved as a StringTag in older versions of PM)
|
||||
$skinTag->getByteArray("CapeData", ""),
|
||||
$skinTag->getString("GeometryName", ""),
|
||||
$skinTag->getByteArray("GeometryData", "")
|
||||
);
|
||||
$skin->validate();
|
||||
return $skin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* Checks the length of a supplied skin bitmap and returns whether the length is valid.
|
||||
*
|
||||
* @param string $skin
|
||||
@ -124,7 +136,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
* @return bool
|
||||
*/
|
||||
public static function isValidSkin(string $skin) : bool{
|
||||
return strlen($skin) === 64 * 64 * 4 or strlen($skin) === 64 * 32 * 4 or strlen($skin) === 128 * 128 * 4;
|
||||
return in_array(strlen($skin), Skin::ACCEPTED_SKIN_SIZES, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,10 +168,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
* @param Skin $skin
|
||||
*/
|
||||
public function setSkin(Skin $skin) : void{
|
||||
if(!$skin->isValid()){
|
||||
throw new \InvalidStateException("Specified skin is not valid, must be 8KiB or 16KiB");
|
||||
}
|
||||
|
||||
$skin->validate();
|
||||
$this->skin = $skin;
|
||||
$this->skin->debloatGeometryData();
|
||||
}
|
||||
@ -203,18 +212,13 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
$old = $attr->getValue();
|
||||
$attr->setValue($new);
|
||||
|
||||
$reset = false;
|
||||
// ranges: 18-20 (regen), 7-17 (none), 1-6 (no sprint), 0 (health depletion)
|
||||
foreach([17, 6, 0] as $bound){
|
||||
if(($old > $bound) !== ($new > $bound)){
|
||||
$reset = true;
|
||||
$this->foodTickTimer = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($reset){
|
||||
$this->foodTickTimer = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getMaxFood() : float{
|
||||
@ -301,7 +305,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
$food = $this->getFood();
|
||||
if($food > 0){
|
||||
$food--;
|
||||
$this->setFood($food);
|
||||
$this->setFood(max($food, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -578,9 +582,14 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
}
|
||||
|
||||
public function getXpDropAmount() : int{
|
||||
return (int) min(100, $this->getCurrentTotalXp());
|
||||
//this causes some XP to be lost on death when above level 1 (by design), dropping at most enough points for
|
||||
//about 7.5 levels of XP.
|
||||
return (int) min(100, 7 * $this->getXpLevel());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PlayerInventory
|
||||
*/
|
||||
public function getInventory(){
|
||||
return $this->inventory;
|
||||
}
|
||||
@ -597,17 +606,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
$this->setNameTag($this->namedtag->getString("NameTag"));
|
||||
}
|
||||
|
||||
$skin = $this->namedtag->getCompoundTag("Skin");
|
||||
if($skin !== null){
|
||||
$this->setSkin(new Skin(
|
||||
$skin->getString("Name"),
|
||||
$skin->hasTag("Data", StringTag::class) ? $skin->getString("Data") : $skin->getByteArray("Data"), //old data (this used to be saved as a StringTag in older versions of PM)
|
||||
$skin->getByteArray("CapeData", ""),
|
||||
$skin->getString("GeometryName", ""),
|
||||
$skin->getByteArray("GeometryData", "")
|
||||
));
|
||||
}
|
||||
|
||||
$this->uuid = UUID::fromData((string) $this->getId(), $this->skin->getSkinData(), $this->getNameTag());
|
||||
}
|
||||
|
||||
@ -633,7 +631,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
//Old hotbar saving stuff, ignore it
|
||||
}elseif($slot >= 100 and $slot < 104){ //Armor
|
||||
$this->armorInventory->setItem($slot - 100, Item::nbtDeserialize($item));
|
||||
}else{
|
||||
}elseif($slot >= 9 and $slot < $this->inventory->getSize() + 9){
|
||||
$this->inventory->setItem($slot - 9, Item::nbtDeserialize($item));
|
||||
}
|
||||
}
|
||||
@ -759,7 +757,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
$this->addEffect(new EffectInstance(Effect::getEffect(Effect::FIRE_RESISTANCE), 40 * 20, 1));
|
||||
$this->addEffect(new EffectInstance(Effect::getEffect(Effect::ABSORPTION), 5 * 20, 1));
|
||||
|
||||
$this->broadcastEntityEvent(EntityEventPacket::CONSUME_TOTEM);
|
||||
$this->broadcastEntityEvent(ActorEventPacket::CONSUME_TOTEM);
|
||||
$this->level->broadcastLevelEvent($this->add(0, $this->eyeHeight, 0), LevelEventPacket::EVENT_SOUND_TOTEM);
|
||||
|
||||
$hand = $this->inventory->getItemInHand();
|
||||
@ -846,9 +844,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
}
|
||||
|
||||
protected function sendSpawnPacket(Player $player) : void{
|
||||
if(!$this->skin->isValid()){
|
||||
throw new \InvalidStateException((new \ReflectionClass($this))->getShortName() . " must have a valid skin set");
|
||||
}
|
||||
$this->skin->validate();
|
||||
|
||||
if(!($this instanceof Player)){
|
||||
/* we don't use Server->updatePlayerListData() because that uses batches, which could cause race conditions in async compression mode */
|
||||
|
@ -44,7 +44,7 @@ use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\FloatTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\network\mcpe\protocol\EntityEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\ActorEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\MobEffectPacket;
|
||||
use pocketmine\Player;
|
||||
@ -143,7 +143,7 @@ abstract class Living extends Entity implements Damageable{
|
||||
parent::setHealth($amount);
|
||||
$this->attributeMap->getAttribute(Attribute::HEALTH)->setValue(ceil($this->getHealth()), true);
|
||||
if($this->isAlive() and !$wasAlive){
|
||||
$this->broadcastEntityEvent(EntityEventPacket::RESPAWN);
|
||||
$this->broadcastEntityEvent(ActorEventPacket::RESPAWN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ abstract class Living extends Entity implements Damageable{
|
||||
}
|
||||
|
||||
public function setMaxHealth(int $amount) : void{
|
||||
$this->attributeMap->getAttribute(Attribute::HEALTH)->setMaxValue($amount);
|
||||
$this->attributeMap->getAttribute(Attribute::HEALTH)->setMaxValue($amount)->setDefaultValue($amount);
|
||||
}
|
||||
|
||||
public function getAbsorption() : float{
|
||||
@ -541,7 +541,9 @@ abstract class Living extends Entity implements Damageable{
|
||||
}
|
||||
|
||||
public function attack(EntityDamageEvent $source) : void{
|
||||
if($this->attackTime > 0 or $this->noDamageTicks > 0){
|
||||
if($this->noDamageTicks > 0){
|
||||
$source->setCancelled();
|
||||
}elseif($this->attackTime > 0){
|
||||
$lastCause = $this->getLastDamageCause();
|
||||
if($lastCause !== null and $lastCause->getBaseDamage() >= $source->getBaseDamage()){
|
||||
$source->setCancelled();
|
||||
@ -604,7 +606,7 @@ abstract class Living extends Entity implements Damageable{
|
||||
}
|
||||
|
||||
protected function doHitAnimation() : void{
|
||||
$this->broadcastEntityEvent(EntityEventPacket::HURT_ANIMATION);
|
||||
$this->broadcastEntityEvent(ActorEventPacket::HURT_ANIMATION);
|
||||
}
|
||||
|
||||
public function knockBack(Entity $attacker, float $damage, float $x, float $z, float $base = 0.4) : void{
|
||||
@ -644,6 +646,10 @@ abstract class Living extends Entity implements Damageable{
|
||||
foreach($ev->getDrops() as $item){
|
||||
$this->getLevel()->dropItem($this, $item);
|
||||
}
|
||||
|
||||
//TODO: check death conditions (must have been damaged by player < 5 seconds from death)
|
||||
//TODO: allow this number to be manipulated during EntityDeathEvent
|
||||
$this->level->dropExperience($this, $this->getXpDropAmount());
|
||||
}
|
||||
|
||||
protected function onDeathUpdate(int $tickDiff) : bool{
|
||||
@ -651,9 +657,6 @@ abstract class Living extends Entity implements Damageable{
|
||||
$this->deadTicks += $tickDiff;
|
||||
if($this->deadTicks >= $this->maxDeadTicks){
|
||||
$this->endDeathAnimation();
|
||||
|
||||
//TODO: check death conditions (must have been damaged by player < 5 seconds from death)
|
||||
$this->level->dropExperience($this, $this->getXpDropAmount());
|
||||
}
|
||||
}
|
||||
|
||||
@ -661,7 +664,7 @@ abstract class Living extends Entity implements Damageable{
|
||||
}
|
||||
|
||||
protected function startDeathAnimation() : void{
|
||||
$this->broadcastEntityEvent(EntityEventPacket::DEATH_ANIMATION);
|
||||
$this->broadcastEntityEvent(ActorEventPacket::DEATH_ANIMATION);
|
||||
}
|
||||
|
||||
protected function endDeathAnimation() : void{
|
||||
|
@ -23,11 +23,18 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\entity;
|
||||
|
||||
use function json_decode;
|
||||
use Ahc\Json\Comment as CommentedJsonDecoder;
|
||||
use function implode;
|
||||
use function in_array;
|
||||
use function json_encode;
|
||||
use function strlen;
|
||||
|
||||
class Skin{
|
||||
public const ACCEPTED_SKIN_SIZES = [
|
||||
64 * 32 * 4,
|
||||
64 * 64 * 4,
|
||||
128 * 128 * 4
|
||||
];
|
||||
|
||||
/** @var string */
|
||||
private $skinId;
|
||||
@ -48,12 +55,34 @@ class Skin{
|
||||
$this->geometryData = $geometryData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid() : bool{
|
||||
return (
|
||||
$this->skinId !== "" and
|
||||
(($s = strlen($this->skinData)) === 16384 or $s === 8192 or $s === 65536) and
|
||||
($this->capeData === "" or strlen($this->capeData) === 8192)
|
||||
);
|
||||
try{
|
||||
$this->validate();
|
||||
return true;
|
||||
}catch(\InvalidArgumentException $e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function validate() : void{
|
||||
if($this->skinId === ""){
|
||||
throw new \InvalidArgumentException("Skin ID must not be empty");
|
||||
}
|
||||
$len = strlen($this->skinData);
|
||||
if(!in_array($len, self::ACCEPTED_SKIN_SIZES, true)){
|
||||
throw new \InvalidArgumentException("Invalid skin data size $len bytes (allowed sizes: " . implode(", ", self::ACCEPTED_SKIN_SIZES) . ")");
|
||||
}
|
||||
if($this->capeData !== "" and strlen($this->capeData) !== 8192){
|
||||
throw new \InvalidArgumentException("Invalid cape data size " . strlen($this->capeData) . " bytes (must be exactly 8192 bytes)");
|
||||
}
|
||||
//TODO: validate geometry
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,7 +129,7 @@ class Skin{
|
||||
*/
|
||||
public function debloatGeometryData() : void{
|
||||
if($this->geometryData !== ""){
|
||||
$this->geometryData = (string) json_encode(json_decode($this->geometryData));
|
||||
$this->geometryData = (string) json_encode((new CommentedJsonDecoder())->decode($this->geometryData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\event\entity\EntityDamageEvent;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\ItemFactory;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\EntityEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\ActorEventPacket;
|
||||
use function atan2;
|
||||
use function mt_rand;
|
||||
use function sqrt;
|
||||
@ -68,7 +68,7 @@ class Squid extends WaterAnimal{
|
||||
$this->swimDirection = (new Vector3($this->x - $e->x, $this->y - $e->y, $this->z - $e->z))->normalize();
|
||||
}
|
||||
|
||||
$this->broadcastEntityEvent(EntityEventPacket::SQUID_INK_CLOUD);
|
||||
$this->broadcastEntityEvent(ActorEventPacket::SQUID_INK_CLOUD);
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ class Squid extends WaterAnimal{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(++$this->switchDirectionTicker === 100 or $this->isCollided){
|
||||
if(++$this->switchDirectionTicker === 100){
|
||||
$this->switchDirectionTicker = 0;
|
||||
if(mt_rand(0, 100) < 50){
|
||||
$this->swimDirection = null;
|
||||
|
@ -28,6 +28,7 @@ use pocketmine\entity\Human;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\nbt\tag\ShortTag;
|
||||
use pocketmine\Player;
|
||||
use function sqrt;
|
||||
|
||||
class ExperienceOrb extends Entity{
|
||||
public const NETWORK_ID = self::XP_ORB;
|
||||
@ -147,7 +148,7 @@ class ExperienceOrb extends Entity{
|
||||
return null;
|
||||
}
|
||||
|
||||
$entity = $this->server->findEntity($this->targetPlayerRuntimeId);
|
||||
$entity = $this->level->getEntity($this->targetPlayerRuntimeId);
|
||||
if($entity instanceof Human){
|
||||
return $entity;
|
||||
}
|
||||
@ -156,7 +157,7 @@ class ExperienceOrb extends Entity{
|
||||
}
|
||||
|
||||
public function setTargetPlayer(?Human $player) : void{
|
||||
$this->targetPlayerRuntimeId = $player ? $player->getId() : null;
|
||||
$this->targetPlayerRuntimeId = $player !== null ? $player->getId() : null;
|
||||
}
|
||||
|
||||
public function entityBaseTick(int $tickDiff = 1) : bool{
|
||||
@ -190,15 +191,15 @@ class ExperienceOrb extends Entity{
|
||||
$this->setTargetPlayer($currentTarget);
|
||||
|
||||
if($currentTarget !== null){
|
||||
$vector = $currentTarget->subtract($this)->add(0, $currentTarget->getEyeHeight() / 2, 0)->divide(self::MAX_TARGET_DISTANCE);
|
||||
$vector = $currentTarget->add(0, $currentTarget->getEyeHeight() / 2, 0)->subtract($this)->divide(self::MAX_TARGET_DISTANCE);
|
||||
|
||||
$distance = $vector->length();
|
||||
$oneMinusDistance = (1 - $distance) ** 2;
|
||||
$distance = $vector->lengthSquared();
|
||||
if($distance < 1){
|
||||
$diff = $vector->normalize()->multiply(0.2 * (1 - sqrt($distance)) ** 2);
|
||||
|
||||
if($oneMinusDistance > 0){
|
||||
$this->motion->x += $vector->x / $distance * $oneMinusDistance * 0.2;
|
||||
$this->motion->y += $vector->y / $distance * $oneMinusDistance * 0.2;
|
||||
$this->motion->z += $vector->z / $distance * $oneMinusDistance * 0.2;
|
||||
$this->motion->x += $diff->x;
|
||||
$this->motion->y += $diff->y;
|
||||
$this->motion->z += $diff->z;
|
||||
}
|
||||
|
||||
if($currentTarget->canPickupXp() and $this->boundingBox->intersectsWith($currentTarget->getBoundingBox())){
|
||||
|
@ -33,6 +33,8 @@ use pocketmine\item\ItemFactory;
|
||||
use pocketmine\level\Position;
|
||||
use pocketmine\nbt\tag\ByteTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use function abs;
|
||||
use function floor;
|
||||
use function get_class;
|
||||
|
||||
class FallingBlock extends Entity{
|
||||
@ -110,7 +112,7 @@ class FallingBlock extends Entity{
|
||||
$this->flagForDespawn();
|
||||
|
||||
$block = $this->level->getBlock($pos);
|
||||
if($block->getId() > 0 and $block->isTransparent() and !$block->canBeReplaced()){
|
||||
if(($block->isTransparent() and !$block->canBeReplaced()) or ($this->onGround and abs($this->y - $this->getFloorY()) > 0.001)){
|
||||
//FIXME: anvils are supposed to destroy torches
|
||||
$this->getLevel()->dropItem($this, ItemFactory::get($this->getBlock(), $this->getDamage()));
|
||||
}else{
|
||||
|
@ -28,8 +28,8 @@ use pocketmine\event\entity\ItemDespawnEvent;
|
||||
use pocketmine\event\entity\ItemSpawnEvent;
|
||||
use pocketmine\event\inventory\InventoryPickupItemEvent;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\network\mcpe\protocol\AddItemEntityPacket;
|
||||
use pocketmine\network\mcpe\protocol\TakeItemEntityPacket;
|
||||
use pocketmine\network\mcpe\protocol\AddItemActorPacket;
|
||||
use pocketmine\network\mcpe\protocol\TakeItemActorPacket;
|
||||
use pocketmine\Player;
|
||||
use function get_class;
|
||||
|
||||
@ -192,7 +192,7 @@ class ItemEntity extends Entity{
|
||||
}
|
||||
|
||||
protected function sendSpawnPacket(Player $player) : void{
|
||||
$pk = new AddItemEntityPacket();
|
||||
$pk = new AddItemActorPacket();
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->position = $this->asVector3();
|
||||
$pk->motion = $this->getMotion();
|
||||
@ -229,7 +229,7 @@ class ItemEntity extends Entity{
|
||||
break;
|
||||
}
|
||||
|
||||
$pk = new TakeItemEntityPacket();
|
||||
$pk = new TakeItemActorPacket();
|
||||
$pk->eid = $player->getId();
|
||||
$pk->target = $this->getId();
|
||||
$this->server->broadcastPacket($this->getViewers(), $pk);
|
||||
|
@ -152,9 +152,11 @@ class Painting extends Entity{
|
||||
protected function sendSpawnPacket(Player $player) : void{
|
||||
$pk = new AddPaintingPacket();
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->x = $this->blockIn->x;
|
||||
$pk->y = $this->blockIn->y;
|
||||
$pk->z = $this->blockIn->z;
|
||||
$pk->position = new Vector3(
|
||||
($this->boundingBox->minX + $this->boundingBox->maxX) / 2,
|
||||
($this->boundingBox->minY + $this->boundingBox->maxY) / 2,
|
||||
($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2
|
||||
);
|
||||
$pk->direction = $this->direction;
|
||||
$pk->title = $this->motive;
|
||||
|
||||
|
@ -28,6 +28,7 @@ use pocketmine\entity\Explosive;
|
||||
use pocketmine\event\entity\EntityDamageEvent;
|
||||
use pocketmine\event\entity\ExplosionPrimeEvent;
|
||||
use pocketmine\level\Explosion;
|
||||
use pocketmine\level\Position;
|
||||
use pocketmine\nbt\tag\ShortTag;
|
||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
|
||||
@ -105,7 +106,7 @@ class PrimedTNT extends Entity implements Explosive{
|
||||
$ev = new ExplosionPrimeEvent($this, 4);
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$explosion = new Explosion($this, $ev->getForce(), $this);
|
||||
$explosion = new Explosion(Position::fromObject($this->add(0, $this->height / 2, 0), $this->level), $ev->getForce(), $this);
|
||||
if($ev->isBlockBreaking()){
|
||||
$explosion->explodeA();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user