Skip to content

iiiii7d/pymcfunc

Repository files navigation

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/

Note: currently being rewritten for v0.5, 99% chance main branch will not run

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_old as pmf
p = pmf.Pack("pack name")

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

@p.function
def make_sheep_jump(f: pmf.JavaFunctionHandler):
    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.JavaFunctionHandler):
    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.JavaFunctionHandler):
    f.r.tellraw('@a', pmf.rt.java("§c§l§w[This is 6000 ticks]5 minutes§xw have passed!"))

print(p.funcs)

About

Minecraft functions, pythonised

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages