Class ItemDriveWrapperStorageDisk
java.lang.Object
com.refinedmods.refinedstorage.apiimpl.network.node.diskdrive.ItemDriveWrapperStorageDisk
- All Implemented Interfaces:
IStorageDisk<net.minecraft.world.item.ItemStack>
,IStorage<net.minecraft.world.item.ItemStack>
public class ItemDriveWrapperStorageDisk
extends Object
implements IStorageDisk<net.minecraft.world.item.ItemStack>
-
Field Summary
Fields inherited from interface com.refinedmods.refinedstorage.api.storage.IStorage
COMPARATOR
-
Constructor Summary
ConstructorDescriptionItemDriveWrapperStorageDisk
(DiskDriveNetworkNode diskDrive, IStorageDisk<net.minecraft.world.item.ItemStack> parent) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.ItemStack
Extracts a stack from this storage.int
getCacheDelta
(int storedPreInsertion, int size, net.minecraft.world.item.ItemStack remainder) Returns the delta that needs to be added to the item or fluid storage cache AFTER insertion of the stack.int
net.minecraft.resources.ResourceLocation
getOwner()
int
Collection<net.minecraft.world.item.ItemStack>
Returns the stacks of the storage.int
net.minecraft.world.item.ItemStack
Inserts a stack to this storage.void
setSettings
(IStorageDiskListener listener, IStorageDiskContainerContext context) When this storage disk is inserted into a storage disk container, it has to adjust to the container's settings and use the following parameters instead.net.minecraft.nbt.CompoundTag
Writes the storage to NBT.
-
Constructor Details
-
ItemDriveWrapperStorageDisk
public ItemDriveWrapperStorageDisk(DiskDriveNetworkNode diskDrive, IStorageDisk<net.minecraft.world.item.ItemStack> parent)
-
-
Method Details
-
getPriority
public int getPriority()- Specified by:
getPriority
in interfaceIStorage<net.minecraft.world.item.ItemStack>
- Returns:
- the priority of this storage
-
getAccessType
- Specified by:
getAccessType
in interfaceIStorage<net.minecraft.world.item.ItemStack>
- Returns:
- the access type of this storage
-
getStacks
Description copied from interface:IStorage
Returns the stacks of the storage. Empty stacks are allowed. Please do not copy the stacks for performance reasons. For the caller: modifying stacks is not allowed! -
insert
@Nonnull public net.minecraft.world.item.ItemStack insert(@Nonnull net.minecraft.world.item.ItemStack stack, int size, Action action) Description copied from interface:IStorage
Inserts a stack to this storage.- Specified by:
insert
in interfaceIStorage<net.minecraft.world.item.ItemStack>
- Parameters:
stack
- the stack prototype to insert, can be empty, do NOT modifysize
- the amount of that prototype that has to be insertedaction
- the action- Returns:
- an empty stack if the insert was successful, or a stack with the remainder
-
extract
@Nonnull public net.minecraft.world.item.ItemStack extract(@Nonnull net.minecraft.world.item.ItemStack stack, int size, int flags, Action action) Description copied from interface:IStorage
Extracts a stack from this storage.If the stack we found in the system is smaller than the requested size, return that stack anyway.
- Specified by:
extract
in interfaceIStorage<net.minecraft.world.item.ItemStack>
- Parameters:
stack
- a prototype of the stack to extract, can be empty, do NOT modifysize
- the amount of that prototype that has to be extractedflags
- the flags to compare on, seeIComparer
action
- the action- Returns:
- an empty stack if nothing was extracted, or an extracted stack
-
getStored
public int getStored() -
getCacheDelta
public int getCacheDelta(int storedPreInsertion, int size, @Nullable net.minecraft.world.item.ItemStack remainder) Description copied from interface:IStorage
Returns the delta that needs to be added to the item or fluid storage cache AFTER insertion of the stack.- Specified by:
getCacheDelta
in interfaceIStorage<net.minecraft.world.item.ItemStack>
- Parameters:
storedPreInsertion
- the amount stored pre insertionsize
- the size of the stack being insertedremainder
- the remainder that we got back, or null if no remainder was there- Returns:
- the amount to increase the cache with
-
getCapacity
public int getCapacity()- Specified by:
getCapacity
in interfaceIStorageDisk<net.minecraft.world.item.ItemStack>
- Returns:
- the capacity of this storage disk
-
getOwner
- Specified by:
getOwner
in interfaceIStorageDisk<net.minecraft.world.item.ItemStack>
- Returns:
- the id of the owner, or null if not present
-
setSettings
public void setSettings(@Nullable IStorageDiskListener listener, IStorageDiskContainerContext context) Description copied from interface:IStorageDisk
When this storage disk is inserted into a storage disk container, it has to adjust to the container's settings and use the following parameters instead.- Specified by:
setSettings
in interfaceIStorageDisk<net.minecraft.world.item.ItemStack>
- Parameters:
listener
- the listener to be called when the storage changes, or null for no listenercontext
- the container context, containing some settings
-
writeToNbt
public net.minecraft.nbt.CompoundTag writeToNbt()Description copied from interface:IStorageDisk
Writes the storage to NBT.- Specified by:
writeToNbt
in interfaceIStorageDisk<net.minecraft.world.item.ItemStack>
-
getFactoryId
public net.minecraft.resources.ResourceLocation getFactoryId()- Specified by:
getFactoryId
in interfaceIStorageDisk<net.minecraft.world.item.ItemStack>
- Returns:
- the factory id as registered in
IStorageDiskRegistry
-