Recode Item API Interface - AlignedCookie88/McDFPy GitHub Wiki

Send a template to DiamondFire

from mcdfpy.template import Template # Import the Template class
from mcdfpy.recodeitemapi import RecodeItemAPI # Import the Recode Item API Interface
# Add your imports here

template = Template() # Create the template

# Add your code here.

iapi = RecodeItemAPI() # Create an instance of the RecodeItemAPI class with the default settings (address="localhost", port=13172)
iapi.send_template(template) # Send the template to DiamondFire

It really is just that simple. You should never need to change the settings of the interface unless you are accessing Recode on a remote computer.

Receive a template from DiamondFire

from mcdfpy.recodeitemapi import RecodeItemAPI # Import the Recode Item API Interface

iapi = RecodeItemAPI() # Create an instance of the RecodeItemAPI class with the default settings (address="localhost", port=13172)
template = iapi.receive_template() # Wait for the user to /sendtemplate.

template is a mcdfpy.template.Template object and you can interact with it Mostly the same as any other template. However, it uses the following classes to represent blocks, brackets and variables respectivley, to prevent the need of looping through all classes:

  • mcdfpy.template.ImportedBlock
  • mcdfpy.template.ImportedBracket
  • mcdfpy.template.ImportedVariable

An option to use the normal classes will be implemented in a future release.