Class LocalResearchFactory

java.lang.Object
com.minecolonies.core.research.LocalResearchFactory
All Implemented Interfaces:
IFactory<FactoryVoidInput,ILocalResearch>, ILocalResearchFactory

public class LocalResearchFactory extends Object implements ILocalResearchFactory
Factory implementation taking care of creating new instances, serializing and deserializing LocalResearch.
  • Constructor Details

    • LocalResearchFactory

      public LocalResearchFactory()
  • Method Details

    • getFactoryOutputType

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

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

      @NotNull public @NotNull ILocalResearch getNewInstance(net.minecraft.resources.ResourceLocation id, net.minecraft.resources.ResourceLocation branch, int depth)
      Description copied from interface: ILocalResearchFactory
      Method to get a new Instance of a Research.
      Specified by:
      getNewInstance in interface ILocalResearchFactory
      Parameters:
      id - the id.
      branch - the branch.
      depth - the depth.
      Returns:
      a new Instance of Research.
    • serialize

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

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

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