def build_structure(self, commands, x, z):
		commands.append(fill(Position(x+1,0,z+0), Position(x+1,0,z+1), base_block()))
		commands.append(fill(Position(x+1,1,z+0), Position(x+1,1,z+1), redstone_dust()))
		commands.append(setblock(Position(x+0,1,z+0), base_block()))
		commands.append(fill(Position(x+0,2,z+0), Position(x+1,2,z+0), base_block()))
		commands.append(fill(Position(x+0,3,z+0), Position(x+1,3,z+0), redstone_dust()))
		commands.append(setblock(Position(x+1,2,z+1), redstone_torch('+z')))
Example #2
0
    def _build_module_7(self, x, y):
        X = x * 2
        Y = y * 2
        self.commands.append(
            fill(Position(X, -3, Y), Position(X, -1, Y), base_block()))
        self.commands.append(setblock(Position(X, -2, Y), repeater('-z')))
        self.commands.append(setblock(Position(X, 0, Y), redstone_dust()))

        self.commands.append(setblock(Position(X, -2, Y + 1), base_block()))
        self.commands.append(setblock(Position(X, -1, Y + 1), redstone_dust()))
Example #3
0
 def _build_module_3(self, x, y):
     X = x * 2
     Y = y * 2
     self.commands.append(setblock(Position(X, -2, Y + 1), base_block()))
     self.commands.append(setblock(Position(X, -3, Y), base_block()))
     self.commands.append(setblock(Position(X, -1, Y + 1), redstone_dust()))
     self.commands.append(setblock(Position(X, -2, Y), redstone_dust()))
     self.commands.append(setblock(Position(X + 1, -4, Y), base_block()))
     self.commands.append(setblock(Position(X + 1, -3, Y), repeater('+x')))
     self.commands.append(setblock(Position(X + 2, -3, Y), base_block()))
Example #4
0
    def _build_module_5(self, x, y):
        X = x * 2
        Y = y * 2
        self.commands.append(setblock(Position(X, -1, Y), base_block()))
        self.commands.append(setblock(Position(X, 0, Y), redstone_dust()))

        self.commands.append(setblock(Position(X, -2, Y + 1), base_block()))
        self.commands.append(setblock(Position(X, -1, Y + 1), redstone_dust()))

        self.commands.append(setblock(Position(X, 0, Y + 1), base_block()))
        self.commands.append(setblock(Position(X, 1, Y + 1), redstone_dust()))
 def _build_inputs(self):
     commands = []
     for x in range(self.length + 1):
         if x % 2 == 0:
             continue
         elif x == 1:
             commands.append(
                 fill(Position(x, 2, 0), Position(x, 2, self.width),
                      base_block()))
             commands.append(
                 fill(Position(x, 3, 0), Position(x, 3, self.width),
                      redstone_dust()))
             if self.input_side == 'left':
                 for z in range(0, self.width, 16):
                     commands.append(
                         setblock(Position(x, 3, z), repeater(facing='+z')))
             if self.input_side == 'right':
                 for z in range(self.width, 0, -16):
                     commands.append(
                         setblock(Position(x, 3, z), repeater(facing='-z')))
         else:
             commands.append(
                 clone(Position(1, 2, 0), Position(1, 3, self.width),
                       Position(x, 2, 0)))
     return commands
Example #6
0
 def _build_module_1(self, x, y):
     self.commands.append(
         fill(Position(x * 2, -2, y * 2), Position(x * 2, -2, y * 2 + 1),
              base_block()))
     self.commands.append(
         fill(Position(x * 2, -1, y * 2), Position(x * 2, -1, y * 2 + 1),
              redstone_dust()))
     self.commands.append(
         setblock(Position(x * 2 + 1, -2, y * 2 + 1), redstone_torch('+x')))
Example #7
0
 def _build_output_lane(self, Y):
     length = len(self.modules[0]) * 2
     self.commands.append(
         fill(Position(length + 2, -4, Y + 1), Position(2, -4, Y + 1),
              base_block()))
     self.commands.append(
         fill(Position(length + 2, -3, Y + 1), Position(2, -3, Y + 1),
              redstone_dust()))
     torchX = length + 3
     if self.right: torchX = 1
     torchDir = '+x'
     if self.right: torchDir = '-x'
