Skip to content

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

License

Notifications You must be signed in to change notification settings

sqdnoises/infinite-craft

Repository files navigation

infinite-craft 1.1.4


An API Wrapper for Neal's Infinite Craft game in Python.

infinite-craft's GitHub Actions Status

Publish Package to PyPI Create GitHub Release

Important

The library is currently broken. If you pair two elements you get a 403 Forbidden error. A fix for this is currently being made.

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

Tip

Need help? Join our Discord community!
» https://discord.gg/FF2fSN2sJd
Discord invite

Table of Contents:

Installation

Important

Python 3.10 or above is required. Any versions below will not work.

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 contacts the URL:

https://neal.fun/api/infinite-craft/pair?first=element+name&second=element+name

where element+name in first= parameter is the first element you want to pair and the element+name in second= parameter is the second element.

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 a documentation page
  • Fix 403 Forbidden Error
  • Add a synchronous class
  • Finish documentation page
  • Make a playable & interactive Infinite Craft CLI game

License


Click MIT License to view the license that comes with this library.


🌟 Please star the repo and show some love 💖