aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
authorLéa Gris <lea.gris@noiraude.net>2022-09-08 08:11:18 +0200
committerGitHub <noreply@github.com>2022-09-08 08:11:18 +0200
commitd0ecbfa6e361b354ef7074ba8194510fc257c352 (patch)
tree09bfcac07d604060d115c9b37fb724c3296ca9f6 /src/main/java/gregtech/api
parentf14ab9d942ee11aff20f5d328b57d26c77c96cb7 (diff)
downloadGT5-Unofficial-d0ecbfa6e361b354ef7074ba8194510fc257c352.tar.gz
GT5-Unofficial-d0ecbfa6e361b354ef7074ba8194510fc257c352.tar.bz2
GT5-Unofficial-d0ecbfa6e361b354ef7074ba8194510fc257c352.zip
fix(API): GT_Fluid (#1349)
* fix(API): GT_Fluid - Fix: Use registeredFluid instead of GT_Fluid to configure Materials and containers to prevent crashes when retrieving fluids referrences from those. - Impr: Adjust fluid luminosity computation to better fit with Tungsten as maximum - Impr: Remove transparency from the fluid.molten.autogenerated.png texture to prevent molten materials to appear dilluted. * ./gradlew :spotlessApply * rev(comment): address review comment from @Glease rev: https://github.com/GTNewHorizons/GT5-Unofficial/pull/1349#pullrequestreview-1098651647 fix: Logic to handle working with own registered fluids and already registered fluids. imp: Some IGT_Fluid methods requires the fluid to be registered, throws an IllegalStateException on use at an unregistered fluid. imp: Normalizes @inheritDoc no additionnal text allowed
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/fluid/GT_FluidFactory.java1
-rw-r--r--src/main/java/gregtech/api/interfaces/fluid/IGT_Fluid.java12
-rw-r--r--src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java1
3 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/gregtech/api/fluid/GT_FluidFactory.java b/src/main/java/gregtech/api/fluid/GT_FluidFactory.java
index 0db1aec7e6..4aa39095ec 100644
--- a/src/main/java/gregtech/api/fluid/GT_FluidFactory.java
+++ b/src/main/java/gregtech/api/fluid/GT_FluidFactory.java
@@ -29,6 +29,7 @@ import net.minecraftforge.fluids.FluidRegistry;
* </li>
* </ol>
*/
+@SuppressWarnings("unused") // API might legitimately expose unused methods within this local project's scope
public class GT_FluidFactory {
/**
diff --git a/src/main/java/gregtech/api/interfaces/fluid/IGT_Fluid.java b/src/main/java/gregtech/api/interfaces/fluid/IGT_Fluid.java
index 1a34b44b5a..5529e111bb 100644
--- a/src/main/java/gregtech/api/interfaces/fluid/IGT_Fluid.java
+++ b/src/main/java/gregtech/api/interfaces/fluid/IGT_Fluid.java
@@ -8,10 +8,11 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
+@SuppressWarnings("unused") // API might legitimately expose unused methods within this local project's scope
public interface IGT_Fluid {
/**
- * Registers this {@link IGT_Fluid} to ths {@link FluidRegistry}
+ * Adds this {@link IGT_Fluid} to the {@link FluidRegistry} and internally-implemented registrations
*
* @return {@link IGT_Fluid} self for call chaining
*/
@@ -24,6 +25,8 @@ public interface IGT_Fluid {
* @param emptyContainer The empty fluid container
* @param containerSize The size of the container
* @return The {@link IGT_Fluid} for chaining
+ *
+ * @throws IllegalStateException on attempt to register containers for an unregistered fluid
*/
IGT_Fluid registerContainers(
final ItemStack fullContainer, final ItemStack emptyContainer, final int containerSize);
@@ -34,6 +37,8 @@ public interface IGT_Fluid {
* @param fullContainer The full container to associate with this {@link IGT_Fluid}
* @param emptyContainer The empty container associate with this {@link IGT_Fluid}
* @return {@link IGT_Fluid} self for call chaining
+ *
+ * @throws IllegalStateException on attempt to register containers for an unregistered fluid
*/
IGT_Fluid registerBContainers(final ItemStack fullContainer, final ItemStack emptyContainer);
@@ -43,6 +48,8 @@ public interface IGT_Fluid {
* @param fullContainer The full container to associate with this {@link IGT_Fluid}
* @param emptyContainer The empty container associate with this {@link IGT_Fluid}
* @return {@link IGT_Fluid} self for call chaining
+ *
+ * @throws IllegalStateException on attempt to register containers for an unregistered fluid
*/
IGT_Fluid registerPContainers(final ItemStack fullContainer, final ItemStack emptyContainer);
@@ -51,6 +58,9 @@ public interface IGT_Fluid {
*
* @param material the {@link Materials} to configure based on this {@link IGT_Fluid} and {@link FluidState}
* @return The {@link IGT_Fluid} for chaining
+ *
+ * @throws IllegalStateException on unknown {@link FluidState}
+ * @throws IllegalStateException on attempt to register containers for an unregistered fluid
*/
IGT_Fluid configureMaterials(final Materials material);
diff --git a/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java b/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java
index 1e5ec60fa0..4010a465ce 100644
--- a/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java
+++ b/src/main/java/gregtech/api/interfaces/fluid/IGT_FluidBuilder.java
@@ -6,6 +6,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
+@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