Skip to main content

An API Wrapper of Neal's Infinite Craft game in Python for people to implement in their programs.

Project description

infinite-craft 1.1.4


An API Wrapper of Neal's Infinite Craft game in Python for people to implement in their programs.

infinite-craft's GitHub Actions Status

Key Features:

  • Stores elements in a neatly indented JSON file
  • Starts with the four main elements: Water, Fire, Wind, Earth
  • Uses neal.fun's Infinite Craft API to pair elements together
  • Built-in ratelimiting handler
  • Custom API support
  • Asynchronous library
  • Conveniently access discovered elements

Discord Server

Need help? Join our community!
-> https://discord.gg/FF2fSN2sJd

Table of Contents:

Installation

Requires Python 3.10 or above.
To install, run:

pip install infinite-craft

To update, run:

pip install -U infinite-craft

NOTE: If pip is not on PATH, you can use:

  • python3 -m pip (for Linux/MacOS) or
  • python -m pip (for Windows) instead.

View infinite-craft on PyPI.

Examples

Using async with

import asyncio
from infinitecraft import InfiniteCraft

async def main():
    async with InfiniteCraft() as game: # automatically start session and end session on async with end
        print(f"Pairing elements: {game.discoveries[0]} and {game.discoveries[1]}")
        result = await game.pair(game.discoveries[0], game.discoveries[1]) # Pair Water and Fire
        print(f"Result: {result}")

asyncio.run(main())

Manually controlling

import asyncio
from infinitecraft import InfiniteCraft

game = InfiniteCraft()

async def main():
    await game.start() # Start InfiniteCraft Session
    
    print(f"Pairing elements: {game.discoveries[0]} and {game.discoveries[1]}")
    result = await game.pair(game.discoveries[0], game.discoveries[1]) # Pair Water and Fire
    print(f"Result: {result}")

    await game.close() # Close InfiniteCraft Session

asyncio.run(main())

You can find more examples in the documentation.

Documentation 📚

Documentation is coming soon™️

While the documentation is not ready, everything is documented well in the code with docstrings which you can see in an IDE like Visual Studio Code.

You can also see the in-development documentation page here.

How does it work?

This library basically contacts the URL: https://neal.fun/api/infinite-craft/pair?first=element+name&second=element+name
Tricks it with some headers, and handles everything accordingly.

Everything is handled in a user-friendly manner and asynchronously, so it should be really easy to use it in your programs.

To-do

  • Release version 1.0.0 on PyPI
  • Make a discord server for support Join our community! https://discord.gg/FF2fSN2sJd
  • Add a runnable and configurable CLI mock API server
  • Make docs
  • Make a playable Infinite Craft CLI game (interactive, probably)

License


View the MIT License license that comes with this library.


🌟 Please star the repo and show some love 💖

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

infinite_craft-1.1.4.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

infinite_craft-1.1.4-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file infinite_craft-1.1.4.tar.gz.

File metadata

  • Download URL: infinite_craft-1.1.4.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for infinite_craft-1.1.4.tar.gz
Algorithm Hash digest
SHA256 a6bdbb437df5857ca0e60ae0950f518fdddd02128022039828ffc130e913ef1b
MD5 19e92bd3d9e609f0c8d03d94fd9d72dd
BLAKE2b-256 b516d0edef0a29d415f170f382479fb331baba589393d87c5628e1422f098e4a

See more details on using hashes here.

File details

Details for the file infinite_craft-1.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for infinite_craft-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 52e9caa7fd4a97cff817f84796c8c6eae2ceb5636a8c4328f2f85733c548b1d6
MD5 f15ec19b59f11f32b221ddb15abbe461
BLAKE2b-256 f8c02ac1235e519af1463eed90810e74639098fc85e710061cf102ac8e2f004e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page