Package com.minecolonies.core.research
Class LocalResearchFactory
java.lang.Object
com.minecolonies.core.research.LocalResearchFactory
- All Implemented Interfaces:
IFactory<FactoryVoidInput,,ILocalResearch> ILocalResearchFactory
Factory implementation taking care of creating new instances, serializing and deserializing LocalResearch.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull ILocalResearchdeserialize(@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<FactoryVoidInput>Used to determine which type this can produce.@NotNull com.google.common.reflect.TypeToken<LocalResearch>Method to get the type this factory can produce.@NotNull ILocalResearchgetNewInstance(net.minecraft.resources.ResourceLocation id, net.minecraft.resources.ResourceLocation branch, int depth) Method to get a new Instance of a Research.shortGet a serialization id for the factory.@NotNull net.minecraft.nbt.CompoundTagserialize(@NotNull IFactoryController controller, @NotNull ILocalResearch research) Method to serialize a given constructable.voidserialize(IFactoryController controller, ILocalResearch 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.ILocalResearchFactory
getNewInstance
-
Constructor Details
-
LocalResearchFactory
public LocalResearchFactory()
-
-
Method Details
-
getFactoryOutputType
Description copied from interface:IFactoryMethod to get the type this factory can produce.- Specified by:
getFactoryOutputTypein interfaceIFactory<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:IFactoryUsed to determine which type this can produce.- Specified by:
getFactoryInputTypein interfaceIFactory<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:ILocalResearchFactoryMethod to get a new Instance of a Research.- Specified by:
getNewInstancein interfaceILocalResearchFactory- 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:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<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:IFactoryMethod to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<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:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<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:IFactoryMethod to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<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:IFactoryGet a serialization id for the factory.- Specified by:
getSerializationIdin interfaceIFactory<FactoryVoidInput,ILocalResearch> - Returns:
- the short id.
-