https://github.com/teverett/mtlib
Minetest library for Redis
https://github.com/teverett/mtlib
Last synced: 6 months ago
JSON representation
Minetest library for Redis
- Host: GitHub
- URL: https://github.com/teverett/mtlib
- Owner: teverett
- License: bsd-2-clause
- Created: 2023-12-17T02:07:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-24T00:41:30.000Z (about 1 year ago)
- Last Synced: 2025-05-24T01:28:45.080Z (about 1 year ago)
- Language: Java
- Size: 218 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.TXT
Awesome Lists containing this project
README
# mtlib
A Java library for reading and writing [Minetest](https://www.minetest.net/) Redis databases from [Redis](https://www.redis.com/)
## License
mtlib is distributed under the [2-clause BSD license](https://opensource.org/license/bsd-2-clause/).
## Usage
````
com.khubla.mtlib
mtlib
1.0.0
````
### Creating database configuration object
````
BaseDatabaseConfig myDatabaseConfig = new BaseDatabaseConfig();
myDatabaseConfig.setHost("localhost");
myDatabaseConfig.setPort(6379);
myDatabaseConfig.setHash("mt");
myDatabaseConfig.setPassword("mypassword");
````
### Instantiating WorldMap
````
WorldMap worldMap = new DefaultWorldMap(myDatabaseConfig);
````
### Query
````
// get Block at 0,0,0
Block block = worldMap.getBlock(new Coord(0,0,0));
// get node at 10,20,30
Node node = worldMap.getNode(new Coord(10,20,30))
// set node type to dirt
short dirtId = BlockTypes.getInstance().getId("default:dirt")
node.setParam0(dirtId);
worldMap.setNode(new Coord(10,20,30), node);
````