Class ImmutableItemStorageFactory
java.lang.Object
com.minecolonies.core.colony.crafting.ImmutableItemStorageFactory
- All Implemented Interfaces:
IFactory<FactoryVoidInput,,ImmutableItemStorage> IImmutableItemStorageFactory
Factory implementation taking care of creating new instances, serializing and deserializing ImmutableItemStorage.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(IFactoryController controller, 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<? extends FactoryVoidInput>Used to determine which type this can produce.@NotNull com.google.common.reflect.TypeToken<? extends ImmutableItemStorage>Method to get the type this factory can produce.getNewInstance(net.minecraft.world.item.ItemStack stack, int size) Method to get a new Instance of an itemStorage.shortGet a serialization id for the factory.net.minecraft.nbt.CompoundTagserialize(IFactoryController controller, ImmutableItemStorage output) Method to serialize a given constructable.voidserialize(IFactoryController controller, ImmutableItemStorage output, 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.crafting.IImmutableItemStorageFactory
getNewInstance
-
Constructor Details
-
ImmutableItemStorageFactory
public ImmutableItemStorageFactory()
-
-
Method Details
-
getFactoryOutputType
@NotNull public @NotNull com.google.common.reflect.TypeToken<? extends ImmutableItemStorage> getFactoryOutputType()Description copied from interface:IFactoryMethod to get the type this factory can produce.- Specified by:
getFactoryOutputTypein interfaceIFactory<FactoryVoidInput,ImmutableItemStorage> - Returns:
- The type of request this factory can produce.
-
getFactoryInputType
@NotNull public @NotNull com.google.common.reflect.TypeToken<? extends FactoryVoidInput> getFactoryInputType()Description copied from interface:IFactoryUsed to determine which type this can produce.- Specified by:
getFactoryInputTypein interfaceIFactory<FactoryVoidInput,ImmutableItemStorage> - Returns:
- The class that represents the Type of Request this can produce.
-
getSerializationId
public short getSerializationId()Description copied from interface:IFactoryGet a serialization id for the factory.- Specified by:
getSerializationIdin interfaceIFactory<FactoryVoidInput,ImmutableItemStorage> - Returns:
- the short id.
-
serialize
public net.minecraft.nbt.CompoundTag serialize(IFactoryController controller, ImmutableItemStorage output) Description copied from interface:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<FactoryVoidInput,ImmutableItemStorage> - 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
public ImmutableItemStorage deserialize(IFactoryController controller, net.minecraft.nbt.CompoundTag nbt) throws Throwable Description copied from interface:IFactoryMethod to deserialize a given constructable.- Specified by:
deserializein interfaceIFactory<FactoryVoidInput,ImmutableItemStorage> - 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
- Throws:
Exception- if somethings goes wrong during the deserialization.Throwable
-
serialize
public void serialize(IFactoryController controller, ImmutableItemStorage output, net.minecraft.network.FriendlyByteBuf packetBuffer) Description copied from interface:IFactoryMethod to serialize a given constructable.- Specified by:
serializein interfaceIFactory<FactoryVoidInput,ImmutableItemStorage> - 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 ImmutableItemStorage 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,ImmutableItemStorage> - 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
-
getNewInstance
Description copied from interface:IImmutableItemStorageFactoryMethod to get a new Instance of an itemStorage.- Specified by:
getNewInstancein interfaceIImmutableItemStorageFactory- Parameters:
stack- the input.size- the grid size.- Returns:
- a new Instance of ItemStorage.
-