KubeJS (Old)

KubeJS (Old)

3M Downloads

FluidTypes are not registered

digitalseraphim opened this issue ยท 0 comments

commented

Minecraft Version

1.19.2

KubeJS Version

1902.6.2-build.39 (all since Fluid API was added)

Rhino Version

1902.2.2-build.280

Architectury Version

6.5.85

Forge/Fabric Version

Forge 43.2.23

Describe your issue

I have also discussed this in a ticket on the discord: https://discord.com/channels/303440391124942858/1173402337507811359

The FluidTypes that are generated by the Architectury API for the Fluids created are not registered with the Forge FluidType registry. There is an Architectury bug that I have submitted a ticket for that creates multiple FluidTypes when only one should be generated. (architectury/architectury-api#447)

In the KubeJS addon I'm making, I am currently registering the fluid types like this:

    public KubeFluidInteraction() {
        var bus = FMLJavaModLoadingContext.get().getModEventBus();
        bus.addListener(KubeFluidInteraction::registerFluidTypes);
    }

    public static void registerFluidTypes(RegisterEvent event) {
        // we do a bunch of work below, so only do it if it's the right RegisterEvent
        if (event.getRegistryKey() != ForgeRegistries.Keys.FLUID_TYPES) {
            return;
        }
        for (var builder : RegistryInfo.FLUID) {
            if (builder instanceof FluidBuilder b) {
                Fluid f = ForgeRegistries.FLUIDS.getValue(b.id);
                event.register(ForgeRegistries.Keys.FLUID_TYPES, b.id, () -> f.getFluidType());
            }
        }
    }

Crash report/logs

No response