Commit Graph

362 Commits

Author SHA1 Message Date
Dylan K. Taylor
bdb0ed0701 Consistently use 'mob head' terminology in the API
previously, we were sometimes using 'mob head' and other times 'skull', sometimes even within the same file.
2023-05-26 15:08:00 +01:00
Dylan K. Taylor
59ca7b75e1 Fixed PHPStan error 2023-05-17 15:32:38 +01:00
Dylan K. Taylor
c9bb4335a1 Item: added getStateId(), removed state data from public API
state data was only used for indexing stuff along with state ID anyway, so it makes more sense to lock it away in here instead.
2023-05-16 14:14:18 +01:00
Dylan K. Taylor
015c668885 Change confusing 'type data' and 'state data' terminology for blocks and items
For blocks, we now use 'block-item state' and 'block-only state', which should be much clearer for people implementing custom stuff.
'block-item state', as the name suggests, sticks to the item when the block is acquired as an item.
'block-only state' applies only to the block and is discarded when the block is acquired as an item.

'type data' for items was also renamed, since 'type' is too ambiguous to be anything but super confusing.
2023-05-16 14:07:29 +01:00
ipad54
fa719f37d5 Implement Cave Vines & Glow Berries (#5424) 2023-05-08 19:24:23 +01:00
Dylan K. Taylor
299ff5d912 Register mangrove boat item 2023-05-04 16:39:23 +01:00
Dylan K. Taylor
896dd2ec9d Boat: use BoatType enum instead of TreeType
TreeType really belongs in the generator package. Not all types of tree may have their own boat type (e.g. azalea).
We can't use WoodType for this either, because some types of wood also don't have associated boat types (crimson, warped).
2023-05-04 16:35:31 +01:00
Dylan K. Taylor
c878bd8289 Merge remote-tracking branch 'origin/minor-next' into major-next 2023-04-20 00:18:19 +01:00
Dylan K. Taylor
674b65f789 Item: optimise serializeCompoundTag() a little 2023-04-18 16:18:34 +01:00
Dylan K. Taylor
027d8f7377 always the CS... 2023-04-13 12:55:18 +01:00
Dylan K. Taylor
874fdf5adb ItemBlock: reference blocks directly (take 2)
This was first attempted in f64dc01bd1, but reverted, since I hadn't considered how to handle stripping state data from blocks.

This removes the abusable API RuntimeBlockStateRegistry::fromTypeId() and related methods. These were only used to allow ItemBlocks to magically start referencing other blocks if the blocks were overridden by a plugin, but this was never a well-supported use-case anyway.

Instead of relying on RuntimeBlockStateRegistry, we remember the state that the block had during its constructor, and use that to normalize the non-item properties for asItem().

closes #5609
2023-04-13 12:44:54 +01:00
Dylan K. Taylor
dbcd2b1e65 ItemTypeIds::toBlockTypeId() now returns null for non-blockitem IDs
closes #5648
2023-04-05 21:04:00 +01:00
Dylan K. Taylor
341a9b78b5 LegacyStringToItemParser: update documentation 2023-03-24 13:48:33 +00:00
Dylan K. Taylor
fff8f0f815 Use Item->canStackWith() instead of Item->equals() wherever possible 2023-03-07 17:08:35 +00:00
Dylan K. Taylor
7c974a12e1 Revert "ItemBlock: drop the charade about overriding built-in block types"
This reverts commit f64dc01bd1.

I forgot that the ItemBlock constructor implicitly strips off any states
of the origin block, which is something that we unfortunately can't do
any other way right now, since the blocks don't remember their default
states.
2023-03-02 15:51:55 +00:00
Dylan K. Taylor
f64dc01bd1 ItemBlock: drop the charade about overriding built-in block types
this allows cleaning up a whole lot of abusable mess from the API, and we never properly supported overriding built-in block types anyway.
2023-03-02 15:50:18 +00:00
Dylan K. Taylor
33140482bb ItemTypeIds: added fromBlockTypeId() and toBlockTypeId()
this allows checking the type of a blockitem without being required to create a block to do it.
2023-03-02 15:28:50 +00:00
Dylan K. Taylor
77fe0a69ba ItemIdentifier: remove dead TODO comment 2023-03-02 15:10:46 +00:00
Dylan K. Taylor
c2f6d8139a Added interface RuntimeDataDescriber 2023-02-16 16:23:32 +00:00
ipad54
75f74454c6 Implemented reinforced deepslate (#5553) 2023-02-15 15:15:04 +00:00
Dylan K. Taylor
0a3ecfdae9 Clean up terminology around block state IDs and their handling 2023-01-25 19:01:15 +00:00
Dylan K. Taylor
2f469ef4a0 Added mangrove, azalea and flowering azalea leaves 2023-01-25 18:50:14 +00:00
Dylan K. Taylor
ca1f1bf09f Fixed glowing item frames
due to technical limitations, this requires separating them back into two different block types. However, this isn't too egregious since it's just one flag, and actually simplifies some code.

closes #5478
2023-01-12 21:52:52 +00:00
ipad54
85231215e7 Implemented Sculk (#5489) 2023-01-04 20:10:46 +00:00
Dylan K. Taylor
c89df7eb1c Merge remote-tracking branch 'origin/next-minor' into next-major 2022-12-25 18:22:13 +00:00
Dylan K. Taylor
0d169b4e80 Filesystem: added fileGetContents to reduce ErrorToExceptionHandler boilerplate code 2022-12-25 17:13:51 +00:00
zSALLAZAR
b4c7d33388 Implement Medicine (from Education Edition) (#5450) 2022-12-24 17:38:12 +00:00
ipad54
b3473960b4 Implemented chain (#5454) 2022-12-22 15:22:04 +00:00
Dylan K. Taylor
4f86ea9933 Merge branch 'next-major' of github.com:pmmp/PocketMine-MP into next-major 2022-12-18 22:25:44 +00:00
Dylan K. Taylor
6e2685cbbb Merge branch 'next-minor' into next-major 2022-12-18 22:25:32 +00:00
Dylan K. Taylor
bf44edd179 Constify a bunch of NBT keys, pass 1 2022-12-18 22:12:15 +00:00
IvanCraft623
44e288554a Implement new records (#5433) 2022-12-18 21:15:27 +00:00
Dylan K. Taylor
ffa88aff67 Merge branch 'next-minor' into next-major 2022-12-18 21:05:26 +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
4d79aced07 Merge branch 'next-minor' into next-major 2022-12-15 19:50:27 +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
8e600b4a78 ItemBlock: fixed unnecessary double singleton usage 2022-12-06 12:48:28 +00:00
Dylan K. Taylor
142ccc7e87 Merge branch 'next-minor' into next-major 2022-12-05 14:14:39 +00:00
Javier León
3984d220bb Implemented the swift sneak enchantment (#5404)
Co-authored-by: Dylan T <dktapps@pmmp.io>

closes #5301
2022-12-01 20:38:41 +00:00
Dylan K. Taylor
28d8526d8d Merge branch 'next-minor' into next-major 2022-11-30 20:05:30 +00:00
SlimyBoy2
95263795a8 Durable: fix misbehaviour of isBroken() since fe982c697b (#5436)
this broke tool and armour break sounds.
2022-11-27 00:13:41 +00:00
Dylan K. Taylor
b0c6e8d8e0 StringToItemParser: added lookupAliases() and lookupBlockAliases()
this permits reverse-lookuping all registered aliases that map to the given item (including properties).
this may be useful for plugins to use for generating configs, instead of using IDs or some godawful hack using getName().
2022-11-26 19:32:39 +00:00
ipad54
858d3dce8e Implement Weeping & Twisting vines (#5396) 2022-11-15 15:29:42 +00:00
Dylan K. Taylor
d9638cef96 Merge branch 'next-minor' into next-major 2022-11-02 16:04:16 +00:00
Dylan K. Taylor
1671405cd0 Merge branch 'stable' into next-minor 2022-11-02 16:03:30 +00:00
Dylan K. Taylor
fe982c697b Durable: reset durability when overstacked items are broken
this is not really defined behaviour, but it makes more sense than the current behaviour, which makes the tool unbreakable unintentionally.

fixes #5378
2022-11-02 15:42:44 +00:00
Dylan K. Taylor
7bcc663b60 Migrate core code to using symfony/filesystem
webmozart/path-util is retained for plugin compatibility, but is dropped in 5.0
2022-10-14 21:51:29 +01:00