478 Commits

Author SHA1 Message Date
Dylan K. Taylor
8831dff61b
Leaves: remove ItemFactory dependency
this is ugly, but it should only be temporary while we liberate the core from legacy nastiness.
Once the liberation is complete, we'll be able to do a lot of cool stuff like making wood types dynamic.
2022-06-29 16:09:55 +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
c0e178c19c
fix CS 2022-06-27 17:15:16 +01:00
Dylan K. Taylor
2fd9b751b6
Log: remove dead code 2022-06-27 16:26:53 +01:00
Dylan K. Taylor
7deee31502
Block: make decodeStateData() and computeStateData() final 2022-06-27 15:40:39 +01:00
Dylan K. Taylor
0afb67be7d
Improve BlockFactory initialization performance
as expected, expanding data range unconditionally resulted in some performance issues ...
2022-06-27 15:37:05 +01:00
Dylan K. Taylor
27d7672273
Item frames can now be placed on the up or down faces of blocks 2022-06-25 16:10:39 +01:00
Dylan K. Taylor
db8bf672f0
fix item frames 2022-06-25 16:10:06 +01:00
Dylan K. Taylor
f57e02849a
Wall: move function for consistency 2022-06-25 16:01:11 +01:00
Dylan K. Taylor
1da4c45979
Add runtime support for wall connections
this doesn't match the 1.16+ behaviour yet, but it at least recognizes walls that are already in the post-1.16 way and doesn't break them if not interacted with.
2022-06-25 15:59:38 +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
00b4e4016c
Obliterate BlockLegacyIds 2022-06-25 14:42:32 +01:00
Dylan K. Taylor
1bce583cf3
Removed BlockIdentifierFlattened
this was necessary to inform BlockFactory of how to map blocks with multiple IDs; this is no longer necessary under the revamped system
2022-06-24 23:31:05 +01:00
Dylan K. Taylor
5f7521027e
FlowerPot: remove usage of legacy variant 2022-06-24 23:24:03 +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
8b80c70b9c
Merge branch 'next-major' into modern-world-support 2022-06-24 01:41:47 +01:00
Dylan K. Taylor
9cc24c2c39
Merge branch 'next-minor' into next-major 2022-06-24 01:40:50 +01:00
Dylan K. Taylor
df2d1fd4f9
of course there were two bugs on one line ... 2022-06-24 01:40:26 +01:00
Dylan K. Taylor
04b855235a
Merge branch 'next-major' into modern-world-support 2022-06-24 01:35:46 +01:00
Dylan K. Taylor
72d8b54188
Merge branch 'next-minor' into next-major 2022-06-24 01:33:15 +01:00
Dylan K. Taylor
9f65fb5f90
Fixed top-side skulls with no-drop flag set being treated as unknown blocks 2022-06-24 01:31:11 +01:00
Dylan K. Taylor
6964012464
fix a bunch of bugs 2022-06-23 19:34:08 +01:00
Dylan K. Taylor
1533fcf8f6
Separate block legacy data upgrading from block deserialization
this commit provides a central place where all block data can go to be upgraded to the latest version (currently 1.19), irrespective of how old it is.

Previously I had issues during debugging, because it wasn't possible to just upgrade a block without deserializing it into a Block object, which isn't currently supported for many blocks.
This commit solves that problem by separating the upgrading from the deserialization.
2022-06-23 16:45:02 +01:00
Dylan K. Taylor
680615eed8
Namespace rename 2022-06-08 15:54:45 +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
5c85aa6e58
Eliminate remaining usages of legacy block ID+meta on disk
flower pots loaded from vanilla worlds should now correctly display the plant inside
2022-06-05 21:49:51 +01:00
Dylan K. Taylor
d2613039ed
Replace BlockLegacyIds usages with BlockTypeIds where possible 2022-06-05 21:17:10 +01:00
Dylan K. Taylor
f97c22c341
Merge branch 'next-major' into modern-world-support 2022-06-05 20:48:49 +01:00
Dylan K. Taylor
f2dc9187f0
Use covariant types for InventoryHolder and Container implementors 2022-06-05 18:49:48 +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
bd8dd48dee
Assign new IDs to every block 2022-05-27 18:07:31 +01:00
Dylan K. Taylor
6d7318af43
Liquid: fixed merge regression 2022-05-26 18:48:45 +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
4ccae2d1de
BlockFactory: use import aliases to reduce code width 2022-05-26 15:50:29 +01:00
Dylan K. Taylor
03c505aaa7
Merge branch 'next-major' into modern-world-support 2022-05-22 16:21:48 +01:00
Dylan K. Taylor
179cac45f5
Merge branch 'stable' into next-minor 2022-05-22 16:21:05 +01:00
Dylan K. Taylor
a45a96b3ee
ShulkerBoxInventory: fixed inappropriate usage of BlockLegacyIds when comparing item IDS 2022-05-21 15:40:25 +01:00
Dylan K. Taylor
f67104c81e
Merge branch 'next-major' into modern-world-support 2022-05-20 17:50:38 +01:00
ShockedPlot7560
6482aa7c64
Block: introduce logic for face support types (#4886)
fixes #4856
fixes #458
fixes #4529
fixes #3299

Added API method Block::getSupportType(Facing) : SupportType
Added SupportType enum
fixes torch, lantern, door etc. placement on slabs and upside-down stairs
2022-05-20 15:18:34 +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
071067effb
Fixed flower pot accepting any block 2022-05-17 20:30:02 +01:00
ipad54
1e59679ec2
Implemented Stonecutter (#4732) 2022-05-17 16:01:03 +01:00
Dylan K. Taylor
4c03aabe0f
I'm going to kill myself... 2022-05-12 16:44:21 +01:00
Dylan K. Taylor
3ae9341c52
[BC break] doors don't have a powered flag in Bedrock 2022-05-12 16:43:44 +01:00