Changes

Summary

  1. Delete the generic 1 field loaders (details)
  2. Make mapped loadable map record loadables into record loadables (details)
  3. Implement compact loadable (details)
  4. Provide a special nullable NBT field for NBTLoadable (details)
  5. Cleanup implementations of fluid stack and item stack loadables (details)
  6. Rework default field a bit (details)
  7. Improve ItemOutput serialization and deserialization (details)
  8. Remove unused GSON instance in AddEntryLootModifier (details)
  9. Fix missing return keyword (details)
  10. Add a method to ItemOutput to support tag outputs (details)
  11. Create DefaultLoaderRegisty for the defualt instance logic (details)
  12. Fix mistake in parsing element predicates in fallback predicate registry (details)
Commit 87032a1079deca7ebd9c50aa06a24b5d8ec06ade by KnightMiner
Delete the generic 1 field loaders

Replaced by RecordLoadable and the various related loadables
The file was removedsrc/main/java/slimeknights/mantle/data/loader/EnumLoader.java
The file was removedsrc/main/java/slimeknights/mantle/data/loader/RegistryEntryLoader.java
The file was removedsrc/main/java/slimeknights/mantle/data/loader/TagKeyLoader.java
The file was removedsrc/main/java/slimeknights/mantle/data/loader/IntLoader.java
The file was removedsrc/main/java/slimeknights/mantle/data/loader/RegistrySetLoader.java
The file was removedsrc/main/java/slimeknights/mantle/data/loader/ResourceLocationLoader.java
The file was removedsrc/main/java/slimeknights/mantle/data/loader/NestedLoader.java
The file was removedsrc/main/java/slimeknights/mantle/data/loader/package-info.java
The file was removedsrc/main/java/slimeknights/mantle/data/loader/StringLoader.java
Commit 028395ae60e68f6023099b40dd40d1bd85146494 by KnightMiner
Make mapped loadable map record loadables into record loadables
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable.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/MappedLoadable.java (diff)
Commit 484f61a145285b2c40a41d75f608a22e0e63bf47 by KnightMiner
Implement compact loadable

This allows a record loadable to read its value from a primitive, and conditionally serialize to a primitive.
It technically would work for a list type as well and you can use the class for that, but did not add helpers for it (as there is no list loadable interface and compact can be deceptive on primitives)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/record/RecordLoadable.java (diff)
The file was addedsrc/main/java/slimeknights/mantle/data/loadable/mapping/CompactLoadable.java
Commit 57433b8352f98e54a913c58e85b643135d711569 by KnightMiner
Provide a special nullable NBT field for NBTLoadable

The packet buffer methods using NBT already are nullable, we made them non-null in NBTLoadable. However, if you want a nullable field, using them natively is more compact
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/NBTLoadable.java (diff)
Commit db7dfa92a04def4c249fc40d2bac3b8447f89a2d by KnightMiner
Cleanup implementations of fluid stack and item stack loadables

Instead of writing a full loadable from scratch, it uses record loadable builder methods (except for item stacks with NBT, which I had to special case due to a dumb forge API)
Takes advantage of the new record mapping, and the new compact loadable.
In addition, both item and fluid stacks support fixed size variants, which will ignore count in JSON in favor of a fixed size (1 for items, 1000 for fluids, though a method exists to let you choose other sizes)
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/FluidStackLoadable.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/common/ItemStackLoadable.java (diff)
Commit a32ab47a553305294420b7d7a56f56d5568edef2 by KnightMiner
Rework default field a bit

Loadable#field is now Loadable#requiredField to make it clear its a required field, will be going through usages and making sure all want required.
No longer override getAndDeserialize (now called getIfPresent) as that messes with some of the loadable builders (and notably cannot be built int). Plus, you might want to requrie a field that has its own default
Instead, going to encourage creation of custom defaultField impls without a default parameter for such usages
Loadable also now has a getOrDefault helper, same semantics as getIfPresent. Simplifies some field implementions
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/mapping/CollectionLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/predicate/entity/HasEnchantmentEntityPredicate.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/predicate/entity/MobTypePredicate.java (diff)
The file was removedsrc/main/java/slimeknights/mantle/data/loadable/field/NamedField.java
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/FluidStackLoadable.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/util/JsonHelper.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/registry/GenericLoaderRegistry.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/field/DefaultingField.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/common/IngredientLoadable.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/predicate/PredicateRegistry.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/predicate/RegistryPredicateRegistry.java (diff)
The file was addedsrc/main/java/slimeknights/mantle/data/loadable/field/RequiredField.java
The file was modifiedsrc/main/java/slimeknights/mantle/data/loadable/common/BlockStateLoadable.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/predicate/damage/SourceMessagePredicate.java (diff)
Commit ff3feff1d262fef3f3ec2b29898b5cf856a4f1a4 by KnightMiner
Improve ItemOutput serialization and deserialization

Now takes full advantage of ItemStackLoadable to allow 2 loading options:
* Optional output is now handled directly in the API, so you can have an ItemOutput that resolves to empty, or disallow that entirely. Note tag output may still resolve to empty due to an empty tag.
* Fixed count is now an option, as some cases using ItemOutput don't support stack sizes greater than 1 (e.g. casting recipes).

In addition, ItemOutput.EMPTY now exists for those wanting an empty instance, and the default serialize function takes a boolean for whether to write count.
Left the old networking logic in place for now, it will be less compact as it always writes count and writes a boolean for empty (instead of just using items.AIR for empty). However, its easier to invoke so figured I'd leave it until more stuff migrates to loadables
The file was modifiedsrc/main/java/slimeknights/mantle/fluid/transfer/EmptyFluidContainerTransfer.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/loot/ReplaceItemLootModifier.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/fluid/transfer/FillFluidContainerTransfer.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/data/ItemNameOutput.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/helper/ItemOutput.java (diff)
Commit a748ac455b5f7ac310ceeb23609ad593f56ada0d by KnightMiner
Remove unused GSON instance in AddEntryLootModifier
The file was modifiedsrc/main/java/slimeknights/mantle/loot/AddEntryLootModifier.java (diff)
Commit 724fb39fe9bbcfe5d4621eca5916afb15ed48ebf by KnightMiner
Fix missing return keyword
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/helper/ItemOutput.java (diff)
Commit 0575f4f0ac53e585432ff9fb3e1475a3641d4008 by KnightMiner
Add a method to ItemOutput to support tag outputs
The file was modifiedsrc/main/java/slimeknights/mantle/recipe/helper/ItemOutput.java (diff)
Commit 2efc708b4d8d18480ce5caa7cdacd4913d3a19f6 by KnightMiner
Create DefaultLoaderRegisty for the defualt instance logic

Lets me make all the stuff related to default not nullable/throw as I can guarantee its present by instance
The file was addedsrc/main/java/slimeknights/mantle/data/registry/DefaultingLoaderRegistry.java
The file was modifiedsrc/main/java/slimeknights/mantle/data/registry/GenericLoaderRegistry.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/predicate/FallbackPredicateRegistry.java (diff)
The file was modifiedsrc/main/java/slimeknights/mantle/data/predicate/PredicateRegistry.java (diff)
Commit 24a72f66a4fb4c7c2b3b62d298cfa7aec3aae147 by KnightMiner
Fix mistake in parsing element predicates in fallback predicate registry
The file was modifiedsrc/main/java/slimeknights/mantle/data/predicate/FallbackPredicateRegistry.java (diff)