517 Commits

Author SHA1 Message Date
Dylan K. Taylor
b329cac3d2 Move pocketmine\tile\* to pocketmine\block\tile\* 2019-05-25 19:23:43 +01:00
Dylan K. Taylor
642c16dfe7 added some //region ... //endregion 2019-05-16 14:35:34 +01:00
Dylan K. Taylor
ff2600a0d0 Regenerated TODOs for BlockFactory and ItemFactory
also added //region and //endregion for IDE collapsibility
2019-05-16 14:20:51 +01:00
Dylan K. Taylor
c99846e069 Unify Item constructor style
this exposed a few more dead classes.
2019-05-11 18:24:21 +01:00
Dylan K. Taylor
51f96b195e ItemFactory: fix wrong typehint 2019-05-11 18:02:18 +01:00
Dylan K. Taylor
9e72bc91a2 Separate block break-info to a separate dynamic unit 2019-05-10 16:24:59 +01:00
Dylan T
3cd6e12e71
Renaming "Level" -> "World" (#2907)
This has been a pain point for a long time due to the misleading nature of the name "level". It's also confusing when trying to do things like getting the XP level of the player or such, and also does not translate well to other languages.

This transition was already executed on the UI some time ago (language strings) and now it's time for the same change to occur on the API.

This will burn a lot of plugins, but they'll acclimatize. Despite the scary size of this PR, there isn't actually so many changes to make. Most of this came from renaming `Position->getLevel()` to `Position->getWorld()`, or cosmetic changes like changing variable names or doc comments.
2019-05-07 14:47:28 +01:00
Dylan K. Taylor
f8ce7797db Player: add hasFiniteResources() 2019-03-31 16:40:54 +01:00
Dylan K. Taylor
260fa50db4 Register Edu compound items 2019-03-28 14:23:42 +00:00
Dylan K. Taylor
0aebb3f4fb Clean up LevelSoundEvent handling 2019-03-26 19:53:40 +00:00
Dylan K. Taylor
2a3e6dcf00 Rename BlockIds -> BlockLegacyIds 2019-03-23 19:46:31 +00:00
Dylan K. Taylor
79ef8e0803 Replace all legacy blockID references with BlockIds:: 2019-03-23 19:44:33 +00:00
Dylan K. Taylor
06a37cc462 Fixed "wood" collision
why the fuck Mojang...
2019-03-23 19:08:17 +00:00
Dylan K. Taylor
a2f42a7016 Updated block/item ID constants from 1.10 2019-03-23 18:54:45 +00:00
Dylan K. Taylor
905cb7544a hack in different wood sign types 2019-03-23 15:44:28 +00:00
Dylan K. Taylor
53bb05a6a7 Fixed different woodtype boats being missing 2019-03-23 14:51:58 +00:00
Dylan K. Taylor
034bd716c8 Clean up WritableBook hierarchy 2019-03-23 14:36:03 +00:00
Dylan K. Taylor
a74a4b579d wtf @sandertv 2019-03-23 12:56:02 +00:00
Dylan K. Taylor
d4fe004375 More consistent fluency in Item API 2019-03-23 12:20:35 +00:00
Dylan K. Taylor
8c536c248d Updating for latest PocketMine-NBT changes 2019-03-21 15:58:22 +00:00
Dylan K. Taylor
2e5ef4ba03 Merge remote-tracking branch 'origin/3.7' 2019-03-20 21:35:13 +00:00
Dylan K. Taylor
cce99b07af 1.10.0 updates 2019-03-20 19:17:41 +00:00
Dylan K. Taylor
8de9e61651 Item: Remove get/set/removeNamedTagEntry() 2019-03-17 17:49:09 +00:00
Dylan K. Taylor
6f54b53f7a thanks for being useless PhpStorm
these problems didn't show up in any inspections until I opened the fucking files...
2019-03-17 15:53:59 +00:00
Dylan K. Taylor
ad19696364 Make Effect and Enchantment functions less verbose 2019-03-13 15:26:21 +00:00
Dylan K. Taylor
01904adf49 Improve enum implementations, move some components to traits
The reason this uses a trait is because `self` refers to the including class in a trait, which offers a small amount of automatic type safety.
If we had templates or generics, this would be a generic class instead.
2019-03-13 15:10:31 +00:00
Dylan K. Taylor
0e1a88f7e5 Armor: Implement right-click to equip, closes #2641 2019-03-12 19:01:36 +00:00
Dylan K. Taylor
8b9eeb0b7f Clean up Armor classes 2019-03-12 18:53:51 +00:00
Dylan K. Taylor
fc9a61859a Item: remove misleading methods & premature optimization 2019-03-03 12:36:46 +00:00
Dylan K. Taylor
abbdd7efdd Item: make __toString() use base64 for displaying NBT 2019-03-03 12:33:28 +00:00
Dylan K. Taylor
6c8fa8ae28 More nullable and void typehints 2019-03-02 10:29:11 +00:00
Dylan K. Taylor
d961b272c7 Remove Tool <-> Block circular dependency in efficiency calculation 2019-03-01 18:18:56 +00:00
Dylan K. Taylor
e9125af51d Revamp Banner API (still rather ghetto)
this needs more work, like signs do.
2019-03-01 17:57:07 +00:00
Dylan K. Taylor
9ad0ea85c7 Rename two misleadingly-named functions 2019-02-27 12:59:12 +00:00
Dylan K. Taylor
cb91afcc00 Added SkullType enum, some cleanup to skull handling
this is still more ugly than I'd like it to be because of the way the blockfactory currently works.
2019-02-26 18:27:30 +00:00
Dylan K. Taylor
97687f2236 Dye, banner and bed items now store DyeColor objects instead of using magic meta values 2019-02-24 10:48:40 +00:00
Dylan K. Taylor
c26544475e More PHP 7.1 nullables 2019-02-22 12:55:34 +00:00
Dylan K. Taylor
461233db09 ItemFactory: Sort items lexicographically ascending 2019-02-22 11:52:22 +00:00
Dylan K. Taylor
3037f45a0c Implement new dye types, split bonemeal and cocoa beans into their own classes 2019-02-22 11:43:48 +00:00
Dylan K. Taylor
7170d9009d Enchantment: more static getters, firehose magic numbers
This is similar in nature to 646fea5a4ecbbdf3f0cbfc590d874dedc1a7bfc0.

On a side note: Migrating this way is a pain in the ass due to lack of types. What the heck is int supposed to mean?!?!?!?! At least if we wanted to go _back_ to magic numbers, it would be easy to locate everything with an Enchantment typehint...
2019-02-20 13:45:50 +00:00
Dylan K. Taylor
646fea5a4e Effect: Introduce a bunch of static getters, change a bunch of API to use objects
This introduces static getters for every currently-known effect type. At some point in the near future, the magic number constants (which are really network IDs, by the way) will disappear.

Migrating:
- If you used constants (like any sensible person would): for the most part it's just a case of adding a () anywhere you used an Effect constant.
- If you hardcoded magic numbers: ... well, have fun fixing your code, and I reserve the right to say "I told you so" :)

