Package com.minecolonies.core.research
Class GlobalResearchFactory
java.lang.Object
com.minecolonies.core.research.GlobalResearchFactory
- All Implemented Interfaces:
IFactory<FactoryVoidInput,,IGlobalResearch> IGlobalResearchFactory
Factory implementation taking care of creating new instances, serializing and deserializing GlobalResearch.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull IGlobalResearchdeserialize(@NotNull IFactoryController controller, @NotNull net.minecraft.nbt.CompoundTag nbt) Method to deserialize a given constructable.@NotNull IGlobalResearchdeserialize(@NotNull IFactoryController controller, net.minecraft.network.FriendlyByteBuf buffer) Method to deserialize a given constructable.@NotNull com.google.common.reflect.TypeToken<FactoryVoidInput>Used to determine which type this can produce.@NotNull com.google.common.reflect.TypeToken<GlobalResearch>Method to get the type this factory can produce.@NotNull IGlobalResearchgetNewInstance(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) Method to get a new Instance of research.shortGet a serialization id for the factory.@NotNull net.minecraft.nbt.CompoundTagserialize(@NotNull IFactoryController controller, @NotNull IGlobalResearch research) Method to serialize a given constructable.voidserialize(@NotNull IFactoryController controller, IGlobalResearch 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.research.factories.IGlobalResearchFactory
getNewInstance
-
Constructor Details
-
GlobalResearchFactory
public GlobalResearchFactory()
-
-
Method Details
-
getFactoryOutputType
Description copied from interface:IFactoryMethod to get the type this factory can produce.- Specified by:
getFactoryOutputTypein interfaceIFactory<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:IFactoryUsed to determine which type this can produce.- Specified by:
getFactoryInputTypein interfaceIFactory<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:IGlobalResearchFactoryMethod to get a new Instance of research.- Specified by:
getNewInstancein interfaceIGlobalResearchFactory- 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:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<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:IFactoryMethod to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<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:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<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:IFactoryMethod to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<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:IFactoryGet a serialization id for the factory.- Specified by:
getSerializationIdin interfaceIFactory<FactoryVoidInput,IGlobalResearch> - Returns:
- the short id.
-