#fluid handling?
6 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
little example
let $ForgeCapabilities = Java.loadClass("net.minecraftforge.common.capabilities.ForgeCapabilities");
BlockEvents.rightClicked("create:fluid_tank", (event) => {
const { hand, block } = event;
if (hand != "MAIN_HAND") return;
let tank = block.entity.getCapability($ForgeCapabilities.FLUID_HANDLER).resolve().get();
if (tank.getFluidInTank(0).amount <= 4000) {
tank.fill(Fluid.of("water", 200), "execute");
} else {
tank.drain(Fluid.of("water", 4000), "execute");
}
});
when doing fluid stuff in kubejs, fluids register as "fluidstacks" not as forge "fluidtypes" tho, the types lets you do stuff like checking if submerged in or not. looking into a work around