{"id":28465521,"url":"https://github.com/lunasquee/fluid_lib","last_synced_at":"2025-09-03T02:06:51.688Z","repository":{"id":296502421,"uuid":"970937943","full_name":"LunaSquee/fluid_lib","owner":"LunaSquee","description":"Universal Fluid API for Luanti","archived":false,"fork":false,"pushed_at":"2025-05-31T06:17:55.000Z","size":662,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-31T17:27:06.214Z","etag":null,"topics":["api","fluids","luanti","luanti-mod"],"latest_commit_sha":null,"homepage":"https://content.luanti.org/packages/IcyDiamond/fluid_lib/","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LunaSquee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-22T19:04:25.000Z","updated_at":"2025-05-31T06:17:58.000Z","dependencies_parsed_at":"2025-05-31T17:29:26.314Z","dependency_job_id":"8626d758-8f36-40ac-8fd3-afe8194ed6e8","html_url":"https://github.com/LunaSquee/fluid_lib","commit_stats":null,"previous_names":["lunasquee/fluid_lib"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LunaSquee/fluid_lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LunaSquee%2Ffluid_lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LunaSquee%2Ffluid_lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LunaSquee%2Ffluid_lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LunaSquee%2Ffluid_lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LunaSquee","download_url":"https://codeload.github.com/LunaSquee/fluid_lib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LunaSquee%2Ffluid_lib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262846300,"owners_count":23373797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","fluids","luanti","luanti-mod"],"created_at":"2025-06-07T05:39:32.042Z","updated_at":"2025-06-30T20:32:21.224Z","avatar_url":"https://github.com/LunaSquee.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Universal Fluid API\nThis API adds support for `fluid_buffers` inside nodes. This means that nodes can contain fluid. Simple fluid transfer is also implemented in `fluid_transfer`.\nThis mod implements [node_io](https://github.com/auouymous/node_io). Note that while it is recommended that you install this mod also, it is not required in order to function. **Enable ALL the mods provided by this \"modpack\"!**\n\nThis mod also provides an attempt to unify bucket mods from different games, currently focused on Minetest Game and VoxeLibre.\n\n## How to Use\n1. Add the node to the `fluid_container` group.\n2. Add the following to the node defintion:\n```\n    fluid_buffers = {\n        buffer_name = {\n            capacity = 2000,\n            accepts = {\"default:water_source\", \"group:water_source\"}, -- you can also set this to true to accept any fluid!\n            drainable = true,\n        },\n    }\n```\n3. Set the appropriate metadata.\n\n* **buffer_name_fluid** = `string` \t\t- Source node of the fluid.\n* **buffer_name_fluid_storage** = `int` \t- How much fluid there is in this buffer.\n\n4. Register your node **(DO NOT MISS THIS STEP! TRANSFER WILL NOT WORK OTHERWISE!)**.\n\nJust call `fluid_lib.register_node(nodename)`.\n\n## API\nAll numbers are in **milli-buckets** (1 bucket = 1000 mB).\n\n* `fluid_lib.get_node_buffers(pos)`\n\t* Returns all the fluid buffers present inside a node.\n\n* `fluid_lib.get_buffer_data(pos, buffer)`\n\t* Returns all the information about this buffer.\n```\n    {\n        fluid     = fluid source block,\n        amount    = amount of fluid,\n        accepts   = list of accepted fluids,\n        capacity  = capacity of the buffer,\n        drainable = is this buffer drainable,\n    }\n```\n\n* `fluid_lib.buffer_accepts_fluid(pos, buffer, fluid)`\n\t* Returns `true` if `fluid` can go inside the `buffer` at `pos`.\n\n* `fluid_lib.can_insert_into_buffer(pos, buffer, fluid, count)`\n\t* Returns the amount of `fluid` that can go inside the `buffer` at `pos`. If all of it fits, it returns `count`.\n\n* `fluid_lib.insert_into_buffer(pos, buffer, fluid, count)`\n\t* Actually does the inserting.\n\n* `fluid_lib.can_take_from_buffer(pos, buffer, count)`\n\t* Returns the amount of `fluid` that can be taken from the `buffer` at `pos`.\n\n* `fluid_lib.take_from_buffer(pos, buffer, count)`\n\t* Actually takes the fluid. On success, returns the source block that was taken and how much was actually taken.\n\n* `fluid_lib.buffer_to_string(buffer)`\n  * Returns textual representation of the buffer.\n  * Example: \"Water (1,000 / 1,000 mB)\"\n\n* `fluid_lib.register_node(nodename)`\n\t* Registers a node that has fluid buffers. This is IMPORTANT!\n\n* `fluid_lib.register_extractor_node(nodename, nodedef)`\n\t* Registers a node that can extract fluid from another node (in front of self) and put it into ducts.\n\t* `fluid_pump_capacity` variable in nodedef determines how much fluid (in mB) this node can \"pump\" every second.\n\n* `fluid_lib.register_transfer_node(nodename, nodedef)`\n\t* Registers a node that can transfer fluids. This is effectively a fluid duct.\n\t* `duct_density` variable in nodedef determines the diameter of the duct (custom node_box is created).\n\n* `fluid_lib.register_liquid(source, flowing, itemname, inventory_image, name, groups, force_renew)`\n\t* Works exactly the same as the default `bucket` mod, except it adds callbacks to insert/take fluid from nodes.\n\t* `inventory_image` can be a **ColorString**.\n\t* Full shims included for the following games: Minetest Game (default bucket mod), VoxeLibre/Mineclonia (mcl_buckets)\n\n* `fluid_lib.get_empty_bucket()`\n  * Get the item name of an empty bucket\n\n* `fluid_lib.get_liquid_list()`\n  * Get the list of registered source nodes\n\n* `fluid_lib.get_flowing_for_source(source)`\n  * Get the flowing variant of a liquid\n\n* `fluid_lib.get_source_for_flowing(source)`\n  * Get the source of a flowing liquid\n\n* `fluid_lib.get_bucket_for_source(source)`\n  * Get the bucket item name for a source node\n\n* `fluid_lib.get_source_for_bucket(bucket)`\n  * Get the source node of a bucket\n\n* `fluid_lib.cleanse_node_description(node)`\n  * Get the translated (if available) name of the fluid source node. If no translated variant is available, it just removes \"Source\" from the source description without applying a translation.\n\n* `fluid_lib.cleanse_node_name(node)`\n  * Get the technical name of the fluid source node without the name of the mod or \"_source\".\n\n* `fluid_lib.comma_value(n)`\n  * Add commas to thousands. (Example: 1000 -\u003e 1,000)\n\n## License\n### fluid_lib\nSee [LICENSE](LICENSE)\n\n### bucket_compat\nContains assets and code snippets from [Minetest Game](https://github.com/luanti-org/minetest_game/tree/master/mods/bucket) and [VoxeLibre](https://git.minetest.land/VoxeLibre/VoxeLibre/src/branch/master/mods/ITEMS/mcl_buckets) to provide maximum compatibility with the fluid APIs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flunasquee%2Ffluid_lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flunasquee%2Ffluid_lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flunasquee%2Ffluid_lib/lists"}