Class ItemStorageFactory
java.lang.Object
com.minecolonies.core.colony.crafting.ItemStorageFactory
- All Implemented Interfaces:
IFactory<FactoryVoidInput,,ItemStorage> IItemStorageFactory
Factory implementation taking care of creating new instances, serializing and deserializing ItemStorage.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(IFactoryController controller, net.minecraft.network.RegistryFriendlyByteBuf buffer) Method to deserialize a given constructable.@NotNull ItemStoragedeserialize(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<FactoryVoidInput> Used to determine which type this can produce.@NotNull com.google.common.reflect.TypeToken<ItemStorage> Method to get the type this factory can produce.@NotNull ItemStoragegetNewInstance(@NotNull net.minecraft.world.item.ItemStack stack, int size, boolean ignoreDamage, boolean ignoreNBT) Method to get a new Instance of an itemStorage.shortGet a serialization id for the factory.voidserialize(IFactoryController controller, ItemStorage 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 ItemStorage storage) 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.crafting.IItemStorageFactory
getNewInstance
-
Constructor Details
-
ItemStorageFactory
public ItemStorageFactory()
-
-
Method Details
-
getFactoryOutputType
Description copied from interface:IFactoryMethod to get the type this factory can produce.- Specified by:
getFactoryOutputTypein interfaceIFactory<FactoryVoidInput,ItemStorage> - 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,ItemStorage> - Returns:
- The class that represents the Type of Request this can produce.
-
getNewInstance
@NotNull public @NotNull ItemStorage getNewInstance(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, int size, boolean ignoreDamage, boolean ignoreNBT) Description copied from interface:IItemStorageFactoryMethod to get a new Instance of an itemStorage.- Specified by:
getNewInstancein interfaceIItemStorageFactory- Parameters:
stack- the input.size- the grid size.- Returns:
- a new Instance of ItemStorage.
-
serialize
@NotNull public @NotNull net.minecraft.nbt.CompoundTag serialize(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull IFactoryController controller, @NotNull @NotNull ItemStorage storage) Description copied from interface:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<FactoryVoidInput,ItemStorage> - Parameters:
controller- The controller that can be used to serialize complicated types.storage- The request to serialize.- Returns:
- The serialized data of the given requets.
-
deserialize
@NotNull public @NotNull ItemStorage 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<FactoryVoidInput,ItemStorage> - 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, ItemStorage input, net.minecraft.network.RegistryFriendlyByteBuf packetBuffer) Description copied from interface:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<FactoryVoidInput,ItemStorage> - 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 ItemStorage deserialize(IFactoryController controller, net.minecraft.network.RegistryFriendlyByteBuf buffer) throws Throwable Description copied from interface:IFactoryMethod to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<FactoryVoidInput,ItemStorage> - 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<FactoryVoidInput,ItemStorage> - Returns:
- the short id.
-