aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces/metatileentity/IItemLockable.java
blob: 65bfb416e2e4b3dc92cd09408f586a706362fa82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package gregtech.api.interfaces.metatileentity;

import javax.annotation.Nullable;

import net.minecraft.item.ItemStack;

/**
 * Implement this interface if your MetaTileEntity supports item locking.
 */
public interface IItemLockable {

    /**
     * Set the locked item.
     * <p>
     * Implementers should make a copy of this item, as it can be either a physical item or a ghost item dragged from
     * NEI.
     *
     * @param itemStack An item stack to lock
     * @see com.gtnewhorizons.modularui.api.forge.ItemHandlerHelper#copyStackWithSize(ItemStack, int)
     */
    void setLockedItem(@Nullable ItemStack itemStack);

    /**
     * Get the locked item.
     *
     * @return an ItemStack of the locked item. Returns null if there is no locked item.
     */
    @Nullable
    ItemStack getLockedItem();

    /**
     * Clears the lock on the machine.
     */
    void clearLock();

    boolean isLocked();

    default boolean acceptsItemLock() {
        return false;
    }
}