#fluid handling?

6 messages · Page 1 of 1 (latest)

glass acorn
#

i dont think kubejs has fluid handling built in but i was scrolling through the probjs generated files and found these, is there any way to acually use them?

lament frostBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

quaint pivot
#

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");
    }
});
glass acorn
#

hmmm interesting

#

il look into forges' fluids stuff then

glass acorn
#

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