Class StandardRequestFactories.FoodRequestFactory

java.lang.Object
com.minecolonies.core.colony.requestsystem.requests.StandardRequestFactories.FoodRequestFactory
All Implemented Interfaces:
IFactory<Food,StandardRequests.FoodRequest>, IRequestFactory<Food,StandardRequests.FoodRequest>
Enclosing class:
StandardRequestFactories

public static final class StandardRequestFactories.FoodRequestFactory extends Object implements IRequestFactory<Food,StandardRequests.FoodRequest>
  • Constructor Details

    • FoodRequestFactory

      public FoodRequestFactory()
  • Method Details

    • getNewInstance

      public StandardRequests.FoodRequest getNewInstance(@NotNull @NotNull Food input, @NotNull @NotNull IRequester location, @NotNull @NotNull IToken<?> token, @NotNull @NotNull RequestState initialState)
      Description copied from interface: IRequestFactory
      Method to get a new instance of a request given the input and token.
      Specified by:
      getNewInstance in interface IRequestFactory<Food,StandardRequests.FoodRequest>
      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

      @NotNull public @NotNull com.google.common.reflect.TypeToken<? extends StandardRequests.FoodRequest> getFactoryOutputType()
      Description copied from interface: IFactory
      Method to get the type this factory can produce.
      Specified by:
      getFactoryOutputType in interface IFactory<Food,StandardRequests.FoodRequest>
      Returns:
      The type of request this factory can produce.
    • getFactoryInputType

      @NotNull public @NotNull com.google.common.reflect.TypeToken<? extends Food> getFactoryInputType()
      Description copied from interface: IFactory
      Used to determine which type this can produce.
      Specified by:
      getFactoryInputType in interface IFactory<Food,StandardRequests.FoodRequest>
      Returns:
      The class that represents the Type of Request this can produce.
    • serialize

      @NotNull public @NotNull net.minecraft.nbt.CompoundTag serialize(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull IFactoryController controller, @NotNull StandardRequests.FoodRequest request)
      Description copied from interface: IFactory
      Method to serialize a given constructable.
      Specified by:
      serialize in interface IFactory<Food,StandardRequests.FoodRequest>
      Parameters:
      controller - The controller that can be used to serialize complicated types.
      request - The request to serialize.
      Returns:
      The serialized data of the given requets.
    • deserialize

      @NotNull public StandardRequests.FoodRequest deserialize(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull IFactoryController controller, @NotNull @NotNull net.minecraft.nbt.CompoundTag nbt)
      Description copied from interface: IFactory
      Method to deserialize a given constructable.
      Specified by:
      deserialize in interface IFactory<Food,StandardRequests.FoodRequest>
      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
    • serialize

      public void serialize(IFactoryController controller, StandardRequests.FoodRequest input, net.minecraft.network.RegistryFriendlyByteBuf packetBuffer)
      Description copied from interface: IFactory
      Method to serialize a given constructable.
      Specified by:
      serialize in interface IFactory<Food,StandardRequests.FoodRequest>
      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 StandardRequests.FoodRequest deserialize(IFactoryController controller, net.minecraft.network.RegistryFriendlyByteBuf buffer) throws Throwable
      Description copied from interface: IFactory
      Method to deserialize a given constructable.
      Specified by:
      deserialize in interface IFactory<Food,StandardRequests.FoodRequest>
      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:
      Throwable
    • getSerializationId

      public short getSerializationId()
      Description copied from interface: IFactory
      Get a serialization id for the factory.
      Specified by:
      getSerializationId in interface IFactory<Food,StandardRequests.FoodRequest>
      Returns:
      the short id.