470 Commits

Author SHA1 Message Date
Dylan K. Taylor
1cf3a500f8 Clean up ChestInventory handling
longer term I want to rip this crap out completely, but right now this provides minor maintainability benefits, while also making it slightly less nasty to deal with other containers which animate their blocks, such as barrels and shulker boxes.
2020-11-16 16:59:19 +00:00
Dylan K. Taylor
4ade7b6225 added CoralType enum 2020-11-14 16:24:13 +00:00
Dylan K. Taylor
06efad94b6 Separated metadata handling from PillarRotationTrait 2020-11-14 16:21:50 +00:00
Dylan K. Taylor
8e0cba56b8 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/tile/Tile.php
#	tests/phpstan/configs/check-explicit-mixed-baseline.neon
#	tests/phpstan/configs/l7-baseline.neon
2020-11-12 22:10:47 +00:00
Dylan K. Taylor
518a7827a6 BlockFactory: make slab registration slightly less awful to look at 2020-11-03 19:28:32 +00:00
Dylan K. Taylor
32929925aa Block: added a bunch of state manipulation APIs 2020-11-03 19:13:32 +00:00
Dylan K. Taylor
0a8dc3edd3 Fixed users of ColorInMetadataTrait having uninitialized default colours 2020-11-03 18:42:40 +00:00
Dylan K. Taylor
bcedbc364b BlockDataSerializer: added methods to read/write coral facing 2020-11-03 18:41:12 +00:00
Dylan K. Taylor
5cc2a9c3dd World: rename getChunkAtPosition() to getOrLoadChunkAtPosition()
this more accurately reflects what it does.
2020-11-03 14:12:47 +00:00
Dylan K. Taylor
3e21e47b7a Liquid: make getFlowVector() slightly less cancerous to read 2020-11-01 14:39:59 +00:00
Dylan K. Taylor
241a50387b World: added getHighestAdjacentRealBlockSkyLight()
this is the same as its 'non-real' counterpart, but it accounts for time of day.
2020-10-31 16:44:42 +00:00
Dylan K. Taylor
014317381f Sugarcane: deduplicate growth code
this also fixes sugarcane attempting to grow past the top of the world (closes #3883).
2020-10-27 18:05:41 +00:00
Dylan K. Taylor
4c0c2ebd24 CS cleanup 2020-10-26 15:56:30 +00:00
Dylan K. Taylor
a01c086481 Introduced VanillaEnchantments registry 2020-10-23 20:48:19 +01:00
Dylan K. Taylor
de6d260b76 Fixed cactus and sugarcane trying to grow past the top of the world 2020-10-17 15:05:55 +01:00
Dylan K. Taylor
792f38f474 Carpet and Wool now have dynamic colours 2020-10-15 14:45:28 +01:00
Dylan K. Taylor
0ef0848c44 Concrete and ConcretePowder colour is now dynamic 2020-10-15 14:30:07 +01:00
Dylan K. Taylor
df7bafe2bc TileFactory: fixed missing Beacon tile registration
I had this locally but forgot to commit it ...
2020-10-07 15:16:27 +01:00
Dylan K. Taylor
78bddac823 Player: remove removeFormat, chat formatting is now unconditionally available
This change was made after exploring turning this into a permission. It occurred to me that this feature is entirely superfluous because it's non-vanilla, can be done by plugins, and is usually considered as a bug. In addition, disabling this behaviour required third party code just for this one thing because it was not able to be managed by a permissions plugin.
Instead, it's better to produce a plugin which implements this behaviour if it's desired, by making use of SignChangeEvent and PlayerChatEvent/PlayerCommandPreprocessEvent.

close #3856, close #2288
2020-10-06 14:00:23 +01:00
Dylan K. Taylor
e39d2c4621 Beacon: fixed crash in PC worlds 2020-10-06 13:40:49 +01:00
Dylan K. Taylor
dfee8b7fa5 Added SignLikeRotationTrait 2020-10-04 21:09:45 +01:00
Dylan K. Taylor
fc1084d65c Sponge: fixed wet/dry state not persisting in inventory 2020-10-04 19:42:29 +01:00
Dylan K. Taylor
7f9c4355f0 Revert back to floor/wall banner variants
this code largely duplicates the same code in FloorSign/WallSign and needs to be de-duplicated.
2020-10-04 19:05:43 +01:00
Dylan K. Taylor
7ef794d725 imports cleanup 2020-10-04 18:22:07 +01:00
Dylan K. Taylor
d3a3a41d2b Revert back to separated floor/wall sign
the conditionally useless properties are problematic.
2020-10-04 17:52:23 +01:00
Dylan K. Taylor
e6bf7278fc Sign: remove obsolete clone hook
this is no longer required because SignText is not mutable anymore.
2020-10-04 17:24:40 +01:00
Dylan K. Taylor
388a19ef5d Persistent block metadata may now have mutable parts
Not allowing this makes stuff like anvil damage, colour, wood type, live/dead bit, wet/dry etc all too much hassle to deal with.
Naturally I want to get rid of this shit altogether, but first it's necessary to construct a new system that we can shift into before all this bullshit can be addressed fully, so for now we have to work within the bounds of the old system.
This change will permit dynamic colours for concrete/concrete powder etc, dynamic wood types where the wood type isn't embedded in the legacy ID, and so forth. Allowing full flexibility requires either more old system hacks or completing the migration to a new system which doesn't have these limitations. I prefer to do the latter, but this change will make it somewhat easier to do.
2020-10-04 11:40:05 +01:00
Dylan K. Taylor
5807a385cc Added stub classes for Beacon
this doesn't do anything yet, it's intended solely to prevent further loss of data.
2020-10-02 00:59:53 +01:00
Dylan K. Taylor
84feec954f BlockLegacyMetadata: Added constants for mushroom block variants 2020-10-01 21:41:46 +01:00
Dylan K. Taylor
14c156b162 Added ChemicalHeat block stub 2020-10-01 14:46:14 +01:00
Dylan K. Taylor
12087c9850 Wall: use facing as value as well as key in connections 2020-09-26 17:41:00 +01:00
Dylan K. Taylor
9e3ff21aea Wall: remove unused import 2020-09-26 17:26:54 +01:00
Dylan K. Taylor
ec7c5fd669 Added a BrewingStandSlot enum 2020-09-26 17:20:02 +01:00
Dylan K. Taylor
7b02cc3efd Implemented #3836: Replace setCancelled() in events with cancel() and uncancel()
The motivation for this is to prevent passing a dynamic argument to cancellation, which in almost all cases is a bug in user code. This same mistake also appears in a few places in the PM core (as seen in this commit), but in those cases the mistakes were mostly harmless since they were taking place before the event was actually called.
closes #3836
2020-09-26 14:31:56 +01:00
Dylan K. Taylor
8e12693494 Entity: Invalid blocksAround cache when something happens during onEntityInside()
this fixes TNT spawning multiple entities when lit by flaming arrows.
The problem here is a bit more complex (entities aren't immediately notified when local block updates happen, so they cache stuff that becomes unusable). The simplest option would be to just lose the cache, but that would have some impacts on performance.
Barring a rethink of the block updating mechanism, this solution seems usable for now.
2020-09-25 16:35:59 +01:00
Dylan K. Taylor
c7070788f9 Rename and repurpose Block->diffusesSkyLight to blocksDirectSkyLight
this new form allows skipping some useless checks during sky light calculation and also allows getting rid of the last hard dependency on core Block classes.
We're getting real close to native light now.
2020-09-08 22:40:05 +01:00
Dylan K. Taylor
205617f29e Untether LightUpdate and children from BlockFactory 2020-09-08 18:14:35 +01:00
Dylan K. Taylor
f45316d2d6 Leaves: fixed phpstan type doc error
for some reason this isn't reported unless bleeding edge is enabled.
2020-09-06 16:12:24 +01:00
Dylan K. Taylor
6054104ecb drop a few more useless static variables
phpstan is better able to understand constant literals, since it knows their types will never change.
2020-09-05 18:43:22 +01:00
Dylan K. Taylor
b96565faa4 Drop some obviously useless static function variables
these are better suited as constant literals.
2020-09-05 18:39:47 +01:00
Dylan K. Taylor
0aee39027e Merge branch 'stable' into master
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/entity/Living.php
#	src/pocketmine/Player.php
#	src/pocketmine/VersionInfo.php
#	src/pocketmine/block/Potato.php
#	src/pocketmine/block/Sugarcane.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/Chunk.php
#	src/pocketmine/level/format/io/leveldb/LevelDB.php
#	src/world/generator/GeneratorRegisterTask.php
#	tests/phpstan/configs/check-explicit-mixed-baseline.neon
#	tests/phpstan/configs/l7-baseline.neon
#	tests/phpstan/configs/l8-baseline.neon
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMainLoggerTest.php
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMemoryLeakTest.php
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskPublishProgressRaceTest.php
2020-09-04 01:43:52 +01:00
Dylan K. Taylor
1ed36573a1 BlockLegacyMetadata: added some coral constants 2020-08-21 17:46:44 +01:00
Dylan K. Taylor
ddc5694b70 remove file accidentally committed in 0b05fd198733ac5d4eebf4cfa720c63a9efa070b 2020-08-17 20:25:30 +01:00
Dylan T
bf401421fa
Implemented bamboo (#3762) 2020-08-16 20:39:51 +01:00
Dylan K. Taylor
6920deac2c BlockFactory: regenerated TODO lists 2020-08-15 19:47:38 +01:00
Jack Honour
ff2a3baa8e
Implemented Jukebox & Records (#3742)
Co-authored-by: Dylan K. Taylor <odigiman@gmail.com>
2020-08-07 21:07:58 +01:00
Dylan K. Taylor
2545897fc2 HorizontalFacingTrait: use a cheaper check for horizontal facing 2020-08-06 14:53:51 +01:00
Dylan K. Taylor
2b044195a5 Update for pocketmine/math Axis refactor 2020-08-06 14:38:54 +01:00
Dylan K. Taylor
7399e6944e Consistent fluency for block property setters 2020-08-06 13:46:08 +01:00
Dylan K. Taylor
56ae3d01da block: added HorizontalFacingTrait and AnyFacingTrait
these are primarily intended for deduplication of code and ability to cross-reference. Don't expect this API to remain the same.
2020-08-05 21:17:37 +01:00