f64dc01bd1
ItemBlock: drop the charade about overriding built-in block types
...
this allows cleaning up a whole lot of abusable mess from the API, and we never properly supported overriding built-in block types anyway.
2023-03-02 15:50:18 +00:00
55a48e0c84
Block: specifying required type/state data bits is no longer required
...
RuntimeDataSizeCalculator allows calculating the number of required bits from describeType directly, which considerably reduces boilerplate code.
2023-02-16 16:45:19 +00:00
c2f6d8139a
Added interface RuntimeDataDescriber
2023-02-16 16:23:32 +00:00
d9b050fb68
First look at using (very) basic tags for dynamic block properties
...
this allows plugins to, for example, add their own custom dirt-like blocks which support having flowers placed on them.
2022-07-24 00:08:02 +01:00
6a2315a63d
Accept BlockTypeInfo in Block constructor, instead of BlockBreakInfo
...
this will allow more stuff to be passed via the constructor without having to change dozens of classes to do it.
2022-07-23 20:42:54 +01:00
f6c9bf5cd1
Merge branch 'next-minor' into next-major
2022-07-20 20:55:33 +01:00
2940547026
Eliminate repeated calls to Position->getWorld()
...
as well as improving readability, it also improves performance in some areas.
2022-07-20 20:44:05 +01:00
6d4279671e
A giant hack to cut down code needed for runtime block serialization by 50%
...
this also avoids repeated information and inconsistencies.
2022-07-18 18:25:41 +01:00
d0ff6d2e36
Enable various types of interaction to return items to the player, without needing to have a bunch of boilerplate creative mode and held item checks
...
it became glaringly obvious that this was needed because of #4827 and #4868 .
this is further needed with the addition of cauldrons.
2022-07-16 19:50:33 +01:00
325f1cf82e
Generalize runtime block data serialization
...
we want to reuse this code for item type data
2022-07-05 14:13:37 +01:00
3792ef5a50
Move blockstate data runtime serialization to a more appropriate package
2022-07-02 16:48:41 +01:00
0afb67be7d
Improve BlockFactory initialization performance
...
as expected, expanding data range unconditionally resulted in some performance issues ...
2022-06-27 15:37:05 +01:00
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
1ff69136a3
Merge branch 'next-major' into modern-world-support
2022-06-07 20:01:40 +01:00
d2613039ed
Replace BlockLegacyIds usages with BlockTypeIds where possible
2022-06-05 21:17:10 +01:00
38d6284671
Use PHP-CS-Fixer to enforce file header presence
2022-06-04 17:34:49 +01:00
79d1feff9c
Replace disallowed operators in src/block/
2022-01-20 16:57:09 +00:00
07b1cff306
Bonemeal is no longer consumed when cancelling plant growth events ( #4551 )
2021-11-05 16:15:55 +00:00
321345fcc8
Sapling: simplify condition
2021-10-13 23:00:38 +01:00
09715906c8
StructureGrowEvent: added API to get the player who caused the growth ( #4445 )
2021-10-09 22:51:46 +01:00
c7f78bec15
Added missing change to complete beba0ffe15
2021-08-27 20:33:17 +01:00
8f89c04c51
Refactor Tree classes ( #4407 )
2021-08-27 20:11:05 +01:00
4189fbdaef
Added StructureGrowEvent ( #4354 )
...
This event is currently fired for tree and bamboo growth. Its intended use is for any plant growth that affects multiple blocks at once.
TODO: We could explore using this for cacti and sugarcane?
2021-08-25 14:05:30 +01:00
7fd712c1ff
Refactor Block & Tile: getPos() to getPosition() ( #4395 )
...
this also changes the name of the class property 'pos' to 'position' as well as Block->getPosOffset() to Block->getPositionOffset()
2021-08-23 14:01:32 +01:00
f68b9e79e1
Use typed properties in block namespace
2021-05-22 23:52:31 +01:00
376d2c4cd4
Consistently declare BlockBreakInfo at the constructor call site
...
instead of inside the class
2021-05-20 22:49:51 +01:00
32929925aa
Block: added a bunch of state manipulation APIs
2020-11-03 19:13:32 +00:00
670ad9eb9d
Position: rename getWorldNonNull() to getWorld(), remove original getWorld()
2020-06-29 21:19:46 +01:00
86e051b7bf
Merge commit 'a2543ff80d2906bccda1a4e2fdbd9d8e7d147fb3'
2020-04-18 17:33:05 +01:00
53ab860db5
first shot making Block not extend Position
...
this makes some stuff a lot less pretty, but this seems to be the bare minimum necessary to do this task. It can be enhanced later.
2019-08-05 16:44:09 +01:00
5499ac620c
Removed pocketmine subdirectory, map PSR-4 style
2019-07-30 19:14:57 +01:00