Class ResourceContainerImpl
java.lang.Object
com.refinedmods.refinedstorage.common.support.resource.ResourceContainerImpl
- All Implemented Interfaces:
ResourceContainer
- Direct Known Subclasses:
ExportedResourcesContainer
-
Constructor Summary
ConstructorDescriptionResourceContainerImpl
(int size, ToLongFunction<ResourceKey> maxAmountProvider, ResourceFactory primaryResourceFactory, Set<ResourceFactory> alternativeResourceFactories) -
Method Summary
Modifier and TypeMethodDescriptionvoid
change
(int index, net.minecraft.world.item.ItemStack stack, boolean tryAlternatives) protected final void
changed()
void
clear()
copy()
static ResourceContainer
static ResourceContainer
createForFilter
(int size) static ResourceContainer
createForFilter
(ResourceFactory resourceFactory) static ResourceContainer
createForFilter
(ResourceFactory resourceFactory, int size) static ResourceContainer
createForFilter
(ResourceFactory resourceFactory, ResourceContainerData data) static ResourceContainer
createForFilter
(ResourceFactory resourceFactory, List<Optional<ResourceAmount>> resources) static ResourceContainer
long
extract
(ResourceKey resource, long amount, Action action) void
fromTag
(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider) get
(int index) long
getAmount
(int index) long
getMaxAmount
(ResourceKey resource) getResource
(int index) net.minecraft.world.item.ItemStack
getStackRepresentation
(int index) void
grow
(int index, long amount) long
insert
(ResourceKey resource, long amount, Action action) boolean
isValid
(ResourceKey resource) void
remove
(int index) protected void
removeSilently
(int index) void
set
(int index, ResourceAmount resourceAmount) void
setAmount
(int index, long amount) void
setListener
(Runnable listener) static void
setResourceContainerData
(List<Optional<ResourceAmount>> resources, ResourceContainer resourceContainer) protected void
setSilently
(int index, ResourceAmount resourceAmount) void
shrink
(int index, long amount) int
size()
net.minecraft.world.Container
net.minecraft.nbt.CompoundTag
toTag
(net.minecraft.core.HolderLookup.Provider provider) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.refinedmods.refinedstorage.common.api.support.resource.ResourceContainer
isEmpty, isEmpty
-
Constructor Details
-
ResourceContainerImpl
public ResourceContainerImpl(int size, ToLongFunction<ResourceKey> maxAmountProvider, ResourceFactory primaryResourceFactory, Set<ResourceFactory> alternativeResourceFactories)
-
-
Method Details
-
setListener
- Specified by:
setListener
in interfaceResourceContainer
-
change
public void change(int index, net.minecraft.world.item.ItemStack stack, boolean tryAlternatives) - Specified by:
change
in interfaceResourceContainer
-
set
- Specified by:
set
in interfaceResourceContainer
-
setSilently
-
isValid
- Specified by:
isValid
in interfaceResourceContainer
-
getAmount
public long getAmount(int index) - Specified by:
getAmount
in interfaceResourceContainer
-
grow
public void grow(int index, long amount) - Specified by:
grow
in interfaceResourceContainer
-
shrink
public void shrink(int index, long amount) - Specified by:
shrink
in interfaceResourceContainer
-
setAmount
public void setAmount(int index, long amount) - Specified by:
setAmount
in interfaceResourceContainer
-
getMaxAmount
- Specified by:
getMaxAmount
in interfaceResourceContainer
-
remove
public void remove(int index) - Specified by:
remove
in interfaceResourceContainer
-
clear
public void clear()- Specified by:
clear
in interfaceResourceContainer
-
removeSilently
protected void removeSilently(int index) -
size
public int size()- Specified by:
size
in interfaceResourceContainer
-
get
- Specified by:
get
in interfaceResourceContainer
-
getResource
- Specified by:
getResource
in interfaceResourceContainer
-
getStackRepresentation
public net.minecraft.world.item.ItemStack getStackRepresentation(int index) - Specified by:
getStackRepresentation
in interfaceResourceContainer
-
getUniqueResources
- Specified by:
getUniqueResources
in interfaceResourceContainer
-
getResources
- Specified by:
getResources
in interfaceResourceContainer
-
toTag
public net.minecraft.nbt.CompoundTag toTag(net.minecraft.core.HolderLookup.Provider provider) - Specified by:
toTag
in interfaceResourceContainer
-
fromTag
public void fromTag(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider) - Specified by:
fromTag
in interfaceResourceContainer
-
getPrimaryResourceFactory
- Specified by:
getPrimaryResourceFactory
in interfaceResourceContainer
-
getAlternativeResourceFactories
- Specified by:
getAlternativeResourceFactories
in interfaceResourceContainer
-
changed
protected final void changed() -
toItemContainer
public net.minecraft.world.Container toItemContainer()- Specified by:
toItemContainer
in interfaceResourceContainer
-
insert
- Specified by:
insert
in interfaceResourceContainer
-
extract
- Specified by:
extract
in interfaceResourceContainer
-
copy
- Specified by:
copy
in interfaceResourceContainer
-
createForFilter
-
createForFilter
-
createForFilter
-
createForFilter
-
createForFilter
-
createForFilter
public static ResourceContainer createForFilter(ResourceFactory resourceFactory, ResourceContainerData data) -
createForFilter
public static ResourceContainer createForFilter(ResourceFactory resourceFactory, List<Optional<ResourceAmount>> resources) -
setResourceContainerData
public static void setResourceContainerData(List<Optional<ResourceAmount>> resources, ResourceContainer resourceContainer)
-