new_contents: #!/usr/bin/env python3
  """
  Minecraft mob spawner generator
  with setblock commands in vanilla minecraft
  
  E.g. usage:
  ./mob_spawner.py -x 82 -z 358 -y 63 -b minecraft:cobblestone
  Capture the output and paste it into the console
  """
  
  
  import argparse
  import math
  
  
  def set_block(x, y, z, block_id):
      """
      Set a block of a specified type
      """
  
      print("/setblock {0} {1} {2} {3}".format(
          x, y, z, block_id))
  
  
  def fall_trap_level(x_center, y, z_center, block_id):
      set_block(x - 1, y + y_current, z, block_id)
      set_block(x - 1, y + y_current, z + 1, block_id)
      set_block(x, y + y_current, z + 2, block_id)
      set_block(x + 1, y + y_current, z + 2, block_id)
      set_block(x + 2, y + y_current, z + 1, block_id)
      set_block(x + 2, y + y_current, z, block_id)
      set_block(x + 1, y + y_current, z + 1, block_id)
      set_block(x + 1, y + y_current, z, block_id)
  
  
  def mob_spawner(x_center, y_bottom, z_center, block_id):
      """
      Generate a mob spawner with a specified block id.
  
  
      Keyword arguments:
      x_center -- the center of the structure in the x dimension
      y_bottom -- the base of the structure in the y dimension
      z_center -- the center of the structure in the z dimension
      block_id -- the block type for the hard parts of the structure
      """
  
      chamber_height = 28
      # increment y_bottom to leave room for chests
      y_current = y_bottom + 1
      # hoppers
      for x in range(2):
          for z in range(2):
              set_block(x + x_center, y_current, z + z_center,
                  "minecraft:hopper")
      # fall chute
      x = x_center
      z = z_center
      for y in range(2, 4):
          fall_trap_level(x_center, y + y_bottom, z_center, "minecraft:glass")
      for y in range(4, chamber_height):
          fall_trap_level(x_center, y + y_bottom, z_center, block_id)
      # spawning chamber
  
  
  def main():
      parser = argparse.ArgumentParser(description="create commands for " +
                                          "mob spawner")
      parser.add_argument("-x", "--x-center", type=int, required=True,
                          help="center of structure in x dimension")
      parser.add_argument("-z", "--z-center", type=int, required=True,
                          help="center of structure in z dimension")
      parser.add_argument("-y", "--y-bottom", type=int, required=True,
                          help="bottom of structure in y dimension")
      parser.add_argument("-b", "--block_id", type=str, required=True,
                          help="the block id of the hard block")
  
      args = parser.parse_args()
  
      mob_spawner(args.x_center, args.y_bottom, args.z_center, 
                          args.block_id)
  
  
  if __name__ == "__main__":
          main()
  
subject: test prototype