aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces/IFluidAccess.java
blob: 8fa9b3a3fa7997a14216ddfebae781531b5c6ad5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package gregtech.api.interfaces;

import net.minecraftforge.fluids.FluidStack;

public interface IFluidAccess {

    void set(FluidStack stack);

    FluidStack get();

    int getCapacity();

    default int getRealCapacity() {
        return getCapacity();
    }

    default void addAmount(int amount) {
        if (get() != null) {
            get().amount = Math.min(get().amount + amount, getRealCapacity());
        }
    }

    default void verifyFluidStack() {
        if (get() != null && get().amount <= 0) set(null);
    }
}