Class GlobalResearchFactory

java.lang.Object
com.minecolonies.core.research.GlobalResearchFactory
All Implemented Interfaces:
IFactory<FactoryVoidInput,IGlobalResearch>, IGlobalResearchFactory

public class GlobalResearchFactory extends Object implements IGlobalResearchFactory
Factory implementation taking care of creating new instances, serializing and deserializing GlobalResearch.
  • Constructor Details

    • GlobalResearchFactory

      public GlobalResearchFactory()
  • Method Details

    • getFactoryOutputType

      @NotNull public @NotNull com.google.common.reflect.TypeToken<GlobalResearch> getFactoryOutputType()
      Description copied from interface: IFactory
      Method to get the type this factory can produce.
      Specified by:
      getFactoryOutputType in interface IFactory<FactoryVoidInput,IGlobalResearch>
      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,IGlobalResearch>
      Returns:
      The class that represents the Type of Request this can produce.
    • getNewInstance

      @NotNull public @NotNull IGlobalResearch getNewInstance(net.minecraft.resources.ResourceLocation id, net.minecraft.resources.ResourceLocation parent, net.minecraft.resources.ResourceLocation branch, net.minecraft.network.chat.contents.TranslatableContents name, net.minecraft.network.chat.contents.TranslatableContents subtitle, int depth, int sortOrder, boolean onlyChild, boolean hidden, boolean autostart, boolean instant, boolean immutable)
      Description copied from interface: IGlobalResearchFactory
      Method to get a new Instance of research.
      Specified by:
      getNewInstance in interface IGlobalResearchFactory
      Parameters:
      id - its id.
      parent - the research's parent, if one is present, or null if not.
      branch - the branch it is on.
      name - the optional name of the research. If empty, a key generated from the id will be used instead.
      subtitle - the optional short description of the research, in plaintext or as a translation key.
      depth - the depth in the tree.
      sortOrder - the relative vertical order of the research's display, in relation to its siblings.
      onlyChild - if the research allows only one child research to be completed.
      hidden - if the research is only visible when eligible to be researched.
      autostart - if the research should begin automatically, or notify the player, when it is eligible.
      instant - if the research should be completed instantly (ish) from when begun.
      immutable - if the research can not be reset once unlocked.
      Returns:
      a new instance of research.
    • serialize

      @NotNull public @NotNull net.minecraft.nbt.CompoundTag serialize(@NotNull @NotNull IFactoryController controller, @NotNull @NotNull IGlobalResearch research)
      Description copied from interface: IFactory
      Method to serialize a given constructable.
      Specified by:
      serialize in interface IFactory<FactoryVoidInput,IGlobalResearch>
      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 IGlobalResearch 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,IGlobalResearch>
      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(@NotNull @NotNull IFactoryController controller, IGlobalResearch input, net.minecraft.network.FriendlyByteBuf packetBuffer)
      Description copied from interface: IFactory
      Method to serialize a given constructable.
      Specified by:
      serialize in interface IFactory<FactoryVoidInput,IGlobalResearch>
      Parameters:
      controller - The controller that can be used to serialize complicated types.
      input - The request to serialize.
      packetBuffer - The buffer to serialize into.
    • deserialize

      @NotNull public @NotNull IGlobalResearch deserialize(@NotNull @NotNull 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,IGlobalResearch>
      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,IGlobalResearch>
      Returns:
      the short id.