Move various settings from non vanilla custom item data to custom item data and allow use in JSON mappings #4655
+463
−310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR moves various settings from the
NonVanillaCustomItemData
to theCustomItemData
class, which is useful for datapack/server side mod developers when porting custom items to Bedrock using Geyser's mapping system.Properties that have been moved to the super-interface:
stackSize
maxDamage
attackDamage
toolType
toolTier
armorType
protectionValue
isHat
isFoil
isEdible
canAlwaysEat
- deprecated, won't be movedisTool
The builders for these classes have been correctly updated, alongside the implementations of these classes and their use in
CustomItemRegistryPopulator
.A few notes:
NonVanillaCustomItemData.Builder
class has been given overrides for the moved properties to allow for full backwards compatibility.isTool
boolean field in the implementation ofNonVanillaCustomItemData
(GeyserNonVanillaCustomItemData
) has been removed and not re-implemented in its super class - it has been replaced withdisplayHandheld
and wasn't used anywhere in the implementation anymore. It was not publicly available.TheisTool
method has been moved to the super-interface and redirects to thedisplayHandheld
method (it is marked deprecated, like before).GeyserCustomItemData
has been simplified to simply take its builder as argument.createComponentNbt
method forCustomItemData
has been updated to continue supportingGeyserMappingItem
as well.MappingsReader_v1
has been updated accordingly.edible
property has been updated to include theminecraft:use_modifiers
Bedrock component alongside theminecraft:food
component, which seems to now be required to make edible items behave correctly.A couple of the new JSON mapping properties have been tested (
stack_size
,max_damage
,hat
andedible
), and backwards compatibility of using builder methods inNonVanillaCustomItemData.Builder
in extensions has been tested as well, which all seem to work okay.Feel free to suggest any changes and I'll be sure to implement them!