Minecraft functions, pythonised
Project description
pymcfunc
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.