Package appeng.api.behaviors
Class ContainerItemStrategies
java.lang.Object
appeng.api.behaviors.ContainerItemStrategies
Manages
ContainerItemStrategy
registrations for key types.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable ContainerItemContext
findCarriedContext
(@Nullable AEKeyType keyType, net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.AbstractContainerMenu menu) static ContainerItemContext
findCarriedContextForKey
(@Nullable AEKey key, net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.AbstractContainerMenu menu) static @Nullable ContainerItemContext
findOwnedItemContext
(@Nullable AEKeyType keyType, net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) Finds a context for an item that is in the possession of the player, but the precise location is unknown.static @Nullable GenericStack
getContainedStack
(net.minecraft.world.item.ItemStack stack) static @Nullable GenericStack
getContainedStack
(net.minecraft.world.item.ItemStack stack, AEKeyType keyType) Tries to get the content of the given key type contained in the given item - if any.static @Nullable EmptyingAction
getEmptyingAction
(net.minecraft.world.item.ItemStack stack) static boolean
isKeySupported
(@Nullable AEKey key) static boolean
isTypeSupported
(AEKeyType type) static <T extends AEKey>
voidregister
(AEKeyType type, Class<T> keyClass, ContainerItemStrategy<T, ?> strategy)
-
Constructor Details
-
ContainerItemStrategies
public ContainerItemStrategies()
-
-
Method Details
-
register
public static <T extends AEKey> void register(AEKeyType type, Class<T> keyClass, ContainerItemStrategy<T, ?> strategy) -
isTypeSupported
-
isKeySupported
-
getContainedStack
@Nullable public static @Nullable GenericStack getContainedStack(net.minecraft.world.item.ItemStack stack) -
getContainedStack
@Nullable public static @Nullable GenericStack getContainedStack(net.minecraft.world.item.ItemStack stack, AEKeyType keyType) Tries to get the content of the given key type contained in the given item - if any. Allows inspecting the content of buckets, fluid tanks and other containers. -
getEmptyingAction
@Nullable public static @Nullable EmptyingAction getEmptyingAction(net.minecraft.world.item.ItemStack stack) -
findCarriedContextForKey
public static ContainerItemContext findCarriedContextForKey(@Nullable @Nullable AEKey key, net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.AbstractContainerMenu menu) -
findCarriedContext
@Nullable public static @Nullable ContainerItemContext findCarriedContext(@Nullable @Nullable AEKeyType keyType, net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.AbstractContainerMenu menu) - Parameters:
keyType
- Desired key type, or null if any is ok.
-
getSupportedKeyTypes
-
findOwnedItemContext
@Nullable public static @Nullable ContainerItemContext findOwnedItemContext(@Nullable @Nullable AEKeyType keyType, net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) Finds a context for an item that is in the possession of the player, but the precise location is unknown. It might be in the inventory, on the body, or just in hand.- Parameters:
keyType
- Desired key type, or null if any is ok.
-