This achieves multiple goals:
1) creating an EffectInstance for application is much less verbose (see diff for examples, especially the Potion class)
2) plugin devs cannot use magic numbers to apply effects anymore and are forced to use type-safe objects. :)

This is a warning shot for plugin devs who use magic numbers. More changes like this are coming in the not-too-distant future.
2019-02-20 12:05:17 +00:00
Dylan K. Taylor
2c8a065b94 Standardise SNAKE_CASE for surrogate enums 2019-02-20 11:14:07 +00:00
Dylan K. Taylor
36e9db4c07 Generate methods for surrogate enums, nip stupidity in the bud
this also allows changing the internal implementation later without breaking plugins.
2019-02-20 11:09:22 +00:00
Dylan K. Taylor
88c4b836f0 Make factory register methods less verbose 2019-02-20 10:24:44 +00:00
Dylan K. Taylor
84cf7c11e6 Fixed some overlooked returns from dce08b4e88bea4065149d6843d64344f7a25872a 2019-02-17 06:01:08 -05:00
Dylan K. Taylor
b252be1c7a Added ItemFactory::air() sugar
This makes it easier to create air stacks without accidents, and also reduces the amount of throwaway air objects which get created.
2019-02-16 12:19:54 +00:00
Dylan K. Taylor
dce08b4e88 Introduce Item use results - can be success, fail or none
closes #2693, closes #2705, closes #2734
2019-02-14 19:21:29 +00:00
Dylan K. Taylor
55be0716d8 Use DyeColor instead of ints for banners 2019-02-13 13:49:44 +00:00
Dylan K. Taylor
1496eefb8b Regenerated TODOs for item and b,locks
this sucks because it doesn't tell us anything about things that are meta values of other things (like dyes), but it's enough to start with.
2019-02-12 19:15:19 +00:00
Dylan K. Taylor
d30316101a Of course, there was a bug in the script... 2019-02-12 16:30:31 +00:00