Mekanism-tilera-Edition/src/main/java/mekanism/common/FluidSlot.java

38 lines
912 B
Java
Raw Normal View History

2013-07-20 18:10:14 +02:00
package mekanism.common;
/**
* Used to manage a slot that stores fluid. Has 3 main values: a stored amount of fluid,
* maximum fluid, and fluid ID.
* @author AidanBrady
*
*/
2023-01-22 17:18:34 +01:00
public class FluidSlot {
/** The amount of fluid this slot is currently holding. */
public int fluidStored;
2023-01-22 17:18:34 +01:00
/** The maximum amount of fluid this slot can handle. */
public int MAX_FLUID;
2023-01-22 17:18:34 +01:00
/** The fluid's ID. */
public int fluidID;
2023-01-22 17:18:34 +01:00
/**
* Creates a FluidSlot with a defined fluid ID and max fluid. The fluid stored starts
* at 0.
* @param max - max fluid
* @param id - fluid id
*/
public FluidSlot(int max, int id) {
MAX_FLUID = max;
fluidID = id;
}
2023-01-22 17:18:34 +01:00
/**
* Sets the fluid to a new amount.
* @param fluid - amount to store
*/
public void setFluid(int amount) {
fluidStored = Math.max(Math.min(amount, MAX_FLUID), 0);
}
2013-07-20 18:10:14 +02:00
}