aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces/metatileentity
diff options
context:
space:
mode:
authorquerns <33518699+querns@users.noreply.github.com>2024-07-29 19:46:55 -0500
committerGitHub <noreply@github.com>2024-07-30 07:46:55 +0700
commit450a7874b06ff508987a4b0f3c3621ab4d9d28b3 (patch)
tree264f273abb9f06530e088ca780fbaf2285f7633f /src/main/java/gregtech/api/interfaces/metatileentity
parent9cff1eb7d1621cb14ef433a75cda62592a31b2cf (diff)
downloadGT5-Unofficial-450a7874b06ff508987a4b0f3c3621ab4d9d28b3.tar.gz
GT5-Unofficial-450a7874b06ff508987a4b0f3c3621ab4d9d28b3.tar.bz2
GT5-Unofficial-450a7874b06ff508987a4b0f3c3621ab4d9d28b3.zip
Adds lockable output buses (#2787)
* Adds output locking for non-ME output buses * Add data stick support for output bus filters * Small optimization to output bus iteration * spotless, my one true enemy
Diffstat (limited to 'src/main/java/gregtech/api/interfaces/metatileentity')
-rw-r--r--src/main/java/gregtech/api/interfaces/metatileentity/IItemLockable.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IItemLockable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IItemLockable.java
new file mode 100644
index 0000000000..65bfb416e2
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/metatileentity/IItemLockable.java
@@ -0,0 +1,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;
+ }
+}