mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Compare commits
275 Commits
5.28.1
...
block-laye
Author | SHA1 | Date | |
---|---|---|---|
a0f5ad1669 | |||
0f932f7cc0 | |||
f01d87474d | |||
7472c5b73d | |||
941632bed9 | |||
e5a38f270c | |||
7c651928ea | |||
48cc87d066 | |||
72781f4042 | |||
30d13508b4 | |||
ba2a7cceaf | |||
98f0417611 | |||
6e861afd9e | |||
8005c74681 | |||
7ea0f2ff43 | |||
6dbd4282cb | |||
3176e7549e | |||
92c3ce7f02 | |||
3a5432b316 | |||
afcd6b4e12 | |||
45e350ddf7 | |||
40a3ee68dd | |||
7082522509 | |||
e415518435 | |||
cb508f4382 | |||
177fa76434 | |||
2a97b4294d | |||
68126b308a | |||
258923cc78 | |||
e4b6f96535 | |||
04494e845c | |||
f8ed7efb3f | |||
0e511ff783 | |||
6826420876 | |||
f0161c84b9 | |||
3643d3aeb8 | |||
6340d12881 | |||
a662510cca | |||
670d3fb997 | |||
8843b1b568 | |||
9c71f4fc1c | |||
6d32ea5850 | |||
bd39caccb0 | |||
95b4db5169 | |||
8229ee1812 | |||
950fb48bcb | |||
9e773ed439 | |||
6b5ff5016e | |||
48b80ecf78 | |||
215da7e3f4 | |||
c3ea6edc22 | |||
0330b25768 | |||
4c3a2ef46e | |||
d053e9e168 | |||
5ebbcd5d33 | |||
a4ac28592c | |||
e99665fb12 | |||
b4b6bbe29f | |||
0910a219d4 | |||
56da492e48 | |||
035d2dec23 | |||
b40b99fe72 | |||
baafaed362 | |||
d5a1007c80 | |||
bf33a625c9 | |||
059f4ee7bf | |||
dca2665e17 | |||
dd17adeaaf | |||
98f28f8b6d | |||
a554d2acf5 | |||
05eda887b1 | |||
5527a0c6bf | |||
18b6b1742c | |||
eee2e62d81 | |||
b20d1b84b5 | |||
4d5c27a734 | |||
e1af2a4af1 | |||
a8e898b13b | |||
f656d7d3d7 | |||
3636173d75 | |||
9606c0e0bb | |||
d907d72e9b | |||
55123b36e1 | |||
94fb5d95b9 | |||
b5f236c019 | |||
9d532b6e95 | |||
7169f8e553 | |||
657e6c8130 | |||
647c2587a8 | |||
81d3017ad5 | |||
a37353c060 | |||
280911ec59 | |||
acf4341d71 | |||
84bb9d2ab4 | |||
bb7bfee0cd | |||
88cdc2eb67 | |||
50f3fe2578 | |||
112bcf7af9 | |||
4bcef443f7 | |||
1c70cee72e | |||
e2e16a4ec5 | |||
7847524df6 | |||
c1cee1fc24 | |||
1d26b21fe0 | |||
6196b9c995 | |||
eb3922fc7e | |||
912a5d6ad0 | |||
2a42e2c75d | |||
3de604ef95 | |||
6bf9a305de | |||
cb4364f8fd | |||
f8abcd5102 | |||
5bfa40618d | |||
efaf9311b3 | |||
8e1426e25e | |||
fe70b31881 | |||
d86943fa8c | |||
cfafb584a8 | |||
ad6f7dfedb | |||
baee0110c7 | |||
028815490e | |||
5617347949 | |||
a74168953c | |||
0bbe56beb4 | |||
1073f372f8 | |||
94caea97e0 | |||
071c15d7de | |||
ad95f392c1 | |||
673b39e2a1 | |||
9af3cde03f | |||
17faa19743 | |||
72f1391bd9 | |||
644c04bee4 | |||
a90e5a6aa2 | |||
d954772a20 | |||
df5f87e309 | |||
6b04bb504f | |||
510ef94698 | |||
d3f40b7b0c | |||
dae3e2b336 | |||
f2fa5933ea | |||
95a324755b | |||
1d13054608 | |||
ec140f7861 | |||
66f5bdcb94 | |||
5d24d8de0b | |||
1ad08e2432 | |||
a43ebcf217 | |||
c637d852e2 | |||
c58c64de85 | |||
694aa17cc9 | |||
c9441e1078 | |||
b0ac8863c4 | |||
e9df0baffb | |||
b3723b5b3e | |||
b370b5458f | |||
8af2d05ec0 | |||
4d186b52da | |||
e6ff55823f | |||
d556389b11 | |||
976fc63567 | |||
02ac512b4e | |||
708784b0a2 | |||
3f7f11b812 | |||
984e995659 | |||
46604b26f2 | |||
6b2fb9c4f8 | |||
80b761627a | |||
882d8c4ab9 | |||
1c35987ead | |||
88ae00fc4d | |||
47a1aa6470 | |||
3e69ee87e4 | |||
a2a2ec9d8b | |||
3a0f15ef0d | |||
7a2427ace2 | |||
f82c8dd3d3 | |||
851bbd7384 | |||
1ee52b69b0 | |||
851f7a9d80 | |||
6d2329128a | |||
07045dd424 | |||
c5b0df4578 | |||
5e9dbace90 | |||
205aabe11f | |||
3091e1325f | |||
779e80a961 | |||
007673cb96 | |||
0dae786a21 | |||
02d181d0c8 | |||
2fc6bbe84e | |||
002383be89 | |||
00bdb6be73 | |||
c3c917bb05 | |||
a078f653f4 | |||
ed33983792 | |||
15eaf67a0c | |||
d72941c36c | |||
e51903d7ea | |||
3e9a96b43a | |||
9fce27eaa8 | |||
7208733d62 | |||
c61434d87b | |||
dcc258706f | |||
820e2d4a2f | |||
0fb1415f7f | |||
a6534ecbbb | |||
330bcd2423 | |||
e71b9e8dc6 | |||
9e2d91bae6 | |||
b6f55b78a9 | |||
ab5176baf9 | |||
ef6fce4091 | |||
cc335889f3 | |||
80b7f6aba4 | |||
82c5a3160c | |||
85de28d6c3 | |||
1ef854f2d1 | |||
082af9978c | |||
e8620ef94d | |||
83a91634c3 | |||
3c73bd22dd | |||
0e1824451b | |||
6c5ae634fd | |||
041944ed16 | |||
603527c6e8 | |||
1ac08ea73b | |||
c9e8d382c5 | |||
12179aa03a | |||
e781c64540 | |||
644693ffee | |||
6b66cbfb1c | |||
4d337add7c | |||
9d75c45bf5 | |||
c7a537abbb | |||
54694df48c | |||
15aae721cd | |||
d565be93a8 | |||
e32a90be72 | |||
d4d7d02067 | |||
a45e143e81 | |||
05981d2669 | |||
fa9bba470c | |||
361626d236 | |||
16d8522245 | |||
a4f3476190 | |||
e96e68d221 | |||
f1a6d71cc1 | |||
89f42c80d4 | |||
cd6b780d31 | |||
ed61a68013 | |||
4dc9d696d0 | |||
258038c9a9 | |||
5c915a3dfe | |||
8c594fd126 | |||
9fd6653f36 | |||
32d67080e5 | |||
ed9d057ca2 | |||
5ec0e0f20b | |||
cb251069dd | |||
e0ad39b70a | |||
9997b614bc | |||
89f8f421a6 | |||
c4ff6d7757 | |||
3c0e7ae492 | |||
b944205f60 | |||
2ab3393568 | |||
1e1b95e1b8 | |||
62465fa676 | |||
aac5944396 | |||
74cfd687d7 | |||
f2f30143b0 | |||
d98adf127f | |||
280bf60830 | |||
1ffa945fbf |
32
.github/workflows/branch-sync-cron-trigger.yml
vendored
Normal file
32
.github/workflows/branch-sync-cron-trigger.yml
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
#Since GitHub automatically disables cron actions after 60 days of repo inactivity, we need the active repo (PM)
|
||||
#to trigger the branch merge workflow explicitly. This avoids the need for TOS-violating actions which we previously
|
||||
#used to keep the restricted action active, as the workflow depends on the activity of this repo anyway.
|
||||
|
||||
name: Trigger branch sync
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *" #once per day so we don't spam merge commits on busy days
|
||||
workflow_dispatch: #for testing
|
||||
|
||||
jobs:
|
||||
trigger:
|
||||
name: Trigger branch sync RestrictedActions workflow
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Generate access token
|
||||
id: generate-token
|
||||
uses: actions/create-github-app-token@v2
|
||||
with:
|
||||
app-id: ${{ vars.RESTRICTED_ACTIONS_DISPATCH_ID }}
|
||||
private-key: ${{ secrets.RESTRICTED_ACTIONS_DISPATCH_KEY }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repositories: RestrictedActions
|
||||
|
||||
- name: Dispatch branch sync restricted action
|
||||
uses: peter-evans/repository-dispatch@v3
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
repository: ${{ github.repository_owner }}/RestrictedActions
|
||||
event-type: pocketmine_mp_branch_sync
|
8
.github/workflows/build-docker-image.yml
vendored
8
.github/workflows/build-docker-image.yml
vendored
@ -53,7 +53,7 @@ jobs:
|
||||
run: echo NAME=$(echo "${GITHUB_REPOSITORY,,}") >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build image for tag
|
||||
uses: docker/build-push-action@v6.16.0
|
||||
uses: docker/build-push-action@v6.18.0
|
||||
with:
|
||||
push: true
|
||||
context: ./pocketmine-mp
|
||||
@ -66,7 +66,7 @@ jobs:
|
||||
|
||||
- name: Build image for major tag
|
||||
if: steps.channel.outputs.CHANNEL == 'stable'
|
||||
uses: docker/build-push-action@v6.16.0
|
||||
uses: docker/build-push-action@v6.18.0
|
||||
with:
|
||||
push: true
|
||||
context: ./pocketmine-mp
|
||||
@ -79,7 +79,7 @@ jobs:
|
||||
|
||||
- name: Build image for minor tag
|
||||
if: steps.channel.outputs.CHANNEL == 'stable'
|
||||
uses: docker/build-push-action@v6.16.0
|
||||
uses: docker/build-push-action@v6.18.0
|
||||
with:
|
||||
push: true
|
||||
context: ./pocketmine-mp
|
||||
@ -92,7 +92,7 @@ jobs:
|
||||
|
||||
- name: Build image for latest tag
|
||||
if: steps.channel.outputs.CHANNEL == 'stable'
|
||||
uses: docker/build-push-action@v6.16.0
|
||||
uses: docker/build-push-action@v6.18.0
|
||||
with:
|
||||
push: true
|
||||
context: ./pocketmine-mp
|
||||
|
47
.github/workflows/copilot-setup-steps.yml
vendored
Normal file
47
.github/workflows/copilot-setup-steps.yml
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
name: "Copilot Agent environment setup"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- .github/workflows/copilot-setup-steps.yml
|
||||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/copilot-setup-steps.yml
|
||||
|
||||
jobs:
|
||||
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
|
||||
copilot-setup-steps:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: pmmp/setup-php-action@3.2.0
|
||||
with:
|
||||
php-version: 8.3
|
||||
install-path: "./bin"
|
||||
pm-version-major: 5
|
||||
|
||||
- name: Restore Composer package cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/composer/files
|
||||
~/.cache/composer/vcs
|
||||
key: "composer-v2-cache-8.3-${{ hashFiles('./composer.lock') }}"
|
||||
restore-keys: |
|
||||
composer-v2-cache-
|
||||
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --prefer-dist --no-interaction
|
||||
|
||||
- name: Clone extension stubs
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: pmmp/phpstorm-stubs
|
||||
path: extension-stubs
|
2
.github/workflows/discord-release-notify.yml
vendored
2
.github/workflows/discord-release-notify.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
- name: Setup PHP and tools
|
||||
uses: shivammathur/setup-php@2.33.0
|
||||
with:
|
||||
php-version: 8.2
|
||||
php-version: 8.3
|
||||
|
||||
- name: Restore Composer package cache
|
||||
uses: actions/cache@v4
|
||||
|
2
.github/workflows/draft-release-pr-check.yml
vendored
2
.github/workflows/draft-release-pr-check.yml
vendored
@ -51,7 +51,7 @@ jobs:
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@2.33.0
|
||||
with:
|
||||
php-version: 8.2
|
||||
php-version: 8.3
|
||||
|
||||
- name: Restore Composer package cache
|
||||
uses: actions/cache@v4
|
||||
|
4
.github/workflows/draft-release.yml
vendored
4
.github/workflows/draft-release.yml
vendored
@ -18,7 +18,7 @@ on:
|
||||
- "*"
|
||||
|
||||
env:
|
||||
PHP_VERSION: "8.2"
|
||||
PHP_VERSION: "8.3"
|
||||
|
||||
jobs:
|
||||
skip:
|
||||
@ -188,4 +188,4 @@ jobs:
|
||||
if: github.event_name == 'pull_request_target'
|
||||
uses: thollander/actions-comment-pull-request@v3
|
||||
with:
|
||||
message: "[Draft release ${{ steps.get-pm-version.outputs.PM_VERSION }}](${{ steps.create-draft.outputs.html_url }}) has been created for commit ${{ github.sha }}. Please review and publish it."
|
||||
message: "${{ vars.DRAFT_RELEASE_NOTIFICATION_MENTION }} [Draft release ${{ steps.get-pm-version.outputs.PM_VERSION }}](${{ steps.create-draft.outputs.html_url }}) has been created for commit ${{ github.sha }}. Please review and publish it."
|
||||
|
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ["8.1", "8.2", "8.3"]
|
||||
php: ["8.3"]
|
||||
|
||||
uses: ./.github/workflows/main-php-matrix.yml
|
||||
with:
|
||||
|
32
.github/workflows/pr-remove-waiting-label.yml
vendored
32
.github/workflows/pr-remove-waiting-label.yml
vendored
@ -15,19 +15,23 @@ jobs:
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
script: |
|
||||
const [owner, repo] = context.payload.repository.full_name.split('/');
|
||||
try {
|
||||
await github.rest.issues.removeLabel({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
issue_number: context.payload.number,
|
||||
name: "Status: Waiting on Author",
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.status === 404) {
|
||||
//probably label wasn't set on the issue
|
||||
console.log('Failed to remove label (probably label isn\'t on the PR): ' + error.message);
|
||||
} else {
|
||||
throw error;
|
||||
async function removeLabel(owner, repo, issue_number, name) {
|
||||
try {
|
||||
await github.rest.issues.removeLabel({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
issue_number: issue_number,
|
||||
name: name,
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.status === 404) {
|
||||
//probably label wasn't set on the issue
|
||||
console.log('Failed to remove label ' + name + ' (probably label isn\'t on the PR): ' + error.message);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
const [owner, repo] = context.payload.repository.full_name.split('/');
|
||||
removeLabel(owner, repo, context.payload.number, "Status: Waiting on Author");
|
||||
removeLabel(owner, repo, context.payload.number, "Stale");
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,6 +1,3 @@
|
||||
[submodule "tests/plugins/DevTools"]
|
||||
path = tests/plugins/DevTools
|
||||
url = https://github.com/pmmp/DevTools.git
|
||||
[submodule "build/php"]
|
||||
path = build/php
|
||||
url = https://github.com/pmmp/php-build-scripts.git
|
||||
|
@ -5,7 +5,7 @@ $finder = PhpCsFixer\Finder::create()
|
||||
->in(__DIR__ . '/build')
|
||||
->in(__DIR__ . '/tests')
|
||||
->in(__DIR__ . '/tools')
|
||||
->notPath('plugins/DevTools')
|
||||
|
||||
//JsonMapper will break if the FQNs in the doc comments for these are shortened :(
|
||||
->notPath('crafting/json')
|
||||
->notPath('inventory/json')
|
||||
|
Submodule build/php updated: 1549433797...ce1b095a9c
@ -25,3 +25,10 @@ Released 17th May 2025.
|
||||
|
||||
## Fixes
|
||||
- Fixed errors when PlayStation players attempt to join due to null `TitleID`.
|
||||
|
||||
# 5.28.2
|
||||
Released 17th May 2025.
|
||||
|
||||
## Fixes
|
||||
- Fixed version constraints which were incorrectly updated during the 1.21.80 update. This led to an unnoticed failure to update BedrockProtocol in the previous patch release.
|
||||
- Actually fixed PlayStation issues this time
|
||||
|
25
changelogs/5.29.md
Normal file
25
changelogs/5.29.md
Normal file
@ -0,0 +1,25 @@
|
||||
# 5.29.0
|
||||
Released 18th June 2025.
|
||||
|
||||
This is a support release for Minecraft: Bedrock Edition 1.21.90.
|
||||
|
||||
**Plugin compatibility:** Plugins for previous 5.x versions will run unchanged on this release, unless they use internal APIs, reflection, or packages like the `pocketmine\network\mcpe` or `pocketmine\data` namespace.
|
||||
Do not update plugin minimum API versions unless you need new features added in this release.
|
||||
|
||||
**WARNING: If your plugin uses the `pocketmine\network\mcpe` namespace, you're not shielded by API change constraints.**
|
||||
Consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you're using packets directly.
|
||||
|
||||
## General
|
||||
- Added support for Minecraft: Bedrock Edition 1.21.90.
|
||||
- Removed support for earlier versions.
|
||||
|
||||
## Fixes
|
||||
- Fixed thread crashes sometimes not reporting proper cause information in crashdumps.
|
||||
- Fixed crash when a plugin replaced a player's held tool with a different tool with a damage exceeding the old tool's max damage during an action.
|
||||
- Fixed performance issue of `PlayerAuthInputPacket` input flags handling (broken change detection).
|
||||
- Fixed `BaseInventory->addItem()` triggering updates on empty slots when no items were added.
|
||||
- Fixed slow check in `SubChunk` block layer garbage collection.
|
||||
|
||||
## Internals
|
||||
- `LoginPacketHandler->processLogin()` signature has changed. This will break any plugins overriding `LoginPacketHandler`. As noted above, this is _not_ covered by the API version guarantee.
|
||||
- Automated branch sync for `minor-next` and `major-next` is now triggered by `repository_dispatch` from a cron job in this repository instead of `RestrictedActions`. The `RestrictedActions` cron job was getting automatically disabled by GitHub due to repo inactivity.
|
73
changelogs/5.30.md
Normal file
73
changelogs/5.30.md
Normal file
@ -0,0 +1,73 @@
|
||||
# 5.30.0
|
||||
Released 18th June 2025.
|
||||
|
||||
This is a minor feature release containing API additions, internals cleanup and user experience improvements.
|
||||
|
||||
**Plugin compatibility:** Plugins for previous 5.x versions will run unchanged on this release, unless they use internal APIs, reflection, or packages like the `pocketmine\network\mcpe` or `pocketmine\data` namespace.
|
||||
Do not update plugin minimum API versions unless you need new features added in this release.
|
||||
|
||||
**WARNING: If your plugin uses the `pocketmine\network\mcpe` namespace, you're not shielded by API change constraints.**
|
||||
Consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you're using packets directly.
|
||||
|
||||
## General
|
||||
- Significantly reduced log spam when unknown blocks, tiles and entities are found in saved worlds.
|
||||
- The file name structure for crashdumps has been changed to improve sorting order in file browsers.
|
||||
- Buffering is now skipped on the RakLib layer. In theory this could reduce player network latency by 10 ms (YMMV).
|
||||
|
||||
## Gameplay
|
||||
### Blocks
|
||||
- Many blocks have had their hardness and blast resistance updated to match vanilla.
|
||||
- Implemented Respawn Anchor.
|
||||
- Melon Stem and Pumpkin Stem drop amounts should now match vanilla (using binomial distribution).
|
||||
|
||||
## API
|
||||
## General
|
||||
- Verification of save registration has been added for blocks, entities and tiles. This is intended to make it easier to find mistakes when registering custom things, which previously would produce obscure core crashes.
|
||||
|
||||
### `pocketmine\event\block`
|
||||
- The following classes have been added:
|
||||
- `BlockPreExplodeEvent` - called before a block tries to explode
|
||||
- `BlockExplodeEvent` - called when after a block's explosion calculation has been done, but before any changes are applied
|
||||
|
||||
### `pocketmine\event\entity`
|
||||
- The following classes have been added:
|
||||
- `EntityExtinguishEvent` - called when a burning entity is extinguished by water or other sources
|
||||
- `EntityFrostWalkerEvent` - called every tick upon which an entity wearing Frost Walker boots moves; this can be used to customise or cancel the behaviour of the Frost Walker enchantment
|
||||
|
||||
### `pocketmine\event\player`
|
||||
- The following classes have been added:
|
||||
- `PlayerRespawnAnchorUseEvent` - called when a player interacts with a charged respawn anchor
|
||||
|
||||
### `pocketmine\entity`
|
||||
- The following methods have been added:
|
||||
- `public Entity->getStepHeight() : float`
|
||||
- `public Entity->setStepHeight(float $stepHeight) : void`
|
||||
|
||||
### `pocketmine\world\generator`
|
||||
- Generator execution has been decoupled from `PopulationTask` and async tasks in general. The following classes have been added:
|
||||
- `executor\GeneratorExecutor`
|
||||
- `executor\SyncGeneratorExecutor` - runs a generator on the main thread (used for flat world generation, which doesn't need threads)
|
||||
- `executor\AsyncGeneratorExecutor` - runs a generator inside an async task, as before
|
||||
- `PopulationUtils` - contains population business logic previously baked into `PopulationTask` - this permits the reuse of that logic outside async tasks
|
||||
- The following methods have signature changes:
|
||||
- `GeneratorManager->addGenerator()` now accepts an optional `bool $fast` parameter, defaulting to `false`; setting this to `true` will cause your generator to run on the main thread
|
||||
- The following methods have been added:
|
||||
- `public GeneratorManagerEntry->isFast() : bool` - returns whether this generator should run on the main thread
|
||||
- `PopulationTask` has been marked as `@internal`. In the next major version, it will move to the `generator\executor` namespace; however, for now it stays put because plugins currently have no other way to regenerate chunks.
|
||||
|
||||
## Internals
|
||||
- World data version numbers have been consolidated in `pocketmine\data\bedrock\WorldDataVersions`. This removes the need to modify several different files to support new world versions, and reduces the chances of things getting missed.
|
||||
- Block hardness and blast resistance is now unit-tested against `block_properties_table.json` in `BedrockData`. This file comes from vanilla BDS, so we can use it to verify compliance.
|
||||
- Protocol-layer "server auth block breaking" has been enabled. Functionally, this is no different from the previous system, it just works differently on the network layer.
|
||||
- Various internal classes in the `pocketmine\world\generator` namespace have been moved to the `generator\executor` namespace.
|
||||
- Removed `World->registerGenerator()` and `World->unregisterGenerator()`.
|
||||
- Removed redundant calls to `curl_close()` (obsolete since PHP 8.0).
|
||||
|
||||
# 5.30.1
|
||||
Released 23rd June 2025.
|
||||
|
||||
## Fixes
|
||||
- Fixed accidental break of backwards compatibility in `EntityExplodeEvent` introduced in the previous release.
|
||||
- Fixed placement of player holding block when exploding respawn anchor.
|
||||
- Updated BedrockProtocol to fix incorrect encoding of `ServerScriptDebugDrawerPacket`.
|
||||
- Disabled client-side locator bar, allowing plugins to write their own implementations.
|
@ -5,7 +5,7 @@
|
||||
"homepage": "https://pmmp.io",
|
||||
"license": "LGPL-3.0",
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"php": "^8.3",
|
||||
"php-64bit": "*",
|
||||
"ext-chunkutils2": "^0.3.1",
|
||||
"ext-crypto": "^0.3.1",
|
||||
@ -34,30 +34,30 @@
|
||||
"adhocore/json-comment": "~1.2.0",
|
||||
"netresearch/jsonmapper": "~v5.0.0",
|
||||
"pocketmine/bedrock-block-upgrade-schema": "~5.1.0+bedrock-1.21.60",
|
||||
"pocketmine/bedrock-data": "5.0.0+bedrock-1.21.80",
|
||||
"pocketmine/bedrock-data": "~5.1.0+bedrock-1.21.90",
|
||||
"pocketmine/bedrock-item-upgrade-schema": "~1.14.0+bedrock-1.21.50",
|
||||
"pocketmine/bedrock-protocol": "38.0.0+bedrock-1.21.80",
|
||||
"pocketmine/bedrock-protocol": "~39.0.0+bedrock-1.21.90",
|
||||
"pocketmine/binaryutils": "^0.2.1",
|
||||
"pocketmine/callback-validator": "^1.0.2",
|
||||
"pocketmine/color": "^0.3.0",
|
||||
"pocketmine/errorhandler": "^0.7.0",
|
||||
"pocketmine/locale-data": "~2.24.0",
|
||||
"pocketmine/locale-data": "~2.25.0",
|
||||
"pocketmine/log": "^0.4.0",
|
||||
"pocketmine/math": "~1.0.0",
|
||||
"pocketmine/nbt": "~1.1.0",
|
||||
"pocketmine/raklib": "~1.1.2",
|
||||
"pocketmine/raklib": "~1.2.0",
|
||||
"pocketmine/raklib-ipc": "~1.0.0",
|
||||
"pocketmine/snooze": "^0.5.0",
|
||||
"ramsey/uuid": "~4.7.0",
|
||||
"symfony/filesystem": "~6.4.0"
|
||||
"ramsey/uuid": "~4.8.0",
|
||||
"symfony/filesystem": "~7.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "2.1.16",
|
||||
"phpstan/phpstan": "2.1.17",
|
||||
"phpstan/phpstan-phpunit": "^2.0.0",
|
||||
"phpstan/phpstan-strict-rules": "^2.0.0",
|
||||
"phpunit/phpunit": "^10.5.24"
|
||||
"phpunit/phpunit": "^12.2.1"
|
||||
},
|
||||
"provide": {
|
||||
"replace": {
|
||||
"symfony/polyfill-ctype": "*",
|
||||
"symfony/polyfill-mbstring": "*"
|
||||
},
|
||||
@ -77,12 +77,11 @@
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "8.1.0"
|
||||
"php": "8.3.0"
|
||||
},
|
||||
"sort-packages": true
|
||||
},
|
||||
"scripts": {
|
||||
"make-devtools": "@php -dphar.readonly=0 tests/plugins/DevTools/src/ConsoleScript.php --make ./ --relative tests/plugins/DevTools --out plugins/DevTools.phar",
|
||||
"make-server": [
|
||||
"@composer install --no-dev --classmap-authoritative --ignore-platform-reqs",
|
||||
"@php -dphar.readonly=0 build/server-phar.php"
|
||||
|
765
composer.lock
generated
765
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -10,9 +10,7 @@ includes:
|
||||
- vendor/phpstan/phpstan-strict-rules/rules.neon
|
||||
|
||||
rules:
|
||||
- pocketmine\phpstan\rules\DeprecatedLegacyEnumAccessRule
|
||||
- pocketmine\phpstan\rules\DisallowDynamicNewRule
|
||||
- pocketmine\phpstan\rules\DisallowEnumComparisonRule
|
||||
- pocketmine\phpstan\rules\DisallowForeachByReferenceRule
|
||||
- pocketmine\phpstan\rules\ExplodeLimitRule
|
||||
- pocketmine\phpstan\rules\UnsafeForeachRule
|
||||
|
@ -123,13 +123,6 @@ class MemoryManager{
|
||||
return $this->globalMemoryLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function canUseChunkCache() : bool{
|
||||
return !$this->lowMemory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the allowed chunk radius based on the current memory usage.
|
||||
*/
|
||||
@ -236,13 +229,4 @@ class MemoryManager{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Static memory dumper accessible from any thread.
|
||||
* @deprecated
|
||||
* @see MemoryDump
|
||||
*/
|
||||
public static function dumpMemory(mixed $startingObject, string $outputFolder, int $maxNesting, int $maxStringSize, \Logger $logger) : void{
|
||||
MemoryDump::dumpMemory($startingObject, $outputFolder, $maxNesting, $maxStringSize, $logger);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ namespace pocketmine {
|
||||
|
||||
require_once __DIR__ . '/VersionInfo.php';
|
||||
|
||||
const MIN_PHP_VERSION = "8.1.0";
|
||||
const MIN_PHP_VERSION = "8.3.0";
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
|
@ -80,6 +80,7 @@ use pocketmine\player\PlayerDataLoadException;
|
||||
use pocketmine\player\PlayerDataProvider;
|
||||
use pocketmine\player\PlayerDataSaveException;
|
||||
use pocketmine\player\PlayerInfo;
|
||||
use pocketmine\plugin\FolderPluginLoader;
|
||||
use pocketmine\plugin\PharPluginLoader;
|
||||
use pocketmine\plugin\PluginEnableOrder;
|
||||
use pocketmine\plugin\PluginGraylist;
|
||||
@ -346,6 +347,10 @@ class Server{
|
||||
return $this->maxPlayers;
|
||||
}
|
||||
|
||||
public function setMaxPlayers(int $maxPlayers) : void{
|
||||
$this->maxPlayers = $maxPlayers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the server requires that players be authenticated to Xbox Live. If true, connecting players who
|
||||
* are not logged into Xbox Live will be disconnected.
|
||||
@ -1029,6 +1034,7 @@ class Server{
|
||||
$this->pluginManager = new PluginManager($this, $this->configGroup->getPropertyBool(Yml::PLUGINS_LEGACY_DATA_DIR, true) ? null : Path::join($this->dataPath, "plugin_data"), $pluginGraylist);
|
||||
$this->pluginManager->registerInterface(new PharPluginLoader($this->autoloader));
|
||||
$this->pluginManager->registerInterface(new ScriptPluginLoader());
|
||||
$this->pluginManager->registerInterface(new FolderPluginLoader($this->autoloader));
|
||||
|
||||
$providerManager = new WorldProviderManager();
|
||||
if(
|
||||
@ -1618,7 +1624,7 @@ class Server{
|
||||
if(!is_dir($crashFolder)){
|
||||
mkdir($crashFolder);
|
||||
}
|
||||
$crashDumpPath = Path::join($crashFolder, date("D_M_j-H.i.s-T_Y", (int) $dump->getData()->time) . ".log");
|
||||
$crashDumpPath = Path::join($crashFolder, date("Y-m-d_H.i.s_T", (int) $dump->getData()->time) . ".log");
|
||||
|
||||
$fp = @fopen($crashDumpPath, "wb");
|
||||
if(!is_resource($fp)){
|
||||
|
@ -31,8 +31,8 @@ use function str_repeat;
|
||||
|
||||
final class VersionInfo{
|
||||
public const NAME = "PocketMine-MP";
|
||||
public const BASE_VERSION = "5.28.1";
|
||||
public const IS_DEVELOPMENT_BUILD = false;
|
||||
public const BASE_VERSION = "5.30.2";
|
||||
public const IS_DEVELOPMENT_BUILD = true;
|
||||
public const BUILD_CHANNEL = "stable";
|
||||
|
||||
/**
|
||||
|
@ -73,7 +73,7 @@ class BlockBreakInfo{
|
||||
return new self(0.0, $toolType, $toolHarvestLevel, 0.0);
|
||||
}
|
||||
|
||||
public static function indestructible(float $blastResistance = 18000000.0) : self{
|
||||
public static function indestructible(float $blastResistance = 18000003.75) : self{
|
||||
return new self(-1.0, BlockToolType::NONE, 0, $blastResistance);
|
||||
}
|
||||
|
||||
|
@ -786,8 +786,9 @@ final class BlockTypeIds{
|
||||
public const RESIN_BRICKS = 10756;
|
||||
public const RESIN_CLUMP = 10757;
|
||||
public const CHISELED_RESIN_BRICKS = 10758;
|
||||
public const RESPAWN_ANCHOR = 10759;
|
||||
|
||||
public const FIRST_UNUSED_BLOCK_ID = 10759;
|
||||
public const FIRST_UNUSED_BLOCK_ID = 10760;
|
||||
|
||||
private static int $nextDynamicId = self::FIRST_UNUSED_BLOCK_ID;
|
||||
|
||||
|
123
src/block/RespawnAnchor.php
Normal file
123
src/block/RespawnAnchor.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?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\data\runtime\RuntimeDataDescriber;
|
||||
use pocketmine\event\block\BlockPreExplodeEvent;
|
||||
use pocketmine\event\player\PlayerRespawnAnchorUseEvent;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\ItemTypeIds;
|
||||
use pocketmine\lang\KnownTranslationFactory;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\player\Player;
|
||||
use pocketmine\utils\TextFormat;
|
||||
use pocketmine\world\Explosion;
|
||||
use pocketmine\world\Position;
|
||||
use pocketmine\world\sound\RespawnAnchorChargeSound;
|
||||
use pocketmine\world\sound\RespawnAnchorSetSpawnSound;
|
||||
|
||||
final class RespawnAnchor extends Opaque{
|
||||
private const MIN_CHARGES = 0;
|
||||
private const MAX_CHARGES = 4;
|
||||
|
||||
private int $charges = self::MIN_CHARGES;
|
||||
|
||||
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
|
||||
$w->boundedIntAuto(self::MIN_CHARGES, self::MAX_CHARGES, $this->charges);
|
||||
}
|
||||
|
||||
public function getCharges() : int{
|
||||
return $this->charges;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function setCharges(int $charges) : self{
|
||||
if($charges < self::MIN_CHARGES || $charges > self::MAX_CHARGES){
|
||||
throw new \InvalidArgumentException("Charges must be between " . self::MIN_CHARGES . " and " . self::MAX_CHARGES . ", given: $charges");
|
||||
}
|
||||
$this->charges = $charges;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLightLevel() : int{
|
||||
return $this->charges > 0 ? ($this->charges * 4) - 1 : 0;
|
||||
}
|
||||
|
||||
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
|
||||
if($item->getTypeId() === ItemTypeIds::fromBlockTypeId(BlockTypeIds::GLOWSTONE) && $this->charges < self::MAX_CHARGES){
|
||||
$this->position->getWorld()->setBlock($this->position, $this->setCharges($this->charges + 1));
|
||||
$this->position->getWorld()->addSound($this->position, new RespawnAnchorChargeSound());
|
||||
return true;
|
||||
}
|
||||
|
||||
if($this->charges > self::MIN_CHARGES){
|
||||
if($player === null){
|
||||
return false;
|
||||
}
|
||||
|
||||
$ev = new PlayerRespawnAnchorUseEvent($player, $this, PlayerRespawnAnchorUseEvent::ACTION_EXPLODE);
|
||||
$ev->call();
|
||||
if($ev->isCancelled()){
|
||||
return false;
|
||||
}
|
||||
|
||||
switch($ev->getAction()){
|
||||
case PlayerRespawnAnchorUseEvent::ACTION_EXPLODE:
|
||||
$this->explode($player);
|
||||
return true;
|
||||
|
||||
case PlayerRespawnAnchorUseEvent::ACTION_SET_SPAWN:
|
||||
if($player->getSpawn() !== null && $player->getSpawn()->equals($this->position)){
|
||||
return true;
|
||||
}
|
||||
|
||||
$player->setSpawn($this->position);
|
||||
$this->position->getWorld()->addSound($this->position, new RespawnAnchorSetSpawnSound());
|
||||
$player->sendMessage(KnownTranslationFactory::tile_respawn_anchor_respawnSet()->prefix(TextFormat::GRAY));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function explode(?Player $player) : void{
|
||||
$ev = new BlockPreExplodeEvent($this, 5, $player);
|
||||
$ev->setIncendiary(true);
|
||||
|
||||
$ev->call();
|
||||
if($ev->isCancelled()){
|
||||
return;
|
||||
}
|
||||
|
||||
$this->position->getWorld()->setBlock($this->position, VanillaBlocks::AIR());
|
||||
|
||||
$explosion = new Explosion(Position::fromObject($this->position->add(0.5, 0.5, 0.5), $this->position->getWorld()), $ev->getRadius(), $this);
|
||||
$explosion->setFireChance($ev->getFireChance());
|
||||
|
||||
if($ev->isBlockBreaking()){
|
||||
$explosion->explodeA();
|
||||
}
|
||||
$explosion->explodeB();
|
||||
}
|
||||
}
|
@ -25,11 +25,12 @@ namespace pocketmine\block;
|
||||
|
||||
use pocketmine\block\utils\BlockEventHelper;
|
||||
use pocketmine\block\utils\CropGrowthHelper;
|
||||
use pocketmine\block\utils\FortuneDropHelper;
|
||||
use pocketmine\data\runtime\RuntimeDataDescriber;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\VanillaItems;
|
||||
use pocketmine\math\Facing;
|
||||
use function array_rand;
|
||||
use function mt_rand;
|
||||
|
||||
abstract class Stem extends Crops{
|
||||
protected int $facing = Facing::UP;
|
||||
@ -90,8 +91,10 @@ abstract class Stem extends Crops{
|
||||
}
|
||||
|
||||
public function getDropsForCompatibleTool(Item $item) : array{
|
||||
//TODO: bit annoying we have to pass an Item instance here
|
||||
//this should not be affected by Fortune, but still follows a binomial distribution
|
||||
return [
|
||||
$this->asItem()->setCount(mt_rand(0, 2))
|
||||
$this->asItem()->setCount(FortuneDropHelper::binomial(VanillaItems::AIR(), 0, chance: ($this->age + 1) / 15))
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -58,17 +58,10 @@ class SweetBerryBush extends Flowable{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
protected function canBeSupportedBy(Block $block) : bool{
|
||||
return $block->getTypeId() !== BlockTypeIds::FARMLAND && //bedrock-specific thing (bug?)
|
||||
($block->hasTypeTag(BlockTypeTags::DIRT) || $block->hasTypeTag(BlockTypeTags::MUD));
|
||||
}
|
||||
|
||||
private function canBeSupportedAt(Block $block) : bool{
|
||||
$supportBlock = $block->getSide(Facing::DOWN);
|
||||
return $this->canBeSupportedBy($supportBlock);
|
||||
return $supportBlock->getTypeId() !== BlockTypeIds::FARMLAND && //bedrock-specific thing (bug?)
|
||||
($supportBlock->hasTypeTag(BlockTypeTags::DIRT) || $supportBlock->hasTypeTag(BlockTypeTags::MUD));
|
||||
}
|
||||
|
||||
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
|
||||
|
@ -694,6 +694,7 @@ use function strtolower;
|
||||
* @method static Stair RESIN_BRICK_STAIRS()
|
||||
* @method static Wall RESIN_BRICK_WALL()
|
||||
* @method static ResinClump RESIN_CLUMP()
|
||||
* @method static RespawnAnchor RESPAWN_ANCHOR()
|
||||
* @method static DoublePlant ROSE_BUSH()
|
||||
* @method static Sand SAND()
|
||||
* @method static Opaque SANDSTONE()
|
||||
@ -804,8 +805,8 @@ use function strtolower;
|
||||
* @method static Water WATER()
|
||||
* @method static WaterCauldron WATER_CAULDRON()
|
||||
* @method static NetherVines WEEPING_VINES()
|
||||
* @method static WeightedPressurePlateHeavy WEIGHTED_PRESSURE_PLATE_HEAVY()
|
||||
* @method static WeightedPressurePlateLight WEIGHTED_PRESSURE_PLATE_LIGHT()
|
||||
* @method static WeightedPressurePlate WEIGHTED_PRESSURE_PLATE_HEAVY()
|
||||
* @method static WeightedPressurePlate WEIGHTED_PRESSURE_PLATE_LIGHT()
|
||||
* @method static Wheat WHEAT()
|
||||
* @method static Flower WHITE_TULIP()
|
||||
* @method static WitherRose WITHER_ROSE()
|
||||
@ -859,7 +860,7 @@ final class VanillaBlocks{
|
||||
$railBreakInfo = new Info(new BreakInfo(0.7));
|
||||
self::register("activator_rail", fn(BID $id) => new ActivatorRail($id, "Activator Rail", $railBreakInfo));
|
||||
self::register("anvil", fn(BID $id) => new Anvil($id, "Anvil", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD, 6000.0))));
|
||||
self::register("bamboo", fn(BID $id) => new Bamboo($id, "Bamboo", new Info(new class(2.0 /* 1.0 in PC */, ToolType::AXE) extends BreakInfo{
|
||||
self::register("bamboo", fn(BID $id) => new Bamboo($id, "Bamboo", new Info(new class(1.0, ToolType::AXE) extends BreakInfo{
|
||||
public function getBreakTime(Item $item) : float{
|
||||
if($item->getBlockToolType() === ToolType::SWORD){
|
||||
return 0.0;
|
||||
@ -867,7 +868,7 @@ final class VanillaBlocks{
|
||||
return parent::getBreakTime($item);
|
||||
}
|
||||
}, [Tags::POTTABLE_PLANTS])));
|
||||
self::register("bamboo_sapling", fn(BID $id) => new BambooSapling($id, "Bamboo Sapling", new Info(BreakInfo::instant())));
|
||||
self::register("bamboo_sapling", fn(BID $id) => new BambooSapling($id, "Bamboo Sapling", new Info(new BreakInfo(1.0))));
|
||||
|
||||
$bannerBreakInfo = new Info(BreakInfo::axe(1.0));
|
||||
self::register("banner", fn(BID $id) => new FloorBanner($id, "Banner", $bannerBreakInfo), TileBanner::class);
|
||||
@ -876,7 +877,7 @@ final class VanillaBlocks{
|
||||
self::register("barrier", fn(BID $id) => new Transparent($id, "Barrier", new Info(BreakInfo::indestructible())));
|
||||
self::register("beacon", fn(BID $id) => new Beacon($id, "Beacon", new Info(new BreakInfo(3.0))), TileBeacon::class);
|
||||
self::register("bed", fn(BID $id) => new Bed($id, "Bed Block", new Info(new BreakInfo(0.2))), TileBed::class);
|
||||
self::register("bedrock", fn(BID $id) => new Bedrock($id, "Bedrock", new Info(BreakInfo::indestructible())));
|
||||
self::register("bedrock", fn(BID $id) => new Bedrock($id, "Bedrock", new Info(BreakInfo::indestructible(18000000.0))));
|
||||
|
||||
self::register("beetroots", fn(BID $id) => new Beetroot($id, "Beetroot Block", new Info(BreakInfo::instant())));
|
||||
self::register("bell", fn(BID $id) => new Bell($id, "Bell", new Info(BreakInfo::pickaxe(5.0))), TileBell::class);
|
||||
@ -913,7 +914,7 @@ final class VanillaBlocks{
|
||||
|
||||
self::register("cobweb", fn(BID $id) => new Cobweb($id, "Cobweb", new Info(new BreakInfo(4.0, ToolType::SWORD | ToolType::SHEARS, 1))));
|
||||
self::register("cocoa_pod", fn(BID $id) => new CocoaBlock($id, "Cocoa Block", new Info(BreakInfo::axe(0.2, null, 15.0))));
|
||||
self::register("coral_block", fn(BID $id) => new CoralBlock($id, "Coral Block", new Info(BreakInfo::pickaxe(7.0, ToolTier::WOOD))));
|
||||
self::register("coral_block", fn(BID $id) => new CoralBlock($id, "Coral Block", new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD, 30.0))));
|
||||
self::register("daylight_sensor", fn(BID $id) => new DaylightSensor($id, "Daylight Sensor", new Info(BreakInfo::axe(0.2))), TileDaylightSensor::class);
|
||||
self::register("dead_bush", fn(BID $id) => new DeadBush($id, "Dead Bush", new Info(BreakInfo::instant(ToolType::SHEARS, 1), [Tags::POTTABLE_PLANTS])));
|
||||
self::register("detector_rail", fn(BID $id) => new DetectorRail($id, "Detector Rail", $railBreakInfo));
|
||||
@ -930,15 +931,15 @@ final class VanillaBlocks{
|
||||
self::register("pitcher_plant", fn(BID $id) => new DoublePlant($id, "Pitcher Plant", new Info(BreakInfo::instant())));
|
||||
self::register("pitcher_crop", fn(BID $id) => new PitcherCrop($id, "Pitcher Crop", new Info(BreakInfo::instant())));
|
||||
self::register("double_pitcher_crop", fn(BID $id) => new DoublePitcherCrop($id, "Double Pitcher Crop", new Info(BreakInfo::instant())));
|
||||
self::register("dragon_egg", fn(BID $id) => new DragonEgg($id, "Dragon Egg", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD))));
|
||||
self::register("dragon_egg", fn(BID $id) => new DragonEgg($id, "Dragon Egg", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD, blastResistance: 45.0))));
|
||||
self::register("dried_kelp", fn(BID $id) => new DriedKelp($id, "Dried Kelp Block", new Info(new BreakInfo(0.5, ToolType::NONE, 0, 12.5))));
|
||||
self::register("emerald", fn(BID $id) => new Opaque($id, "Emerald Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::IRON, 30.0))));
|
||||
self::register("enchanting_table", fn(BID $id) => new EnchantingTable($id, "Enchanting Table", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD, 6000.0))), TileEnchantingTable::class);
|
||||
self::register("end_portal_frame", fn(BID $id) => new EndPortalFrame($id, "End Portal Frame", new Info(BreakInfo::indestructible())));
|
||||
self::register("end_portal_frame", fn(BID $id) => new EndPortalFrame($id, "End Portal Frame", new Info(BreakInfo::indestructible(18000000.0))));
|
||||
self::register("end_rod", fn(BID $id) => new EndRod($id, "End Rod", new Info(BreakInfo::instant())));
|
||||
self::register("end_stone", fn(BID $id) => new Opaque($id, "End Stone", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD, 45.0))));
|
||||
|
||||
$endBrickBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD, 4.0));
|
||||
$endBrickBreakInfo = new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD, 45.0));
|
||||
self::register("end_stone_bricks", fn(BID $id) => new Opaque($id, "End Stone Bricks", $endBrickBreakInfo));
|
||||
self::register("end_stone_brick_stairs", fn(BID $id) => new Stair($id, "End Stone Brick Stairs", $endBrickBreakInfo));
|
||||
|
||||
@ -962,7 +963,7 @@ final class VanillaBlocks{
|
||||
self::register("torchflower", fn(BID $id) => new Flower($id, "Torchflower", $flowerTypeInfo));
|
||||
self::register("torchflower_crop", fn(BID $id) => new TorchflowerCrop($id, "Torchflower Crop", new Info(BreakInfo::instant())));
|
||||
self::register("flower_pot", fn(BID $id) => new FlowerPot($id, "Flower Pot", new Info(BreakInfo::instant())), TileFlowerPot::class);
|
||||
self::register("frosted_ice", fn(BID $id) => new FrostedIce($id, "Frosted Ice", new Info(BreakInfo::pickaxe(2.5))));
|
||||
self::register("frosted_ice", fn(BID $id) => new FrostedIce($id, "Frosted Ice", new Info(BreakInfo::pickaxe(0.5))));
|
||||
self::register("furnace", fn(BID $id) => new Furnace($id, "Furnace", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD)), FurnaceType::FURNACE), TileNormalFurnace::class);
|
||||
self::register("blast_furnace", fn(BID $id) => new Furnace($id, "Blast Furnace", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD)), FurnaceType::BLAST_FURNACE), TileBlastFurnace::class);
|
||||
self::register("smoker", fn(BID $id) => new Furnace($id, "Smoker", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD)), FurnaceType::SMOKER), TileSmoker::class);
|
||||
@ -970,30 +971,28 @@ final class VanillaBlocks{
|
||||
$glassBreakInfo = new Info(new BreakInfo(0.3));
|
||||
self::register("glass", fn(BID $id) => new Glass($id, "Glass", $glassBreakInfo));
|
||||
self::register("glass_pane", fn(BID $id) => new GlassPane($id, "Glass Pane", $glassBreakInfo));
|
||||
self::register("glowing_obsidian", fn(BID $id) => new GlowingObsidian($id, "Glowing Obsidian", new Info(BreakInfo::pickaxe(10.0, ToolTier::DIAMOND, 50.0))));
|
||||
self::register("glowing_obsidian", fn(BID $id) => new GlowingObsidian($id, "Glowing Obsidian", new Info(BreakInfo::pickaxe(35.0, ToolTier::DIAMOND, 6000.0))));
|
||||
self::register("glowstone", fn(BID $id) => new Glowstone($id, "Glowstone", new Info(BreakInfo::pickaxe(0.3))));
|
||||
self::register("glow_lichen", fn(BID $id) => new GlowLichen($id, "Glow Lichen", new Info(BreakInfo::axe(0.2, null, 0.2))));
|
||||
self::register("glow_lichen", fn(BID $id) => new GlowLichen($id, "Glow Lichen", new Info(BreakInfo::axe(0.2))));
|
||||
self::register("gold", fn(BID $id) => new Opaque($id, "Gold Block", new Info(BreakInfo::pickaxe(3.0, ToolTier::IRON, 30.0))));
|
||||
|
||||
$grassBreakInfo = BreakInfo::shovel(0.6);
|
||||
self::register("grass", fn(BID $id) => new Grass($id, "Grass", new Info($grassBreakInfo, [Tags::DIRT])));
|
||||
self::register("grass_path", fn(BID $id) => new GrassPath($id, "Grass Path", new Info($grassBreakInfo)));
|
||||
self::register("grass", fn(BID $id) => new Grass($id, "Grass", new Info(BreakInfo::shovel(0.6), [Tags::DIRT])));
|
||||
self::register("grass_path", fn(BID $id) => new GrassPath($id, "Grass Path", new Info(BreakInfo::shovel(0.65))));
|
||||
self::register("gravel", fn(BID $id) => new Gravel($id, "Gravel", new Info(BreakInfo::shovel(0.6))));
|
||||
|
||||
$hardenedClayBreakInfo = new Info(BreakInfo::pickaxe(1.25, ToolTier::WOOD, 21.0));
|
||||
self::register("hardened_clay", fn(BID $id) => new HardenedClay($id, "Hardened Clay", $hardenedClayBreakInfo));
|
||||
self::register("hardened_clay", fn(BID $id) => new HardenedClay($id, "Hardened Clay", new Info(BreakInfo::pickaxe(1.25, ToolTier::WOOD, 21.0))));
|
||||
|
||||
$hardenedGlassBreakInfo = new Info(new BreakInfo(10.0));
|
||||
self::register("hardened_glass", fn(BID $id) => new HardenedGlass($id, "Hardened Glass", $hardenedGlassBreakInfo));
|
||||
self::register("hardened_glass_pane", fn(BID $id) => new HardenedGlassPane($id, "Hardened Glass Pane", $hardenedGlassBreakInfo));
|
||||
self::register("hay_bale", fn(BID $id) => new HayBale($id, "Hay Bale", new Info(new BreakInfo(0.5))));
|
||||
self::register("hopper", fn(BID $id) => new Hopper($id, "Hopper", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD, 15.0))), TileHopper::class);
|
||||
self::register("hopper", fn(BID $id) => new Hopper($id, "Hopper", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD, 24.0))), TileHopper::class);
|
||||
self::register("ice", fn(BID $id) => new Ice($id, "Ice", new Info(BreakInfo::pickaxe(0.5))));
|
||||
|
||||
$updateBlockBreakInfo = new Info(new BreakInfo(1.0));
|
||||
self::register("info_update", fn(BID $id) => new Opaque($id, "update!", $updateBlockBreakInfo));
|
||||
self::register("info_update2", fn(BID $id) => new Opaque($id, "ate!upd", $updateBlockBreakInfo));
|
||||
self::register("invisible_bedrock", fn(BID $id) => new Transparent($id, "Invisible Bedrock", new Info(BreakInfo::indestructible())));
|
||||
self::register("invisible_bedrock", fn(BID $id) => new Transparent($id, "Invisible Bedrock", new Info(BreakInfo::indestructible(18000000.0))));
|
||||
|
||||
$ironBreakInfo = new Info(BreakInfo::pickaxe(5.0, ToolTier::STONE, 30.0));
|
||||
self::register("iron", fn(BID $id) => new Opaque($id, "Iron Block", $ironBreakInfo));
|
||||
@ -1006,16 +1005,16 @@ final class VanillaBlocks{
|
||||
self::register("item_frame", fn(BID $id) => new ItemFrame($id, "Item Frame", $itemFrameInfo), TileItemFrame::class);
|
||||
self::register("glowing_item_frame", fn(BID $id) => new ItemFrame($id, "Glow Item Frame", $itemFrameInfo), TileGlowingItemFrame::class);
|
||||
|
||||
self::register("jukebox", fn(BID $id) => new Jukebox($id, "Jukebox", new Info(BreakInfo::axe(0.8))), TileJukebox::class); //TODO: in PC the hardness is 2.0, not 0.8, unsure if this is a MCPE bug or not
|
||||
self::register("jukebox", fn(BID $id) => new Jukebox($id, "Jukebox", new Info(BreakInfo::axe(2.0, blastResistance: 30.0))), TileJukebox::class);
|
||||
self::register("ladder", fn(BID $id) => new Ladder($id, "Ladder", new Info(BreakInfo::axe(0.4))));
|
||||
|
||||
$lanternBreakInfo = new Info(BreakInfo::pickaxe(5.0));
|
||||
$lanternBreakInfo = new Info(BreakInfo::pickaxe(3.5));
|
||||
self::register("lantern", fn(BID $id) => new Lantern($id, "Lantern", $lanternBreakInfo, 15));
|
||||
self::register("soul_lantern", fn(BID $id) => new Lantern($id, "Soul Lantern", $lanternBreakInfo, 10));
|
||||
|
||||
self::register("lapis_lazuli", fn(BID $id) => new Opaque($id, "Lapis Lazuli Block", new Info(BreakInfo::pickaxe(3.0, ToolTier::STONE))));
|
||||
self::register("lava", fn(BID $id) => new Lava($id, "Lava", new Info(BreakInfo::indestructible(500.0))));
|
||||
self::register("lectern", fn(BID $id) => new Lectern($id, "Lectern", new Info(BreakInfo::axe(2.0))), TileLectern::class);
|
||||
self::register("lectern", fn(BID $id) => new Lectern($id, "Lectern", new Info(BreakInfo::axe(2.5))), TileLectern::class);
|
||||
self::register("lever", fn(BID $id) => new Lever($id, "Lever", new Info(new BreakInfo(0.5))));
|
||||
self::register("magma", fn(BID $id) => new Magma($id, "Magma Block", new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD))));
|
||||
self::register("melon", fn(BID $id) => new Melon($id, "Melon Block", new Info(BreakInfo::axe(1.0))));
|
||||
@ -1065,14 +1064,15 @@ final class VanillaBlocks{
|
||||
self::register("purpur_stairs", fn(BID $id) => new Stair($id, "Purpur Stairs", $purpurBreakInfo));
|
||||
|
||||
$quartzBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD));
|
||||
$smoothQuartzBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
self::register("quartz", fn(BID $id) => new Opaque($id, "Quartz Block", $quartzBreakInfo));
|
||||
self::register("chiseled_quartz", fn(BID $id) => new SimplePillar($id, "Chiseled Quartz Block", $quartzBreakInfo));
|
||||
self::register("quartz_pillar", fn(BID $id) => new SimplePillar($id, "Quartz Pillar", $quartzBreakInfo));
|
||||
self::register("smooth_quartz", fn(BID $id) => new Opaque($id, "Smooth Quartz Block", $quartzBreakInfo));
|
||||
self::register("smooth_quartz", fn(BID $id) => new Opaque($id, "Smooth Quartz Block", $smoothQuartzBreakInfo));
|
||||
self::register("quartz_bricks", fn(BID $id) => new Opaque($id, "Quartz Bricks", $quartzBreakInfo));
|
||||
|
||||
self::register("quartz_stairs", fn(BID $id) => new Stair($id, "Quartz Stairs", $quartzBreakInfo));
|
||||
self::register("smooth_quartz_stairs", fn(BID $id) => new Stair($id, "Smooth Quartz Stairs", $quartzBreakInfo));
|
||||
self::register("smooth_quartz_stairs", fn(BID $id) => new Stair($id, "Smooth Quartz Stairs", $smoothQuartzBreakInfo));
|
||||
|
||||
self::register("rail", fn(BID $id) => new Rail($id, "Rail", $railBreakInfo));
|
||||
self::register("red_mushroom", fn(BID $id) => new RedMushroom($id, "Red Mushroom", new Info(BreakInfo::instant(), [Tags::POTTABLE_PLANTS])));
|
||||
@ -1127,13 +1127,13 @@ final class VanillaBlocks{
|
||||
$infestedStoneBreakInfo = new Info(BreakInfo::pickaxe(0.75));
|
||||
self::register("infested_stone", fn(BID $id) => new InfestedStone($id, "Infested Stone", $infestedStoneBreakInfo, $stone));
|
||||
self::register("infested_stone_brick", fn(BID $id) => new InfestedStone($id, "Infested Stone Brick", $infestedStoneBreakInfo, $stoneBrick));
|
||||
self::register("infested_cobblestone", fn(BID $id) => new InfestedStone($id, "Infested Cobblestone", $infestedStoneBreakInfo, $cobblestone));
|
||||
self::register("infested_cobblestone", fn(BID $id) => new InfestedStone($id, "Infested Cobblestone", new Info(BreakInfo::pickaxe(1.0, blastResistance: 3.75)), $cobblestone));
|
||||
self::register("infested_mossy_stone_brick", fn(BID $id) => new InfestedStone($id, "Infested Mossy Stone Brick", $infestedStoneBreakInfo, $mossyStoneBrick));
|
||||
self::register("infested_cracked_stone_brick", fn(BID $id) => new InfestedStone($id, "Infested Cracked Stone Brick", $infestedStoneBreakInfo, $crackedStoneBrick));
|
||||
self::register("infested_chiseled_stone_brick", fn(BID $id) => new InfestedStone($id, "Infested Chiseled Stone Brick", $infestedStoneBreakInfo, $chiseledStoneBrick));
|
||||
|
||||
self::register("stone_stairs", fn(BID $id) => new Stair($id, "Stone Stairs", $stoneBreakInfo));
|
||||
self::register("smooth_stone", fn(BID $id) => new Opaque($id, "Smooth Stone", $stoneBreakInfo));
|
||||
self::register("smooth_stone", fn(BID $id) => new Opaque($id, "Smooth Stone", new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0))));
|
||||
self::register("andesite_stairs", fn(BID $id) => new Stair($id, "Andesite Stairs", $stoneBreakInfo));
|
||||
self::register("diorite_stairs", fn(BID $id) => new Stair($id, "Diorite Stairs", $stoneBreakInfo));
|
||||
self::register("granite_stairs", fn(BID $id) => new Stair($id, "Granite Stairs", $stoneBreakInfo));
|
||||
@ -1146,7 +1146,6 @@ final class VanillaBlocks{
|
||||
self::register("stonecutter", fn(BID $id) => new Stonecutter($id, "Stonecutter", new Info(BreakInfo::pickaxe(3.5))));
|
||||
self::register("stone_pressure_plate", fn(BID $id) => new StonePressurePlate($id, "Stone Pressure Plate", new Info(BreakInfo::pickaxe(0.5))));
|
||||
|
||||
//TODO: in the future this won't be the same for all the types
|
||||
$stoneSlabBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
|
||||
self::register("brick_slab", fn(BID $id) => new Slab($id, "Brick", $stoneSlabBreakInfo));
|
||||
@ -1157,28 +1156,31 @@ final class VanillaBlocks{
|
||||
self::register("sandstone_slab", fn(BID $id) => new Slab($id, "Sandstone", $stoneSlabBreakInfo));
|
||||
self::register("smooth_stone_slab", fn(BID $id) => new Slab($id, "Smooth Stone", $stoneSlabBreakInfo));
|
||||
self::register("stone_brick_slab", fn(BID $id) => new Slab($id, "Stone Brick", $stoneSlabBreakInfo));
|
||||
self::register("dark_prismarine_slab", fn(BID $id) => new Slab($id, "Dark Prismarine", $stoneSlabBreakInfo));
|
||||
self::register("mossy_cobblestone_slab", fn(BID $id) => new Slab($id, "Mossy Cobblestone", $stoneSlabBreakInfo));
|
||||
self::register("prismarine_slab", fn(BID $id) => new Slab($id, "Prismarine", $stoneSlabBreakInfo));
|
||||
self::register("prismarine_bricks_slab", fn(BID $id) => new Slab($id, "Prismarine Bricks", $stoneSlabBreakInfo));
|
||||
self::register("purpur_slab", fn(BID $id) => new Slab($id, "Purpur", $stoneSlabBreakInfo));
|
||||
self::register("red_nether_brick_slab", fn(BID $id) => new Slab($id, "Red Nether Brick", $stoneSlabBreakInfo));
|
||||
self::register("red_sandstone_slab", fn(BID $id) => new Slab($id, "Red Sandstone", $stoneSlabBreakInfo));
|
||||
self::register("smooth_sandstone_slab", fn(BID $id) => new Slab($id, "Smooth Sandstone", $stoneSlabBreakInfo));
|
||||
self::register("andesite_slab", fn(BID $id) => new Slab($id, "Andesite", $stoneSlabBreakInfo));
|
||||
self::register("diorite_slab", fn(BID $id) => new Slab($id, "Diorite", $stoneSlabBreakInfo));
|
||||
self::register("end_stone_brick_slab", fn(BID $id) => new Slab($id, "End Stone Brick", $stoneSlabBreakInfo));
|
||||
self::register("granite_slab", fn(BID $id) => new Slab($id, "Granite", $stoneSlabBreakInfo));
|
||||
self::register("polished_andesite_slab", fn(BID $id) => new Slab($id, "Polished Andesite", $stoneSlabBreakInfo));
|
||||
self::register("polished_diorite_slab", fn(BID $id) => new Slab($id, "Polished Diorite", $stoneSlabBreakInfo));
|
||||
self::register("polished_granite_slab", fn(BID $id) => new Slab($id, "Polished Granite", $stoneSlabBreakInfo));
|
||||
self::register("smooth_red_sandstone_slab", fn(BID $id) => new Slab($id, "Smooth Red Sandstone", $stoneSlabBreakInfo));
|
||||
self::register("cut_red_sandstone_slab", fn(BID $id) => new Slab($id, "Cut Red Sandstone", $stoneSlabBreakInfo));
|
||||
self::register("cut_sandstone_slab", fn(BID $id) => new Slab($id, "Cut Sandstone", $stoneSlabBreakInfo));
|
||||
self::register("mossy_stone_brick_slab", fn(BID $id) => new Slab($id, "Mossy Stone Brick", $stoneSlabBreakInfo));
|
||||
self::register("mossy_cobblestone_slab", fn(BID $id) => new Slab($id, "Mossy Cobblestone", $stoneSlabBreakInfo));
|
||||
self::register("purpur_slab", fn(BID $id) => new Slab($id, "Purpur", $stoneSlabBreakInfo));
|
||||
self::register("smooth_red_sandstone_slab", fn(BID $id) => new Slab($id, "Smooth Red Sandstone", $stoneSlabBreakInfo));
|
||||
self::register("smooth_quartz_slab", fn(BID $id) => new Slab($id, "Smooth Quartz", $stoneSlabBreakInfo));
|
||||
self::register("stone_slab", fn(BID $id) => new Slab($id, "Stone", $stoneSlabBreakInfo));
|
||||
|
||||
self::register("end_stone_brick_slab", fn(BID $id) => new Slab($id, "End Stone Brick", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD, 30.0))));
|
||||
|
||||
$lightStoneSlabBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD, 30.0));
|
||||
self::register("dark_prismarine_slab", fn(BID $id) => new Slab($id, "Dark Prismarine", $lightStoneSlabBreakInfo));
|
||||
self::register("prismarine_slab", fn(BID $id) => new Slab($id, "Prismarine", $lightStoneSlabBreakInfo));
|
||||
self::register("prismarine_bricks_slab", fn(BID $id) => new Slab($id, "Prismarine Bricks", $lightStoneSlabBreakInfo));
|
||||
self::register("andesite_slab", fn(BID $id) => new Slab($id, "Andesite", $lightStoneSlabBreakInfo));
|
||||
self::register("diorite_slab", fn(BID $id) => new Slab($id, "Diorite", $lightStoneSlabBreakInfo));
|
||||
self::register("granite_slab", fn(BID $id) => new Slab($id, "Granite", $lightStoneSlabBreakInfo));
|
||||
self::register("polished_andesite_slab", fn(BID $id) => new Slab($id, "Polished Andesite", $lightStoneSlabBreakInfo));
|
||||
self::register("polished_diorite_slab", fn(BID $id) => new Slab($id, "Polished Diorite", $lightStoneSlabBreakInfo));
|
||||
self::register("polished_granite_slab", fn(BID $id) => new Slab($id, "Polished Granite", $lightStoneSlabBreakInfo));
|
||||
self::register("mossy_stone_brick_slab", fn(BID $id) => new Slab($id, "Mossy Stone Brick", $lightStoneSlabBreakInfo));
|
||||
|
||||
self::register("legacy_stonecutter", fn(BID $id) => new Opaque($id, "Legacy Stonecutter", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD))));
|
||||
self::register("sugarcane", fn(BID $id) => new Sugarcane($id, "Sugarcane", new Info(BreakInfo::instant())));
|
||||
self::register("sweet_berry_bush", fn(BID $id) => new SweetBerryBush($id, "Sweet Berry Bush", new Info(BreakInfo::instant())));
|
||||
@ -1201,14 +1203,14 @@ final class VanillaBlocks{
|
||||
self::register("lily_pad", fn(BID $id) => new WaterLily($id, "Lily Pad", new Info(BreakInfo::instant())));
|
||||
|
||||
$weightedPressurePlateBreakInfo = new Info(BreakInfo::pickaxe(0.5));
|
||||
self::register("weighted_pressure_plate_heavy", fn(BID $id) => new WeightedPressurePlateHeavy(
|
||||
self::register("weighted_pressure_plate_heavy", fn(BID $id) => new WeightedPressurePlate(
|
||||
$id,
|
||||
"Weighted Pressure Plate Heavy",
|
||||
$weightedPressurePlateBreakInfo,
|
||||
deactivationDelayTicks: 10,
|
||||
signalStrengthFactor: 0.1
|
||||
));
|
||||
self::register("weighted_pressure_plate_light", fn(BID $id) => new WeightedPressurePlateLight(
|
||||
self::register("weighted_pressure_plate_light", fn(BID $id) => new WeightedPressurePlate(
|
||||
$id,
|
||||
"Weighted Pressure Plate Light",
|
||||
$weightedPressurePlateBreakInfo,
|
||||
@ -1237,25 +1239,26 @@ final class VanillaBlocks{
|
||||
}
|
||||
|
||||
$sandstoneBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD));
|
||||
$smoothSandstoneBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
self::register("red_sandstone_stairs", fn(BID $id) => new Stair($id, "Red Sandstone Stairs", $sandstoneBreakInfo));
|
||||
self::register("smooth_red_sandstone_stairs", fn(BID $id) => new Stair($id, "Smooth Red Sandstone Stairs", $sandstoneBreakInfo));
|
||||
self::register("smooth_red_sandstone_stairs", fn(BID $id) => new Stair($id, "Smooth Red Sandstone Stairs", $smoothSandstoneBreakInfo));
|
||||
self::register("red_sandstone", fn(BID $id) => new Opaque($id, "Red Sandstone", $sandstoneBreakInfo));
|
||||
self::register("chiseled_red_sandstone", fn(BID $id) => new Opaque($id, "Chiseled Red Sandstone", $sandstoneBreakInfo));
|
||||
self::register("cut_red_sandstone", fn(BID $id) => new Opaque($id, "Cut Red Sandstone", $sandstoneBreakInfo));
|
||||
self::register("smooth_red_sandstone", fn(BID $id) => new Opaque($id, "Smooth Red Sandstone", $sandstoneBreakInfo));
|
||||
self::register("smooth_red_sandstone", fn(BID $id) => new Opaque($id, "Smooth Red Sandstone", $smoothSandstoneBreakInfo));
|
||||
|
||||
self::register("sandstone_stairs", fn(BID $id) => new Stair($id, "Sandstone Stairs", $sandstoneBreakInfo));
|
||||
self::register("smooth_sandstone_stairs", fn(BID $id) => new Stair($id, "Smooth Sandstone Stairs", $sandstoneBreakInfo));
|
||||
self::register("smooth_sandstone_stairs", fn(BID $id) => new Stair($id, "Smooth Sandstone Stairs", $smoothSandstoneBreakInfo));
|
||||
self::register("sandstone", fn(BID $id) => new Opaque($id, "Sandstone", $sandstoneBreakInfo));
|
||||
self::register("chiseled_sandstone", fn(BID $id) => new Opaque($id, "Chiseled Sandstone", $sandstoneBreakInfo));
|
||||
self::register("cut_sandstone", fn(BID $id) => new Opaque($id, "Cut Sandstone", $sandstoneBreakInfo));
|
||||
self::register("smooth_sandstone", fn(BID $id) => new Opaque($id, "Smooth Sandstone", $sandstoneBreakInfo));
|
||||
self::register("smooth_sandstone", fn(BID $id) => new Opaque($id, "Smooth Sandstone", $smoothSandstoneBreakInfo));
|
||||
|
||||
self::register("glazed_terracotta", fn(BID $id) => new GlazedTerracotta($id, "Glazed Terracotta", new Info(BreakInfo::pickaxe(1.4, ToolTier::WOOD))));
|
||||
self::register("dyed_shulker_box", fn(BID $id) => new DyedShulkerBox($id, "Dyed Shulker Box", $shulkerBoxBreakInfo), TileShulkerBox::class);
|
||||
self::register("stained_glass", fn(BID $id) => new StainedGlass($id, "Stained Glass", $glassBreakInfo));
|
||||
self::register("stained_glass_pane", fn(BID $id) => new StainedGlassPane($id, "Stained Glass Pane", $glassBreakInfo));
|
||||
self::register("stained_clay", fn(BID $id) => new StainedHardenedClay($id, "Stained Clay", $hardenedClayBreakInfo));
|
||||
self::register("stained_clay", fn(BID $id) => new StainedHardenedClay($id, "Stained Clay", new Info(BreakInfo::pickaxe(1.25, ToolTier::WOOD, 6.25))));
|
||||
self::register("stained_hardened_glass", fn(BID $id) => new StainedHardenedGlass($id, "Stained Hardened Glass", $hardenedGlassBreakInfo));
|
||||
self::register("stained_hardened_glass_pane", fn(BID $id) => new StainedHardenedGlassPane($id, "Stained Hardened Glass Pane", $hardenedGlassBreakInfo));
|
||||
self::register("carpet", fn(BID $id) => new Carpet($id, "Carpet", new Info(new BreakInfo(0.1))));
|
||||
@ -1272,22 +1275,26 @@ final class VanillaBlocks{
|
||||
}
|
||||
})));
|
||||
|
||||
//TODO: in the future these won't all have the same hardness; they only do now because of the old metadata crap
|
||||
$wallBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
self::register("cobblestone_wall", fn(BID $id) => new Wall($id, "Cobblestone Wall", $wallBreakInfo));
|
||||
self::register("andesite_wall", fn(BID $id) => new Wall($id, "Andesite Wall", $wallBreakInfo));
|
||||
self::register("brick_wall", fn(BID $id) => new Wall($id, "Brick Wall", $wallBreakInfo));
|
||||
self::register("diorite_wall", fn(BID $id) => new Wall($id, "Diorite Wall", $wallBreakInfo));
|
||||
self::register("end_stone_brick_wall", fn(BID $id) => new Wall($id, "End Stone Brick Wall", $wallBreakInfo));
|
||||
self::register("granite_wall", fn(BID $id) => new Wall($id, "Granite Wall", $wallBreakInfo));
|
||||
self::register("mossy_stone_brick_wall", fn(BID $id) => new Wall($id, "Mossy Stone Brick Wall", $wallBreakInfo));
|
||||
self::register("mossy_cobblestone_wall", fn(BID $id) => new Wall($id, "Mossy Cobblestone Wall", $wallBreakInfo));
|
||||
self::register("nether_brick_wall", fn(BID $id) => new Wall($id, "Nether Brick Wall", $wallBreakInfo));
|
||||
self::register("prismarine_wall", fn(BID $id) => new Wall($id, "Prismarine Wall", $wallBreakInfo));
|
||||
self::register("red_nether_brick_wall", fn(BID $id) => new Wall($id, "Red Nether Brick Wall", $wallBreakInfo));
|
||||
self::register("red_sandstone_wall", fn(BID $id) => new Wall($id, "Red Sandstone Wall", $wallBreakInfo));
|
||||
self::register("sandstone_wall", fn(BID $id) => new Wall($id, "Sandstone Wall", $wallBreakInfo));
|
||||
self::register("stone_brick_wall", fn(BID $id) => new Wall($id, "Stone Brick Wall", $wallBreakInfo));
|
||||
self::register("end_stone_brick_wall", fn(BID $id) => new Wall($id, "End Stone Brick Wall", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD, 45.0))));
|
||||
|
||||
$brickWallBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
self::register("cobblestone_wall", fn(BID $id) => new Wall($id, "Cobblestone Wall", $brickWallBreakInfo));
|
||||
self::register("brick_wall", fn(BID $id) => new Wall($id, "Brick Wall", $brickWallBreakInfo));
|
||||
self::register("mossy_cobblestone_wall", fn(BID $id) => new Wall($id, "Mossy Cobblestone Wall", $brickWallBreakInfo));
|
||||
self::register("nether_brick_wall", fn(BID $id) => new Wall($id, "Nether Brick Wall", $brickWallBreakInfo));
|
||||
self::register("red_nether_brick_wall", fn(BID $id) => new Wall($id, "Red Nether Brick Wall", $brickWallBreakInfo));
|
||||
|
||||
$stoneWallBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD, 30.0));
|
||||
self::register("stone_brick_wall", fn(BID $id) => new Wall($id, "Stone Brick Wall", $stoneWallBreakInfo));
|
||||
self::register("mossy_stone_brick_wall", fn(BID $id) => new Wall($id, "Mossy Stone Brick Wall", $stoneWallBreakInfo));
|
||||
self::register("granite_wall", fn(BID $id) => new Wall($id, "Granite Wall", $stoneWallBreakInfo));
|
||||
self::register("diorite_wall", fn(BID $id) => new Wall($id, "Diorite Wall", $stoneWallBreakInfo));
|
||||
self::register("andesite_wall", fn(BID $id) => new Wall($id, "Andesite Wall", $stoneWallBreakInfo));
|
||||
self::register("prismarine_wall", fn(BID $id) => new Wall($id, "Prismarine Wall", $stoneWallBreakInfo));
|
||||
|
||||
$sandstoneWallBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD, 4.0));
|
||||
self::register("red_sandstone_wall", fn(BID $id) => new Wall($id, "Red Sandstone Wall", $sandstoneWallBreakInfo));
|
||||
self::register("sandstone_wall", fn(BID $id) => new Wall($id, "Sandstone Wall", $sandstoneWallBreakInfo));
|
||||
|
||||
self::registerElements();
|
||||
|
||||
@ -1320,8 +1327,8 @@ final class VanillaBlocks{
|
||||
self::register("mangrove_roots", fn(BID $id) => new MangroveRoots($id, "Mangrove Roots", new Info(BreakInfo::axe(0.7))));
|
||||
self::register("muddy_mangrove_roots", fn(BID $id) => new SimplePillar($id, "Muddy Mangrove Roots", new Info(BreakInfo::shovel(0.7), [Tags::MUD])));
|
||||
self::register("froglight", fn(BID $id) => new Froglight($id, "Froglight", new Info(new BreakInfo(0.3))));
|
||||
self::register("sculk", fn(BID $id) => new Sculk($id, "Sculk", new Info(new BreakInfo(0.6, ToolType::HOE))));
|
||||
self::register("reinforced_deepslate", fn(BID $id) => new class($id, "Reinforced Deepslate", new Info(new BreakInfo(55.0, ToolType::NONE, 0, 3600.0))) extends Opaque{
|
||||
self::register("sculk", fn(BID $id) => new Sculk($id, "Sculk", new Info(new BreakInfo(0.2, ToolType::HOE))));
|
||||
self::register("reinforced_deepslate", fn(BID $id) => new class($id, "Reinforced Deepslate", new Info(new BreakInfo(55.0, ToolType::NONE, 0, 6000.0))) extends Opaque{
|
||||
public function getDropsForCompatibleTool(Item $item) : array{
|
||||
return [];
|
||||
}
|
||||
@ -1537,7 +1544,7 @@ final class VanillaBlocks{
|
||||
self::register("lapis_lazuli_ore", fn(BID $id) => new LapisOre($id, "Lapis Lazuli Ore", $stoneOreBreakInfo(ToolTier::STONE)));
|
||||
self::register("redstone_ore", fn(BID $id) => new RedstoneOre($id, "Redstone Ore", $stoneOreBreakInfo(ToolTier::IRON)));
|
||||
|
||||
$deepslateOreBreakInfo = fn(ToolTier $toolTier) => new Info(BreakInfo::pickaxe(4.5, $toolTier));
|
||||
$deepslateOreBreakInfo = fn(ToolTier $toolTier) => new Info(BreakInfo::pickaxe(4.5, $toolTier, 15.0));
|
||||
self::register("deepslate_coal_ore", fn(BID $id) => new CoalOre($id, "Deepslate Coal Ore", $deepslateOreBreakInfo(ToolTier::WOOD)));
|
||||
self::register("deepslate_copper_ore", fn(BID $id) => new CopperOre($id, "Deepslate Copper Ore", $deepslateOreBreakInfo(ToolTier::STONE)));
|
||||
self::register("deepslate_diamond_ore", fn(BID $id) => new DiamondOre($id, "Deepslate Diamond Ore", $deepslateOreBreakInfo(ToolTier::IRON)));
|
||||
@ -1581,10 +1588,10 @@ final class VanillaBlocks{
|
||||
//for some reason, slabs have weird hardness like the legacy ones
|
||||
$slabBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
|
||||
self::register("ancient_debris", fn(BID $id) => new class($id, "Ancient Debris", new Info(BreakInfo::pickaxe(30, ToolTier::DIAMOND, 3600.0))) extends Opaque{
|
||||
self::register("ancient_debris", fn(BID $id) => new class($id, "Ancient Debris", new Info(BreakInfo::pickaxe(30, ToolTier::DIAMOND, 6000.0))) extends Opaque{
|
||||
public function isFireProofAsItem() : bool{ return true; }
|
||||
});
|
||||
$netheriteBreakInfo = new Info(BreakInfo::pickaxe(50, ToolTier::DIAMOND, 3600.0));
|
||||
$netheriteBreakInfo = new Info(BreakInfo::pickaxe(50, ToolTier::DIAMOND, 6000.0));
|
||||
self::register("netherite", fn(BID $id) => new class($id, "Netherite Block", $netheriteBreakInfo) extends Opaque{
|
||||
public function isFireProofAsItem() : bool{ return true; }
|
||||
});
|
||||
@ -1602,14 +1609,14 @@ final class VanillaBlocks{
|
||||
|
||||
self::register("gilded_blackstone", fn(BID $id) => new GildedBlackstone($id, "Gilded Blackstone", $blackstoneBreakInfo));
|
||||
|
||||
//TODO: polished blackstone ought to have 2.0 hardness (as per java) but it's 1.5 in Bedrock (probably parity bug)
|
||||
$polishedBlackstoneBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
$prefix = fn(string $thing) => "Polished Blackstone" . ($thing !== "" ? " $thing" : "");
|
||||
self::register("polished_blackstone", fn(BID $id) => new Opaque($id, $prefix(""), $blackstoneBreakInfo));
|
||||
self::register("polished_blackstone", fn(BID $id) => new Opaque($id, $prefix(""), $polishedBlackstoneBreakInfo));
|
||||
self::register("polished_blackstone_button", fn(BID $id) => new StoneButton($id, $prefix("Button"), new Info(BreakInfo::pickaxe(0.5))));
|
||||
self::register("polished_blackstone_pressure_plate", fn(BID $id) => new StonePressurePlate($id, $prefix("Pressure Plate"), new Info(BreakInfo::pickaxe(0.5)), 20));
|
||||
self::register("polished_blackstone_slab", fn(BID $id) => new Slab($id, $prefix(""), $slabBreakInfo));
|
||||
self::register("polished_blackstone_stairs", fn(BID $id) => new Stair($id, $prefix("Stairs"), $blackstoneBreakInfo));
|
||||
self::register("polished_blackstone_wall", fn(BID $id) => new Wall($id, $prefix("Wall"), $blackstoneBreakInfo));
|
||||
self::register("polished_blackstone_stairs", fn(BID $id) => new Stair($id, $prefix("Stairs"), $polishedBlackstoneBreakInfo));
|
||||
self::register("polished_blackstone_wall", fn(BID $id) => new Wall($id, $prefix("Wall"), $polishedBlackstoneBreakInfo));
|
||||
self::register("chiseled_polished_blackstone", fn(BID $id) => new Opaque($id, "Chiseled Polished Blackstone", $blackstoneBreakInfo));
|
||||
|
||||
$prefix = fn(string $thing) => "Polished Blackstone Brick" . ($thing !== "" ? " $thing" : "");
|
||||
@ -1622,8 +1629,7 @@ final class VanillaBlocks{
|
||||
self::register("soul_torch", fn(BID $id) => new Torch($id, "Soul Torch", new Info(BreakInfo::instant())));
|
||||
self::register("soul_fire", fn(BID $id) => new SoulFire($id, "Soul Fire", new Info(BreakInfo::instant(), [Tags::FIRE])));
|
||||
|
||||
//TODO: soul soul ought to have 0.5 hardness (as per java) but it's 1.0 in Bedrock (probably parity bug)
|
||||
self::register("soul_soil", fn(BID $id) => new Opaque($id, "Soul Soil", new Info(BreakInfo::shovel(1.0))));
|
||||
self::register("soul_soil", fn(BID $id) => new Opaque($id, "Soul Soil", new Info(BreakInfo::shovel(0.5))));
|
||||
|
||||
self::register("shroomlight", fn(BID $id) => new class($id, "Shroomlight", new Info(new BreakInfo(1.0, ToolType::HOE))) extends Opaque{
|
||||
public function getLightLevel() : int{ return 15; }
|
||||
@ -1641,7 +1647,9 @@ final class VanillaBlocks{
|
||||
self::register("crimson_roots", fn(BID $id) => new NetherRoots($id, "Crimson Roots", $netherRootsInfo));
|
||||
self::register("warped_roots", fn(BID $id) => new NetherRoots($id, "Warped Roots", $netherRootsInfo));
|
||||
|
||||
self::register("chain", fn(BID $id) => new Chain($id, "Chain", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD))));
|
||||
self::register("chain", fn(BID $id) => new Chain($id, "Chain", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD, 30.0))));
|
||||
|
||||
self::register("respawn_anchor", fn(BID $id) => new RespawnAnchor($id, "Respawn Anchor", new Info(BreakInfo::pickaxe(50.0, ToolTier::DIAMOND, 6000.0))));
|
||||
}
|
||||
|
||||
private static function registerBlocksR17() : void{
|
||||
@ -1659,7 +1667,7 @@ final class VanillaBlocks{
|
||||
self::register("raw_gold", fn(BID $id) => new Opaque($id, "Raw Gold Block", new Info(BreakInfo::pickaxe(5, ToolTier::IRON, 30.0))));
|
||||
self::register("raw_iron", fn(BID $id) => new Opaque($id, "Raw Iron Block", new Info(BreakInfo::pickaxe(5, ToolTier::STONE, 30.0))));
|
||||
|
||||
$deepslateBreakInfo = new Info(BreakInfo::pickaxe(3, ToolTier::WOOD, 18.0));
|
||||
$deepslateBreakInfo = new Info(BreakInfo::pickaxe(3, ToolTier::WOOD, 30.0));
|
||||
self::register("deepslate", fn(BID $id) => new class($id, "Deepslate", $deepslateBreakInfo) extends SimplePillar{
|
||||
public function getDropsForCompatibleTool(Item $item) : array{
|
||||
return [VanillaBlocks::COBBLED_DEEPSLATE()->asItem()];
|
||||
@ -1671,29 +1679,29 @@ final class VanillaBlocks{
|
||||
});
|
||||
|
||||
//TODO: parity issue here - in Java this has a hardness of 3.0, but in bedrock it's 3.5
|
||||
self::register("chiseled_deepslate", fn(BID $id) => new Opaque($id, "Chiseled Deepslate", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 18.0))));
|
||||
self::register("chiseled_deepslate", fn(BID $id) => new Opaque($id, "Chiseled Deepslate", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 30.0))));
|
||||
|
||||
$deepslateBrickBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 18.0));
|
||||
$deepslateBrickBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 30.0));
|
||||
self::register("deepslate_bricks", fn(BID $id) => new Opaque($id, "Deepslate Bricks", $deepslateBrickBreakInfo));
|
||||
self::register("deepslate_brick_slab", fn(BID $id) => new Slab($id, "Deepslate Brick", $deepslateBrickBreakInfo));
|
||||
self::register("deepslate_brick_stairs", fn(BID $id) => new Stair($id, "Deepslate Brick Stairs", $deepslateBrickBreakInfo));
|
||||
self::register("deepslate_brick_wall", fn(BID $id) => new Wall($id, "Deepslate Brick Wall", $deepslateBrickBreakInfo));
|
||||
self::register("cracked_deepslate_bricks", fn(BID $id) => new Opaque($id, "Cracked Deepslate Bricks", $deepslateBrickBreakInfo));
|
||||
|
||||
$deepslateTilesBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 18.0));
|
||||
$deepslateTilesBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 30.0));
|
||||
self::register("deepslate_tiles", fn(BID $id) => new Opaque($id, "Deepslate Tiles", $deepslateTilesBreakInfo));
|
||||
self::register("deepslate_tile_slab", fn(BID $id) => new Slab($id, "Deepslate Tile", $deepslateTilesBreakInfo));
|
||||
self::register("deepslate_tile_stairs", fn(BID $id) => new Stair($id, "Deepslate Tile Stairs", $deepslateTilesBreakInfo));
|
||||
self::register("deepslate_tile_wall", fn(BID $id) => new Wall($id, "Deepslate Tile Wall", $deepslateTilesBreakInfo));
|
||||
self::register("cracked_deepslate_tiles", fn(BID $id) => new Opaque($id, "Cracked Deepslate Tiles", $deepslateTilesBreakInfo));
|
||||
|
||||
$cobbledDeepslateBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 18.0));
|
||||
$cobbledDeepslateBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 30.0));
|
||||
self::register("cobbled_deepslate", fn(BID $id) => new Opaque($id, "Cobbled Deepslate", $cobbledDeepslateBreakInfo));
|
||||
self::register("cobbled_deepslate_slab", fn(BID $id) => new Slab($id, "Cobbled Deepslate", $cobbledDeepslateBreakInfo));
|
||||
self::register("cobbled_deepslate_stairs", fn(BID $id) => new Stair($id, "Cobbled Deepslate Stairs", $cobbledDeepslateBreakInfo));
|
||||
self::register("cobbled_deepslate_wall", fn(BID $id) => new Wall($id, "Cobbled Deepslate Wall", $cobbledDeepslateBreakInfo));
|
||||
|
||||
$polishedDeepslateBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 18.0));
|
||||
$polishedDeepslateBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 30.0));
|
||||
self::register("polished_deepslate", fn(BID $id) => new Opaque($id, "Polished Deepslate", $polishedDeepslateBreakInfo));
|
||||
self::register("polished_deepslate_slab", fn(BID $id) => new Slab($id, "Polished Deepslate", $polishedDeepslateBreakInfo));
|
||||
self::register("polished_deepslate_stairs", fn(BID $id) => new Stair($id, "Polished Deepslate Stairs", $polishedDeepslateBreakInfo));
|
||||
@ -1702,7 +1710,7 @@ final class VanillaBlocks{
|
||||
self::register("tinted_glass", fn(BID $id) => new TintedGlass($id, "Tinted Glass", new Info(new BreakInfo(0.3))));
|
||||
|
||||
//blast resistance should be 30 if we were matched with java :(
|
||||
$copperBreakInfo = new Info(BreakInfo::pickaxe(3.0, ToolTier::STONE, 18.0));
|
||||
$copperBreakInfo = new Info(BreakInfo::pickaxe(3.0, ToolTier::STONE, 30.0));
|
||||
self::register("lightning_rod", fn(BID $id) => new LightningRod($id, "Lightning Rod", $copperBreakInfo));
|
||||
|
||||
self::register("copper", fn(BID $id) => new Copper($id, "Copper Block", $copperBreakInfo));
|
||||
@ -1730,8 +1738,8 @@ final class VanillaBlocks{
|
||||
self::register("cave_vines", fn(BID $id) => new CaveVines($id, "Cave Vines", new Info(BreakInfo::instant())));
|
||||
|
||||
self::register("small_dripleaf", fn(BID $id) => new SmallDripleaf($id, "Small Dripleaf", new Info(BreakInfo::instant(ToolType::SHEARS, toolHarvestLevel: 1))));
|
||||
self::register("big_dripleaf_head", fn(BID $id) => new BigDripleafHead($id, "Big Dripleaf", new Info(BreakInfo::instant())));
|
||||
self::register("big_dripleaf_stem", fn(BID $id) => new BigDripleafStem($id, "Big Dripleaf Stem", new Info(BreakInfo::instant())));
|
||||
self::register("big_dripleaf_head", fn(BID $id) => new BigDripleafHead($id, "Big Dripleaf", new Info(new BreakInfo(0.1))));
|
||||
self::register("big_dripleaf_stem", fn(BID $id) => new BigDripleafStem($id, "Big Dripleaf Stem", new Info(new BreakInfo(0.1))));
|
||||
}
|
||||
|
||||
private static function registerBlocksR18() : void{
|
||||
@ -1742,7 +1750,7 @@ final class VanillaBlocks{
|
||||
self::register("mud", fn(BID $id) => new Opaque($id, "Mud", new Info(BreakInfo::shovel(0.5), [Tags::MUD])));
|
||||
self::register("packed_mud", fn(BID $id) => new Opaque($id, "Packed Mud", new Info(BreakInfo::pickaxe(1.0, null, 15.0))));
|
||||
|
||||
$mudBricksBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
$mudBricksBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD, 15.0));
|
||||
|
||||
self::register("mud_bricks", fn(BID $id) => new Opaque($id, "Mud Bricks", $mudBricksBreakInfo));
|
||||
self::register("mud_brick_slab", fn(BID $id) => new Slab($id, "Mud Brick", $mudBricksBreakInfo));
|
||||
@ -1754,7 +1762,7 @@ final class VanillaBlocks{
|
||||
self::register("resin", fn(BID $id) => new Opaque($id, "Block of Resin", new Info(BreakInfo::instant())));
|
||||
self::register("resin_clump", fn(BID $id) => new ResinClump($id, "Resin Clump", new Info(BreakInfo::instant())));
|
||||
|
||||
$resinBricksInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD));
|
||||
$resinBricksInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD, 30.0));
|
||||
self::register("resin_brick_slab", fn(BID $id) => new Slab($id, "Resin Brick", $resinBricksInfo));
|
||||
self::register("resin_brick_stairs", fn(BID $id) => new Stair($id, "Resin Brick Stairs", $resinBricksInfo));
|
||||
self::register("resin_brick_wall", fn(BID $id) => new Wall($id, "Resin Brick Wall", $resinBricksInfo));
|
||||
|
@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\event\entity\EntityExtinguishEvent;
|
||||
use pocketmine\world\sound\BucketEmptyWaterSound;
|
||||
use pocketmine\world\sound\BucketFillWaterSound;
|
||||
use pocketmine\world\sound\Sound;
|
||||
@ -53,7 +54,7 @@ class Water extends Liquid{
|
||||
public function onEntityInside(Entity $entity) : bool{
|
||||
$entity->resetFallDistance();
|
||||
if($entity->isOnFire()){
|
||||
$entity->extinguish();
|
||||
$entity->extinguish(EntityExtinguishEvent::CAUSE_WATER);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ use pocketmine\block\tile\Cauldron as TileCauldron;
|
||||
use pocketmine\block\utils\DyeColor;
|
||||
use pocketmine\color\Color;
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\event\entity\EntityExtinguishEvent;
|
||||
use pocketmine\item\Armor;
|
||||
use pocketmine\item\Banner;
|
||||
use pocketmine\item\Dye;
|
||||
@ -183,7 +184,7 @@ final class WaterCauldron extends FillableCauldron{
|
||||
|
||||
public function onEntityInside(Entity $entity) : bool{
|
||||
if($entity->isOnFire()){
|
||||
$entity->extinguish();
|
||||
$entity->extinguish(EntityExtinguishEvent::CAUSE_WATER_CAULDRON);
|
||||
//TODO: particles
|
||||
|
||||
$this->position->getWorld()->setBlock($this->position, $this->withFillLevel($this->getFillLevel() - self::ENTITY_EXTINGUISH_USE_AMOUNT));
|
||||
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
class WeightedPressurePlateHeavy extends WeightedPressurePlate{
|
||||
|
||||
}
|
@ -35,20 +35,6 @@ abstract class Spawnable extends Tile{
|
||||
/** @phpstan-var CacheableNbt<CompoundTag>|null */
|
||||
private ?CacheableNbt $spawnCompoundCache = null;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function isDirty() : bool{
|
||||
return $this->spawnCompoundCache === null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function setDirty(bool $dirty = true) : void{
|
||||
$this->clearSpawnCompoundCache();
|
||||
}
|
||||
|
||||
public function clearSpawnCompoundCache() : void{
|
||||
$this->spawnCompoundCache = null;
|
||||
}
|
||||
|
@ -114,6 +114,13 @@ final class TileFactory{
|
||||
$this->saveNames[$className] = reset($saveNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-param class-string<Tile> $class
|
||||
*/
|
||||
public function isRegistered(string $class) : bool{
|
||||
return isset($this->saveNames[$class]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @throws SavedDataLoadingException
|
||||
|
@ -23,54 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static BannerPatternType BORDER()
|
||||
* @method static BannerPatternType BRICKS()
|
||||
* @method static BannerPatternType CIRCLE()
|
||||
* @method static BannerPatternType CREEPER()
|
||||
* @method static BannerPatternType CROSS()
|
||||
* @method static BannerPatternType CURLY_BORDER()
|
||||
* @method static BannerPatternType DIAGONAL_LEFT()
|
||||
* @method static BannerPatternType DIAGONAL_RIGHT()
|
||||
* @method static BannerPatternType DIAGONAL_UP_LEFT()
|
||||
* @method static BannerPatternType DIAGONAL_UP_RIGHT()
|
||||
* @method static BannerPatternType FLOWER()
|
||||
* @method static BannerPatternType GRADIENT()
|
||||
* @method static BannerPatternType GRADIENT_UP()
|
||||
* @method static BannerPatternType HALF_HORIZONTAL()
|
||||
* @method static BannerPatternType HALF_HORIZONTAL_BOTTOM()
|
||||
* @method static BannerPatternType HALF_VERTICAL()
|
||||
* @method static BannerPatternType HALF_VERTICAL_RIGHT()
|
||||
* @method static BannerPatternType MOJANG()
|
||||
* @method static BannerPatternType RHOMBUS()
|
||||
* @method static BannerPatternType SKULL()
|
||||
* @method static BannerPatternType SMALL_STRIPES()
|
||||
* @method static BannerPatternType SQUARE_BOTTOM_LEFT()
|
||||
* @method static BannerPatternType SQUARE_BOTTOM_RIGHT()
|
||||
* @method static BannerPatternType SQUARE_TOP_LEFT()
|
||||
* @method static BannerPatternType SQUARE_TOP_RIGHT()
|
||||
* @method static BannerPatternType STRAIGHT_CROSS()
|
||||
* @method static BannerPatternType STRIPE_BOTTOM()
|
||||
* @method static BannerPatternType STRIPE_CENTER()
|
||||
* @method static BannerPatternType STRIPE_DOWNLEFT()
|
||||
* @method static BannerPatternType STRIPE_DOWNRIGHT()
|
||||
* @method static BannerPatternType STRIPE_LEFT()
|
||||
* @method static BannerPatternType STRIPE_MIDDLE()
|
||||
* @method static BannerPatternType STRIPE_RIGHT()
|
||||
* @method static BannerPatternType STRIPE_TOP()
|
||||
* @method static BannerPatternType TRIANGLES_BOTTOM()
|
||||
* @method static BannerPatternType TRIANGLES_TOP()
|
||||
* @method static BannerPatternType TRIANGLE_BOTTOM()
|
||||
* @method static BannerPatternType TRIANGLE_TOP()
|
||||
*/
|
||||
enum BannerPatternType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case BORDER;
|
||||
case BRICKS;
|
||||
case CIRCLE;
|
||||
|
@ -23,20 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static BellAttachmentType CEILING()
|
||||
* @method static BellAttachmentType FLOOR()
|
||||
* @method static BellAttachmentType ONE_WALL()
|
||||
* @method static BellAttachmentType TWO_WALLS()
|
||||
*/
|
||||
enum BellAttachmentType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case CEILING;
|
||||
case FLOOR;
|
||||
case ONE_WALL;
|
||||
|
@ -24,19 +24,8 @@ declare(strict_types=1);
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\block\inventory\BrewingStandInventory;
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static BrewingStandSlot EAST()
|
||||
* @method static BrewingStandSlot NORTHWEST()
|
||||
* @method static BrewingStandSlot SOUTHWEST()
|
||||
*/
|
||||
enum BrewingStandSlot{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case EAST;
|
||||
case NORTHWEST;
|
||||
case SOUTHWEST;
|
||||
|
@ -23,20 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static CopperOxidation EXPOSED()
|
||||
* @method static CopperOxidation NONE()
|
||||
* @method static CopperOxidation OXIDIZED()
|
||||
* @method static CopperOxidation WEATHERED()
|
||||
*/
|
||||
enum CopperOxidation : int{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case NONE = 0;
|
||||
case EXPOSED = 1;
|
||||
case WEATHERED = 2;
|
||||
|
@ -23,21 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static CoralType BRAIN()
|
||||
* @method static CoralType BUBBLE()
|
||||
* @method static CoralType FIRE()
|
||||
* @method static CoralType HORN()
|
||||
* @method static CoralType TUBE()
|
||||
*/
|
||||
enum CoralType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case TUBE;
|
||||
case BRAIN;
|
||||
case BUBBLE;
|
||||
|
@ -23,19 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static DirtType COARSE()
|
||||
* @method static DirtType NORMAL()
|
||||
* @method static DirtType ROOTED()
|
||||
*/
|
||||
enum DirtType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case NORMAL;
|
||||
case COARSE;
|
||||
case ROOTED;
|
||||
|
@ -23,20 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static DripleafState FULL_TILT()
|
||||
* @method static DripleafState PARTIAL_TILT()
|
||||
* @method static DripleafState STABLE()
|
||||
* @method static DripleafState UNSTABLE()
|
||||
*/
|
||||
enum DripleafState{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case STABLE;
|
||||
case UNSTABLE;
|
||||
case PARTIAL_TILT;
|
||||
|
@ -24,35 +24,12 @@ declare(strict_types=1);
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\color\Color;
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
use function spl_object_id;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static DyeColor BLACK()
|
||||
* @method static DyeColor BLUE()
|
||||
* @method static DyeColor BROWN()
|
||||
* @method static DyeColor CYAN()
|
||||
* @method static DyeColor GRAY()
|
||||
* @method static DyeColor GREEN()
|
||||
* @method static DyeColor LIGHT_BLUE()
|
||||
* @method static DyeColor LIGHT_GRAY()
|
||||
* @method static DyeColor LIME()
|
||||
* @method static DyeColor MAGENTA()
|
||||
* @method static DyeColor ORANGE()
|
||||
* @method static DyeColor PINK()
|
||||
* @method static DyeColor PURPLE()
|
||||
* @method static DyeColor RED()
|
||||
* @method static DyeColor WHITE()
|
||||
* @method static DyeColor YELLOW()
|
||||
*
|
||||
* @phpstan-type TMetadata array{0: string, 1: Color}
|
||||
*/
|
||||
enum DyeColor{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case WHITE;
|
||||
case ORANGE;
|
||||
case MAGENTA;
|
||||
|
@ -23,19 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static FroglightType OCHRE()
|
||||
* @method static FroglightType PEARLESCENT()
|
||||
* @method static FroglightType VERDANT()
|
||||
*/
|
||||
enum FroglightType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case OCHRE;
|
||||
case PEARLESCENT;
|
||||
case VERDANT;
|
||||
|
@ -23,26 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static LeavesType ACACIA()
|
||||
* @method static LeavesType AZALEA()
|
||||
* @method static LeavesType BIRCH()
|
||||
* @method static LeavesType CHERRY()
|
||||
* @method static LeavesType DARK_OAK()
|
||||
* @method static LeavesType FLOWERING_AZALEA()
|
||||
* @method static LeavesType JUNGLE()
|
||||
* @method static LeavesType MANGROVE()
|
||||
* @method static LeavesType OAK()
|
||||
* @method static LeavesType SPRUCE()
|
||||
*/
|
||||
enum LeavesType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case OAK;
|
||||
case SPRUCE;
|
||||
case BIRCH;
|
||||
|
@ -24,24 +24,8 @@ declare(strict_types=1);
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static LeverFacing DOWN_AXIS_X()
|
||||
* @method static LeverFacing DOWN_AXIS_Z()
|
||||
* @method static LeverFacing EAST()
|
||||
* @method static LeverFacing NORTH()
|
||||
* @method static LeverFacing SOUTH()
|
||||
* @method static LeverFacing UP_AXIS_X()
|
||||
* @method static LeverFacing UP_AXIS_Z()
|
||||
* @method static LeverFacing WEST()
|
||||
*/
|
||||
enum LeverFacing{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case UP_AXIS_X;
|
||||
case UP_AXIS_Z;
|
||||
case DOWN_AXIS_X;
|
||||
|
@ -23,23 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static MobHeadType CREEPER()
|
||||
* @method static MobHeadType DRAGON()
|
||||
* @method static MobHeadType PIGLIN()
|
||||
* @method static MobHeadType PLAYER()
|
||||
* @method static MobHeadType SKELETON()
|
||||
* @method static MobHeadType WITHER_SKELETON()
|
||||
* @method static MobHeadType ZOMBIE()
|
||||
*/
|
||||
enum MobHeadType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case SKELETON;
|
||||
case WITHER_SKELETON;
|
||||
case ZOMBIE;
|
||||
|
@ -23,27 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static MushroomBlockType ALL_CAP()
|
||||
* @method static MushroomBlockType CAP_EAST()
|
||||
* @method static MushroomBlockType CAP_MIDDLE()
|
||||
* @method static MushroomBlockType CAP_NORTH()
|
||||
* @method static MushroomBlockType CAP_NORTHEAST()
|
||||
* @method static MushroomBlockType CAP_NORTHWEST()
|
||||
* @method static MushroomBlockType CAP_SOUTH()
|
||||
* @method static MushroomBlockType CAP_SOUTHEAST()
|
||||
* @method static MushroomBlockType CAP_SOUTHWEST()
|
||||
* @method static MushroomBlockType CAP_WEST()
|
||||
* @method static MushroomBlockType PORES()
|
||||
*/
|
||||
enum MushroomBlockType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case PORES;
|
||||
case CAP_NORTHWEST;
|
||||
case CAP_NORTH;
|
||||
|
@ -26,34 +26,12 @@ namespace pocketmine\block\utils;
|
||||
use pocketmine\lang\KnownTranslationFactory;
|
||||
use pocketmine\lang\Translatable;
|
||||
use pocketmine\network\mcpe\protocol\types\LevelSoundEvent;
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
use function spl_object_id;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static RecordType DISK_11()
|
||||
* @method static RecordType DISK_13()
|
||||
* @method static RecordType DISK_5()
|
||||
* @method static RecordType DISK_BLOCKS()
|
||||
* @method static RecordType DISK_CAT()
|
||||
* @method static RecordType DISK_CHIRP()
|
||||
* @method static RecordType DISK_FAR()
|
||||
* @method static RecordType DISK_MALL()
|
||||
* @method static RecordType DISK_MELLOHI()
|
||||
* @method static RecordType DISK_OTHERSIDE()
|
||||
* @method static RecordType DISK_PIGSTEP()
|
||||
* @method static RecordType DISK_STAL()
|
||||
* @method static RecordType DISK_STRAD()
|
||||
* @method static RecordType DISK_WAIT()
|
||||
* @method static RecordType DISK_WARD()
|
||||
*
|
||||
* @phpstan-type TMetadata array{0: string, 1: LevelSoundEvent::*, 2: Translatable}
|
||||
*/
|
||||
enum RecordType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case DISK_13;
|
||||
case DISK_5;
|
||||
case DISK_CAT;
|
||||
|
@ -23,23 +23,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
use pocketmine\world\generator\object\TreeType;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static SaplingType ACACIA()
|
||||
* @method static SaplingType BIRCH()
|
||||
* @method static SaplingType DARK_OAK()
|
||||
* @method static SaplingType JUNGLE()
|
||||
* @method static SaplingType OAK()
|
||||
* @method static SaplingType SPRUCE()
|
||||
*/
|
||||
enum SaplingType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case OAK;
|
||||
case SPRUCE;
|
||||
case BIRCH;
|
||||
|
@ -23,19 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static SlabType BOTTOM()
|
||||
* @method static SlabType DOUBLE()
|
||||
* @method static SlabType TOP()
|
||||
*/
|
||||
enum SlabType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case BOTTOM;
|
||||
case TOP;
|
||||
case DOUBLE;
|
||||
|
@ -23,21 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static StairShape INNER_LEFT()
|
||||
* @method static StairShape INNER_RIGHT()
|
||||
* @method static StairShape OUTER_LEFT()
|
||||
* @method static StairShape OUTER_RIGHT()
|
||||
* @method static StairShape STRAIGHT()
|
||||
*/
|
||||
enum StairShape{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case STRAIGHT;
|
||||
case INNER_LEFT;
|
||||
case INNER_RIGHT;
|
||||
|
@ -23,20 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static SupportType CENTER()
|
||||
* @method static SupportType EDGE()
|
||||
* @method static SupportType FULL()
|
||||
* @method static SupportType NONE()
|
||||
*/
|
||||
enum SupportType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case FULL;
|
||||
case CENTER;
|
||||
case EDGE;
|
||||
|
@ -23,18 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static WallConnectionType SHORT()
|
||||
* @method static WallConnectionType TALL()
|
||||
*/
|
||||
enum WallConnectionType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case SHORT;
|
||||
case TALL;
|
||||
}
|
||||
|
@ -23,26 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static WoodType ACACIA()
|
||||
* @method static WoodType BIRCH()
|
||||
* @method static WoodType CHERRY()
|
||||
* @method static WoodType CRIMSON()
|
||||
* @method static WoodType DARK_OAK()
|
||||
* @method static WoodType JUNGLE()
|
||||
* @method static WoodType MANGROVE()
|
||||
* @method static WoodType OAK()
|
||||
* @method static WoodType SPRUCE()
|
||||
* @method static WoodType WARPED()
|
||||
*/
|
||||
enum WoodType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case OAK;
|
||||
case SPRUCE;
|
||||
case BIRCH;
|
||||
|
@ -66,7 +66,7 @@ abstract class Command{
|
||||
|
||||
/** @var string[] */
|
||||
private array $permission = [];
|
||||
private ?string $permissionMessage = null;
|
||||
private Translatable|string|null $permissionMessage = null;
|
||||
|
||||
/**
|
||||
* @param string[] $aliases
|
||||
@ -122,10 +122,11 @@ abstract class Command{
|
||||
return true;
|
||||
}
|
||||
|
||||
if($this->permissionMessage === null){
|
||||
$target->sendMessage(KnownTranslationFactory::pocketmine_command_error_permission($this->name)->prefix(TextFormat::RED));
|
||||
}elseif($this->permissionMessage !== ""){
|
||||
$target->sendMessage(str_replace("<permission>", $permission ?? implode(";", $this->permission), $this->permissionMessage));
|
||||
$message = $this->permissionMessage ?? KnownTranslationFactory::pocketmine_command_error_permission($this->name);
|
||||
if($message instanceof Translatable){
|
||||
$target->sendMessage($message->prefix(TextFormat::RED));
|
||||
}elseif($message !== ""){
|
||||
$target->sendMessage(str_replace("<permission>", $permission ?? implode(";", $this->permission), $message));
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -198,7 +199,7 @@ abstract class Command{
|
||||
return $this->activeAliases;
|
||||
}
|
||||
|
||||
public function getPermissionMessage() : ?string{
|
||||
public function getPermissionMessage() : Translatable|string|null{
|
||||
return $this->permissionMessage;
|
||||
}
|
||||
|
||||
@ -226,7 +227,7 @@ abstract class Command{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
public function setPermissionMessage(string $permissionMessage) : void{
|
||||
public function setPermissionMessage(Translatable|string $permissionMessage) : void{
|
||||
$this->permissionMessage = $permissionMessage;
|
||||
}
|
||||
|
||||
|
@ -152,10 +152,10 @@ final class CraftingManagerFromDataHelper{
|
||||
* @return mixed[]
|
||||
*
|
||||
* @phpstan-template TData of object
|
||||
* @phpstan-param class-string<TData> $modelCLass
|
||||
* @phpstan-param class-string<TData> $modelClass
|
||||
* @phpstan-return list<TData>
|
||||
*/
|
||||
public static function loadJsonArrayOfObjectsFile(string $filePath, string $modelCLass) : array{
|
||||
public static function loadJsonArrayOfObjectsFile(string $filePath, string $modelClass) : array{
|
||||
$recipes = json_decode(Filesystem::fileGetContents($filePath));
|
||||
if(!is_array($recipes)){
|
||||
throw new SavedDataLoadingException("$filePath root should be an array, got " . get_debug_type($recipes));
|
||||
@ -166,7 +166,7 @@ final class CraftingManagerFromDataHelper{
|
||||
$mapper->bExceptionOnUndefinedProperty = true;
|
||||
$mapper->bExceptionOnMissingData = true;
|
||||
|
||||
return self::loadJsonObjectListIntoModel($mapper, $modelCLass, $recipes);
|
||||
return self::loadJsonObjectListIntoModel($mapper, $modelClass, $recipes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\crafting;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
use pocketmine\world\sound\BlastFurnaceSound;
|
||||
use pocketmine\world\sound\CampfireSound;
|
||||
use pocketmine\world\sound\FurnaceSound;
|
||||
@ -32,20 +31,9 @@ use pocketmine\world\sound\Sound;
|
||||
use function spl_object_id;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static FurnaceType BLAST_FURNACE()
|
||||
* @method static FurnaceType CAMPFIRE()
|
||||
* @method static FurnaceType FURNACE()
|
||||
* @method static FurnaceType SMOKER()
|
||||
* @method static FurnaceType SOUL_CAMPFIRE()
|
||||
*
|
||||
* @phpstan-type TMetadata array{0: int, 1: Sound}
|
||||
*/
|
||||
enum FurnaceType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case FURNACE;
|
||||
case BLAST_FURNACE;
|
||||
case SMOKER;
|
||||
|
@ -23,20 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\crafting;
|
||||
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static ShapelessRecipeType CARTOGRAPHY()
|
||||
* @method static ShapelessRecipeType CRAFTING()
|
||||
* @method static ShapelessRecipeType SMITHING()
|
||||
* @method static ShapelessRecipeType STONECUTTER()
|
||||
*/
|
||||
enum ShapelessRecipeType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case CRAFTING;
|
||||
case STONECUTTER;
|
||||
case SMITHING;
|
||||
|
@ -26,7 +26,6 @@ namespace pocketmine\crash;
|
||||
use Composer\InstalledVersions;
|
||||
use pocketmine\errorhandler\ErrorTypeToStringMap;
|
||||
use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
||||
use pocketmine\plugin\PluginBase;
|
||||
use pocketmine\plugin\PluginManager;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\thread\ThreadCrashInfoFrame;
|
||||
@ -259,10 +258,8 @@ class CrashDump{
|
||||
}
|
||||
|
||||
if(file_exists($filePath)){
|
||||
$reflection = new \ReflectionClass(PluginBase::class);
|
||||
$file = $reflection->getProperty("file");
|
||||
foreach($this->server->getPluginManager()->getPlugins() as $plugin){
|
||||
$filePath = Filesystem::cleanPath($file->getValue($plugin));
|
||||
$filePath = Filesystem::cleanPath($plugin->getFile());
|
||||
if(str_starts_with($frameCleanPath, $filePath)){
|
||||
$this->data->plugin = $plugin->getName();
|
||||
break;
|
||||
|
66
src/data/bedrock/WorldDataVersions.php
Normal file
66
src/data/bedrock/WorldDataVersions.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock;
|
||||
|
||||
use pocketmine\world\format\io\leveldb\ChunkVersion;
|
||||
use pocketmine\world\format\io\leveldb\SubChunkVersion;
|
||||
|
||||
/**
|
||||
* All version infos related to current Minecraft data version support
|
||||
* These are mostly related to world storage but may also influence network stuff
|
||||
*/
|
||||
final class WorldDataVersions{
|
||||
/**
|
||||
* Bedrock version of the most recent backwards-incompatible change to blockstates.
|
||||
*
|
||||
* This is *NOT* the same as current game version. It should match the numbers in the
|
||||
* newest blockstate upgrade schema used in BedrockBlockUpgradeSchema.
|
||||
*/
|
||||
public const BLOCK_STATES =
|
||||
(1 << 24) | //major
|
||||
(21 << 16) | //minor
|
||||
(60 << 8) | //patch
|
||||
(33); //revision
|
||||
|
||||
public const CHUNK = ChunkVersion::v1_21_40;
|
||||
public const SUBCHUNK = SubChunkVersion::PALETTED_MULTI;
|
||||
|
||||
public const STORAGE = 10;
|
||||
|
||||
/**
|
||||
* Highest NetworkVersion of Bedrock worlds currently supported by PocketMine-MP.
|
||||
*
|
||||
* This may be lower than the current protocol version if PocketMine-MP does not yet support features of the newer
|
||||
* version. This allows the protocol to be updated independently of world format support.
|
||||
*/
|
||||
public const NETWORK = 818;
|
||||
|
||||
public const LAST_OPENED_IN = [
|
||||
1, //major
|
||||
21, //minor
|
||||
90, //patch
|
||||
3, //revision
|
||||
0 //is beta
|
||||
];
|
||||
}
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block;
|
||||
|
||||
use pocketmine\data\bedrock\WorldDataVersions;
|
||||
use pocketmine\nbt\NbtException;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\Tag;
|
||||
@ -36,17 +37,7 @@ use function implode;
|
||||
* Contains the common information found in a serialized blockstate.
|
||||
*/
|
||||
final class BlockStateData{
|
||||
/**
|
||||
* Bedrock version of the most recent backwards-incompatible change to blockstates.
|
||||
*
|
||||
* This is *not* the same as current game version. It should match the numbers in the
|
||||
* newest blockstate upgrade schema used in BedrockBlockUpgradeSchema.
|
||||
*/
|
||||
public const CURRENT_VERSION =
|
||||
(1 << 24) | //major
|
||||
(21 << 16) | //minor
|
||||
(60 << 8) | //patch
|
||||
(33); //revision
|
||||
public const CURRENT_VERSION = WorldDataVersions::BLOCK_STATES;
|
||||
|
||||
public const TAG_NAME = "name";
|
||||
public const TAG_STATES = "states";
|
||||
|
@ -122,6 +122,7 @@ use pocketmine\block\RedstoneRepeater;
|
||||
use pocketmine\block\RedstoneTorch;
|
||||
use pocketmine\block\RedstoneWire;
|
||||
use pocketmine\block\ResinClump;
|
||||
use pocketmine\block\RespawnAnchor;
|
||||
use pocketmine\block\RuntimeBlockStateRegistry;
|
||||
use pocketmine\block\Sapling;
|
||||
use pocketmine\block\SeaPickle;
|
||||
@ -166,8 +167,7 @@ use pocketmine\block\WallBanner;
|
||||
use pocketmine\block\WallCoralFan;
|
||||
use pocketmine\block\WallSign;
|
||||
use pocketmine\block\Water;
|
||||
use pocketmine\block\WeightedPressurePlateHeavy;
|
||||
use pocketmine\block\WeightedPressurePlateLight;
|
||||
use pocketmine\block\WeightedPressurePlate;
|
||||
use pocketmine\block\Wheat;
|
||||
use pocketmine\block\Wood;
|
||||
use pocketmine\block\WoodenButton;
|
||||
@ -225,6 +225,10 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
||||
return $this->cache[$stateId] ??= $this->serializeBlock(RuntimeBlockStateRegistry::getInstance()->fromStateId($stateId));
|
||||
}
|
||||
|
||||
public function isRegistered(Block $block) : bool{
|
||||
return isset($this->serializers[$block->getTypeId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-template TBlockType of Block
|
||||
* @phpstan-param TBlockType $block
|
||||
@ -1750,6 +1754,10 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
||||
return Writer::create(Ids::RESIN_CLUMP)
|
||||
->writeFacingFlags($block->getFaces());
|
||||
});
|
||||
$this->map(Blocks::RESPAWN_ANCHOR(), function(RespawnAnchor $block) : Writer{
|
||||
return Writer::create(Ids::RESPAWN_ANCHOR)
|
||||
->writeInt(StateNames::RESPAWN_ANCHOR_CHARGE, $block->getCharges());
|
||||
});
|
||||
$this->map(Blocks::ROSE_BUSH(), fn(DoublePlant $block) => Helper::encodeDoublePlant($block, Writer::create(Ids::ROSE_BUSH)));
|
||||
$this->mapSlab(Blocks::SANDSTONE_SLAB(), Ids::SANDSTONE_SLAB, Ids::SANDSTONE_DOUBLE_SLAB);
|
||||
$this->mapStairs(Blocks::SANDSTONE_STAIRS(), Ids::SANDSTONE_STAIRS);
|
||||
@ -1869,11 +1877,11 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
||||
return Writer::create(Ids::WEEPING_VINES)
|
||||
->writeInt(StateNames::WEEPING_VINES_AGE, $block->getAge());
|
||||
});
|
||||
$this->map(Blocks::WEIGHTED_PRESSURE_PLATE_HEAVY(), function(WeightedPressurePlateHeavy $block) : Writer{
|
||||
$this->map(Blocks::WEIGHTED_PRESSURE_PLATE_HEAVY(), function(WeightedPressurePlate $block) : Writer{
|
||||
return Writer::create(Ids::HEAVY_WEIGHTED_PRESSURE_PLATE)
|
||||
->writeInt(StateNames::REDSTONE_SIGNAL, $block->getOutputSignalStrength());
|
||||
});
|
||||
$this->map(Blocks::WEIGHTED_PRESSURE_PLATE_LIGHT(), function(WeightedPressurePlateLight $block) : Writer{
|
||||
$this->map(Blocks::WEIGHTED_PRESSURE_PLATE_LIGHT(), function(WeightedPressurePlate $block) : Writer{
|
||||
return Writer::create(Ids::LIGHT_WEIGHTED_PRESSURE_PLATE)
|
||||
->writeInt(StateNames::REDSTONE_SIGNAL, $block->getOutputSignalStrength());
|
||||
});
|
||||
|
@ -1717,6 +1717,10 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
$this->mapStairs(Ids::RESIN_BRICK_STAIRS, fn() => Blocks::RESIN_BRICK_STAIRS());
|
||||
$this->map(Ids::RESIN_BRICK_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::RESIN_BRICK_WALL(), $in));
|
||||
$this->map(Ids::RESIN_CLUMP, fn(Reader $in) => Blocks::RESIN_CLUMP()->setFaces($in->readFacingFlags()));
|
||||
$this->map(Ids::RESPAWN_ANCHOR, function(Reader $in) : Block{
|
||||
return Blocks::RESPAWN_ANCHOR()
|
||||
->setCharges($in->readBoundedInt(StateNames::RESPAWN_ANCHOR_CHARGE, 0, 4));
|
||||
});
|
||||
$this->mapSlab(Ids::SANDSTONE_SLAB, Ids::SANDSTONE_DOUBLE_SLAB, fn() => Blocks::SANDSTONE_SLAB());
|
||||
$this->mapStairs(Ids::SANDSTONE_STAIRS, fn() => Blocks::SANDSTONE_STAIRS());
|
||||
$this->map(Ids::SANDSTONE_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::SANDSTONE_WALL(), $in));
|
||||
|
@ -380,6 +380,7 @@ final class ItemTypeNames{
|
||||
public const MUSIC_DISC_RELIC = "minecraft:music_disc_relic";
|
||||
public const MUSIC_DISC_STAL = "minecraft:music_disc_stal";
|
||||
public const MUSIC_DISC_STRAD = "minecraft:music_disc_strad";
|
||||
public const MUSIC_DISC_TEARS = "minecraft:music_disc_tears";
|
||||
public const MUSIC_DISC_WAIT = "minecraft:music_disc_wait";
|
||||
public const MUSIC_DISC_WARD = "minecraft:music_disc_ward";
|
||||
public const MUTTON = "minecraft:mutton";
|
||||
|
@ -1,89 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\runtime;
|
||||
|
||||
/**
|
||||
* Provides backwards-compatible shims for the old codegen'd enum describer methods.
|
||||
* This is kept for plugin backwards compatibility, but these functions should not be used in new code.
|
||||
* @deprecated
|
||||
*/
|
||||
trait LegacyRuntimeEnumDescriberTrait{
|
||||
abstract protected function enum(\UnitEnum &$case) : void;
|
||||
|
||||
public function bellAttachmentType(\pocketmine\block\utils\BellAttachmentType &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function copperOxidation(\pocketmine\block\utils\CopperOxidation &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function coralType(\pocketmine\block\utils\CoralType &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function dirtType(\pocketmine\block\utils\DirtType &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function dripleafState(\pocketmine\block\utils\DripleafState &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function dyeColor(\pocketmine\block\utils\DyeColor &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function froglightType(\pocketmine\block\utils\FroglightType &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function leverFacing(\pocketmine\block\utils\LeverFacing &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function medicineType(\pocketmine\item\MedicineType &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function mobHeadType(\pocketmine\block\utils\MobHeadType &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function mushroomBlockType(\pocketmine\block\utils\MushroomBlockType &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function potionType(\pocketmine\item\PotionType &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function slabType(\pocketmine\block\utils\SlabType &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
|
||||
public function suspiciousStewType(\pocketmine\item\SuspiciousStewType &$value) : void{
|
||||
$this->enum($value);
|
||||
}
|
||||
}
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\runtime;
|
||||
|
||||
use pocketmine\block\utils\BrewingStandSlot;
|
||||
use pocketmine\block\utils\WallConnectionType;
|
||||
use pocketmine\math\Facing;
|
||||
|
||||
@ -35,14 +34,9 @@ use pocketmine\math\Facing;
|
||||
* You may use it as a type for parameters and return values, but it should not be implemented outside of this package.
|
||||
* New methods may be added without warning.
|
||||
*/
|
||||
interface RuntimeDataDescriber extends RuntimeEnumDescriber{
|
||||
interface RuntimeDataDescriber{
|
||||
public function int(int $bits, int &$value) : void;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link RuntimeDataDescriber::boundedIntAuto()} instead.
|
||||
*/
|
||||
public function boundedInt(int $bits, int $min, int $max, int &$value) : void;
|
||||
|
||||
/**
|
||||
* Same as boundedInt() but automatically calculates the required number of bits from the range.
|
||||
* The range bounds must be constant.
|
||||
@ -77,14 +71,6 @@ interface RuntimeDataDescriber extends RuntimeEnumDescriber{
|
||||
*/
|
||||
public function wallConnections(array &$connections) : void;
|
||||
|
||||
/**
|
||||
* @param BrewingStandSlot[] $slots
|
||||
* @phpstan-param array<int, BrewingStandSlot> $slots
|
||||
*
|
||||
* @deprecated Use {@link enumSet()} instead.
|
||||
*/
|
||||
public function brewingStandSlots(array &$slots) : void;
|
||||
|
||||
public function railShape(int &$railShape) : void;
|
||||
|
||||
public function straightOnlyRailShape(int &$railShape) : void;
|
||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\runtime;
|
||||
|
||||
use pocketmine\block\utils\BrewingStandSlot;
|
||||
use pocketmine\block\utils\RailConnectionInfo;
|
||||
use pocketmine\block\utils\WallConnectionType;
|
||||
use pocketmine\math\Axis;
|
||||
@ -35,8 +34,6 @@ use function log;
|
||||
use function spl_object_id;
|
||||
|
||||
final class RuntimeDataReader implements RuntimeDataDescriber{
|
||||
use LegacyRuntimeEnumDescriberTrait;
|
||||
|
||||
private int $offset = 0;
|
||||
|
||||
public function __construct(
|
||||
@ -59,18 +56,6 @@ final class RuntimeDataReader implements RuntimeDataDescriber{
|
||||
$value = $this->readInt($bits);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link self::boundedIntAuto()} instead.
|
||||
*/
|
||||
public function boundedInt(int $bits, int $min, int $max, int &$value) : void{
|
||||
$offset = $this->offset;
|
||||
$this->boundedIntAuto($min, $max, $value);
|
||||
$actualBits = $this->offset - $offset;
|
||||
if($this->offset !== $offset + $bits){
|
||||
throw new \InvalidArgumentException("Bits should be $actualBits for the given bounds, but received $bits. Use boundedIntAuto() for automatic bits calculation.");
|
||||
}
|
||||
}
|
||||
|
||||
private function readBoundedIntAuto(int $min, int $max) : int{
|
||||
$bits = ((int) log($max - $min, 2)) + 1;
|
||||
$result = $this->readInt($bits) + $min;
|
||||
@ -192,16 +177,6 @@ final class RuntimeDataReader implements RuntimeDataDescriber{
|
||||
$connections = $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BrewingStandSlot[] $slots
|
||||
* @phpstan-param array<int, BrewingStandSlot> $slots
|
||||
*
|
||||
* @deprecated Use {@link enumSet()} instead.
|
||||
*/
|
||||
public function brewingStandSlots(array &$slots) : void{
|
||||
$this->enumSet($slots, BrewingStandSlot::cases());
|
||||
}
|
||||
|
||||
public function railShape(int &$railShape) : void{
|
||||
$result = $this->readInt(4);
|
||||
if(!isset(RailConnectionInfo::CONNECTIONS[$result]) && !isset(RailConnectionInfo::CURVE_CONNECTIONS[$result])){
|
||||
|
@ -23,14 +23,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\runtime;
|
||||
|
||||
use pocketmine\block\utils\BrewingStandSlot;
|
||||
use pocketmine\math\Facing;
|
||||
use function count;
|
||||
use function log;
|
||||
|
||||
final class RuntimeDataSizeCalculator implements RuntimeDataDescriber{
|
||||
use LegacyRuntimeEnumDescriberTrait;
|
||||
|
||||
private int $bits = 0;
|
||||
|
||||
protected function addBits(int $bits) : void{
|
||||
@ -45,18 +42,6 @@ final class RuntimeDataSizeCalculator implements RuntimeDataDescriber{
|
||||
$this->addBits($bits);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link self::boundedIntAuto()} instead.
|
||||
*/
|
||||
public function boundedInt(int $bits, int $min, int $max, int &$value) : void{
|
||||
$currentBits = $this->bits;
|
||||
$this->boundedIntAuto($min, $max, $value);
|
||||
$actualBits = $this->bits - $currentBits;
|
||||
if($actualBits !== $bits){
|
||||
throw new \InvalidArgumentException("Bits should be $actualBits for the given bounds, but received $bits. Use boundedIntAuto() for automatic bits calculation.");
|
||||
}
|
||||
}
|
||||
|
||||
public function boundedIntAuto(int $min, int $max, int &$value) : void{
|
||||
$this->addBits(((int) log($max - $min, 2)) + 1);
|
||||
}
|
||||
@ -97,10 +82,6 @@ final class RuntimeDataSizeCalculator implements RuntimeDataDescriber{
|
||||
$this->addBits(7);
|
||||
}
|
||||
|
||||
public function brewingStandSlots(array &$slots) : void{
|
||||
$this->addBits(count(BrewingStandSlot::cases()));
|
||||
}
|
||||
|
||||
public function railShape(int &$railShape) : void{
|
||||
$this->addBits(4);
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\runtime;
|
||||
|
||||
use pocketmine\block\utils\BrewingStandSlot;
|
||||
use pocketmine\block\utils\WallConnectionType;
|
||||
use pocketmine\math\Axis;
|
||||
use pocketmine\math\Facing;
|
||||
@ -32,8 +31,6 @@ use function log;
|
||||
use function spl_object_id;
|
||||
|
||||
final class RuntimeDataWriter implements RuntimeDataDescriber{
|
||||
use LegacyRuntimeEnumDescriberTrait;
|
||||
|
||||
private int $value = 0;
|
||||
private int $offset = 0;
|
||||
|
||||
@ -57,18 +54,6 @@ final class RuntimeDataWriter implements RuntimeDataDescriber{
|
||||
$this->writeInt($bits, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link self::boundedIntAuto()} instead.
|
||||
*/
|
||||
public function boundedInt(int $bits, int $min, int $max, int &$value) : void{
|
||||
$offset = $this->offset;
|
||||
$this->writeBoundedIntAuto($min, $max, $value);
|
||||
$actualBits = $this->offset - $offset;
|
||||
if($actualBits !== $bits){
|
||||
throw new \InvalidArgumentException("Bits should be $actualBits for the given bounds, but received $bits. Use boundedIntAuto() for automatic bits calculation.");
|
||||
}
|
||||
}
|
||||
|
||||
private function writeBoundedIntAuto(int $min, int $max, int $value) : void{
|
||||
if($value < $min || $value > $max){
|
||||
throw new \InvalidArgumentException("Value $value is outside the range $min - $max");
|
||||
@ -170,16 +155,6 @@ final class RuntimeDataWriter implements RuntimeDataDescriber{
|
||||
$this->writeBoundedIntAuto(0, (3 ** 4) - 1, $packed);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BrewingStandSlot[] $slots
|
||||
* @phpstan-param array<int, BrewingStandSlot> $slots
|
||||
*
|
||||
* @deprecated Use {@link enumSet()} instead.
|
||||
*/
|
||||
public function brewingStandSlots(array &$slots) : void{
|
||||
$this->enumSet($slots, BrewingStandSlot::cases());
|
||||
}
|
||||
|
||||
public function railShape(int &$railShape) : void{
|
||||
$this->int(4, $railShape);
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\runtime;
|
||||
|
||||
/**
|
||||
* Provides backwards-compatible shims for the old codegen'd enum describer methods.
|
||||
* This is kept for plugin backwards compatibility, but these functions should not be used in new code.
|
||||
* @deprecated
|
||||
*/
|
||||
interface RuntimeEnumDescriber{
|
||||
|
||||
public function bellAttachmentType(\pocketmine\block\utils\BellAttachmentType &$value) : void;
|
||||
|
||||
public function copperOxidation(\pocketmine\block\utils\CopperOxidation &$value) : void;
|
||||
|
||||
public function coralType(\pocketmine\block\utils\CoralType &$value) : void;
|
||||
|
||||
public function dirtType(\pocketmine\block\utils\DirtType &$value) : void;
|
||||
|
||||
public function dripleafState(\pocketmine\block\utils\DripleafState &$value) : void;
|
||||
|
||||
public function dyeColor(\pocketmine\block\utils\DyeColor &$value) : void;
|
||||
|
||||
public function froglightType(\pocketmine\block\utils\FroglightType &$value) : void;
|
||||
|
||||
public function leverFacing(\pocketmine\block\utils\LeverFacing &$value) : void;
|
||||
|
||||
public function medicineType(\pocketmine\item\MedicineType &$value) : void;
|
||||
|
||||
public function mobHeadType(\pocketmine\block\utils\MobHeadType &$value) : void;
|
||||
|
||||
public function mushroomBlockType(\pocketmine\block\utils\MushroomBlockType &$value) : void;
|
||||
|
||||
public function potionType(\pocketmine\item\PotionType &$value) : void;
|
||||
|
||||
public function slabType(\pocketmine\block\utils\SlabType &$value) : void;
|
||||
|
||||
public function suspiciousStewType(\pocketmine\item\SuspiciousStewType &$value) : void;
|
||||
|
||||
}
|
@ -31,6 +31,7 @@ use pocketmine\block\Water;
|
||||
use pocketmine\entity\animation\Animation;
|
||||
use pocketmine\event\entity\EntityDamageEvent;
|
||||
use pocketmine\event\entity\EntityDespawnEvent;
|
||||
use pocketmine\event\entity\EntityExtinguishEvent;
|
||||
use pocketmine\event\entity\EntityMotionEvent;
|
||||
use pocketmine\event\entity\EntityRegainHealthEvent;
|
||||
use pocketmine\event\entity\EntitySpawnEvent;
|
||||
@ -718,7 +719,10 @@ abstract class Entity{
|
||||
}
|
||||
}
|
||||
|
||||
public function extinguish() : void{
|
||||
public function extinguish(int $cause = EntityExtinguishEvent::CAUSE_CUSTOM) : void{
|
||||
$ev = new EntityExtinguishEvent($this, $cause);
|
||||
$ev->call();
|
||||
|
||||
$this->fireTicks = 0;
|
||||
$this->networkPropertiesDirty = true;
|
||||
}
|
||||
@ -729,7 +733,7 @@ abstract class Entity{
|
||||
|
||||
protected function doOnFireTick(int $tickDiff = 1) : bool{
|
||||
if($this->isFireProof() && $this->isOnFire()){
|
||||
$this->extinguish();
|
||||
$this->extinguish(EntityExtinguishEvent::CAUSE_FIRE_PROOF);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -740,7 +744,7 @@ abstract class Entity{
|
||||
}
|
||||
|
||||
if(!$this->isOnFire()){
|
||||
$this->extinguish();
|
||||
$this->extinguish(EntityExtinguishEvent::CAUSE_TICKING);
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
@ -1187,12 +1191,14 @@ abstract class Entity{
|
||||
|
||||
$moveBB->offset(0, 0, $dz);
|
||||
|
||||
if($this->stepHeight > 0 && $fallingFlag && ($wantedX !== $dx || $wantedZ !== $dz)){
|
||||
$stepHeight = $this->getStepHeight();
|
||||
|
||||
if($stepHeight > 0 && $fallingFlag && ($wantedX !== $dx || $wantedZ !== $dz)){
|
||||
$cx = $dx;
|
||||
$cy = $dy;
|
||||
$cz = $dz;
|
||||
$dx = $wantedX;
|
||||
$dy = $this->stepHeight;
|
||||
$dy = $stepHeight;
|
||||
$dz = $wantedZ;
|
||||
|
||||
$stepBB = clone $this->boundingBox;
|
||||
@ -1262,6 +1268,14 @@ abstract class Entity{
|
||||
Timings::$entityMove->stopTiming();
|
||||
}
|
||||
|
||||
public function setStepHeight(float $stepHeight) : void{
|
||||
$this->stepHeight = $stepHeight;
|
||||
}
|
||||
|
||||
public function getStepHeight() : float{
|
||||
return $this->stepHeight;
|
||||
}
|
||||
|
||||
protected function checkGroundState(float $wantedX, float $wantedY, float $wantedZ, float $dx, float $dy, float $dz) : void{
|
||||
$this->isCollidedVertically = $wantedY !== $dy;
|
||||
$this->isCollidedHorizontally = ($wantedX !== $dx || $wantedZ !== $dz);
|
||||
@ -1494,7 +1508,7 @@ abstract class Entity{
|
||||
return $this->hasSpawned;
|
||||
}
|
||||
|
||||
abstract public static function getNetworkTypeId() : string;
|
||||
abstract public function getNetworkTypeId() : string;
|
||||
|
||||
/**
|
||||
* Called by spawnTo() to send whatever packets needed to spawn the entity to the client.
|
||||
@ -1503,7 +1517,7 @@ abstract class Entity{
|
||||
$player->getNetworkSession()->sendDataPacket(AddActorPacket::create(
|
||||
$this->getId(), //TODO: actor unique ID
|
||||
$this->getId(),
|
||||
static::getNetworkTypeId(),
|
||||
$this->getNetworkTypeId(),
|
||||
$this->getOffsetPosition($this->location->asVector3()),
|
||||
$this->getMotion(),
|
||||
$this->location->pitch,
|
||||
|
@ -219,6 +219,13 @@ final class EntityFactory{
|
||||
$this->saveNames[$className] = reset($saveNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-param class-string<Entity> $class
|
||||
*/
|
||||
public function isRegistered(string $class) : bool{
|
||||
return isset($this->saveNames[$class]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an entity from data stored on a chunk.
|
||||
*
|
||||
|
@ -30,7 +30,7 @@ use pocketmine\entity\effect\EffectInstance;
|
||||
use pocketmine\entity\effect\VanillaEffects;
|
||||
use pocketmine\entity\projectile\ProjectileSource;
|
||||
use pocketmine\event\entity\EntityDamageEvent;
|
||||
use pocketmine\event\player\PlayerExhaustEvent;
|
||||
use pocketmine\event\entity\EntityExhaustEvent;
|
||||
use pocketmine\inventory\CallbackInventoryListener;
|
||||
use pocketmine\inventory\Inventory;
|
||||
use pocketmine\inventory\InventoryHolder;
|
||||
@ -99,7 +99,7 @@ class Human extends Living implements ProjectileSource, InventoryHolder{
|
||||
private const TAG_SKIN_GEOMETRY_NAME = "GeometryName"; //TAG_String
|
||||
private const TAG_SKIN_GEOMETRY_DATA = "GeometryData"; //TAG_ByteArray
|
||||
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::PLAYER; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::PLAYER; }
|
||||
|
||||
protected PlayerInventory $inventory;
|
||||
protected PlayerOffHandInventory $offHandInventory;
|
||||
@ -173,9 +173,9 @@ class Human extends Living implements ProjectileSource, InventoryHolder{
|
||||
public function jump() : void{
|
||||
parent::jump();
|
||||
if($this->isSprinting()){
|
||||
$this->hungerManager->exhaust(0.2, PlayerExhaustEvent::CAUSE_SPRINT_JUMPING);
|
||||
$this->hungerManager->exhaust(0.2, EntityExhaustEvent::CAUSE_SPRINT_JUMPING);
|
||||
}else{
|
||||
$this->hungerManager->exhaust(0.05, PlayerExhaustEvent::CAUSE_JUMPING);
|
||||
$this->hungerManager->exhaust(0.05, EntityExhaustEvent::CAUSE_JUMPING);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,8 @@ declare(strict_types=1);
|
||||
namespace pocketmine\entity;
|
||||
|
||||
use pocketmine\event\entity\EntityDamageEvent;
|
||||
use pocketmine\event\entity\EntityExhaustEvent;
|
||||
use pocketmine\event\entity\EntityRegainHealthEvent;
|
||||
use pocketmine\event\player\PlayerExhaustEvent;
|
||||
use pocketmine\world\World;
|
||||
use function max;
|
||||
use function min;
|
||||
@ -130,13 +130,13 @@ class HungerManager{
|
||||
*
|
||||
* @return float the amount of exhaustion level increased
|
||||
*/
|
||||
public function exhaust(float $amount, int $cause = PlayerExhaustEvent::CAUSE_CUSTOM) : float{
|
||||
public function exhaust(float $amount, int $cause = EntityExhaustEvent::CAUSE_CUSTOM) : float{
|
||||
if(!$this->enabled){
|
||||
return 0;
|
||||
}
|
||||
$evAmount = $amount;
|
||||
if(PlayerExhaustEvent::hasHandlers()){
|
||||
$ev = new PlayerExhaustEvent($this->entity, $amount, $cause);
|
||||
if(EntityExhaustEvent::hasHandlers()){
|
||||
$ev = new EntityExhaustEvent($this->entity, $amount, $cause);
|
||||
$ev->call();
|
||||
if($ev->isCancelled()){
|
||||
return 0.0;
|
||||
@ -205,7 +205,7 @@ class HungerManager{
|
||||
if($food >= 18){
|
||||
if($health < $this->entity->getMaxHealth()){
|
||||
$this->entity->heal(new EntityRegainHealthEvent($this->entity, 1, EntityRegainHealthEvent::CAUSE_SATURATION));
|
||||
$this->exhaust(6.0, PlayerExhaustEvent::CAUSE_HEALTH_REGEN);
|
||||
$this->exhaust(6.0, EntityExhaustEvent::CAUSE_HEALTH_REGEN);
|
||||
}
|
||||
}elseif($food <= 0){
|
||||
if(($difficulty === World::DIFFICULTY_EASY && $health > 10) || ($difficulty === World::DIFFICULTY_NORMAL && $health > 1) || $difficulty === World::DIFFICULTY_HARD){
|
||||
|
@ -38,6 +38,7 @@ use pocketmine\event\entity\EntityDamageByChildEntityEvent;
|
||||
use pocketmine\event\entity\EntityDamageByEntityEvent;
|
||||
use pocketmine\event\entity\EntityDamageEvent;
|
||||
use pocketmine\event\entity\EntityDeathEvent;
|
||||
use pocketmine\event\entity\EntityFrostWalkerEvent;
|
||||
use pocketmine\inventory\ArmorInventory;
|
||||
use pocketmine\inventory\CallbackInventoryListener;
|
||||
use pocketmine\inventory\Inventory;
|
||||
@ -721,19 +722,30 @@ abstract class Living extends Entity{
|
||||
$y = $this->location->getFloorY() - 1;
|
||||
$baseZ = $this->location->getFloorZ();
|
||||
|
||||
$frostedIce = VanillaBlocks::FROSTED_ICE();
|
||||
$liquid = VanillaBlocks::WATER();
|
||||
$targetBlock = VanillaBlocks::FROSTED_ICE();
|
||||
if(EntityFrostWalkerEvent::hasHandlers()){
|
||||
$ev = new EntityFrostWalkerEvent($this, $radius, $liquid, $targetBlock);
|
||||
$ev->call();
|
||||
if($ev->isCancelled()){
|
||||
return;
|
||||
}
|
||||
$radius = $ev->getRadius();
|
||||
$liquid = $ev->getLiquid();
|
||||
$targetBlock = $ev->getTargetBlock();
|
||||
}
|
||||
|
||||
for($x = $baseX - $radius; $x <= $baseX + $radius; $x++){
|
||||
for($z = $baseZ - $radius; $z <= $baseZ + $radius; $z++){
|
||||
$block = $world->getBlockAt($x, $y, $z);
|
||||
if(
|
||||
!$block instanceof Water ||
|
||||
!$block->isSource() ||
|
||||
!$block->isSameState($liquid) ||
|
||||
$world->getBlockAt($x, $y + 1, $z)->getTypeId() !== BlockTypeIds::AIR ||
|
||||
count($world->getNearbyEntities(AxisAlignedBB::one()->offset($x, $y, $z))) !== 0
|
||||
){
|
||||
continue;
|
||||
}
|
||||
$world->setBlockAt($x, $y, $z, $frostedIce);
|
||||
$world->setBlockAt($x, $y, $z, $targetBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ use const M_PI;
|
||||
|
||||
class Squid extends WaterAnimal{
|
||||
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::SQUID; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::SQUID; }
|
||||
|
||||
public ?Vector3 $swimDirection = null;
|
||||
public float $swimSpeed = 0.1;
|
||||
|
@ -40,7 +40,7 @@ class Villager extends Living implements Ageable{
|
||||
|
||||
private const TAG_PROFESSION = "Profession"; //TAG_Int
|
||||
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::VILLAGER; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::VILLAGER; }
|
||||
|
||||
private bool $baby = false;
|
||||
private int $profession = self::PROFESSION_FARMER;
|
||||
|
@ -30,7 +30,7 @@ use function mt_rand;
|
||||
|
||||
class Zombie extends Living{
|
||||
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::ZOMBIE; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::ZOMBIE; }
|
||||
|
||||
protected function getInitialSizeInfo() : EntitySizeInfo{
|
||||
return new EntitySizeInfo(1.8, 0.6); //TODO: eye height ??
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\entity\effect;
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\entity\Human;
|
||||
use pocketmine\entity\Living;
|
||||
use pocketmine\event\player\PlayerExhaustEvent;
|
||||
use pocketmine\event\entity\EntityExhaustEvent;
|
||||
|
||||
class HungerEffect extends Effect{
|
||||
|
||||
@ -36,7 +36,7 @@ class HungerEffect extends Effect{
|
||||
|
||||
public function applyEffect(Living $entity, EffectInstance $instance, float $potency = 1.0, ?Entity $source = null) : void{
|
||||
if($entity instanceof Human){
|
||||
$entity->getHungerManager()->exhaust(0.1 * $instance->getEffectLevel(), PlayerExhaustEvent::CAUSE_POTION);
|
||||
$entity->getHungerManager()->exhaust(0.1 * $instance->getEffectLevel(), EntityExhaustEvent::CAUSE_POTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class EndCrystal extends Entity implements Explosive{
|
||||
private const TAG_BLOCKTARGET_Y = "BlockTargetY"; //TAG_Int
|
||||
private const TAG_BLOCKTARGET_Z = "BlockTargetZ"; //TAG_Int
|
||||
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::ENDER_CRYSTAL; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::ENDER_CRYSTAL; }
|
||||
|
||||
protected bool $showBase = false;
|
||||
protected ?Vector3 $beamTarget = null;
|
||||
@ -129,7 +129,7 @@ class EndCrystal extends Entity implements Explosive{
|
||||
$ev = new EntityPreExplodeEvent($this, 6);
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$explosion = new Explosion($this->getPosition(), $ev->getRadius(), $this);
|
||||
$explosion = new Explosion($this->getPosition(), $ev->getRadius(), $this, $ev->getFireChance());
|
||||
if($ev->isBlockBreaking()){
|
||||
$explosion->explodeA();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ use function sqrt;
|
||||
|
||||
class ExperienceOrb extends Entity{
|
||||
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::XP_ORB; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::XP_ORB; }
|
||||
|
||||
public const TAG_VALUE_PC = "Value"; //short
|
||||
public const TAG_VALUE_PE = "experience value"; //int (WTF?)
|
||||
|
@ -56,7 +56,7 @@ class FallingBlock extends Entity{
|
||||
private const TAG_TILE = "Tile"; //TAG_Byte
|
||||
private const TAG_DATA = "Data"; //TAG_Byte
|
||||
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::FALLING_BLOCK; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::FALLING_BLOCK; }
|
||||
|
||||
protected Block $block;
|
||||
|
||||
|
@ -52,7 +52,7 @@ class ItemEntity extends Entity{
|
||||
private const TAG_THROWER = "Thrower"; //TAG_String
|
||||
public const TAG_ITEM = "Item"; //TAG_Compound
|
||||
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::ITEM; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::ITEM; }
|
||||
|
||||
public const MERGE_CHECK_PERIOD = 2; //0.1 seconds
|
||||
public const DEFAULT_DESPAWN_DELAY = 6000; //5 minutes
|
||||
|
@ -49,7 +49,7 @@ class Painting extends Entity{
|
||||
public const TAG_DIRECTION_BE = "Direction"; //TAG_Byte
|
||||
public const TAG_MOTIVE = "Motive"; //TAG_String
|
||||
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::PAINTING; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::PAINTING; }
|
||||
|
||||
public const DATA_TO_FACING = [
|
||||
0 => Facing::SOUTH,
|
||||
|
@ -43,7 +43,7 @@ class PrimedTNT extends Entity implements Explosive{
|
||||
|
||||
private const TAG_FUSE = "Fuse"; //TAG_Short
|
||||
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::TNT; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::TNT; }
|
||||
|
||||
protected int $fuse;
|
||||
protected bool $worksUnderwater = false;
|
||||
@ -121,7 +121,7 @@ class PrimedTNT extends Entity implements Explosive{
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
//TODO: deal with underwater TNT (underwater TNT treats water as if it has a blast resistance of 0)
|
||||
$explosion = new Explosion(Position::fromObject($this->location->add(0, $this->size->getHeight() / 2, 0), $this->getWorld()), $ev->getRadius(), $this);
|
||||
$explosion = new Explosion(Position::fromObject($this->location->add(0, $this->size->getHeight() / 2, 0), $this->getWorld()), $ev->getRadius(), $this, $ev->getFireChance());
|
||||
if($ev->isBlockBreaking()){
|
||||
$explosion->explodeA();
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ use function sqrt;
|
||||
|
||||
class Arrow extends Projectile{
|
||||
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::ARROW; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::ARROW; }
|
||||
|
||||
public const PICKUP_NONE = 0;
|
||||
public const PICKUP_ANY = 1;
|
||||
|
@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\entity\EntityIds;
|
||||
use pocketmine\world\particle\ItemBreakParticle;
|
||||
|
||||
class Egg extends Throwable{
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::EGG; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::EGG; }
|
||||
|
||||
//TODO: spawn chickens on collision
|
||||
|
||||
|
@ -30,7 +30,7 @@ use pocketmine\world\particle\EndermanTeleportParticle;
|
||||
use pocketmine\world\sound\EndermanTeleportSound;
|
||||
|
||||
class EnderPearl extends Throwable{
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::ENDER_PEARL; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::ENDER_PEARL; }
|
||||
|
||||
protected function onHit(ProjectileHitEvent $event) : void{
|
||||
$owner = $this->getOwningEntity();
|
||||
|
@ -30,7 +30,7 @@ use pocketmine\world\sound\PotionSplashSound;
|
||||
use function mt_rand;
|
||||
|
||||
class ExperienceBottle extends Throwable{
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::XP_BOTTLE; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::XP_BOTTLE; }
|
||||
|
||||
protected function getInitialGravity() : float{ return 0.07; }
|
||||
|
||||
|
@ -36,7 +36,7 @@ use pocketmine\world\particle\ItemBreakParticle;
|
||||
use pocketmine\world\sound\IceBombHitSound;
|
||||
|
||||
class IceBomb extends Throwable{
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::ICE_BOMB; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::ICE_BOMB; }
|
||||
|
||||
public function getResultDamage() : int{
|
||||
return -1;
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\types\entity\EntityIds;
|
||||
use pocketmine\world\particle\SnowballPoofParticle;
|
||||
|
||||
class Snowball extends Throwable{
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::SNOWBALL; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::SNOWBALL; }
|
||||
|
||||
protected function onHit(ProjectileHitEvent $event) : void{
|
||||
$world = $this->getWorld();
|
||||
|
@ -52,7 +52,7 @@ class SplashPotion extends Throwable{
|
||||
|
||||
public const TAG_POTION_ID = "PotionId"; //TAG_Short
|
||||
|
||||
public static function getNetworkTypeId() : string{ return EntityIds::SPLASH_POTION; }
|
||||
public function getNetworkTypeId() : string{ return EntityIds::SPLASH_POTION; }
|
||||
|
||||
protected bool $linger = false;
|
||||
protected PotionType $potionType;
|
||||
|
122
src/event/block/BlockExplodeEvent.php
Normal file
122
src/event/block/BlockExplodeEvent.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?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\event\block;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\event\CancellableTrait;
|
||||
use pocketmine\utils\Utils;
|
||||
use pocketmine\world\Position;
|
||||
|
||||
/**
|
||||
* Called when a block explodes, after explosion impact has been calculated.
|
||||
*
|
||||
* @see BlockPreExplodeEvent
|
||||
*/
|
||||
class BlockExplodeEvent extends BlockEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
/**
|
||||
* @param Block[] $blocks
|
||||
* @param Block[] $ignitions
|
||||
*/
|
||||
public function __construct(
|
||||
Block $block,
|
||||
private Position $position,
|
||||
private array $blocks,
|
||||
private float $yield,
|
||||
private array $ignitions
|
||||
){
|
||||
parent::__construct($block);
|
||||
|
||||
Utils::checkFloatNotInfOrNaN("yield", $yield);
|
||||
if($yield < 0.0 || $yield > 100.0){
|
||||
throw new \InvalidArgumentException("Yield must be in range 0.0 - 100.0");
|
||||
}
|
||||
}
|
||||
|
||||
public function getPosition() : Position{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the percentage chance of drops from each block destroyed by the explosion.
|
||||
*
|
||||
* @return float 0-100
|
||||
*/
|
||||
public function getYield() : float{
|
||||
return $this->yield;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the percentage chance of drops from each block destroyed by the explosion.
|
||||
*
|
||||
* @param float $yield 0-100
|
||||
*/
|
||||
public function setYield(float $yield) : void{
|
||||
Utils::checkFloatNotInfOrNaN("yield", $yield);
|
||||
if($yield < 0.0 || $yield > 100.0){
|
||||
throw new \InvalidArgumentException("Yield must be in range 0.0 - 100.0");
|
||||
}
|
||||
$this->yield = $yield;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of blocks destroyed by the explosion.
|
||||
*
|
||||
* @return Block[]
|
||||
*/
|
||||
public function getAffectedBlocks() : array{
|
||||
return $this->blocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the blocks destroyed by the explosion.
|
||||
*
|
||||
* @param Block[] $blocks
|
||||
*/
|
||||
public function setAffectedBlocks(array $blocks) : void{
|
||||
Utils::validateArrayValueType($blocks, fn(Block $block) => null);
|
||||
$this->blocks = $blocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of affected blocks that will be replaced by fire.
|
||||
*
|
||||
* @return Block[]
|
||||
*/
|
||||
public function getIgnitions() : array{
|
||||
return $this->ignitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the list of blocks that will be replaced by fire.
|
||||
*
|
||||
* @param Block[] $ignitions
|
||||
*/
|
||||
public function setIgnitions(array $ignitions) : void{
|
||||
Utils::validateArrayValueType($ignitions, fn(Block $block) => null);
|
||||
$this->ignitions = $ignitions;
|
||||
}
|
||||
}
|
129
src/event/block/BlockPreExplodeEvent.php
Normal file
129
src/event/block/BlockPreExplodeEvent.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?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\event\block;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\event\CancellableTrait;
|
||||
use pocketmine\player\Player;
|
||||
use pocketmine\utils\Utils;
|
||||
use pocketmine\world\Explosion;
|
||||
|
||||
/**
|
||||
* Called when a block wants to explode, before the explosion impact is calculated.
|
||||
* This allows changing the explosion force, fire chance and whether it will destroy blocks.
|
||||
*
|
||||
* @see BlockExplodeEvent
|
||||
*/
|
||||
class BlockPreExplodeEvent extends BlockEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
private bool $blockBreaking = true;
|
||||
|
||||
public function __construct(
|
||||
Block $block,
|
||||
private float $radius,
|
||||
private readonly ?Player $player = null,
|
||||
private float $fireChance = 0.0
|
||||
){
|
||||
Utils::checkFloatNotInfOrNaN("radius", $radius);
|
||||
if($radius <= 0){
|
||||
throw new \InvalidArgumentException("Explosion radius must be positive");
|
||||
}
|
||||
Utils::checkFloatNotInfOrNaN("fireChance", $fireChance);
|
||||
if($fireChance < 0.0 || $fireChance > 1.0){
|
||||
throw new \InvalidArgumentException("Fire chance must be a number between 0 and 1.");
|
||||
}
|
||||
parent::__construct($block);
|
||||
}
|
||||
|
||||
public function getRadius() : float{
|
||||
return $this->radius;
|
||||
}
|
||||
|
||||
public function setRadius(float $radius) : void{
|
||||
Utils::checkFloatNotInfOrNaN("radius", $radius);
|
||||
if($radius <= 0){
|
||||
throw new \InvalidArgumentException("Explosion radius must be positive");
|
||||
}
|
||||
$this->radius = $radius;
|
||||
}
|
||||
|
||||
public function isBlockBreaking() : bool{
|
||||
return $this->blockBreaking;
|
||||
}
|
||||
|
||||
public function setBlockBreaking(bool $affectsBlocks) : void{
|
||||
$this->blockBreaking = $affectsBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the explosion will create a fire.
|
||||
*/
|
||||
public function isIncendiary() : bool{
|
||||
return $this->fireChance > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the explosion will create a fire by filling fireChance with default values.
|
||||
*
|
||||
* If $incendiary is true, the fire chance will be filled only if explosion isn't currently creating a fire (if fire chance is 0).
|
||||
*/
|
||||
public function setIncendiary(bool $incendiary) : void{
|
||||
if(!$incendiary){
|
||||
$this->fireChance = 0;
|
||||
}elseif($this->fireChance <= 0){
|
||||
$this->fireChance = Explosion::DEFAULT_FIRE_CHANCE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a chance between 0 and 1 of creating a fire.
|
||||
*/
|
||||
public function getFireChance() : float{
|
||||
return $this->fireChance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a chance between 0 and 1 of creating a fire.
|
||||
* For example, if the chance is 1/3, then that amount of affected blocks will be ignited.
|
||||
*
|
||||
* @param float $fireChance 0 ... 1
|
||||
*/
|
||||
public function setFireChance(float $fireChance) : void{
|
||||
Utils::checkFloatNotInfOrNaN("fireChance", $fireChance);
|
||||
if($fireChance < 0.0 || $fireChance > 1.0){
|
||||
throw new \InvalidArgumentException("Fire chance must be a number between 0 and 1.");
|
||||
}
|
||||
$this->fireChance = $fireChance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the player who triggered the block explosion.
|
||||
* Returns null if the block was exploded by other means.
|
||||
*/
|
||||
public function getPlayer() : ?Player{
|
||||
return $this->player;
|
||||
}
|
||||
}
|
@ -21,17 +21,16 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\event\player;
|
||||
namespace pocketmine\event\entity;
|
||||
|
||||
use pocketmine\entity\Human;
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\event\CancellableTrait;
|
||||
use pocketmine\event\entity\EntityEvent;
|
||||
|
||||
/**
|
||||
* @phpstan-extends EntityEvent<Human>
|
||||
* @phpstan-extends EntityEvent<Entity>
|
||||
*/
|
||||
class PlayerExhaustEvent extends EntityEvent implements Cancellable{
|
||||
class EntityExhaustEvent extends EntityEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
public const CAUSE_ATTACK = 1;
|
||||
@ -47,18 +46,11 @@ class PlayerExhaustEvent extends EntityEvent implements Cancellable{
|
||||
public const CAUSE_CUSTOM = 11;
|
||||
|
||||
public function __construct(
|
||||
protected Human $human,
|
||||
Entity $entity,
|
||||
private float $amount,
|
||||
private int $cause
|
||||
){
|
||||
$this->entity = $human;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Human
|
||||
*/
|
||||
public function getPlayer(){
|
||||
return $this->human;
|
||||
$this->entity = $entity;
|
||||
}
|
||||
|
||||
public function getAmount() : float{
|
@ -43,13 +43,15 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
|
||||
|
||||
/**
|
||||
* @param Block[] $blocks
|
||||
* @param float $yield 0-100
|
||||
* @param float $yield 0-100
|
||||
* @param Block[] $ignitions
|
||||
*/
|
||||
public function __construct(
|
||||
Entity $entity,
|
||||
protected Position $position,
|
||||
protected array $blocks,
|
||||
protected float $yield
|
||||
protected float $yield,
|
||||
private array $ignitions = []
|
||||
){
|
||||
$this->entity = $entity;
|
||||
if($yield < 0.0 || $yield > 100.0){
|
||||
@ -98,4 +100,23 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
|
||||
}
|
||||
$this->yield = $yield;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the list of blocks that will be replaced by fire.
|
||||
*
|
||||
* @param Block[] $ignitions
|
||||
*/
|
||||
public function setIgnitions(array $ignitions) : void{
|
||||
Utils::validateArrayValueType($ignitions, fn(Block $block) => null);
|
||||
$this->ignitions = $ignitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of affected blocks that will be replaced by fire.
|
||||
*
|
||||
* @return Block[]
|
||||
*/
|
||||
public function getIgnitions() : array{
|
||||
return $this->ignitions;
|
||||
}
|
||||
}
|
||||
|
@ -21,11 +21,33 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block;
|
||||
namespace pocketmine\event\entity;
|
||||
|
||||
use pocketmine\entity\Entity;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Called when an entity on fire gets extinguished.
|
||||
*
|
||||
* @phpstan-extends EntityEvent<Entity>
|
||||
*/
|
||||
class WeightedPressurePlateLight extends WeightedPressurePlate{
|
||||
class EntityExtinguishEvent extends EntityEvent{
|
||||
public const CAUSE_CUSTOM = 0;
|
||||
public const CAUSE_WATER = 1;
|
||||
public const CAUSE_WATER_CAULDRON = 2;
|
||||
public const CAUSE_RESPAWN = 3;
|
||||
public const CAUSE_FIRE_PROOF = 4;
|
||||
public const CAUSE_TICKING = 5;
|
||||
public const CAUSE_RAIN = 6;
|
||||
public const CAUSE_POWDER_SNOW = 7;
|
||||
|
||||
public function __construct(
|
||||
Entity $entity,
|
||||
private int $cause
|
||||
){
|
||||
$this->entity = $entity;
|
||||
}
|
||||
|
||||
public function getCause() : int{
|
||||
return $this->cause;
|
||||
}
|
||||
}
|
84
src/event/entity/EntityFrostWalkerEvent.php
Normal file
84
src/event/entity/EntityFrostWalkerEvent.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?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\event\entity;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\Liquid;
|
||||
use pocketmine\entity\Living;
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\event\CancellableTrait;
|
||||
|
||||
/**
|
||||
* Called when an entity moves horizontally while wearing boots enchanted with Frost Walker.
|
||||
*
|
||||
* @phpstan-extends EntityEvent<Living>
|
||||
*/
|
||||
class EntityFrostWalkerEvent extends EntityEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
public function __construct(
|
||||
Living $entity,
|
||||
private int $radius,
|
||||
private Liquid $liquid,
|
||||
private Block $targetBlock
|
||||
){
|
||||
$this->entity = $entity;
|
||||
}
|
||||
|
||||
public function getRadius() : int{
|
||||
return $this->radius;
|
||||
}
|
||||
|
||||
public function setRadius(int $radius) : void{
|
||||
$this->radius = $radius;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the liquid that gets frozen
|
||||
*/
|
||||
public function getLiquid() : Liquid{
|
||||
return $this->liquid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the liquid that gets frozen
|
||||
*/
|
||||
public function setLiquid(Liquid $liquid) : void{
|
||||
$this->liquid = $liquid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the block that replaces the liquid
|
||||
*/
|
||||
public function getTargetBlock() : Block{
|
||||
return $this->targetBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the block that replaces the liquid
|
||||
*/
|
||||
public function setTargetBlock(Block $targetBlock) : void{
|
||||
$this->targetBlock = $targetBlock;
|
||||
}
|
||||
}
|
@ -26,6 +26,8 @@ namespace pocketmine\event\entity;
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\event\CancellableTrait;
|
||||
use pocketmine\utils\Utils;
|
||||
use pocketmine\world\Explosion;
|
||||
|
||||
/**
|
||||
* Called when an entity decides to explode, before the explosion's impact is calculated.
|
||||
@ -42,11 +44,16 @@ class EntityPreExplodeEvent extends EntityEvent implements Cancellable{
|
||||
|
||||
public function __construct(
|
||||
Entity $entity,
|
||||
protected float $radius
|
||||
protected float $radius,
|
||||
private float $fireChance = 0.0,
|
||||
){
|
||||
if($radius <= 0){
|
||||
throw new \InvalidArgumentException("Explosion radius must be positive");
|
||||
}
|
||||
Utils::checkFloatNotInfOrNaN("fireChance", $fireChance);
|
||||
if($fireChance < 0.0 || $fireChance > 1.0){
|
||||
throw new \InvalidArgumentException("Fire chance must be between 0 and 1.");
|
||||
}
|
||||
$this->entity = $entity;
|
||||
}
|
||||
|
||||
@ -61,6 +68,47 @@ class EntityPreExplodeEvent extends EntityEvent implements Cancellable{
|
||||
$this->radius = $radius;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the explosion will create a fire.
|
||||
*/
|
||||
public function isIncendiary() : bool{
|
||||
return $this->fireChance > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the explosion will create a fire by filling fireChance with default values.
|
||||
*
|
||||
* If $incendiary is true, the fire chance will be filled only if explosion isn't currently creating a fire (if fire chance is 0).
|
||||
*/
|
||||
public function setIncendiary(bool $incendiary) : void{
|
||||
if(!$incendiary){
|
||||
$this->fireChance = 0;
|
||||
}elseif($this->fireChance <= 0){
|
||||
$this->fireChance = Explosion::DEFAULT_FIRE_CHANCE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a chance between 0 and 1 of creating a fire.
|
||||
*/
|
||||
public function getFireChance() : float{
|
||||
return $this->fireChance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a chance between 0 and 1 of creating a fire.
|
||||
* For example, if the chance is 1/3, then that amount of affected blocks will be ignited.
|
||||
*
|
||||
* @param float $fireChance 0 ... 1
|
||||
*/
|
||||
public function setFireChance(float $fireChance) : void{
|
||||
Utils::checkFloatNotInfOrNaN("fireChance", $fireChance);
|
||||
if($fireChance < 0.0 || $fireChance > 1.0){
|
||||
throw new \InvalidArgumentException("Fire chance must be between 0 and 1.");
|
||||
}
|
||||
$this->fireChance = $fireChance;
|
||||
}
|
||||
|
||||
public function isBlockBreaking() : bool{
|
||||
return $this->blockBreaking;
|
||||
}
|
||||
|
56
src/event/player/PlayerRespawnAnchorUseEvent.php
Normal file
56
src/event/player/PlayerRespawnAnchorUseEvent.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?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\event\player;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\event\CancellableTrait;
|
||||
use pocketmine\player\Player;
|
||||
|
||||
class PlayerRespawnAnchorUseEvent extends PlayerEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
public const ACTION_EXPLODE = 0;
|
||||
public const ACTION_SET_SPAWN = 1;
|
||||
|
||||
public function __construct(
|
||||
Player $player,
|
||||
protected Block $block,
|
||||
private int $action = self::ACTION_EXPLODE
|
||||
){
|
||||
$this->player = $player;
|
||||
}
|
||||
|
||||
public function getBlock() : Block{
|
||||
return $this->block;
|
||||
}
|
||||
|
||||
public function getAction() : int{
|
||||
return $this->action;
|
||||
}
|
||||
|
||||
public function setAction(int $action) : void{
|
||||
$this->action = $action;
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@ namespace pocketmine\event\server;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\event\CancellableTrait;
|
||||
use pocketmine\event\Event;
|
||||
|
||||
/**
|
||||
* Called when any CommandSender runs a command, before it is parsed.
|
||||
@ -41,7 +42,7 @@ use pocketmine\event\CancellableTrait;
|
||||
*
|
||||
* The message DOES NOT begin with a slash.
|
||||
*/
|
||||
class CommandEvent extends ServerEvent implements Cancellable{
|
||||
class CommandEvent extends Event implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
public function __construct(
|
||||
|
@ -25,13 +25,14 @@ namespace pocketmine\event\server;
|
||||
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\event\CancellableTrait;
|
||||
use pocketmine\event\Event;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
|
||||
/**
|
||||
* Called before a packet is decoded and handled by the network session.
|
||||
* Cancelling this event will drop the packet without decoding it, minimizing wasted CPU time.
|
||||
*/
|
||||
class DataPacketDecodeEvent extends ServerEvent implements Cancellable{
|
||||
class DataPacketDecodeEvent extends Event implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
public function __construct(
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user