Class BuildingBasedRequesterFactory
java.lang.Object
com.minecolonies.core.colony.requestsystem.requesters.factories.BuildingBasedRequesterFactory
- All Implemented Interfaces:
IFactory<AbstractBuilding,BuildingBasedRequester>
public class BuildingBasedRequesterFactory
extends Object
implements IFactory<AbstractBuilding,BuildingBasedRequester>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(IFactoryController controller, net.minecraft.network.RegistryFriendlyByteBuf buffer) Method to deserialize a given constructable.@NotNull BuildingBasedRequesterdeserialize(net.minecraft.core.HolderLookup.Provider provider, @NotNull IFactoryController controller, @NotNull net.minecraft.nbt.CompoundTag nbt) Method to deserialize a given constructable.@NotNull com.google.common.reflect.TypeToken<? extends AbstractBuilding> Used to determine which type this can produce.@NotNull com.google.common.reflect.TypeToken<? extends BuildingBasedRequester> Method to get the type this factory can produce.@NotNull BuildingBasedRequestergetNewInstance(@NotNull IFactoryController factoryController, @NotNull AbstractBuilding building, @NotNull Object... context) Method to get a new instance of the output given the input and additional context data.shortGet a serialization id for the factory.voidserialize(IFactoryController controller, BuildingBasedRequester output, net.minecraft.network.RegistryFriendlyByteBuf packetBuffer) Method to serialize a given constructable.@NotNull net.minecraft.nbt.CompoundTagserialize(net.minecraft.core.HolderLookup.Provider provider, @NotNull IFactoryController controller, @NotNull BuildingBasedRequester output) Method to serialize a given constructable.
-
Constructor Details
-
BuildingBasedRequesterFactory
public BuildingBasedRequesterFactory()
-
-
Method Details
-
getFactoryOutputType
@NotNull public @NotNull com.google.common.reflect.TypeToken<? extends BuildingBasedRequester> getFactoryOutputType()Description copied from interface:IFactoryMethod to get the type this factory can produce.- Specified by:
getFactoryOutputTypein interfaceIFactory<AbstractBuilding,BuildingBasedRequester> - Returns:
- The type of request this factory can produce.
-
getFactoryInputType
@NotNull public @NotNull com.google.common.reflect.TypeToken<? extends AbstractBuilding> getFactoryInputType()Description copied from interface:IFactoryUsed to determine which type this can produce.- Specified by:
getFactoryInputTypein interfaceIFactory<AbstractBuilding,BuildingBasedRequester> - Returns:
- The class that represents the Type of Request this can produce.
-
getNewInstance
@NotNull public @NotNull BuildingBasedRequester getNewInstance(@NotNull @NotNull IFactoryController factoryController, @NotNull @NotNull AbstractBuilding building, @NotNull @NotNull Object... context) throws IllegalArgumentException Description copied from interface:IFactoryMethod to get a new instance of the output given the input and additional context data.- Specified by:
getNewInstancein interfaceIFactory<AbstractBuilding,BuildingBasedRequester> - Parameters:
factoryController- The controller calling this factory method.building- The input to build a new output for.context- The context of the request.- Returns:
- The new output instance for a given input.
- Throws:
IllegalArgumentException- is thrown when the factory cannot produce a new instance out of the given context and input.
-
serialize
@NotNull public @NotNull net.minecraft.nbt.CompoundTag serialize(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull IFactoryController controller, @NotNull @NotNull BuildingBasedRequester output) Description copied from interface:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<AbstractBuilding,BuildingBasedRequester> - Parameters:
controller- The controller that can be used to serialize complicated types.output- The request to serialize.- Returns:
- The serialized data of the given requets.
-
deserialize
@NotNull public @NotNull BuildingBasedRequester deserialize(@NotNull net.minecraft.core.HolderLookup.Provider provider, @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<AbstractBuilding,BuildingBasedRequester> - 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, BuildingBasedRequester output, net.minecraft.network.RegistryFriendlyByteBuf packetBuffer) Description copied from interface:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<AbstractBuilding,BuildingBasedRequester> - Parameters:
controller- The controller that can be used to serialize complicated types.output- The request to serialize.packetBuffer- The buffer to serialize into.
-
deserialize
public BuildingBasedRequester deserialize(IFactoryController controller, net.minecraft.network.RegistryFriendlyByteBuf buffer) throws Throwable Description copied from interface:IFactoryMethod to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<AbstractBuilding,BuildingBasedRequester> - 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:IFactoryGet a serialization id for the factory.- Specified by:
getSerializationIdin interfaceIFactory<AbstractBuilding,BuildingBasedRequester> - Returns:
- the short id.
-