Dylan K. Taylor
bf44edd179
Constify a bunch of NBT keys, pass 1
2022-12-18 22:12:15 +00:00
Javier León
c5d716dc9d
Added keep on death methods for items ( #5395 )
2022-12-15 20:10:20 +00:00
Dylan K. Taylor
95d0a3bf41
Merge branch 'stable' into next-minor
2022-12-15 19:38:22 +00:00
Dylan K. Taylor
cf707e15c2
fix
2022-12-15 19:36:16 +00:00
! Bryan
1308cda5c2
Implemented hook method Item::onInteractEntity() ( #5432 )
...
this is called when the player right-clicks on an entity to do some action, such as shearing, naming etc.
2022-12-15 19:30:52 +00:00
Dylan K. Taylor
99996b62d6
Align PhpDoc @param tags according to PHP-CS-Fixer
2022-12-06 13:21:20 +00:00
Dylan K. Taylor
0ad2985247
Update documentation for Item::__construct()
2022-07-06 23:54:29 +01:00
Dylan K. Taylor
38d6284671
Use PHP-CS-Fixer to enforce file header presence
2022-06-04 17:34:49 +01:00
Dylan K. Taylor
3fcf6372e0
Merge branch 'stable' into next-minor
2022-06-01 15:32:37 +01:00
Dylan K. Taylor
227f28a6d2
Use VanillaItems::AIR() instead of ItemFactory
2022-05-24 15:47:27 +01:00
Dylan K. Taylor
95ad3f16e1
Modernize private property declarations in src/item
2022-05-17 20:59:24 +01:00
Dylan K. Taylor
5a98b08ee8
Fixed several crashes on bad data due to inadequate TAG_List type checks
2022-04-19 16:48:18 +01:00
Muqsit Rayyan
55dfacea8d
Item: Improve performance of nbtSerialize() ( #4831 )
...
Replace hasNamedTag() with $nbt->count() > 0
This avoids a duplicate indirect call to Item::serializeCompoundTag() method call when serializing items with namedtags.
2022-02-16 00:32:12 +00:00
Dylan K. Taylor
22fb02c4e6
Replace disallowed operators in src/item/
2022-01-20 19:16:50 +00:00
Dylan K. Taylor
ed4978c31b
Added VanillaItems::AIR()
...
we don't usually add VanillaItems entries for blocks since they already exist in VanillaBlocks, but air has a special use case specifically as an itemstack, so we make an exception for this case.
2021-12-07 00:41:07 +00:00
Dylan K. Taylor
5c7125f190
Improved error handling for loading broken entity / tile data
2021-11-23 17:41:26 +00:00
Dylan K. Taylor
dbeaf27cb7
Document that Item::setNamedTag() may cause NbtException to be thrown
...
if the NBT is bogus for some reason
in PM3, these kinds of bugs wouldn't show up until/unless the item NBT was actually used, but on PM4, we decode it ahead of time, so the errors always show up immediately.
2021-10-05 19:09:22 +01:00
Dylan K. Taylor
654fc9a2a6
LegacyStringToItemParser: Throw more specific exceptions
2021-07-10 21:03:12 +01:00
Dylan K. Taylor
76a74b3931
Revert "Item: skip a step when decoding PC itemstacks"
...
This reverts commit 9b52af62b6f469771f2355a964b35ecffa5117d9.
We shouldn't assume that a string maps directly to a legacy ID,
because we might want string aliases (e.g. dark_oak_boat) which refer to
items that have a specific meta value in the MCPE system.
Overall, I want to get rid of the reliance on IDs here and register all
this stuff using closure callbacks on VanillaItems, so getting rid of
this assumption also serves that goal.
2021-06-30 13:13:53 +01:00
Dylan K. Taylor
7ba573db77
Added API method Item::canStackWith()
2021-06-29 19:52:52 +01:00
Dylan K. Taylor
c61f66d973
Removed ext-ds dependency
2021-02-11 15:40:37 +00:00
Dylan K. Taylor
9228f006d4
Merge remote-tracking branch 'origin/stable'
...
# Conflicts:
# composer.json
# composer.lock
# resources/vanilla
# src/CrashDump.php
# src/PocketMine.php
# src/pocketmine/Server.php
# src/pocketmine/item/Bucket.php
# src/pocketmine/item/Item.php
# src/pocketmine/level/format/Chunk.php
# src/pocketmine/level/format/io/leveldb/LevelDB.php
# src/pocketmine/level/format/io/region/McRegion.php
# src/pocketmine/network/mcpe/protocol/BatchPacket.php
# src/pocketmine/tile/Furnace.php
# src/pocketmine/utils/UUID.php
# src/utils/ServerKiller.php
2020-12-20 20:54:13 +00:00
Dylan K. Taylor
6cf875ca3a
Item: rename onActivate() to onInteractBlock()
2020-11-09 19:33:13 +00:00
David
b059e0b475
Item: fixed wrong tag being removed during serialization of custom name ( #3894 )
2020-11-07 01:25:37 +00:00
Dylan K. Taylor
47976bac34
Moved enchantment ID handling to pocketmine/data/bedrock package
...
this permits plugins to register their own enchantments mapped to MCPE IDs again.
2020-10-24 17:59:46 +01:00
Dylan K. Taylor
a01c086481
Introduced VanillaEnchantments registry
2020-10-23 20:48:19 +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
9b52af62b6
Item: skip a step when decoding PC itemstacks
2020-07-10 21:32:39 +01:00
Dylan K. Taylor
279abb871d
Remove all usages of CompoundTag->hasTag()
...
in pretty much every case, these usages really wanted to read the tag's contents anyway, which can be combined with a getTag() and instanceof call for more concise and static analysis friendly code.
In the few cases where the tag contents wasn't needed, it still wanted to check the type, which, again, can be done in a more static analysis friendly way by just using getTag() and instanceof.
2020-07-10 21:01:43 +01:00
Dylan K. Taylor
4fc134bd04
Separate item ID/meta to ItemIdentifier structure
2020-06-29 12:16:34 +01:00
Dylan K. Taylor
c040248dbd
Item: use static-analysis-friendly method for retrieving custom block data
...
fixes 2 phpstan level 8 errors
2020-06-27 13:46:04 +01:00
Dylan K. Taylor
0000783926
Item: make nbt field non-nullable
2020-06-27 13:34:08 +01:00
Dylan K. Taylor
11ef9fb0c0
Item-from-string parsing no longer depends on ItemIds
...
after this is done I'm banning the constant() function.
2020-05-13 00:18:49 +01:00
Dylan K. Taylor
5a94af40e2
Convert ItemFactory to singleton
2020-04-24 00:18:31 +01:00
Dylan K. Taylor
995309424e
updated pocketmine/nbt dependency
...
this is going to need work on exception handling, but right now it's so inconsistent that it doesn't matter anyway.
2020-03-04 17:53:37 +00:00
Dylan K. Taylor
78394a336c
Merge branch 'stable'
2020-02-25 20:45:39 +00:00
Dylan K. Taylor
8a770d837e
Merge branch 'stable'
2020-02-24 20:32:43 +00:00
Dylan K. Taylor
aac7da6c96
eliminate remaining empty() usages
2020-02-07 21:51:50 +00:00
Dylan K. Taylor
cb16f5c142
Merge commit '260ac47588c76a2e6814cfba46773a990fb8c5da'
...
# Conflicts:
# resources/vanilla
# src/Server.php
# src/lang/Language.php
# src/network/mcpe/protocol/AddItemActorPacket.php
# src/network/mcpe/protocol/AddPlayerPacket.php
# src/network/mcpe/protocol/SetActorDataPacket.php
# src/network/mcpe/serializer/NetworkBinaryStream.php
# src/permission/Permission.php
# src/pocketmine/block/Leaves.php
# src/pocketmine/entity/DataPropertyManager.php
# src/pocketmine/entity/Entity.php
# src/pocketmine/item/Banner.php
# src/pocketmine/item/Item.php
# src/pocketmine/level/format/io/LevelProvider.php
# src/pocketmine/level/format/io/LevelProviderManager.php
# src/pocketmine/network/mcpe/protocol/AddActorPacket.php
# src/pocketmine/network/mcpe/protocol/LoginPacket.php
# src/pocketmine/tile/Banner.php
# src/scheduler/BulkCurlTask.php
# src/updater/AutoUpdater.php
# src/utils/Config.php
# src/utils/Utils.php
# src/world/generator/Flat.php
# src/world/generator/Generator.php
2020-01-31 21:07:34 +00:00
Dylan K. Taylor
96ac95798b
Merge commit '4ff4434a220813e446efde4a38e48a0416476dba'
...
# Conflicts:
# resources/vanilla
# src/pocketmine/item/Banner.php
# src/pocketmine/item/Item.php
2020-01-31 20:11:29 +00:00
Dylan K. Taylor
67bcc1c0fb
phpdoc armageddon for master, pass 1
2020-01-22 11:55:03 +00:00
Dylan K. Taylor
b4e6608e9f
Merge branch 'stable'
2020-01-18 20:13:54 +00:00
Dylan K. Taylor
0e1cea043a
added some phpstan-specific generic type annotations
2020-01-13 15:05:02 +00:00
Dylan K. Taylor
0a4a1f634f
Item: fixed possible type violation in jsonDeserialize()
2019-12-12 20:26:26 +00:00
Dylan K. Taylor
66aa940ed1
Item: fixed foreach doc comment in deserializeCompoundTag()
...
detected by PHPStan 0.12.0
2019-12-04 11:28:59 +00:00
Dylan K. Taylor
135a2f520c
add some UTF-8 validation
2019-08-01 19:51:31 +01:00
Dylan K. Taylor
28c9a2c0cd
fixed Protection enchantments being dropped from items, closes #3066
2019-08-01 16:02:05 +01:00
Dylan K. Taylor
5499ac620c
Removed pocketmine subdirectory, map PSR-4 style
2019-07-30 19:14:57 +01:00