Changes

Summary

  1. Cleanup throws declarations on loadable (details)
  2. Add typed maps (details)
  3. Implement LoadableRecipeSerializer (details)
  4. Make collection loadable error during datagen if given too many elements (details)
  5. Implement EitherLoadable (details)
  6. Implement SizedIngredient loadable (details)
  7. Fix reading item stacks from network reading with size 0 if count is unspecified (details)
  8. Expand debug info on logging recipe serializer (details)
  9. Rename FriendlyByteBuffer methods on Loadable to match StreamCodec (details)
  10. Add a custom nullable field implementation to NamedComponentRegistry (details)
Commit aeec65fa23948af734557a1535d8a148c6a3c388 by KnightMiner
Cleanup throws declarations on loadable

Moved them to the Javadocs so they are not automatically added to every override, the goal is just to tell the implementer what exception is expected there.
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/IngredientLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/predicate/FallbackPredicateRegistry.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/registry/DirectRegistryField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/mapping/CollectionLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/mapping/MappedLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/ingredient/FluidIngredient.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/mapping/CompactLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/ColorLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/DirectField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/CodecLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/RequiredField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/registry/GenericLoaderRegistry.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/Loadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/NullableField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/registry/NamedComponentRegistry.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/helper/ItemOutput.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/registry/DefaultingLoaderRegistry.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/NBTLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/DefaultingField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/LoadableField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/primitive/EnumLoadable.java (diff)
Commit c8fda4fdc1f48b06b87aabc617c170e8524250f4 by KnightMiner
Add typed maps

Have in a few places needed a map where the values are typed based on a key, will need it for something in Mantle soon so including as a utility.
The file was addedsrc/main/java/slimeknights/mantle/util/typed/TypedMap.java
The file was addedsrc/main/java/slimeknights/mantle/util/typed/MutableTypedMap.java
The file was addedsrc/main/java/slimeknights/mantle/util/typed/TypedMapBuilder.java
The file was addedsrc/main/java/slimeknights/mantle/util/typed/package-info.java
The file was addedsrc/main/java/slimeknights/mantle/util/typed/BackedTypedMap.java
Commit b79c3d73e3c282403c93e6bb0c50e915c1dcb636 by KnightMiner
Implement LoadableRecipeSerializer

To minimize additional boilerplate, I opted to add a context to record loadables where additional data can be passed to the root record.
LoadableField now has a superclass RecordField, which has context aware methods. Idea here being LoadableField works when there is no context (and has impls passing in empty context), while RecordField is only usable in a record builder.
LoadableRecord got context parameters, but still has the method headers with no context for IGenericLoader and non-loadable usage compact. They just pass in empty, which means context does not currently propigate to nested loaders unless you use a direct field. I don't think there is any justification for including context in all loader usage unless I start including other stuff in context.
ContextKey allows creating keys for said data, by default there are two - the recipe ID, and the recipe serializer.
In addition AbstractRecipeBuilder has a finished recipe using loadables
Finally, added TypeAwareRecipeSerializer for the sake of recipes that use the serializer to swap types, lets them reuse a loadable instance.
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/NBTLoadable.java (diff)
The file was addedsrc/main/java/slimeknights/mantle/recipe/helper/LoadableRecipeSerializer.java
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/DirectField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/predicate/block/BlockPropertiesPredicate.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable6.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable1.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/data/AbstractRecipeBuilder.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable11.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable4.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable16.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable9.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/LoadableField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/BlockStateLoadable.java (diff)
The file was addedsrc/main/java/slimeknights/mantle/recipe/helper/TypeAwareRecipeSerializer.java
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/ItemStackLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable13.java (diff)
The file was addedsrc/main/java/slimeknights/mantle/data/loadable/field/ContextField.java
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable8.java (diff)
The file was addedsrc/main/java/slimeknights/mantle/data/loadable/field/ContextKey.java
The file was addedsrc/main/java/slimeknights/mantle/data/loadable/field/RecordField.java
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable5.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable10.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable2.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable14.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable3.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable12.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/mapping/CompactLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable15.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable7.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/mapping/MappedLoadable.java (diff)
Commit 1fdf5d22584f1a8d459ec1d1d3d4ec85e2c5d9da by KnightMiner
Make collection loadable error during datagen if given too many elements

