847 Commits

Author SHA1 Message Date
Dylan K. Taylor
3f937605ac
Added calcite 2022-07-02 23:54:51 +01:00
Dylan K. Taylor
0e0b858b69
Added raw copper, gold and iron blocks 2022-07-02 23:17:10 +01:00
Dylan K. Taylor
0d0296d535
Light block brightness can be changed by right-clicking on it 2022-07-02 22:48:10 +01:00
Dylan K. Taylor
2a0fade893
Implemented Light blocks 2022-07-02 22:39:11 +01:00
Dylan K. Taylor
30149c6ed4
wtf happened here ... 2022-07-02 22:06:47 +01:00
Dylan K. Taylor
172214386a
Added a batch of simple blocks from 1.16 and 1.17 2022-07-02 21:53:59 +01:00
Dylan K. Taylor
ff90c83d66
Implemented log stripping via axe right-click 2022-07-02 19:16:15 +01:00
Dylan K. Taylor
248eacd042
GlazedTerracotta: make colour dynamic, like all other coloured blocks
made possible by stripping out legacy mess
2022-07-02 18:30:23 +01:00
Dylan K. Taylor
7430e1fbc0
Coral: remove obsolete workaround 2022-07-02 17:51:48 +01:00
Dylan K. Taylor
b125d4d25f
Strip all remaining legacy item ID/meta stuff from blocks
the doors are now finally open, we can:
- make all the wood types dynamic
- fix glazed terracotta
- add all the new blocks

LET'S GOOOOOOOOOOOO
2022-07-02 17:48:11 +01:00
Dylan K. Taylor
323c563684
Break Block's dependence on ItemFactory, and item legacy IDs
let's GOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
2022-07-02 17:29:28 +01:00
Dylan K. Taylor
9740891a2f
Move BlockLegacyMetadata to pocketmine\data package 2022-07-02 17:01:10 +01:00
Dylan K. Taylor
3792ef5a50
Move blockstate data runtime serialization to a more appropriate package 2022-07-02 16:48:41 +01:00
Dylan K. Taylor
ba079bd9aa
Avoid implicit ItemFactory reliance for blocks with special items
this hasn't yet been addressed for signs, since they are a bit of a pain in the ass.
2022-06-30 20:00:41 +01:00
Dylan K. Taylor
4bd087fc83
Fix CS 2022-06-30 19:09:49 +01:00
Dylan K. Taylor
af8f2c47f3
ShulkerBoxInventory: avoid usage of legacy ItemIds 2022-06-30 19:03:07 +01:00
Dylan K. Taylor
2a0b500010
Block: Separate encoding of type and state data
the terminology of this needs improvement, but...

the basic concept here is that 'type' data will persist on an itemstack, while 'state' data will not.

Type data consists of things like:
- Colour
- Coral type
- Wet/dry (sponges)
- Live/dead (coral)
- Wood type

State data consists of things like:
- Facing
- Axis
- Powered/unpowered
- Open/closed

In the past, with the old system, this information was separated by way of getStateBitmask(). This solution was fraught with problems, but achieved the basic goal: removing unwanted block properties from items.
2022-06-30 18:08:34 +01:00
Dylan K. Taylor
c22a840d27
Update VanillaBlocks:
for some reason some stuff was returned using non-default states
2022-06-30 17:52:07 +01:00
Dylan K. Taylor
cab56b0479
fix PHPStan 2022-06-29 17:18:44 +01:00
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