Class EntityLocation.Factory
java.lang.Object
com.minecolonies.core.colony.requestsystem.locations.EntityLocation.Factory
- All Implemented Interfaces:
IFactory<net.minecraft.world.entity.Entity,,EntityLocation> ILocationFactory<net.minecraft.world.entity.Entity,EntityLocation>
- Enclosing class:
EntityLocation
public static class EntityLocation.Factory
extends Object
implements ILocationFactory<net.minecraft.world.entity.Entity,EntityLocation>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(IFactoryController controller, net.minecraft.network.RegistryFriendlyByteBuf buffer) Method to deserialize a given constructable.@NotNull EntityLocationdeserialize(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<net.minecraft.world.entity.Entity> Used to determine which type this can produce.@NotNull com.google.common.reflect.TypeToken<EntityLocation> Method to get the type this factory can produce.@NotNull EntityLocationgetNewInstance(@NotNull IFactoryController factoryController, @NotNull net.minecraft.world.entity.Entity input) Method to get a new instance of a location given the input.shortGet a serialization id for the factory.voidserialize(IFactoryController controller, EntityLocation input, 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 EntityLocation request) 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.colony.requestsystem.location.ILocationFactory
getNewInstance
-
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.world.entity.Entity,EntityLocation> - Returns:
- The type of request this factory can produce.
-
getFactoryInputType
@NotNull public @NotNull com.google.common.reflect.TypeToken<net.minecraft.world.entity.Entity> getFactoryInputType()Description copied from interface:IFactoryUsed to determine which type this can produce.- Specified by:
getFactoryInputTypein interfaceIFactory<net.minecraft.world.entity.Entity,EntityLocation> - Returns:
- The class that represents the Type of Request this can produce.
-
serialize
@NotNull public @NotNull net.minecraft.nbt.CompoundTag serialize(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull IFactoryController controller, @NotNull @NotNull EntityLocation request) Method to serialize a given constructable.- Specified by:
serializein interfaceIFactory<net.minecraft.world.entity.Entity,EntityLocation> - 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 EntityLocation deserialize(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull IFactoryController controller, @NotNull @NotNull net.minecraft.nbt.CompoundTag nbt) Method to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<net.minecraft.world.entity.Entity,EntityLocation> - 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 EntityLocation getNewInstance(@NotNull @NotNull IFactoryController factoryController, @NotNull @NotNull net.minecraft.world.entity.Entity input) Method to get a new instance of a location given the input.- Specified by:
getNewInstancein interfaceILocationFactory<net.minecraft.world.entity.Entity,EntityLocation> - Parameters:
factoryController- TheIFactoryControllerthat called this method.input- The input to build a new location for.- Returns:
- The new output instance for a given input.
-
serialize
public void serialize(IFactoryController controller, EntityLocation input, net.minecraft.network.RegistryFriendlyByteBuf packetBuffer) Description copied from interface:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<net.minecraft.world.entity.Entity,EntityLocation> - 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 EntityLocation deserialize(IFactoryController controller, net.minecraft.network.RegistryFriendlyByteBuf buffer) throws Throwable Description copied from interface:IFactoryMethod to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<net.minecraft.world.entity.Entity,EntityLocation> - 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<net.minecraft.world.entity.Entity,EntityLocation> - Returns:
- the short id.
-