Class StandardRequestFactories.AbstractCraftingRequestFactory<C extends AbstractCrafting,R extends StandardRequests.AbstractCraftingRequest<C>>
java.lang.Object
com.minecolonies.core.colony.requestsystem.requests.StandardRequestFactories.AbstractCraftingRequestFactory<C,R>
- All Implemented Interfaces:
IFactory<C,,R> IRequestFactory<C,R>
- Direct Known Subclasses:
StandardRequestFactories.PrivateCraftingRequestFactory,StandardRequestFactories.PublicCraftingRequestFactory
- Enclosing class:
- StandardRequestFactories
public abstract static class StandardRequestFactories.AbstractCraftingRequestFactory<C extends AbstractCrafting,R extends StandardRequests.AbstractCraftingRequest<C>>
extends Object
implements IRequestFactory<C,R>
-
Field Summary
Fields inherited from interface com.minecolonies.api.colony.requestsystem.request.IRequestFactory
NUMBER_OF_PROPERTIES -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCraftingRequestFactory(StandardRequestFactories.IObjectConstructor<C, R> constructor, Class<C> cClass, Class<R> rClass, StandardRequestFactories.IObjectToNBTConverter<C> nbtSerializer, StandardRequestFactories.INBTToObjectConverter<C> nbtDeserializer, StandardRequestFactories.IObjectToPackBufferWriter<C> packetSerializer, StandardRequestFactories.IFriendlyByteBufToObjectReader<C> packetDeserializer) -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(@NotNull IFactoryController controller, @NotNull net.minecraft.nbt.CompoundTag nbt) Method to deserialize a given constructable.deserialize(IFactoryController controller, net.minecraft.network.FriendlyByteBuf buffer) Method to deserialize a given constructable.@NotNull com.google.common.reflect.TypeToken<? extends C>Used to determine which type this can produce.@NotNull com.google.common.reflect.TypeToken<? extends R>Method to get the type this factory can produce.getNewInstance(C input, @NotNull IRequester location, @NotNull IToken<?> token, @NotNull RequestState initialState) Method to get a new instance of a request given the input and token.@NotNull net.minecraft.nbt.CompoundTagserialize(@NotNull IFactoryController controller, R r) Method to serialize a given constructable.voidserialize(IFactoryController controller, R input, net.minecraft.network.FriendlyByteBuf packetBuffer) Method to serialize a given constructable.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.requestsystem.factory.IFactory
getSerializationIdMethods inherited from interface com.minecolonies.api.colony.requestsystem.request.IRequestFactory
getNewInstance, getNewInstance
-
Constructor Details
-
AbstractCraftingRequestFactory
protected AbstractCraftingRequestFactory(StandardRequestFactories.IObjectConstructor<C, R> constructor, Class<C> cClass, Class<R> rClass, StandardRequestFactories.IObjectToNBTConverter<C> nbtSerializer, StandardRequestFactories.INBTToObjectConverter<C> nbtDeserializer, StandardRequestFactories.IObjectToPackBufferWriter<C> packetSerializer, StandardRequestFactories.IFriendlyByteBufToObjectReader<C> packetDeserializer)
-
-
Method Details
-
getNewInstance
public R getNewInstance(@NotNull C input, @NotNull @NotNull IRequester location, @NotNull @NotNull IToken<?> token, @NotNull @NotNull RequestState initialState) Description copied from interface:IRequestFactoryMethod to get a new instance of a request given the input and token.- Specified by:
getNewInstancein interfaceIRequestFactory<C extends AbstractCrafting,R extends StandardRequests.AbstractCraftingRequest<C>> - Parameters:
input- The input to build a new request for.location- the location of the requester.token- The token to build the request from.initialState- The initial state of the request request.- Returns:
- The new output instance for a given input.
-
getFactoryOutputType
Description copied from interface:IFactoryMethod to get the type this factory can produce.- Specified by:
getFactoryOutputTypein interfaceIFactory<C extends AbstractCrafting,R extends StandardRequests.AbstractCraftingRequest<C>> - Returns:
- The type of request this factory can produce.
-
getFactoryInputType
Description copied from interface:IFactoryUsed to determine which type this can produce.- Specified by:
getFactoryInputTypein interfaceIFactory<C extends AbstractCrafting,R extends StandardRequests.AbstractCraftingRequest<C>> - Returns:
- The class that represents the Type of Request this can produce.
-
serialize
@NotNull public @NotNull net.minecraft.nbt.CompoundTag serialize(@NotNull @NotNull IFactoryController controller, @NotNull R r) Description copied from interface:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<C extends AbstractCrafting,R extends StandardRequests.AbstractCraftingRequest<C>> - Parameters:
controller- The controller that can be used to serialize complicated types.r- The request to serialize.- Returns:
- The serialized data of the given requets.
-
deserialize
@NotNull public R deserialize(@NotNull @NotNull IFactoryController controller, @NotNull @NotNull net.minecraft.nbt.CompoundTag nbt) throws Throwable Description copied from interface:IFactoryMethod to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<C extends AbstractCrafting,R extends StandardRequests.AbstractCraftingRequest<C>> - Parameters:
controller- The controller that can be used to deserialize complicated types.nbt- The data of the request that should be deserialized.- Returns:
- The request that corresponds with the given data in the nbt
- Throws:
Exception- if somethings goes wrong during the deserialization.Throwable
-
serialize
public void serialize(IFactoryController controller, R input, net.minecraft.network.FriendlyByteBuf packetBuffer) Description copied from interface:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<C extends AbstractCrafting,R extends StandardRequests.AbstractCraftingRequest<C>> - Parameters:
controller- The controller that can be used to serialize complicated types.input- The request to serialize.packetBuffer- The buffer to serialize into.
-
deserialize
public R deserialize(IFactoryController controller, net.minecraft.network.FriendlyByteBuf buffer) throws Throwable Description copied from interface:IFactoryMethod to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<C extends AbstractCrafting,R extends StandardRequests.AbstractCraftingRequest<C>> - Parameters:
controller- The controller that can be used to deserialize complicated types.buffer- The data buffer of the request that should be deserialized.- Returns:
- The request that corresponds with the given data in the nbt
- Throws:
Exception- if somethings goes wrong during the deserialization.Throwable
-