Class SimpleMountedStorage
java.lang.Object
com.simibubi.create.api.contraption.storage.item.MountedItemStorage
com.simibubi.create.api.contraption.storage.item.WrapperMountedItemStorage<net.neoforged.neoforge.items.ItemStackHandler>
com.simibubi.create.api.contraption.storage.item.simple.SimpleMountedStorage
- All Implemented Interfaces:
net.neoforged.neoforge.items.IItemHandler,net.neoforged.neoforge.items.IItemHandlerModifiable
- Direct Known Subclasses:
ChestMountedStorage,DispenserMountedStorage,FallbackMountedStorage
public class SimpleMountedStorage
extends WrapperMountedItemStorage<net.neoforged.neoforge.items.ItemStackHandler>
Widely-applicable mounted storage implementation.
Gets an item handler from the mounted block, copies it to an ItemStackHandler,
and then copies the inventory back to the target when unmounting.
All blocks for which this mounted storage is registered must provide an
To use this implementation, either register
IItemHandlerModifiable to Capabilities.ItemHandler.BLOCK.
To use this implementation, either register
AllMountedStorageTypes.SIMPLE to your block
manually, or add your block to the AllTags.AllBlockTags.SIMPLE_MOUNTED_STORAGE tag.
It is also possible to extend this class to create your own implementation.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<SimpleMountedStorage> Fields inherited from class com.simibubi.create.api.contraption.storage.item.WrapperMountedItemStorage
wrappedFields inherited from class com.simibubi.create.api.contraption.storage.item.MountedItemStorage
STREAM_CODEC, type -
Constructor Summary
ConstructorsConstructorDescriptionSimpleMountedStorage(MountedItemStorageType<?> type, net.neoforged.neoforge.items.IItemHandler handler) SimpleMountedStorage(net.neoforged.neoforge.items.IItemHandler handler) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends SimpleMountedStorage>
com.mojang.serialization.MapCodec<T> voidunmount(net.minecraft.world.level.Level level, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, @Nullable net.minecraft.world.level.block.entity.BlockEntity be) Un-mount this storage back into the world.protected Optional<net.neoforged.neoforge.items.IItemHandlerModifiable> validate(net.neoforged.neoforge.items.IItemHandler handler) Make sure the targeted handler is valid for copying items back into.Methods inherited from class com.simibubi.create.api.contraption.storage.item.WrapperMountedItemStorage
copyToItemStackHandler, extractItem, getSlotLimit, getSlots, getStackInSlot, insertItem, isItemValid, setStackInSlotMethods inherited from class com.simibubi.create.api.contraption.storage.item.MountedItemStorage
createMenuProvider, getHandlerForMenu, getMenuName, handleInteraction, isMenuValid, playClosingSound, playOpeningSound
-
Field Details
-
CODEC
-
-
Constructor Details
-
SimpleMountedStorage
public SimpleMountedStorage(MountedItemStorageType<?> type, net.neoforged.neoforge.items.IItemHandler handler) -
SimpleMountedStorage
public SimpleMountedStorage(net.neoforged.neoforge.items.IItemHandler handler)
-
-
Method Details
-
unmount
public void unmount(net.minecraft.world.level.Level level, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, @Nullable @Nullable net.minecraft.world.level.block.entity.BlockEntity be) Description copied from class:MountedItemStorageUn-mount this storage back into the world. The expected storage type of the target block has already been checked to make sure it matches this storage's type.- Specified by:
unmountin classMountedItemStorage
-
validate
protected Optional<net.neoforged.neoforge.items.IItemHandlerModifiable> validate(net.neoforged.neoforge.items.IItemHandler handler) Make sure the targeted handler is valid for copying items back into. It is highly recommended to call super in overrides. -
codec
public static <T extends SimpleMountedStorage> com.mojang.serialization.MapCodec<T> codec(Function<net.neoforged.neoforge.items.IItemHandler, T> factory)
-