17935 Commits

Author SHA1 Message Date
Dylan K. Taylor
9fcc9f4338
StringToItemParser: added missing blocks
closes #6108
2023-10-23 12:24:02 +01:00
Dylan K. Taylor
41c5f63565
World: remove dead code 2023-10-23 12:17:41 +01:00
Dylan K. Taylor
73b1fba53c
Fixed Promise<null> calling rejection handler given after being successfully resolved
closes #6110

this is a weird use case, but it should work nonetheless.
2023-10-23 11:46:08 +01:00
Dylan K. Taylor
8e17aed4f4
Fix build 2023-10-20 17:43:04 +01:00
Dylan K. Taylor
1f461977d4
Block: Avoid useless Vector3 allocations in getHorizontalSides and getAllSides 2023-10-20 17:28:19 +01:00
Dylan K. Taylor
e4888d7102
ÂCONTRIBUTING.md: restructure, reword and reorganize
[ci skip]
2023-10-20 12:12:14 +01:00
Dylan K. Taylor
450ad42202
Added some new recommendations to CONTRIBUTING.md 2023-10-20 11:37:58 +01:00
Dylan K. Taylor
eb935ca80f
ÂLeaves: use a constant for max distance from wood 2023-10-20 11:20:30 +01:00
Dylan K. Taylor
1c5d3b43be
5.6.2 is next 2023-10-20 10:30:50 +01:00
Dylan K. Taylor
decc188302
Release 5.6.1 5.6.1 2023-10-20 10:30:50 +01:00
Dylan K. Taylor
8fa5c7cdab
World: do not apply fake state properties from tile if the block doesn't expect this tile type
This was causing a variety of crashes due to incorrect tiles, presumably from PM3 worlds.
2023-10-20 10:28:46 +01:00
Dylan K. Taylor
7dd3a70d2e
Revert "World: discard tiles on load if they aren't the correct type or no tile is expected"
This reverts commit 8f804f6f342e650156767372bac2d42b55297361.

This change is too disruptive, since popular plugins like
ExtendedBlocks and ExtendedBlocksConverter relied on custom tiles.
Deleting them at this stage would prevent these plugins from working,
making it impossible to upgrade old data.

An alternative solution to this problem will need to be developed.
2023-10-20 10:16:49 +01:00
Dylan K. Taylor
dbb5a32a96
Liquid: eliminate unnecessary Position allocations and getSide() calls 2023-10-19 17:09:13 +01:00
Dylan K. Taylor
9474324f75
Liquid: simplify code 2023-10-19 17:02:40 +01:00
Dylan K. Taylor
ada37899aa
Liquid: improve code legibility and fix a bunch of PHPStan errors 2023-10-19 17:02:22 +01:00
Dylan K. Taylor
f1440324a7
Update PHPStan baselines 2023-10-19 16:56:15 +01:00
Dylan K. Taylor
73659318f6
World: Avoid unnecessary Vector3 usages in neighbour block update scheduling
The old code was allocating 6 Vector3s which were all immediately discarded. In addition, we didn't need to take the performance hit of reading Vector3 properties when we could have just passed integers directly.
The real performance difference of this is likely to be close to zero, but it's still worth doing.
2023-10-19 16:46:52 +01:00
Dylan K. Taylor
f868c1d8c6
Liquid: Update legacy code with Facing::OFFSET 2023-10-19 16:38:34 +01:00
Dylan K. Taylor
114f444ec3
Update PHPStan baseline 2023-10-19 13:28:40 +01:00
Dylan K. Taylor
19a1792184
Fixed behavioural change on invalid Facing introduced by previous commit
while this shouldn't be given invalid facings anyway, Vector3::getSide() accepts them and just returns itself.
2023-10-19 13:27:44 +01:00
Dylan K. Taylor
6a3ec70c72
ÂBlock: use Facing::OFFSET in getSide()
instead of the comically inefficient getBlock() + throwaway Position->getSide()
This improved the function's performance by 2.3x.
2023-10-19 13:25:32 +01:00
Dylan K. Taylor
ccd2cdd324
World: improve performance of calculating non-cached AABBs for a cell
Avoiding getSide() improved the performance by 2x ...
2023-10-19 13:13:46 +01:00
Dylan K. Taylor
c7a358a56f
World: extract getBlockCollisionBoxes() from getCollisionBoxes()
closes #6104

