-3

I made my code simpler here but I think I have also narrowed down my question. name dosent equal main when this is run by mcedit as a filter, so are you supposed to compare name to something else other than main that its called by another program, making main PlaceBlock instead still didnt work either?

from multiprocessing import Process
from pymclevel import alphaMaterials

displayName = "PlaceBlock"

def perform(level, box, options):

    x = box.minx
    z = box.minz

    def block(height):
         level.setBlockAt(x, height, z, 1)

    print(__name__)
    if __name__ == "__main__":
        print('Processing')
        p1 = Process(target=block, args=(1, ))
        p2 = Process(target=block, args=(2, ))

        p1.start()
        p2.start()

    p1.join()
    p2.join()

Also to answer a question in the comments, this a filter for a minecraft program called mcedit to edit worlds, filters are just programs that edit the worlds. So this program dosent actually do anything unless you have the program

  • 2
    How are you running your script? – juanpa.arrivillaga Feb 15 '17 at 01:13
  • 2
    Questions surrounding code should incorporate a **minimal**, complete verifiable example. "Minimal", in this context means it should be pruned down to the smallest code that will let others see your problem themselves, with as many complicating factors as possible removed (for example, using `multiprocessing` only if the problem can't be reproduced without it). See http://stackoverflow.com/help/mcve – Charles Duffy Feb 15 '17 at 01:38
  • This may be relevant: http://stackoverflow.com/questions/419163/what-does-if-name-main-do – ToxicTeacakes Feb 15 '17 at 01:39
  • move all codes except import statement under `if __name__ == '__main__':`, keep all functions before if statement to start. – Gang Feb 15 '17 at 02:50
  • Possible duplicate of [What does if \_\_name\_\_ == "\_\_main\_\_": do?](http://stackoverflow.com/questions/419163/what-does-if-name-main-do) – SiHa Feb 15 '17 at 10:59

2 Answers2

0

After a lot of messing around it turns that it was not running the right file in the processes, it would run the main program which is why it opened a second version of the program, so I put in a execution file change to open python instead of the program and it works fine!

0

Your script will only function in MCEdit Unified.

pymclevel cannot be run outside of MCEdit.

You don't need to write a script to do this. If you hold alt down it will reveal the coordinates of your cube pointer. Go to the point in the world where you would like to place the block and use the fill and replace tool to make fill that coordinate with the block you want.

T54
  • 81
  • 1
  • 16
  • P.S. (Post Script) Please feel free to correct my spelling/grammar/formatting as I am [dyslexic](https://duckduckgo.com/?q=dyslexic&ia=web) and so am not good at things. – T54 May 28 '18 at 23:06