Class StaticLocation.Factory
java.lang.Object
com.minecolonies.core.colony.requestsystem.locations.StaticLocation.Factory
- All Implemented Interfaces:
IFactory<net.minecraft.core.BlockPos,,StaticLocation> ILocationFactory<net.minecraft.core.BlockPos,StaticLocation>
- Enclosing class:
- StaticLocation
public static class StaticLocation.Factory
extends Object
implements ILocationFactory<net.minecraft.core.BlockPos,StaticLocation>
Internal factory class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull StaticLocationdeserialize(@NotNull IFactoryController controller, @NotNull net.minecraft.nbt.CompoundTag nbt) Method to deserialize a given constructable.@NotNull StaticLocationdeserialize(@NotNull IFactoryController controller, @NotNull net.minecraft.network.FriendlyByteBuf buffer) Method to deserialize a given constructable.@NotNull com.google.common.reflect.TypeToken<net.minecraft.core.BlockPos>Used to determine which type this can produce.@NotNull com.google.common.reflect.TypeToken<StaticLocation>Method to get the type this factory can produce.@NotNull StaticLocationgetNewInstance(@NotNull IFactoryController factoryController, @NotNull net.minecraft.core.BlockPos input) Method to get a new instance of a location given the input.@NotNull StaticLocationgetNewInstance(@NotNull IFactoryController factoryController, @NotNull net.minecraft.core.BlockPos blockPos, @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.@NotNull net.minecraft.nbt.CompoundTagserialize(@NotNull IFactoryController controller, @NotNull StaticLocation request) Method to serialize a given constructable.voidserialize(@NotNull IFactoryController controller, @NotNull StaticLocation input, net.minecraft.network.FriendlyByteBuf packetBuffer) Method to serialize a given constructable.
-
Constructor Details
-
Factory
public Factory()
-
-
Method Details
-
getFactoryOutputType
Description copied from interface:IFactoryMethod to get the type this factory can produce.- Specified by:
getFactoryOutputTypein interfaceIFactory<net.minecraft.core.BlockPos,StaticLocation> - Returns:
- The type of request this factory can produce.
-
getFactoryInputType
@NotNull public @NotNull com.google.common.reflect.TypeToken<net.minecraft.core.BlockPos> getFactoryInputType()Description copied from interface:IFactoryUsed to determine which type this can produce.- Specified by:
getFactoryInputTypein interfaceIFactory<net.minecraft.core.BlockPos,StaticLocation> - Returns:
- The class that represents the Type of Request this can produce.
-
serialize
@NotNull public @NotNull net.minecraft.nbt.CompoundTag serialize(@NotNull @NotNull IFactoryController controller, @NotNull @NotNull StaticLocation request) Method to serialize a given constructable.- Specified by:
serializein interfaceIFactory<net.minecraft.core.BlockPos,StaticLocation> - Parameters:
controller- The controller that can be used to serialize complicated types.request- The request to serialize.- Returns:
- The serialized data of the given requets.
-
deserialize
@NotNull public @NotNull StaticLocation deserialize(@NotNull @NotNull IFactoryController controller, @NotNull @NotNull net.minecraft.nbt.CompoundTag nbt) Method to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<net.minecraft.core.BlockPos,StaticLocation> - 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
-
getNewInstance
@NotNull public @NotNull StaticLocation getNewInstance(@NotNull @NotNull IFactoryController factoryController, @NotNull @NotNull net.minecraft.core.BlockPos blockPos, @NotNull @NotNull Object... context) Description copied from interface:ILocationFactoryMethod to get a new instance of the output given the input and additional context data.- Specified by:
getNewInstancein interfaceIFactory<net.minecraft.core.BlockPos,StaticLocation> - Specified by:
getNewInstancein interfaceILocationFactory<net.minecraft.core.BlockPos,StaticLocation> - Parameters:
factoryController- TheIFactoryControllerthat called this factory method.blockPos- The input to build a new output for.context- The context of the location.- Returns:
- The new output instance for a given input.
-
getNewInstance
@NotNull public @NotNull StaticLocation getNewInstance(@NotNull @NotNull IFactoryController factoryController, @NotNull @NotNull net.minecraft.core.BlockPos input) Method to get a new instance of a location given the input. Method not used in this factory.- Specified by:
getNewInstancein interfaceILocationFactory<net.minecraft.core.BlockPos,StaticLocation> - Parameters:
input- The input to build a new location for.factoryController- TheIFactoryControllerthat called this factory method.- Returns:
- The new output instance for a given input.
-
serialize
public void serialize(@NotNull @NotNull IFactoryController controller, @NotNull @NotNull StaticLocation input, net.minecraft.network.FriendlyByteBuf packetBuffer) Description copied from interface:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<net.minecraft.core.BlockPos,StaticLocation> - 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 StaticLocation deserialize(@NotNull @NotNull IFactoryController controller, @NotNull @NotNull net.minecraft.network.FriendlyByteBuf buffer) throws Throwable Description copied from interface:IFactoryMethod to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<net.minecraft.core.BlockPos,StaticLocation> - 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<net.minecraft.core.BlockPos,StaticLocation> - Returns:
- the short id.
-