Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class FluidDetails {
public static void fillBasic(Map<? super String, Object> data, StorageView<FluidVariant> fluid) {
data.put("name", DetailHelpers.getId(BuiltInRegistries.FLUID, fluid.getResource().getFluid()));
data.put("amount", fluid.getAmount());
data.put("capacity", fluid.getCapacity());
}

public static void fill(Map<? super String, Object> data, StorageView<FluidVariant> fluid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class FluidData {
public static void fillBasic(Map<? super String, Object> data, FluidStack stack) {
data.put("name", DetailHelpers.getId(BuiltInRegistries.FLUID, stack.getFluid()));
data.put("amount", stack.getAmount());
// "capacity" is added manually elsewhere since FluidStack does not contain a capacity.
// See: dan200.computercraft.shared.peripheral.generic.methods.FluidMethods#tanks
}

public static void fill(Map<? super String, Object> data, FluidStack stack) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ public final class FluidMethods extends AbstractFluidMethods<IFluidHandler> {
var size = fluids.getTanks();
for (var i = 0; i < size; i++) {
var stack = fluids.getFluidInTank(i);
if (!stack.isEmpty()) result.put(i + 1, ForgeDetailRegistries.FLUID_STACK.getBasicDetails(stack));
if (!stack.isEmpty()) {
var data = ForgeDetailRegistries.FLUID_STACK.getBasicDetails(stack);
// FluidStacks do not keep capacity, meaning the DetailRegistry cannot add it by itself. We'll
// add it manually here instead.
data.put("capacity", fluids.getTankCapacity(i));
result.put(i + 1, data);
}
}

return result;
Expand Down
Loading