How to use the mcpi.util.flatten function in mcpi

To help you get started, we’ve selected a few mcpi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brooksc / mcpipy / mcpi / minecraft.py View on Github external
def intFloor(*args):
    return [int(math.floor(x)) for x in flatten(args)]
github martinohanlon / mcpi / mcpi / minecraft.py View on Github external
def intFloor(*args):
    return [int(math.floor(x)) for x in flatten(args)]
github martinohanlon / mcpi / mcpi / minecraft.py View on Github external
def setSign(self, *args):
        """Set a sign (x,y,z,id,data,[line1,line2,line3,line4])
        
        Wall signs (id=68) require data for facing direction 2=north, 3=south, 4=west, 5=east
        Standing signs (id=63) require data for facing rotation (0-15) 0=south, 4=west, 8=north, 12=east
        @author: Tim Cummings https://www.triptera.com.au/wordpress/"""
        lines = []
        flatargs = []
        for arg in flatten(args):
            flatargs.append(arg)
        for flatarg in flatargs[5:]:
            lines.append(flatarg.replace(",",";").replace(")","]").replace("(","["))
        self.conn.send(b"world.setSign",intFloor(flatargs[0:5]) + lines)