-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fluid Storage Properties Improvements (#932)
* glass tubes for mv acid storage * drum fluid type handling * fluid temperatures * change tube to vial * make item pipe require wrench Co-authored-by: brachy84 <[email protected]>
- Loading branch information
1 parent
149bad0
commit 1359f4b
Showing
17 changed files
with
289 additions
and
58 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
src/main/java/gregtech/api/capability/IThermalFluidHandlerItemStack.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package gregtech.api.capability; | ||
|
||
import gregtech.api.fluids.MaterialFluid; | ||
import gregtech.api.fluids.fluidType.FluidType; | ||
import gregtech.api.fluids.fluidType.FluidTypes; | ||
import net.minecraftforge.fluids.Fluid; | ||
import net.minecraftforge.fluids.FluidStack; | ||
|
||
/** | ||
* Interface for FluidHandlerItemStacks which handle GT's unique fluid mechanics | ||
* @see FluidType | ||
* @see FluidTypes | ||
* @see MaterialFluid | ||
*/ | ||
public interface IThermalFluidHandlerItemStack { | ||
|
||
/** | ||
* | ||
* @param stack the {@link FluidStack} to check | ||
* @return whether the FluidStack can be used to fill this fluid container | ||
*/ | ||
default boolean canFillFluidType(FluidStack stack) { | ||
if (stack == null || stack.getFluid() == null) return false; | ||
|
||
Fluid fluid = stack.getFluid(); | ||
if (fluid.getTemperature() > getMaxFluidTemperature()) return false; | ||
// fluids less than 120K are cryogenic | ||
if (fluid.getTemperature() < 120 && !isCryoProof()) return false; | ||
if (fluid.isGaseous() && !isGasProof()) return false; | ||
|
||
if (fluid instanceof MaterialFluid) { | ||
FluidType fluidType = ((MaterialFluid) fluid).getFluidType(); | ||
if (fluidType == FluidTypes.ACID && !isAcidProof()) return false; | ||
if (fluidType == FluidTypes.PLASMA && !isPlasmaProof()) return false; | ||
} | ||
return true; | ||
} | ||
|
||
/** | ||
* This is always checked, regardless of the contained fluid being a {@link MaterialFluid} or not | ||
* | ||
* @return the maximum allowed temperature for a fluid to be stored in this container | ||
*/ | ||
int getMaxFluidTemperature(); | ||
|
||
/** | ||
* This is always checked, regardless of the contained fluid being a {@link MaterialFluid} or not | ||
* | ||
* @return true if this fluid container allows gases, otherwise false | ||
*/ | ||
boolean isGasProof(); | ||
|
||
/** | ||
* @see FluidTypes | ||
* | ||
* @return true if this fluid container allows acids, otherwise false | ||
*/ | ||
boolean isAcidProof(); | ||
|
||
/** | ||
* @see FluidTypes | ||
* | ||
* @return true if this fluid container allows cryogenics, otherwise false | ||
*/ | ||
boolean isCryoProof(); | ||
|
||
/** | ||
* @see FluidTypes | ||
* | ||
* @return true if this fluid container allows plasmas, otherwise false | ||
*/ | ||
boolean isPlasmaProof(); | ||
} |
39 changes: 32 additions & 7 deletions
39
src/main/java/gregtech/api/capability/impl/SimpleThermalFluidHandlerItemStack.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.