720 Commits

Author SHA1 Message Date
Dylan K. Taylor
8454076235
WaterCauldron: remove more repeated code 2023-05-19 15:45:12 +01:00
Dylan K. Taylor
4a3843a881
WaterCauldron: reduce code repetition 2023-05-19 15:40:04 +01:00
ipad54
b8a1b32461
Fixed late property initializing in UnknownBlock (#5755) 2023-05-18 19:53:37 +01:00
Dylan K. Taylor
9621836e36
Clean up confusing mess around block and item overriding
right now, I don't see an obvious reason to do this. If it turns out I was wrong later on, we can add functionality back, but we can't remove functionality after release.
2023-05-17 15:21:49 +01:00
Dylan K. Taylor
015c668885
Change confusing 'type data' and 'state data' terminology for blocks and items
For blocks, we now use 'block-item state' and 'block-only state', which should be much clearer for people implementing custom stuff.
'block-item state', as the name suggests, sticks to the item when the block is acquired as an item.
'block-only state' applies only to the block and is discarded when the block is acquired as an item.

'type data' for items was also renamed, since 'type' is too ambiguous to be anything but super confusing.
2023-05-16 14:07:29 +01:00
platz1de
ccb22ceb3f
Fix flower pots being marked as pottable (#5747) 2023-05-16 12:31:30 +01:00
ipad54
fa719f37d5
Implement Cave Vines & Glow Berries (#5424) 2023-05-08 19:24:23 +01:00
Hugo_
d834266635
BlockGrowEvent: add player information for bonemeal usage (#5596)
this is in line with StructureGrowEvent, which also has a similar API.
2023-05-08 17:38:07 +01:00
Dylan K. Taylor
5c7f4570b4
Merge branch 'minor-next' into major-next 2023-05-06 17:20:37 +01:00
Dylan K. Taylor
289ede669d
BlockTranslator: use less ambiguous function names 2023-05-05 14:47:23 +01:00
Dylan K. Taylor
d8e77c1920
Tidy up crafting block registration
according to data dumps from bds-mod-mapping, fletching tables have a blast resistance of 12.5, just like the others.
2023-05-04 18:47:06 +01:00
Dylan K. Taylor
85372633eb
Tidy up BlockLegacyIdHelper stuff
I don't plan to make wood-like blocks have a dynamic wood/leaves/sapling type, as it's entirely possible their type properties will continue to diverge in future versions.
2023-05-04 17:05:22 +01:00
Dylan K. Taylor
2c81446e5b
Move TreeType to generator package, added dedicated SaplingType enum
TreeType includes a bunch of stuff that don't have regular saplings associated with them, such as mangrove and azalea trees.
Mangrove has a dedicated propagule block with different behaviour than the others, and azalea trees are grown from azalea blocks, which are solid and have different behaviour to saplings.

We may also want to account for crimson and warped 'trees' in TreeType too, although I'm not sure if those belong there or not.
2023-05-04 16:54:10 +01:00
Dylan K. Taylor
01f340985a
Centralize all conversion-related stuff under TypeConverter
instead of having singletons for everything, which are a nightmare to manage for multi version
2023-05-03 16:33:17 +01:00
Dylan K. Taylor
6beb80b8fe
Fixed usages of BlockDataUpgrader which weren't accounting for thrown exceptions 2023-05-02 17:13:31 +01:00
Dylan K. Taylor
73bf5d4b29
DoubleChestInventory: specialize isSlotEmpty() and getMatchingItemCount() 2023-04-27 21:17:55 +01:00
Dylan K. Taylor
0dca85af44
Merge branch 'minor-next' into major-next 2023-04-26 23:28:27 +01:00
Dylan K. Taylor
0d21e591d1
Support sign editing UI in 1.19.80, with APIs to allow plugins to use it
this doesn't support editing the rear side of a sign, since the 1.12 format doesn't allow us to represent the rear text, and it would necessitate API breaks to support anyway.

However, we can quite trivially support APIs for the sign GUI, which plugins can use to enable editing signs. PocketMine-MP doesn't currently permit this, since it's currently an experimental feature in 1.20, but plugins can simply use Player->openSignEditor() to mimic it.

This is, however, a byproduct of the fact that APIs needed to be added in order to facilitate the use of OpenSignPacket in 1.19.80.
2023-04-26 22:55:05 +01:00
Dylan K. Taylor
edcaeef831
VanillaBlocks: reduce width of element block registration 2023-04-21 21:33:45 +01:00
Dylan K. Taylor
d4ca566fd0
Move block permutation generation into Block
this allows sealing off a whole bunch of internal APIs.
2023-04-21 20:38:28 +01:00
Dylan K. Taylor
6c0ad9589b
Block: rename isSameType() to hasSameTypeId()
this should remove any ambiguity about its behaviour.
2023-04-21 20:25:21 +01:00
Dylan K. Taylor
1026811741
Merge branch 'minor-next' into major-next 2023-04-14 21:00:08 +01:00
Dylan K. Taylor
692e1253c6
Fixed AABB height for farmland and grass paths (fixed in 1.19.50) 2023-04-14 16:02:28 +01:00
Dylan K. Taylor
6acabf7a1b
Block: add clarifying note about isSameType()
I'm still not happy with this method though...
2023-04-13 13:40:53 +01:00
Dylan K. Taylor
b122703fd0
BaseCoral: fixed late property initialization 2023-04-13 13:18:47 +01:00
Dylan K. Taylor
e40774d62f
Block: make internal methods private (they are no longer used outside of Block) 2023-04-13 13:06:56 +01:00
Dylan K. Taylor
5950707267
Block: simplify required type data / state data bits code 2023-04-13 12:55:09 +01:00
Dylan K. Taylor
6703f46a08
Remove random dead TODOs 2023-04-13 12:47:08 +01:00
Dylan K. Taylor
874fdf5adb
ItemBlock: reference blocks directly (take 2)
This was first attempted in f64dc01bd1c14ff3f79bd6c18d0c337dbc0e87e0, 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
IvanCraft623
bea878e9e9
Implement anvil fall damage (#5312) 2023-03-27 20:17:08 +01:00
Dylan K. Taylor
72853677bb
Fixed mushroom blocks for PM5
closes #5284
2023-03-15 16:54:13 +00:00
Dylan K. Taylor
5f9e0081fd
Fixed mushroom block silk-touch drops and block picking behaviour
fixes #5284
2023-03-15 16:36:35 +00:00
Dylan K. Taylor
fff8f0f815
Use Item->canStackWith() instead of Item->equals() wherever possible 2023-03-07 17:08:35 +00:00
Dylan K. Taylor
b9d62de29d
Pack wall connections into 7 bits for runtime data encoding 2023-03-04 15:47:34 +00:00
Dylan K. Taylor
95c18ef99a
Block: change confusing naming of decode/computeStateData
these actually accept a combination of type and state data, so it's a bit inconsistent with other references to 'state data'.
2023-03-02 17:42:44 +00:00
Dylan K. Taylor
972f107972
Block: added documentation for describeType() and describeState() 2023-03-02 17:31:52 +00:00
Dylan K. Taylor
e15e53859f
tidy 2023-03-02 17:25:48 +00:00
Dylan K. Taylor
4692552fdc
Block: improve documentation of type ID and state ID 2023-03-02 16:32:33 +00:00
Dylan K. Taylor
cbb58d3e0d
Block: reduce method placement chaos 2023-03-02 16:23:40 +00:00
Dylan K. Taylor
7c974a12e1
Revert "ItemBlock: drop the charade about overriding built-in block types"
This reverts commit f64dc01bd1c14ff3f79bd6c18d0c337dbc0e87e0.

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
Dylan K. Taylor
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
Dylan K. Taylor
33140482bb
ItemTypeIds: added fromBlockTypeId() and toBlockTypeId()
this allows checking the type of a blockitem without being required to create a block to do it.
2023-03-02 15:28:50 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
c2f6d8139a
Added interface RuntimeDataDescriber 2023-02-16 16:23:32 +00:00
Dylan K. Taylor
e6f1cb69d1
RuntimeBlockStateRegistry: throw a hard error on blockstates that return different state data than they were given
this suggests improper validation of state data.
2023-02-16 15:44:58 +00:00
Dylan K. Taylor
4c3892b2d6
RuntimeBlockStateRegistry: separate permutation expansion from register() 2023-02-16 15:41:43 +00:00
ipad54
75f74454c6
Implemented reinforced deepslate (#5553) 2023-02-15 15:15:04 +00:00
IvanCraft623
5226300b99
Ring bell when hit by a projectile (#5505) 2023-01-27 23:07:41 +00:00
ipad54
0f81b7be15
Fixed deepslate drops (#5535)
Co-authored-by: Dylan T <dktapps@pmmp.io>
2023-01-26 15:08:15 +00:00
Dylan K. Taylor
f56339c306
Fix build 2023-01-26 14:48:43 +00:00