aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/interfaces')
-rw-r--r--src/main/java/gregtech/api/interfaces/fluid/IFluidStore.java22
-rw-r--r--src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java26
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IVoidable.java64
3 files changed, 88 insertions, 24 deletions
diff --git a/src/main/java/gregtech/api/interfaces/fluid/IFluidStore.java b/src/main/java/gregtech/api/interfaces/fluid/IFluidStore.java
new file mode 100644
index 0000000000..047cf4df5b
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/fluid/IFluidStore.java
@@ -0,0 +1,22 @@
+package gregtech.api.interfaces.fluid;
+
+import javax.annotation.Nonnull;
+
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidTank;
+
+/**
+ * Objects implementing this interface can be used for storing certain fluid, especially for recipe output.
+ */
+public interface IFluidStore extends IFluidTank {
+
+ /**
+ * @return If this does not have partially filled fluid nor have restriction on what fluid to accept.
+ */
+ boolean isEmptyAndAcceptsAnyFluid();
+
+ /**
+ * @return Whether to allow given fluid to be inserted into this.
+ */
+ boolean canStoreFluid(@Nonnull FluidStack fluidStack);
+}
diff --git a/src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java b/src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java
index cf740a6bc6..04b6b4e6a9 100644
--- a/src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java
+++ b/src/main/java/gregtech/api/interfaces/modularui/ControllerWithOptionalFeatures.java
@@ -19,6 +19,7 @@ import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
import gregtech.api.enums.SoundResource;
import gregtech.api.enums.VoidingMode;
import gregtech.api.gui.modularui.GT_UITextures;
+import gregtech.api.interfaces.tileentity.IVoidable;
/**
* Machines implementing this interface can have logic and GUI buttons
@@ -31,7 +32,7 @@ import gregtech.api.gui.modularui.GT_UITextures;
* <li>Recipe locking</li>
* </ul>
*/
-public interface ControllerWithOptionalFeatures {
+public interface ControllerWithOptionalFeatures extends IVoidable {
boolean isAllowedToWork();
@@ -72,29 +73,6 @@ public interface ControllerWithOptionalFeatures {
return (ButtonWidget) button;
}
- /**
- * @return if this machine can prevent excess item and fluid from voiding.
- */
- boolean supportsVoidProtection();
-
- /**
- * @return if this machine is configured to not void excess item.
- */
- default boolean protectsExcessItem() {
- return supportsVoidProtection() && getVoidingMode().protectItem;
- }
-
- /**
- * @return if this machine is configured to not void excess fluid.
- */
- default boolean protectsExcessFluid() {
- return supportsVoidProtection() && getVoidingMode().protectFluid;
- }
-
- VoidingMode getVoidingMode();
-
- void setVoidingMode(VoidingMode mode);
-
Pos2d getVoidingModeButtonPos();
default ButtonWidget createVoidExcessButton(IWidgetBuilder<?> builder) {
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IVoidable.java b/src/main/java/gregtech/api/interfaces/tileentity/IVoidable.java
new file mode 100644
index 0000000000..d6325e8597
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IVoidable.java
@@ -0,0 +1,64 @@
+package gregtech.api.interfaces.tileentity;
+
+import java.util.List;
+
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import gregtech.api.enums.VoidingMode;
+import gregtech.api.interfaces.fluid.IFluidStore;
+
+/**
+ * Machines implementing this interface can have logic to configure whether to void excess output or not.
+ */
+public interface IVoidable {
+
+ /**
+ * @return if this machine can prevent excess item and fluid from voiding.
+ */
+ boolean supportsVoidProtection();
+
+ /**
+ * @return if this machine is configured to not void excess item.
+ */
+ default boolean protectsExcessItem() {
+ return supportsVoidProtection() && getVoidingMode().protectItem;
+ }
+
+ /**
+ * @return if this machine is configured to not void excess fluid.
+ */
+ default boolean protectsExcessFluid() {
+ return supportsVoidProtection() && getVoidingMode().protectFluid;
+ }
+
+ VoidingMode getVoidingMode();
+
+ void setVoidingMode(VoidingMode mode);
+
+ /**
+ * @param toOutput List of items this machine is going to output.
+ * @return List of slots available for item outputs. Null element represents empty slot.
+ */
+ List<ItemStack> getItemOutputSlots(ItemStack[] toOutput);
+
+ /**
+ * @param toOutput List of fluids this machine is going to output.
+ * @return List of slots available for fluid outputs.
+ */
+ List<? extends IFluidStore> getFluidOutputSlots(FluidStack[] toOutput);
+
+ /**
+ * @return If this machine has ability to dump item outputs to ME network.
+ * This doesn't need to check if it can actually dump to ME,
+ * as this might be called every tick and cause lag.
+ */
+ boolean canDumpItemToME();
+
+ /**
+ * @return If this machine has ability to dump fluid outputs to ME network.
+ * This doesn't need to check if it can actually dump to ME,
+ * as this might be called every tick and cause lag.
+ */
+ boolean canDumpFluidToME();
+}