aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces/fluid
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/interfaces/fluid')
-rw-r--r--src/main/java/gregtech/api/interfaces/fluid/IFluidStore.java22
-rw-r--r--src/main/java/gregtech/api/interfaces/fluid/IGT_Fluid.java14
-rw-r--r--src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java96
-rw-r--r--src/main/java/gregtech/api/interfaces/fluid/IGT_RegisteredFluid.java60
4 files changed, 192 insertions, 0 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/fluid/IGT_Fluid.java b/src/main/java/gregtech/api/interfaces/fluid/IGT_Fluid.java
new file mode 100644
index 0000000000..7c8b2b3f11
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/fluid/IGT_Fluid.java
@@ -0,0 +1,14 @@
+package gregtech.api.interfaces.fluid;
+
+import net.minecraftforge.fluids.FluidRegistry;
+
+@SuppressWarnings("unused") // API might legitimately expose unused methods within this local project's scope
+public interface IGT_Fluid {
+
+ /**
+ * Adds this {@link IGT_Fluid} to the {@link FluidRegistry} and internally-implemented registrations
+ *
+ * @return {@link IGT_RegisteredFluid} The GregTech registered fluid
+ */
+ IGT_RegisteredFluid addFluid();
+}
diff --git a/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java b/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java
new file mode 100644
index 0000000000..f15b148fcb
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java
@@ -0,0 +1,96 @@
+package gregtech.api.interfaces.fluid;
+
+import javax.annotation.Nonnull;
+
+import net.minecraft.block.Block;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+
+import gregtech.api.enums.FluidState;
+
+@SuppressWarnings("unused") // API might legitimately expose unused methods within this local project's scope
+public interface IGT_FluidBuilder {
+
+ /**
+ * @param colorRGBA The {@code short[]} RGBA color of the {@link Fluid} or {@code null} for no defined RGBA color
+ * @return {@link IGT_FluidBuilder} self for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_FluidBuilder withColorRGBA(final short[] colorRGBA);
+
+ /**
+ * @param localizedName The localized name of this {@link IGT_FluidBuilder}
+ * @return {@link IGT_FluidBuilder} self for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_FluidBuilder withLocalizedName(final String localizedName);
+
+ /**
+ * @param fluidState The {@link FluidState} of this {@link IGT_FluidBuilder}
+ * @param temperature The Kelvin temperature of this {@link IGT_FluidBuilder}
+ * @return {@link IGT_FluidBuilder} self for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_FluidBuilder withStateAndTemperature(final FluidState fluidState, final int temperature);
+
+ /**
+ * @param stillIconResourceLocation the {@link ResourceLocation} of the still fluid icon
+ * @return {@link IGT_FluidBuilder} self for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_FluidBuilder withStillIconResourceLocation(final ResourceLocation stillIconResourceLocation);
+
+ /**
+ * @param flowingIconResourceLocation the {@link ResourceLocation} of the flowing fluid icon
+ * @return {@link IGT_FluidBuilder} self for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_FluidBuilder withFlowingIconResourceLocation(final ResourceLocation flowingIconResourceLocation);
+
+ /**
+ * @param textureName The name of the GregTech mod texture of this {@link IGT_FluidBuilder}
+ * @return {@link IGT_FluidBuilder} self for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_FluidBuilder withTextureName(final String textureName);
+
+ /**
+ * @param fluidBlock the {@link Block} implementation of the {@link IGT_Fluid}
+ * @return {@link IGT_FluidBuilder} self for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_FluidBuilder withFluidBlock(final Block fluidBlock);
+
+ /**
+ * @param fromFluid the {@link Fluid} to copy the icons from
+ * @return {@link IGT_FluidBuilder} self for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_FluidBuilder withIconsFrom(@Nonnull final Fluid fromFluid);
+
+ /**
+ * @param stillIconResourceLocation The {@link ResourceLocation} of the still fluid texture
+ * @param flowingIconResourceLocation The {@link ResourceLocation} of the flowing fluid texture
+ * @return {@link IGT_FluidBuilder} self for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_FluidBuilder withTextures(final ResourceLocation stillIconResourceLocation,
+ final ResourceLocation flowingIconResourceLocation);
+
+ /**
+ * Builds the {@link IGT_Fluid}
+ *
+ * @return the built {@link IGT_Fluid}
+ */
+ IGT_Fluid build();
+
+ /**
+ * Builds, then adds the {@link IGT_Fluid} to the {@link FluidRegistry}
+ *
+ * @return the {@link IGT_Fluid}
+ * @see #build()
+ * @see IGT_Fluid#addFluid()
+ */
+ IGT_RegisteredFluid buildAndRegister();
+}
diff --git a/src/main/java/gregtech/api/interfaces/fluid/IGT_RegisteredFluid.java b/src/main/java/gregtech/api/interfaces/fluid/IGT_RegisteredFluid.java
new file mode 100644
index 0000000000..181824874c
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/fluid/IGT_RegisteredFluid.java
@@ -0,0 +1,60 @@
+package gregtech.api.interfaces.fluid;
+
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidContainerRegistry;
+
+import gregtech.api.enums.FluidState;
+import gregtech.api.enums.Materials;
+
+public interface IGT_RegisteredFluid {
+
+ /**
+ * Registers the containers in the {@link FluidContainerRegistry} for this {@link IGT_RegisteredFluid}
+ *
+ * @param fullContainer The full fluid container
+ * @param emptyContainer The empty fluid container
+ * @param containerSize The size of the container
+ * @return The {@link IGT_RegisteredFluid} for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_RegisteredFluid registerContainers(final ItemStack fullContainer, final ItemStack emptyContainer,
+ final int containerSize);
+
+ /**
+ * Registers the bucket-sized 1000L containers in the {@link FluidContainerRegistry} for this
+ * {@link IGT_RegisteredFluid}
+ *
+ * @param fullContainer The full container to associate with this {@link IGT_RegisteredFluid}
+ * @param emptyContainer The empty container associate with this {@link IGT_RegisteredFluid}
+ * @return {@link IGT_RegisteredFluid} for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_RegisteredFluid registerBContainers(final ItemStack fullContainer, final ItemStack emptyContainer);
+
+ /**
+ * Registers the potion-sized 250L containers in the {@link FluidContainerRegistry} for this
+ * {@link IGT_RegisteredFluid}
+ *
+ * @param fullContainer The full container to associate with this {@link IGT_RegisteredFluid}
+ * @param emptyContainer The empty container associate with this {@link IGT_RegisteredFluid}
+ * @return {@link IGT_RegisteredFluid} self for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_RegisteredFluid registerPContainers(final ItemStack fullContainer, final ItemStack emptyContainer);
+
+ /**
+ * Updates the {@link Materials}'s fluids from this {@link IGT_RegisteredFluid}'s state
+ *
+ * @param material the {@link Materials} to configure based on this {@link IGT_RegisteredFluid} and
+ * {@link FluidState}
+ * @return The {@link IGT_RegisteredFluid} for call chaining
+ */
+ @SuppressWarnings("UnusedReturnValue") // Last call in chain, may not use this returned value
+ IGT_RegisteredFluid configureMaterials(final Materials material);
+
+ /**
+ * @return this {@link IGT_RegisteredFluid} cast to {@link Fluid}
+ */
+ Fluid asFluid();
+}