We never want to datagen a combination that is illegal to parse, defeats the whole purpose of datagen
Does not currently validate network in the same way, partly as if you got that far you should be valid, partly as a vew casees with custom networking can get weird behavior, like empty tags syncing as an empty set
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/mapping/CollectionLoadable.java (diff)
Commit a33309837c6d17fc88ab87768aebf692dd505a2c by KnightMiner
Implement EitherLoadable

This is designed for things like FluidIngredient and EntityIngredient that have multiple forms controlled by subclasses. USing this let me much simplify the impl for both getting loadables
I did not use it for ItemOutput as that one wants 4 different loadable variants, which conflicts with how the either internals work. Only way to deal with this breaks the datagen only ingredients so I figured I'd stick with what works.
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/ingredient/FluidContainerIngredient.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/ingredient/EntityIngredient.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/ingredient/FluidIngredient.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/fluid/tooltip/FluidTooltipHandler.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/data/FluidNameIngredient.java (diff)
The file was addedsrc/main/java/slimeknights/mantle/data/loadable/IAmLoadable.java
The file was addedsrc/main/java/slimeknights/mantle/data/loadable/mapping/EitherLoadable.java
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/Loadables.java (diff)
Commit 414ee41af285dca35a4f89e0f36dd94cbe41ce46 by KnightMiner
Implement SizedIngredient loadable

Uses new TryDirectField, like DirectField but for a loadable that is not strictly an object, only saves into the object if its safe to do so
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/ingredient/SizedIngredient.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/Loadable.java (diff)
The file was addedsrc/main/java/slimeknights/mantle/data/loadable/field/TryDirectField.java
Commit 576da2bb63fe48e1f478fef9a50bbdbac9e7e71a by KnightMiner
Fix reading item stacks from network reading with size 0 if count is unspecified

Holdover from when I supported fixed sizes of values besides 1
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/ItemStackLoadable.java (diff)
Commit 92f453ec79528af8397ae412b93fd4e12e2c231d by KnightMiner
Expand debug info on logging recipe serializer

On serialization, print the recipe ID, type, and class. On deserialization, print the recipe ID, and in loadable serializers print the type (if type aware) and the loadable. Makes it easier ot identify which recipe is failing.
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/helper/LoadableRecipeSerializer.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/helper/LoggingRecipeSerializer.java (diff)
Commit c536ba21ae5f411609a7f967f9274461dbd8ee58 by KnightMiner
Rename FriendlyByteBuffer methods on Loadable to match StreamCodec

Saves me from doing a refactor later making it less effort for addons to update that directly call the methods.
As part of implementation, created Streamable, which is a less generic version of StreamCodec. I would just use StreamCodec but it has the minor issue of not existing.
EitherLoadable now uses streamable instead of loadable for its network logic as that makes it easier to implement a custom variant.
GenericLoaderRegistry and GenericNamedComponent both have their methods updated to the new name with the old ones kept around as deprecated.
This commit also marks the deprecation of IGenericLoader, come 1.20 I'll be making GenericLoaderRegistry a registry of RecordLoadable.
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/primitive/BooleanLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/RecordField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable13.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable12.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable8.java (diff)
The file was addedsrc/main/java/slimeknights/mantle/data/loadable/Streamable.java
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/primitive/IntLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/ingredient/FluidIngredient.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/Loadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/mapping/CollectionLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/mapping/EitherLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable15.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/registry/NamedComponentRegistry.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/primitive/StringLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/primitive/FloatLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/IngredientLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable5.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable11.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/BlockStateLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable2.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/ItemStackLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/mapping/MappedLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/RegistryLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/ContextField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/ingredient/EntityIngredient.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/helper/LoadableRecipeSerializer.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/NBTLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable7.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/ingredient/SizedIngredient.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/LoadableField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable14.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable9.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/CodecLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/mapping/CompactLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable4.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/DirectField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/primitive/EnumLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/predicate/block/BlockPropertiesPredicate.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/helper/ItemOutput.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable3.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/NullableField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable10.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable16.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/field/AlwaysPresentLoadableField.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/registry/DefaultingLoaderRegistry.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable6.java (diff)
The file was addedsrc/main/java/slimeknights/mantle/data/loadable/ContextStreamable.java
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/ColorLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable1.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/registry/GenericLoaderRegistry.java (diff)
Commit 80ee8f9b5a2e6091579795e3ba9032b3847b4245 by KnightMiner
Add a custom nullable field implementation to NamedComponentRegistry

Since its got its own optional byte buffer methods, might as well support it
The file was modifiedsrc/main/java/slimeknights/mantle/data/registry/NamedComponentRegistry.java (diff)