328 Commits

Author SHA1 Message Date
Dylan K. Taylor
ea3d5ac563
LegacyStringToItemParser: use string IDs directly
this allows plugins to add their own mappings (though they should really be using StringToItemParser) without needing any legacy numeric ID bullshit in the mix.
2022-06-29 15:25:50 +01:00
Dylan K. Taylor
ce6b09291a
LegacyStringToItemParser: bypass ItemFactory, use GlobalItemDataHandlers directly 2022-06-29 15:18:11 +01:00
Dylan K. Taylor
2cb722b674
Fixed durability handling (ish) 2022-06-29 15:17:16 +01:00
Dylan K. Taylor
dd63681f94
Assign auto-generated runtime type IDs to all items 2022-06-29 13:50:58 +01:00
Dylan K. Taylor
56428e8a4e
Make more item stuff dynamic 2022-06-29 00:26:16 +01:00
Dylan K. Taylor
6058032807
Make potion types dynamic
It became obvious this was needed when I wanted to make new IDs for existing items - there's no way I'm unrolling those registrations...
2022-06-28 23:33:25 +01:00
Dylan K. Taylor
541a624d48
ItemFactory::get() now consistently throws SavedDataLoadingException on any error, including unknown items 2022-06-27 17:14:43 +01:00
Dylan K. Taylor
bedc9cf518
Item::jsonDeserialize(): remove bogus phpdoc (we don't actually know if this is even valid) 2022-06-27 14:30:12 +01:00
Dylan K. Taylor
65ed7d7794
Remove Item::hasAnyDamageValue() 2022-06-27 13:35:43 +01:00
Dylan K. Taylor
55cb68e5b5
Burn meta wildcards from Item, allow more dynamic recipe inputs
this was an obstacle for getting rid of legacy item IDs.
2022-06-27 13:33:26 +01:00
Dylan K. Taylor
bc5a600d59
Added item stack serialize/deserialize methods 2022-06-26 17:02:55 +01:00
Dylan K. Taylor
3d61345543
Remove ItemFactory::air() 2022-06-25 16:18:35 +01:00
Dylan K. Taylor
b9542b4908
ItemFactory: fix isRegistered() again
we really need to get rid of the ItemFactory legacy nasties so we can burn this code
2022-06-25 15:52:43 +01:00
Dylan K. Taylor
b268818eda
ItemFactory: fixed bogus usage of BlockFactory::isRegistered()
ItemFactory IDs don't necessarily correspond to BlockFactory ones anymore.
2022-06-25 14:02:55 +01:00
Dylan K. Taylor
f24f2d9ca9
Hit block legacy metadata with the biggest nuke you've ever seen
This commit completely revamps the way that blocks are represented in memory at runtime.

Instead of being represented by legacy Mojang block IDs and metadata, which are dated, limited and unchangeable, we now use custom PM block IDs, which are generated from VanillaBlocks.
This means we have full control of how they are assigned, which opens the doors to finally addressing inconsistencies like glazed terracotta, stripped logs handling, etc.

To represent state, BlockDataReader and BlockDataWriter have been introduced, and are used by blocks with state information to pack said information into a binary form that can be stored on a chunk at runtime.
Conceptually it's pretty similar to legacy metadata, but the actual format shares no resemblance whatsoever to legacy metadata, and is fully controlled by PM.
This means that the 'state data' may change in serialization format at any time, so it should **NOT** be stored on disk or in a config.

In the future, this will be improved using more auto-generated code and attributes, instead of hand-baked decodeState() and encodeState(). For now, this opens the gateway to a significant expansion of features.
It's not ideal, but it's a big step forwards.
2022-06-24 23:19:37 +01:00
Dylan K. Taylor
6964012464
fix a bunch of bugs 2022-06-23 19:34:08 +01:00
Dylan K. Taylor
5ed75731f2
First (untested) look at hooking all the itemstack serializer/deserializer stuff together
this should address #5063 and related issues, if it works correctly.
2022-06-23 19:02:16 +01:00
Dylan K. Taylor
cf7d42b3ea
Fix CS according to new rules 2022-06-07 20:02:24 +01:00
Dylan K. Taylor
1ff69136a3
Merge branch 'next-major' into modern-world-support 2022-06-07 20:01:40 +01:00
Dylan K. Taylor
aa9f8781ff
Merge branch 'next-minor' into next-major 2022-06-07 19:56:26 +01:00
Dylan K. Taylor
02568bb049
Remove ItemFactory usage from Bucket 2022-06-05 21:19:38 +01:00
Dylan K. Taylor
d2613039ed
Replace BlockLegacyIds usages with BlockTypeIds where possible 2022-06-05 21:17:10 +01:00
Dylan K. Taylor
6ecfbd1bde
FishingRod: make class less useless 2022-06-05 20:20:16 +01:00
Dylan K. Taylor
dab7686656
Merge branch 'next-major' into modern-world-support 2022-06-04 18:43:11 +01:00
Dylan K. Taylor
083a35f970
Modernize property type declarations 2022-06-04 18:16:32 +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
ef15dc883a
Merge branch 'next-major' into modern-world-support 2022-06-01 15:34:26 +01:00
Dylan K. Taylor
3fcf6372e0
Merge branch 'stable' into next-minor 2022-06-01 15:32:37 +01:00
Dylan K. Taylor
adfabca684
Merge branch 'next-major' into modern-world-support 2022-05-26 16:02:32 +01:00
Dylan K. Taylor
97c0d72e28
ItemFactory: use import aliases to reduce code width 2022-05-26 15:55:33 +01:00
Dylan K. Taylor
b36c6ea13b
StringToItemParser: Use import aliases to reduce code width 2022-05-26 15:40:18 +01:00
Dylan K. Taylor
227f28a6d2
Use VanillaItems::AIR() instead of ItemFactory 2022-05-24 15:47:27 +01:00
Dylan K. Taylor
d8dc32ec4b
PhpStorm sucks
I'm very sure I enabled 'Ensure every file ends with a line break' ...
2022-05-24 15:22:23 +01:00
Dylan K. Taylor
0fc24c94cd
Fix PHPStan 2022-05-24 15:20:11 +01:00
Dylan K. Taylor
24bd403e23
Updated VanillaItems 2022-05-24 15:19:22 +01:00
Dylan K. Taylor
81eafde074
Hacks for banners and coral fans 2022-05-24 15:07:38 +01:00
Dylan K. Taylor
f67104c81e
Merge branch 'next-major' into modern-world-support 2022-05-20 17:50:38 +01:00
Dylan K. Taylor
86efa0aae6
Merge remote-tracking branch 'origin/stable' into next-minor 2022-05-20 17:49:04 +01:00
ipad54
26df37e6ef
Minecart: fixed max stack size to match vanilla (#5051) 2022-05-20 16:57:48 +01:00
Dylan K. Taylor
68491be847
Merge branch 'next-major' into modern-world-support 2022-05-20 11:21:35 +01:00
Dylan K. Taylor
d4b7f66e15
Promote some constructors 2022-05-17 22:34:58 +01:00
Dylan K. Taylor
95ad3f16e1
Modernize private property declarations in src/item 2022-05-17 20:59:24 +01:00
ipad54
1e59679ec2
Implemented Stonecutter (#4732) 2022-05-17 16:01:03 +01:00
Dylan K. Taylor
d807840d57
Merge branch 'next-major' into modern-world-support 2022-05-16 18:03:10 +01:00
Dylan K. Taylor
4dbac79e86
Merge branch 'stable' into next-minor 2022-05-16 18:02:25 +01:00
Dylan K. Taylor
7c3b78b0a0
ItemFactory: fix missing registration for dead coral fans
closes #5032

this is evidently not an ideal solution, and something more dynamic would be preferred so that we don't have to manually register an item for every permutation.
2022-05-13 13:53:28 +01:00
Dylan K. Taylor
cb97f37d13
First look at modern-spec serializer/deserializer for items
this is not yet used by anything
2022-05-12 16:26:38 +01:00
Dylan K. Taylor
60d3bddfbc
Merge branch 'next-major' into modern-world-support 2022-05-11 13:14:42 +01:00
Dylan K. Taylor
9ff1bf6deb
Merge remote-tracking branch 'origin/stable' into next-minor 2022-05-11 13:12:45 +01:00
Nick
69418084bc
Boat: fixed max stack size to match vanilla (#5018) 2022-05-10 13:16:04 +01:00