Skip to main content

Minecraft functions, pythonised

Project description

pymcfunc

Build Status Documentation Status PyPI version Github Version Python Versions License

GitHub code size in bytes GitHub repo size GitHub last commit GitHub Release Date Lines of code Codecov CodeFactor

Minecraft functions, pythonised. Made by 7d

Latest release version: v0.4 Changelogs: https://pymcfunc.readthedocs.io/en/latest/changelog.html

Documentation: https://pymcfunc.readthedocs.io/en/latest/

Why pymcfunc?

It would seem pretty obvious to program directly with Minecraft commands into functions; however things start to get complicated when you try to do things that are simple in regular programming but are cumbersome in Minecraft commands.

Hence pymcfunc, which translates Python code into Minecraft commands. The code is aimed to be short, brief and concise so that it does not become another troublesome job.

Progress: Raw commands are complete, currently working on features to make programming functions easier, and tools to build datapacks :)

Usage

import pymcfunc as pmf
p = pmf.Pack("pack name")

@p.function
def diamond(f: pmf.JavaFuncHandler):
    f.r.tell("@s", "Enjoy your free diamonds! :D")
    f.r.give("@s", "diamond", 64)

@p.function
def make_sheep_jump(f: pmf.JavaFuncHandler):
    f.r.execute(
      as_="@e[type=sheep]",
      run=lambda sf: [
        sf.r.tp(destxyz="~ ~1 ~"),
        sf.r.say("boingg")
      ]
    )

@p.function
def addition(f: pmf.JavaFuncHandler):
    val1 = f.v('val1', '@s')
    val1.set(10)
    val2 = f.v('val2', '@s')
    val2.set(20)
    val1 += val2
    f.r.tellraw('@s', pmf.rt.java("§aThe value is now ¶s[val1|@s]"))

@p.function
@p.t.repeat_every(6000)
def five_min_alert(f: pmf.JavaFuncHandler):
    f.r.tellraw('@a', pmf.rt.java("§c§l§w[This is 6000 ticks]5 minutes§xw have passed!"))

print(p.funcs)

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

pymcfunc-0.4.tar.gz (58.6 kB view hashes)

Uploaded Source

Built Distribution

pymcfunc-0.4-py3-none-any.whl (61.8 kB view hashes)

Uploaded Python 3

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