Example #8
0
 def _build_module_2(self, x, y):
     self.commands.append(
         setblock(Position(x * 2, -2, y * 2 + 1), base_block()))
     self.commands.append(setblock(Position(x * 2, -3, y * 2),
                                   base_block()))
     self.commands.append(
         setblock(Position(x * 2, -2, y * 2), repeater('+z')))
     self.commands.append(
         fill(Position(x * 2, -1, y * 2), Position(x * 2, -1, y * 2 + 1),
              base_block()))
     self.commands.append(
         fill(Position(x * 2, 0, y * 2), Position(x * 2, 0, y * 2 + 1),
              redstone_dust()))
Example #9
0
 def _build_inputs(self):
     self.commands.append(
         fill(Position(2, -2, 0), Position(2, -2, 1), base_block()))
     self.commands.append(setblock(Position(2, -1, 0), repeater('+z')))
     self.commands.append(setblock(Position(2, -1, 1), redstone_dust()))
     availableLanes = 1
     leftToBuild = len(self.modules[0]) - 1
     x = 1
     while leftToBuild > 0:
         toCopy = min(availableLanes, leftToBuild)
         depth = toCopy * 2 - 1
         self.commands.append(
             clone(Position(2, -2, 0), Position(2 + depth, -1, 1),
                   Position(x * 2 + 2, -2, 0)))
         availableLanes += toCopy
         leftToBuild -= toCopy
         x += toCopy
Example #10
0
 def _place_repeaters(self):
     # Input Lanes
     for x in range(len(self.modules[0])):
         X = x * 2 + 2
         for y in range(7, len(self.modules), 7):
             module = self.modules[y][x]
             if module == 4 or module == 5: y -= 1
             module = self.modules[y][x]
             Y = y * 2 + 2
             if module == 0 or module == 1:
                 self.commands.append(
                     setblock(Position(X, -1, Y), repeater('+z')))
             elif module == 2:
                 self.commands.append(
                     fill(Position(X, 0, Y), Position(X, -1, Y + 1), air()))
                 self.commands.append(
                     setblock(Position(X, -1, Y + 1), redstone_dust()))
             elif module == 3:
                 self.commands.append(
                     setblock(Position(X, -1, Y - 1), repeater('+z')))
                 self.commands.append(
                     setblock(Position(X, -1, Y), base_block()))
             elif module == 6 or module == 7:
                 self.commands.append(
                     setblock(Position(X, 0, Y), repeater('+z')))
                 self.commands.append(
                     setblock(Position(X, 0, Y + 1), base_block()))
     # Output Lanes
     repeaterDir = '+x'
     if self.right: repeaterDir = '-x'
     for x in range(7, len(self.modules[0]), 7):
         X = x * 2 + 2
         for y in range(len(self.modules)):
             Y = y * 2 + 2
             module = self.modules[y][x]
             if module == 1 or module == 6:
                 self.commands.append(
                     setblock(Position(X, -3, Y + 1),
                              repeater(repeaterDir)))
             else:
                 self.commands.append(
                     setblock(Position(X + 1, -3, Y + 1),
                              repeater(repeaterDir)))
 def _build_outputs(self):
     commands = []
     for z in range(self.width):
         if z % 2 == 1:
             continue
         elif z == 0:
             commands.append(
                 fill(Position(0, 0, z), Position(self.length, 0, z),
                      base_block()))
             commands.append(
                 fill(Position(0, 1, z), Position(self.length, 1, z),
                      redstone_dust()))
             for x in range(15, self.length, 16):
                 commands.append(
                     setblock(Position(x, 1, 0), repeater(facing='-x')))
         else:
             commands.append(
                 clone(Position(0, 0, 0), Position(self.length, 1, 0),
                       Position(0, 0, z)))
     if self.input_side == 'left':
         for command in commands:
             command.translate(0, 0, 1)
     return commands
Example #12
0
 def generate_build(self, pos_x, pos_y, pos_z):
     self._add_command(
         setblock(Position(pos_x, pos_y, pos_z), redstone_dust()))
Example #13
0
 def place_input_repeater(self, commands, x, z):
     commands.append(
         fill(Position(x + 0, 3, z + 0), Position(x + 1, 4, z + 0), air()))
     commands.append(setblock(Position(x + 1, 3, z + 0), redstone_dust()))