445 Commits

Author SHA1 Message Date
Dylan K. Taylor
10317527e4 Item: restrict bounds of count to 0-255 2020-02-23 17:23:53 +00:00
Dylan K. Taylor
2f1fad2745 Bucket: implement MaybeConsumable, fixes #3306
this is a nauseating fix, but it's only needed for stable.
2020-02-21 17:49:55 +00:00
Dylan K. Taylor
1257378198 clean up function imports 2020-02-08 09:31:15 +00:00
Dylan K. Taylor
758a68aa2c ItemFactory: add Item[] as type for list field (for auto complete) 2020-02-07 20:11:31 +00:00
Dylan K. Taylor
9b02b8e51e Item: do not compare serialized NBT in equals()
this isn't cached anymore, and would be a performance drag.
It would be nice to have some kind of fast path for this, but comparing NBT binary isn't it.
2020-02-06 20:23:58 +00:00
Dylan K. Taylor
0ec869932f Item: clean up internal NBT storage, discard useless legacy network cache
this will now bail if the NBT string given is invalid upon setCompoundTag(), rather than shitting the bed when it's accessed.
2020-02-06 17:59:05 +00:00
Dylan K. Taylor
4518d9d9ce Item: drop useless @var confusing PHPStan 2020-02-05 20:55:58 +00:00
Dylan K. Taylor
1a5228e7a6 Fixed property types with missing null PhpDoc types 2020-02-05 20:55:03 +00:00
Dylan K. Taylor
495bfda044 Drop a bunch of invalid null defaults
phpstan doesn't report these out of the box, for reasons I'm not clear on. It's also not clear if having null defaults has any effect on nullability behaviour, so they are best removed. In addition, these would be problematic on 7.4.
2020-02-05 20:53:54 +00:00
Dylan K. Taylor
3f7e7352fb added SplFixedArray generics for phpstan 0.12.9 2020-02-05 11:57:37 +00:00
Dylan K. Taylor
260ac47588 add some phpstan array types 2020-01-30 22:23:11 +00:00
Dylan K. Taylor
5d8bb84269 add more mixed[] to item namespace 2020-01-30 21:48:11 +00:00
Dylan K. Taylor
3b9a5c5ccc populate missing array value types in item namespace 2020-01-30 20:54:38 +00:00
Dylan K. Taylor
24ed823d96 WritableBook: remove extra line from phpdoc on setPages() 2020-01-22 14:51:14 +00:00
Dylan K. Taylor
f624871b3f strip extra blank lines (php-cs-fixer) 2020-01-22 14:50:29 +00:00
Dylan K. Taylor
c4793241f5 Mass removal of useless @param/@return PHPDoc annotations, pass 1 2020-01-21 15:10:18 +00:00
Dylan K. Taylor
e6ba3ce8a6 item: populate missing return type information 2020-01-19 17:13:33 +00:00
Dylan K. Taylor
e544bc0d4b Item: added missing return type info for clearCustomBlockData() 2020-01-18 20:11:47 +00:00
Dylan K. Taylor
fd27227cc7 Item: fix @return annotations for fluent methods (needed for correct auto complete) 2020-01-18 20:10:46 +00:00
Dylan K. Taylor
494660102e Replace empty() usages with count() 2019-12-18 11:23:24 +00:00
Dylan K. Taylor
2cb6990698 Enchantment: don't throw exceptions on out of range IDs
this function is used for data deserialization, and data may have bad enchantment IDs in it.
2019-12-14 10:04:51 +00:00
Dylan K. Taylor
8ecf5e02b9 bad fix for WritableBook phpstan warning
master has this shit so much better
2019-12-04 22:00:19 +00:00
Dylan K. Taylor
8a7017fd6b Enchantment: fixed doc comment for static enchantments field 2019-12-01 20:16:45 +00:00
Dylan K. Taylor
bb05cfb36c Shears: fixed always-false hardness check
thanks PHPStan
2019-10-21 15:21:22 +01:00
Dylan T
ee60a7bc36
Item: add documentation for addCreativeItem(), removeCreativeItem() and clearCreativeItems()
[ci skip]
2019-10-07 09:37:59 +01:00
Dylan K. Taylor
e93d034a4e fix bucket empty sound position, close #3051 2019-07-22 17:17:15 +01:00
Eren A. Akyol
b788982d60 Item: fixed setCustomName() not removing display NBT tag with empty name (#3049) 2019-07-19 20:07:53 +01:00
Dylan K. Taylor
eb161f8e1c Use base64 instead of hex to display binary in some places
base64 takes less space than hex, which is beneficial for logging larger payloads.
2019-06-06 14:43:20 +01:00
Dylan K. Taylor
cce99b07af 1.10.0 updates 2019-03-20 19:17:41 +00:00
Dylan K. Taylor
30b49e0d22 Merge branch '3.5' into 3.6 2019-02-08 15:32:20 +00:00
Dylan K. Taylor
769cc91543 ItemFactory: fix crash when getting negative item IDs
these are now treated the same as any unknown item, and are now not possible to place.
2019-02-08 13:51:41 +00:00
Dylan K. Taylor
b8703d5dff Protocol changes for 1.9.0 2019-02-07 21:56:42 +00:00
Dylan K. Taylor
0f545c410a Bow: Improve consistency with vanilla (JE at least), closes #2660
This change causes the existing test I did to now report ~55-60 blocks, which is much closer to parity with vanilla.
2019-01-15 14:42:41 +00:00
Dylan K. Taylor
4b9a142a5d Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called.

When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace.
This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified.

However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement.
But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations.
We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
2019-01-04 20:43:15 +00:00
Dylan K. Taylor
d71a543d10 Fixed a bunch of things PHPStan finds unpalatable
close #2614, fix a bunch of docs bugs, fix sendCreativeContents() crash on Human holders, move some inline variable declarations
2019-01-04 00:23:09 +00:00
Dylan K. Taylor
30f5a8fac6 Protocol changes for 1.8.0 release 2018-12-11 21:05:03 +00:00
Dylan K. Taylor
05dba61a69 Merge branch 'release/3.3' into release/3.4 2018-11-29 19:47:28 +00:00
Dylan K. Taylor
60dddcd12a Painting: clean up guard checks, remove unnecessary checks 2018-11-29 19:29:10 +00:00
Dylan K. Taylor
6dd2597934 Merge branch 'release/3.3' into release/3.4 2018-10-21 18:17:07 +01:00
Dylan K. Taylor
45c9caa38c Fixup some formatting issues 2018-10-21 18:15:25 +01:00
Dylan K. Taylor
1dd6591ac1 Migrate a bunch of PluginManager->callEvent() usages to Event->call
This has the triple bonus effect of a) making a lot of code easier to read, b) reducing Server::getInstance() usages, and c) removing a whole bunch of Server dependencies.

