Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
/ PyDatapack Public archive

A python library for creating Minecraft Datapacks!

Notifications You must be signed in to change notification settings

Mjtlittle/PyDatapack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PyDatapack

A python library for creating Minecraft Datapacks!

Introduction

The examples below are combined into a python file located in the examples folder.

Importing the Library

from pydatapack import *

Creating a Datapack

dp = Datapack('.','Name','Description')

Making a Function

Functions are objects defined in the library to hold all of the commands run when called in the game. Using .newFunction() on the datapack pre registers the function with the datapack. This method also returns the Function object created.

hello = dp.functions.newFunction('hello_world')
hello.add_command('say hello')
hello.add_command(tellraw('world!'))

A function can be defined before the datapack, and then added afterwards.

hello = functions.Function('hello_world')
hello.add_command('say hello')
hello.add_command(tellraw('world!'))

dp.functions.registerFunction(hello)

Calling a Function from another

Calling the function (function_name()) as if it were a python function converts it to a runnable minecraft command.

wrapper = dp.newFunction('hello_world_wrapper')
wrapper.add_command(hello())

Compiling the Datapack

compiling the datapack with .compile() places the unzipped datapack in the current directory.

dp.compile()

About

A python library for creating Minecraft Datapacks!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages