-
-
Notifications
You must be signed in to change notification settings - Fork 3
Fluid Interaction API
Ahmad Ansori Palembani edited this page May 16, 2023
·
7 revisions
Warning: API is still in Alpha stage, expect some breaking changes.
Fluid Interaction API (introduced in v4.0) allows mod makers to define their own custom generators.
To use CobbleGen's Fluid Interaction API, you need to add it to your mod's project:
repositories {
// ...
maven {
url = "https://api.modrinth.com/maven"
}
}
dependencies {
modApi "maven.modrinth:cobblegen:4.0.1+12-BETA"
}
After you sync gradle, you can now create a plugin class that implements CobbleGenPlugin
, for example:
public class CreateFluidInteraction implements CobbleGenPlugin
{
public void registerInteraction(CGRegistry registry) {
if (!FabricLoader.getInstance().isModLoaded("create")) return;
registry.addGenerator(
Fluids.LAVA,
new CobbleGenerator(List.of(new WeightedBlock("create:limestone", 1.0)),
AllFluids.HONEY.get().getStill(),
false
)
);
registry.addGenerator(
Fluids.LAVA,
new CobbleGenerator(List.of(new WeightedBlock("create:scoria", 1.0)),
AllFluids.CHOCOLATE.get().getStill(),
false
)
);
}
}
Then add the plugin class location to a cobblegen_plugin
entrypoint in fabric.mod.json
:
"entrypoints": {
"cobblegen_plugin": [
"io.github.null2264.cobblegen.integration.create.CreateFluidInteraction"
]
},