Commit Graph

12 Commits

Author SHA1 Message Date
874fdf5adb ItemBlock: reference blocks directly (take 2)
This was first attempted in f64dc01bd1, but reverted, since I hadn't considered how to handle stripping state data from blocks.

This removes the abusable API RuntimeBlockStateRegistry::fromTypeId() and related methods. These were only used to allow ItemBlocks to magically start referencing other blocks if the blocks were overridden by a plugin, but this was never a well-supported use-case anyway.

Instead of relying on RuntimeBlockStateRegistry, we remember the state that the block had during its constructor, and use that to normalize the non-item properties for asItem().

closes #5609
2023-04-13 12:44:54 +01:00
7c974a12e1 Revert "ItemBlock: drop the charade about overriding built-in block types"
This reverts commit f64dc01bd1.

I forgot that the ItemBlock constructor implicitly strips off any states
of the origin block, which is something that we unfortunately can't do
any other way right now, since the blocks don't remember their default
states.
2023-03-02 15:51:55 +00:00
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
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
8b2d941502 Offset integer ranges in runtime block data serialization
this is useful for stuff like snow layers where the range doesn't start at 0.
2022-07-13 19:49:30 +01:00
5c4288de01 block/Light: fixed placement when clicking on another light block
closes #5132
2022-07-06 14:23:32 +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
0d0296d535 Light block brightness can be changed by right-clicking on it 2022-07-02 22:48:10 +01:00
2a0fade893 Implemented Light blocks 2022-07-02 22:39:11 +01:00