Dylan K. Taylor
20849d6268
Fixed potential crashes in type ID tests
...
if the constants had any non-stringable values, these would blow up.
this would still be fine in the sense that the tests would fail, but better that they fail gracefully if possible.
2025-01-06 22:48:22 +00:00
Dylan K. Taylor
12ae8dc03b
Merge branch 'stable' into minor-next
2024-11-25 14:32:30 +00:00
Dylan K. Taylor
5325ecee37
Deal with a whole lot of PHPStan suppressed key casting errors
...
closes #6534
2024-11-25 14:30:58 +00:00
Dylan T.
33a7b46329
Use reflection to locate BlockTypeIds and ItemTypeIds for VanillaBlocks/VanillaItems ( #6498 )
...
Use reflection to locate BlockTypeIds and ItemTypeIds for VanillaBlocks/VanillaItems
Since BlockTypeIds and ItemTypeIds are derived from VanillaBlocks and VanillaItems respectively anyway (they only exist to allow identifying blocks/items without having to create instances of them), this hack is probably OK, and reduces the chances of mistakes.
Previously it was explored to have these IDs generated by auto-incrementing in VanillaBlocks/Items and have the constants generated that way, but this proved to be too problematic because of unstable diffs no matter how we chose to sort the elements. See #6313 for previous research on the subject.
This is obviously not a desirable hack to keep long-term. In the future it will probably make sense to redesign VanillaBlocks like so:
enum VanillaBlocks { ... }
VanillaBlocks::STONE (the type ID)
VanillaBlocks::STONE->new() (to create a block)
However, more research is needed on this, as I'd prefer not to make block creation any more verbose.
2024-11-14 17:32:22 +00:00
Dylan K. Taylor
58278f22f3
Remove deprecated API usages from tests
2023-09-07 20:30:45 +01:00
Dylan K. Taylor
ab8386ed5a
Tests: verify that ItemTypeIds/BlockTypeIds constants match their corresponding VanillaItems/VanillaBlocks registrations
2023-06-09 15:49:10 +01:00
Dylan K. Taylor
f9818efff4
Fixed PHPUnit deprecation warnings
2023-06-04 14:00:26 +01:00
Dylan K. Taylor
6ba3b39541
Added tests for BlockTypeIds and ItemTypeIds
2022-07-24 21:57:51 +01:00
Dylan K. Taylor
4e71cc7d79
Remove ItemFactory::get(), use ItemFactory::fromTypeId() for VanillaItems
...
soon we'll invert the dependency and set up all this stuff in VanillaItems directly, rendering ItemFactory (mostly) unnecessary.
2022-07-05 14:26:02 +01:00
Dylan K. Taylor
f8547ad57c
LegacyStringToItemParserTest: do not rely on the presence of legacy ID and meta in the API
2022-06-30 16:39:50 +01:00
Dylan K. Taylor
83c46a4b54
LegacyStringToItemParser: remove bogus test
...
this test is obsolete since ea3d5ac5630f57b9cec46771001ab83bb0ddec25, since durable items no longer use meta to represent damage.
2022-06-29 15:26:56 +01:00
Dylan K. Taylor
03fdbd9f7b
fix CS
2022-06-25 15:59:52 +01:00
Dylan K. Taylor
cac72d73fb
ItemFactoryTest: remove bogus test case
2022-06-25 14:34:19 +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
6846f1e78a
Replace disallowed operators in tests/
2022-01-20 16:48:36 +00:00
Dylan K. Taylor
0c012ca5d9
Replace usages of ItemFactory in tests with VanillaItems
2021-12-06 23:45:36 +00:00
Dylan K. Taylor
aa5a9f6d12
Enchantment: use Translatable instead of hardcoded translation keys
2021-09-03 20:52:05 +01:00
Dylan K. Taylor
6384b6602c
phpstorm you piece of shit
2021-05-07 23:55:49 +01:00
Dylan K. Taylor
b33bf1f433
Unfuck banners ...
2021-04-28 18:44:21 +01:00
Dylan K. Taylor
5872b2fe23
Merge remote-tracking branch 'origin/stable'
2021-04-19 13:32:15 +01:00
TheNewHEROBRINEX
8d1a1628de
Item: Remove "ench" tag when all enchantments are removed from an item ( #4184 )
...
fixes #4144
2021-04-18 20:56:07 +01:00
Dylan K. Taylor
9abdcd8ee5
shut
2021-04-16 21:45:22 +01:00
Dylan K. Taylor
01c3668375
ItemFactory: Check the bounds of durability, instead of trying to catch exceptions
2021-04-16 21:30:48 +01:00
Dylan K. Taylor
be1da07ee5
tests: phpdoc cleanup
2020-11-01 14:23:44 +00:00
Dylan K. Taylor
500fd2d842
tests: strip useless phpdoc
2020-10-26 15:59:17 +00:00
Dylan K. Taylor
a01c086481
Introduced VanillaEnchantments registry
2020-10-23 20:48:19 +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
13d784cd0c
Convert BlockFactory to singleton
2020-04-23 23:45:13 +01:00
Dylan K. Taylor
f8ce01e2fd
ItemFactory: extract fromStringSingle() from fromString()
...
on PM4, the multiple functionality is removed, but on PM3 this is a problem for phpstan.
2020-03-13 17:54:25 +00:00
Dylan K. Taylor
78394a336c
Merge branch 'stable'
2020-02-25 20:45:39 +00:00
Dylan K. Taylor
7aa8bd18d3
Revert "Item: restrict bounds of count to 0-255"
...
This reverts commit 10317527e4012fb1dbb1661f2f7fc33b05a7a6d1.
this breaks user code which exceeds stack limits in legitimate
circumstances. For example, it should be OK to add 6000x diamond to a
player's inventory without being forced to manually split the count up
for addItem().
2020-02-25 20:42:03 +00:00
Dylan K. Taylor
8a770d837e
Merge branch 'stable'
2020-02-24 20:32:43 +00:00
Dylan K. Taylor
10317527e4
Item: restrict bounds of count to 0-255
2020-02-23 17:23:53 +00:00
Dylan K. Taylor
31fcd8e5fa
ItemTest: use the proper method to explicitly fail a test
2020-02-07 18:35:26 +00:00
Dylan K. Taylor
fb1126797a
Merge branch 'stable'
2020-02-07 18:13:55 +00:00
Dylan K. Taylor
532dc0fb6f
tests/phpunit: populate iterable types for phpstan
2020-02-06 13:11:56 +00:00
Dylan K. Taylor
1fee70abfb
Item no longer implements ItemIds
2019-07-19 17:43:06 +01:00
Muqsit
a8fa3ba434
Add test for whether item retains it's display properties after deserialization ( #3047 )
2019-07-19 13:06:07 +01:00
Dylan K. Taylor
9ad0ea85c7
Rename two misleadingly-named functions
2019-02-27 12:59:12 +00:00
Dylan K. Taylor
9354929cad
added a whole bunch of tests for enchantment handling
2019-02-20 14:43:57 +00:00
Dylan K. Taylor
3760307a88
Merge branch 'release/3.4'
2018-10-29 12:42:29 +00:00
Dylan K. Taylor
2da2fdd6d4
Added a test for Item->equals() when both items have no NBT
2018-10-29 12:42:03 +00:00
Dylan K. Taylor
9284e53f9e
Added failing test case for #2483
2018-10-19 15:29:00 +01:00
Dylan K. Taylor
6ab2fa84da
added some tests for ItemFactory::fromString()
2018-07-17 14:52:47 +01:00
Dylan K. Taylor
9d16863b1a
Convert some TesterPlugin tests into PHPUnit tests, add PHPUnit configuration
2018-06-05 19:33:21 +01:00