The network and block namespaces are untouched by this commit due to potential for merge conflicts. These should be dealt with separately on master.
2018-10-05 17:30:06 +01:00
Dylan K. Taylor
5b511f6d06 Merge branch 'release/3.1' into release/3.2 2018-09-29 15:39:27 +01:00
Dylan K. Taylor
426dee04a6 Potion: remove unnecessary exception throw in getPotionEffectsById()
this is only used by Potion and SplashPotion, and simply causes errors when trying to use potions with unknown IDs.
2018-09-29 15:39:20 +01:00
Dylan K. Taylor
f6a8ec83a1 Merge branch 'release/3.1' into release/3.2 2018-09-24 18:26:39 -04:00
Dylan K. Taylor
28137efb53 Fixed server freezing when using chorus fruit from large Y coordinates 2018-09-24 18:26:20 -04:00
Dylan K. Taylor
8db1ccc1ae Merge branch 'release/3.1' into release/3.2 2018-09-20 19:02:09 +01:00
Dylan K. Taylor
5d56030afa Item: make nbtDeserialize() return AIR when reading an unknown PC item
This is scummy, but it's better than crashing the whole server just because a chest contained an unknown item.
2018-09-20 19:00:44 +01:00
Dylan K. Taylor
d8e27e6081 Bow: fix wrong arithmetic for Flame fire ticks, closes #2420 2018-09-06 19:30:55 +01:00
Dylan K. Taylor
14a2ffa51b Merge branch 'release/3.1' into release/3.2 2018-09-06 18:43:28 +01:00
Dylan K. Taylor
c447d51e3f Bucket: use ItemFactory instead of self-clone
in the future Item->setDamage() will be removed.
2018-09-06 18:42:09 +01:00