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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file pymcfunc-0.4.tar.gz.

File metadata

  • Download URL: pymcfunc-0.4.tar.gz
  • Upload date:
  • Size: 58.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for pymcfunc-0.4.tar.gz
Algorithm Hash digest
SHA256 ee13bf3158d71924c203281e94428d7c22cb6b23ae2476751f580e43b9846785
MD5 b972139a397125ec22060a517a3b2f39
BLAKE2b-256 69ff2001de1e4e04274a2a88e5a02b71e5538826ba16626aa68f72551ee80679

See more details on using hashes here.

File details

Details for the file pymcfunc-0.4-py3-none-any.whl.

File metadata

  • Download URL: pymcfunc-0.4-py3-none-any.whl
  • Upload date:
  • Size: 61.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for pymcfunc-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0d94577ac1b581971a5b9d452f480b30804ee94170cb4fbdc01f75fa110e7250
MD5 90366f4af36399affb682da6926b0a15
BLAKE2b-256 e700061a8885c544ddca85f126f7840ec0035f1a023b89e0f3483c1fd332e5bd

See more details on using hashes here.

Supported by

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