This function has been a footgun for anyone using it, since it also returns entity AABBs by default.
In all core use cases, this functionality was disabled, and we were paying a needless (admittedly micro) performance penalty for passing the extra useless argument and useless condition check.
2023-10-19 12:52:24 +01:00
dependabot[bot]
b3390458b4
Bump phpstan/phpstan from 1.10.38 to 1.10.39 (#6103)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.38 to 1.10.39.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.10.38...1.10.39)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-19 11:58:27 +01:00
Javier León
b4d55e4384
Fixed dirt and grass block interactions when clicking on sides other than the top (#6071) 2023-10-18 10:40:01 +01:00
Dylan K. Taylor
932116fa52
Server: re-added @see reference that somehow got deleted
this is useful when clicking through references in the call stack.
2023-10-18 10:23:02 +01:00
Hugo_
7b5c30bc2c
WoodenDoor can be a fuel (#6101) 2023-10-17 22:10:08 +01:00
Hugo_
c14eb63f9b
Wooden Button can be a fuel (#6099) 2023-10-17 16:30:35 +01:00
Dylan T
48dcf0e32c
Farmland: Remember relative location of nearby water in blockstate data (#6090)
Farmland can end up scanning up to 162 blocks looking for water in the worst case. This is obviously not great for huge farms where there are thousands of blocks of the stuff.

In most farms, the water won't be moved, and nor will the farmland. This means that we can avoid this costly search on random updates.

This PR implements a cache using blockstate data (only possible in PM5) which stores an index mapping to a coordinate offset where water was previously found by this farmland block. This allows the farmland to avoid water searching entirely in most cases.

This is a colossal improvement as compared to scanning the whole 9x2x9 area every time, which, on average, scans about 40 blocks to find water if the water is at the same Y coordinate. In real terms this translates into about a 8x performance improvement for farmland (see timings below).
2023-10-17 16:25:13 +01:00
Dylan K. Taylor
7f3de835e4
Block: private internal function 2023-10-17 15:23:39 +01:00
Dylan K. Taylor
63fcf9879a
Block: Use xxhash'd XOR mask to improve state data lower bits distribution
xxhash is generally well known for its hash key properties, so this is a suitable use case.
We XOR the state data with a partial hash of xxh3(typeID), which provides sufficient hash distribution regardless of the size of state data.
The previous method started to break down as the number of bits exceeded the number of significant bits of type ID (about 10 currently).

As well as being better for hash distribution regardless of state data size, this also reduces the load factor of RuntimeBlockRegistry to 1.08 (previously around 1.24), which is a nice bonus.
2023-10-17 15:21:22 +01:00
Hugo_
224a69b11a
Sign can be a fuel (#6095) 2023-10-17 12:22:20 +01:00
Dylan K. Taylor
d0d16cdeb7
RuntimeDataDescriber: Introduce boundedIntAuto, replacing boundedInt
closes #6096
boundedIntAuto automatically calculates the correct number of bits to use based on the given bounds. The bounds must be constant, of course.
2023-10-17 12:03:43 +01:00
Dylan K. Taylor
18b711aca8
Apparently this function is no longer needed 2023-10-17 11:34:02 +01:00
Dylan K. Taylor
b0936a50c1
Block: split generateStatePermutations into type and state parts
this makes it marginally faster, since we can skip all permutations containing invalid type data.
I measured a performance improvement of about 20% across all blocks.
In addition, this makes it easier to locate where a problem is coming from if invalid inputs are accepted.
2023-10-17 11:28:58 +01:00
ace
82d6fc3890
Fix loading of Chiseled Bookshelf tile from vanilla world (#6084)
Co-authored-by: Dylan T <dktapps@pmmp.io>
2023-10-17 11:10:36 +01:00
Dylan K. Taylor
3c614b505d
Merge branch 'stable' into minor-next 2023-10-16 21:28:59 +01:00
Dylan K. Taylor
15ba642258
Merge branch 'legacy/pm4' into stable 2023-10-16 21:28:48 +01:00
Dylan K. Taylor
edea793a98
Downgrade PHPUnit to 10.3 until sebastianbergmann/phpunit#5539 is fixed 2023-10-16 21:25:53 +01:00
Dylan K. Taylor
1da7e3586b
Updated composer dependencies 2023-10-16 20:45:44 +01:00
Dylan K. Taylor
538b698a00
Revert "World: specialize nearby entity updating for block updates"
This reverts commit 128eb500ebee5163583b84640a9c4f28c0218d42.

This breaks when entities in neighbouring chunks overlap into the
current chunk without actually being tracked by it.
Perhaps it might be worth having entities tracked by all chunks their
AABB touches in the future, so that we don't have to check padding
chunks and waste CPU time.
2023-10-14 19:43:46 +01:00
Dylan K. Taylor
128eb500eb
World: specialize nearby entity updating for block updates
this slashes the cost of checking this with no entities by 50%, which should be the common case for farms and such.
once factoring in other things, this translates into a real-world performance gain of about 15% for block updates.
2023-10-13 17:35:47 +01:00
Dylan K. Taylor
7d200247f8
Cactus: do not update if only age changed
I'd prefer a smarter solution for this that automatically disables updates depending on which type of property was changed, but for now, this will significantly improve the performance of cactus farms.
The newly placed cactus block at the top cannot have updates disabled, though, since it needs to check its surroundings in case it grew into a space with a solid block next to it.

Thanks @KingOfTurkey38 for bringing this to light.
2023-10-13 12:45:11 +01:00
ace
8b52a5cd9e
Fix book placed in wrong slot in Chiseled Bookshelf (#6085) 2023-10-10 12:35:50 +01:00
ace
c9163a1505
ChiseledBookshelf: Fix duplication bug (#6086)
Also fixes being able to put more than 1 book in the slot
2023-10-10 10:59:39 +01:00
Dylan K. Taylor
2d697c5f04
A random change that Composer 2.6 wanted to make 2023-10-09 18:27:20 +01:00
Dylan K. Taylor
364f408eb1
Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2023-10-09 18:22:54 +01:00
Dylan K. Taylor
660e2b8173
Update build/php to pmmp/php-build-scripts@a34e48e7da 2023-10-09 18:22:28 +01:00
dependabot[bot]
9facb98327
Bump phpunit/phpunit from 10.3.5 to 10.4.1 (#6082)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 10.3.5 to 10.4.1.
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/10.4.1/ChangeLog-10.4.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/10.3.5...10.4.1)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-09 17:16:15 +01:00
dependabot[bot]
7e42a03db3
Bump phpstan/phpstan from 1.10.37 to 1.10.38 (#6081)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.37 to 1.10.38.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.10.37...1.10.38)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-09 17:15:50 +01:00