Interface IFactory<Input,Output>
- Type Parameters:
Input- The input type.Output- The output type.
- All Known Subinterfaces:
IBlockSettingFactory<T>,IBoolSettingFactory<T>,IGlobalResearchFactory,IImmutableItemStorageFactory,IIntSettingFactory<T>,IItemStorageFactory,ILocalResearchFactory,ILocationFactory<T,,L> IRecipeSettingFactory<T>,IRecipeStorageFactory,IRequesterFactory<Input,,Output> IRequestFactory<T,,R> IRequestResolverFactory<Resolver>,IResearchEffectFactory<T>,IStringSettingFactory<T>,ITokenFactory<T,RT>
- All Known Implementing Classes:
AbstractTokenFactory,BuildingBasedRequesterFactory,BuildingRequestResolverFactory,DeliveryRequestResolverFactory,EntityLocation.Factory,GlobalResearchFactory,ImmutableItemStorageFactory,InitializedTokenFactory,IntegerFactory,ItemStorageFactory,LocalResearchFactory,PickupRequestResolverFactory,PrivateWorkerCraftingProductionResolverFactory,PrivateWorkerCraftingRequestResolverFactory,PublicWorkerCraftingProductionResolverFactory,PublicWorkerCraftingRequestResolverFactory,RandomSeededTokenFactory,RecipeStorageFactory,SettingsFactories.AbstractBoolSettingFactory,SettingsFactories.AbstractIntSettingFactory,SettingsFactories.AbstractStringSettingsFactory,SettingsFactories.BeekeeperCollectionSettingsFactory,SettingsFactories.BlockSettingFactory,SettingsFactories.BoolSettingFactory,SettingsFactories.BuilderModeSettingFactory,SettingsFactories.CrafterRecipeSettingFactory,SettingsFactories.DynamicTreesSettingFactory,SettingsFactories.GuardFollowModeSettingFactory,SettingsFactories.GuardPatrolModeSettingFactory,SettingsFactories.GuardTaskSettingFactory,SettingsFactories.IntSettingFactory,SettingsFactories.RecipeSettingFactory,SettingsFactories.StringSettingsFactory,SettingsFactories.StringWithDescSettingsFactory,StandardDataStoreManager.Factory,StandardPlayerRequestResolverFactory,StandardProviderRequestResolverAssignmentDataStore.Factory,StandardRequestableTypeRequestResolverAssignmentDataStore.Factory,StandardRequestFactories.AbstractCraftingRequestFactory,StandardRequestFactories.BurnableRequestFactory,StandardRequestFactories.DeliveryRequestFactory,StandardRequestFactories.FoodRequestFactory,StandardRequestFactories.ItemStackListRequestFactory,StandardRequestFactories.ItemStackRequestFactory,StandardRequestFactories.ItemTagRequestFactory,StandardRequestFactories.MinimumStackRequestFactory,StandardRequestFactories.PickupRequestFactory,StandardRequestFactories.PrivateCraftingRequestFactory,StandardRequestFactories.PublicCraftingRequestFactory,StandardRequestFactories.SmeltableOreRequestFactory,StandardRequestFactories.ToolRequestFactory,StandardRequestIdentitiesDataStore.Factory,StandardRequestResolverRequestAssignmentDataStore.Factory,StandardRequestResolversIdentitiesDataStore.Factory,StandardRequestSystemBuildingDataStore.Factory,StandardRequestSystemCrafterJobDataStore.Factory,StandardRequestSystemDeliveryManJobDataStore.Factory,StandardRetryingRequestResolverFactory,StandardTokenFactory,StaticLocation.Factory,StationRequestResolverFactory,TypeTokenFactory,WarehouseConcreteRequestResolverFactory,WarehouseRequestResolverFactory
public interface IFactory<Input,Output>
Interface used to describe factories.
-
Method Summary
Modifier and TypeMethodDescriptiondeserialize(@NotNull IFactoryController controller, @NotNull net.minecraft.nbt.CompoundTag nbt) Method to deserialize a given constructable.deserialize(@NotNull IFactoryController controller, @NotNull net.minecraft.network.FriendlyByteBuf buffer) Method to deserialize a given constructable.@NotNull com.google.common.reflect.TypeToken<? extends Input>Used to determine which type this can produce.@NotNull com.google.common.reflect.TypeToken<? extends Output>Method to get the type this factory can produce.getNewInstance(@NotNull IFactoryController factoryController, Input input, @NotNull Object... context) Method to get a new instance of the output given the input and additional context data.shortGet a serialization id for the factory.@NotNull net.minecraft.nbt.CompoundTagserialize(@NotNull IFactoryController controller, Output output) Method to serialize a given constructable.voidserialize(@NotNull IFactoryController controller, Output output, net.minecraft.network.FriendlyByteBuf packetBuffer) Method to serialize a given constructable.
-
Method Details
-
getFactoryOutputType
Method to get the type this factory can produce.- Returns:
- The type of request this factory can produce.
-
getFactoryInputType
Used to determine which type this can produce.- Returns:
- The class that represents the Type of Request this can produce.
-
getSerializationId
short getSerializationId()Get a serialization id for the factory.- Returns:
- the short id.
-
getNewInstance
@NotNull Output getNewInstance(@NotNull @NotNull IFactoryController factoryController, @NotNull Input input, @NotNull @NotNull Object... context) throws IllegalArgumentException Method to get a new instance of the output given the input and additional context data.- Parameters:
factoryController- The controller calling this factory method.input- The input to build a new output for.context- The context of the request.- Returns:
- The new output instance for a given input.
- Throws:
IllegalArgumentException- is thrown when the factory cannot produce a new instance out of the given context and input.
-
serialize
@NotNull @NotNull net.minecraft.nbt.CompoundTag serialize(@NotNull @NotNull IFactoryController controller, @NotNull Output output) Method to serialize a given constructable.- Parameters:
controller- The controller that can be used to serialize complicated types.output- The request to serialize.- Returns:
- The serialized data of the given requets.
-
deserialize
@NotNull Output deserialize(@NotNull @NotNull IFactoryController controller, @NotNull @NotNull net.minecraft.nbt.CompoundTag nbt) throws Throwable Method to deserialize a given constructable.- Parameters:
nbt- The data of the request that should be deserialized.controller- The controller that can be used to deserialize complicated types.- Returns:
- The request that corresponds with the given data in the nbt
- Throws:
Exception- if somethings goes wrong during the deserialization.Throwable
-
serialize
@NotNull void serialize(@NotNull @NotNull IFactoryController controller, @NotNull Output output, net.minecraft.network.FriendlyByteBuf packetBuffer) Method to serialize a given constructable.- Parameters:
controller- The controller that can be used to serialize complicated types.output- The request to serialize.packetBuffer- The buffer to serialize into.
-
deserialize
@NotNull Output deserialize(@NotNull @NotNull IFactoryController controller, @NotNull @NotNull net.minecraft.network.FriendlyByteBuf buffer) throws Throwable Method to deserialize a given constructable.- Parameters:
buffer- The data buffer of the request that should be deserialized.controller- The controller that can be used to deserialize complicated types.- Returns:
- The request that corresponds with the given data in the nbt
- Throws:
Exception- if somethings goes wrong during the deserialization.Throwable
-