AntOfThy

World Edit Transforms

Apr 23rd, 2018
1,142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.15 KB | None | 0 0
  1.  
  2. World Edit Commands used in my video
  3. Ant 028 WE Transformations (by AntOfThy, April 2017)
  4. https://youtu.be/Dmk0uy8tRcU
  5.  
  6. World Download (so you can try these command in the same world as the video)
  7. https://www.dropbox.com/s/rwaug8pvd7arqm2/WE_Transforms.zip?dl=1
  8.  
  9. #
  10. # Block Replacement
  11. #
  12. # Select Villager House for Transform
  13. //sel extend
  14. # reselect new house
  15. # simple things are easy
  16. //replace cobble brick
  17. //replace log brick
  18. //replace wood cobble
  19. # But the Roof is harder
  20. # Data type fail!
  21. //replace wood_stairs cobble_stairs
  22. //undo
  23. # Do each data type separately!
  24. //replace wood_stairs:0 cobble_stairs:0
  25. //replace wood_stairs:1 cobble_stairs:1
  26. //replace wood_stairs:2 cobble_stairs:2
  27. //replace wood_stairs:3 cobble_stairs:3
  28. # Landscape (for nether)
  29. //replace grass,dirt netherrack
  30. //replace grass_path nether_brick
  31.  
  32. # As you can see block replacement can be a real pain
  33. # So I wanted to see if I can do it in a different way.
  34.  
  35.  
  36. #
  37. # The Generate Command
  38. #
  39. # Select the castle turret
  40. //outset -h 2
  41. //expand 2 up
  42.  
  43. # Equivalent Set command
  44. //g 95 1
  45.  
  46. # World Edit Expression Parser - Functions
  47. # http://wiki.sk89q.com/wiki/WorldEdit/Expression_syntax#Functions
  48.  
  49. # using generate replace based on type
  50. # query() -- lookup at x,y,z based on region coordinates
  51. //g 95 query(x,y,z,0,0)
  52. //g 95 !query(x,y,z,0,0)
  53.  
  54. # Place glass in any air block above a non-air block
  55. //g -c 95 query(x,y,z,0,0) && !query(x,y-1,z,0,0)
  56.  
  57. # Place glass in any air block next to a non-air block
  58. # Idea from http://forum.enginehub.org/threads/generate.16797/
  59. # select ALL lines of this to paste!
  60. //g -c 95 query(x,y,z,0,0)&&(
  61. !query(x-1,y,z,0,0) || !query(x+1,y,z,0,0) ||
  62. !query(x,y-1,z,0,0) || !query(x,y+1,z,0,0) ||
  63. !query(x,y,z-1,0,0) || !query(x,y,z+1,0,0) )
  64.  
  65. #
  66. # Example Uses
  67. #
  68. # You can use the command rotate existing objects
  69. # Select the center block of the 'road'
  70. //outset -h 7
  71. //g -c 95 rotate(x,z,.4); query(x,y,z,type,data); 1
  72. # NOTE: ignore the result of the query, and always replace by ending in 1
  73.  
  74. # Select Logs -- and randomise there orientation
  75. # Can be used for Wood Logs (17, 162), Hay Bales (170), Purpur Pillars (202)
  76. # data values need to be set to data%4 + 0,4,8 (+12 is all sided)
  77. //g 0 query(x,y,z,type,data); data=(data%4)+4*randint(3); 1
  78. //g 0 query(x,y,z,type,data); if(type==170) data=(data%4)+4*randint(3); 1
  79. //g 0 query(x,y,z,type,data); if(type==162 &&data%4==1) data=(data%4)+4*randint(3); 1
  80.  
  81. # Quartz Pillar's (155:2) needs a slightly different formula (data of 2,3,4)
  82. //g 0 query(x,y,z,type,data); if(type==155 && data>=2) data=2+randint(3); 1
  83.  
  84.  
  85. #
  86. # Relative Query
  87. #
  88. # You can also lookup using relative coordinates (more useful)
  89. # queryRel() - lookup relative to the x,y,d coordinates
  90. //g -c 95 queryRel(0,0,0,0,0)
  91. //g -c 95 !queryRel(0,0,0,0,0)
  92.  
  93. # glass example relative
  94. //g -c 95 queryRel(0,0,0,0,0)&&(
  95. !queryRel(-1,0,0,0,0) || !queryRel(1,0,0,0,0) ||
  96. !queryRel(0,-1,0,0,0) || !queryRel(0,1,0,0,0) ||
  97. !queryRel(0,0,-1,0,0) || !queryRel(0,0,1,0,0) )
  98.  
  99.  
  100. #
  101. # Relative Copy (to the east (+x) with original to the west (-x))
  102. #
  103. # Copy Blocks using Generate (set block if not air)
  104. //size
  105. //shift 15 east
  106. //g -c 0 queryRel(-15,0,0,type,data); type
  107.  
  108. # NOTE on using Generate to Copy:
  109. # signs are blank, chests empty!
  110.  
  111. # copy just specific block (stone_brick_stairs)
  112. //g -c 0 queryRel(-15,0,0,type,data); type==109
  113.  
  114. # copy and replace the stone_brick_stairs (109) with quartz (156)
  115. # Note that result will be false if the if is false
  116. //g 0 queryRel(-15,0,0,type,data); if(type==109) type=156
  117.  
  118. # copy all blocks, but replace the stone_brick_stairs (109) with quartz (156)
  119. //g 0 queryRel(-15,0,0,type,data); if(type==109) type=156; 1
  120.  
  121.  
  122. #
  123. # Absolute Query
  124. #
  125. # One other query function -- absolute coordinates...
  126. # Set whole region with another block in the world
  127. # In this case we give it a variable instead of a number
  128. # queryAbs() -- look up at absolute world
  129. //g -c 0 queryAbs(20,4,64,type,data); 1
  130.  
  131. # Set it to that block, only if the original block it isn't air
  132. # First 'lookup' the type and data values, then check original block
  133. //g -c 95 queryAbs(20,4,64,type,data); !queryRel(-15,0,0,0,0)
  134.  
  135.  
  136. #
  137. # Replace using Looked up Block
  138. #
  139. # Replace block based on blocks located in the world
  140.  
  141. # copy blocks that match the block (type & data)
  142. # This works as query functions are also a test -- but tests both type and data!
  143. //g 0 queryRel(-15,0,0,type,data); queryAbs(25,4,64,type,data);
  144.  
  145. # If the type and data type match -- look up the replacement block
  146. //g 0 queryRel(-15,0,0,type,data); t=type; d=data; if( queryAbs(25,4,64,t,d) ) queryAbs(25,4,66,type,data); 1
  147.  
  148.  
  149. #
  150. # Replace using a palette of blocks
  151. #
  152.  
  153. # Replacing just ONE type of stairs is not good. What we need is to
  154. # replace multiple blocks a palette of block.
  155. # Matching Blocks starts at 30,4,64 going in the +x direction,
  156. # with replacement blocks at 30,4,66 going parallel in the +x direction.
  157. #
  158. # We loop over the line blocks, until we match, or we run out of blocks (air)
  159. # * lookup original block with i=0 (index) and start value of t=1
  160. # * loop over matching blocks until lookup matched (or air is reached)
  161. # * lookup replacement block and return
  162. # * else no match, so just copy block (unless air)
  163.  
  164. //g 0 queryRel(-15,0,0,type,data); i=0;t=1; while(t) { t=type;d=data; if (queryAbs(30+i,4,64,t,d)) { queryAbs(30+i,4,66,type,data); return 1 } i++ }; type
  165.  
  166. # Minor improvement - skip loop over blocks if original is air blocks
  167. //g 0 queryRel(-15,0,0,type,data); i=0;t=type; while(t) { t=type;d=data; if (queryAbs(30+i,4,64,t,d)) { queryAbs(30+i,4,66,type,data); return 1 } i++ }; type
  168.  
  169. # Minor Change - also set air blocks
  170. //g 0 queryRel(-15,0,0,type,data); i=0;t=type; while(t) { t=type;d=data; if (queryAbs(30+i,4,64,t,d)) { queryAbs(30+i,4,66,type,data); return 1 } i++ }; 1
  171.  
  172.  
  173. # As we are using values all over the expression,
  174. # assign them to variables at the start of the expression
  175. # to allow them to be more easily modified.
  176. # xo,zo X,Z offset from selected region (the shift used)
  177. # mx,my,mz start location of match palette in +x direction
  178. # rx,ry,rz start location of replacement palette in +x direction
  179. #
  180. # The formula...
  181. # This should be typed in, as a single line,
  182. # all spaces and newlines in expression can be removed!
  183.  
  184. //g 0 xo=-15;zo=0;
  185. mx=30;my=4;mz=64;
  186. rx=30;ry=4;rz=66;
  187. queryRel(xo,0,zo,type,data);
  188. i=0;t=type;
  189. while(t) {
  190. t=type;d=data;
  191. if( queryAbs(mx+i,my,mz,t,d)) {
  192. queryAbs(rx+i,ry,rz,type,data);
  193. return 1
  194. }
  195. i++
  196. }
  197. 1
  198.  
  199. # Formula as a single line, spaces removed...
  200.  
  201. //g 0 xo=-15;zo=0;mx=30;my=4;mz=64;rx=30;ry=4;rz=66;queryRel(xo,0,zo,type,data);i=0;t=type;while(t){t=type;d=data;if(queryAbs(mx+i,my,mz,t,d)){queryAbs(rx+i,ry,rz,type,data);return 1}i++}1
  202.  
  203. # Replace the final '1' with "type=type?7:0"
  204. # To set any non-air block, not found in the palette to bedrock
  205.  
  206.  
  207.  
  208. #
  209. # Practical Example -- Transform Noodler's Blackwater Castle
  210. #
  211.  
  212. # Select Castle corner
  213. //expand 47 east
  214. //expand 47 south
  215. //expand 52 up
  216. //size
  217. //shift 64 east
  218.  
  219. # Copy (one to one)
  220. //g 0 xo=-64;zo=0; mx=112;my=4;mz=106; rx=mx;ry=my;rz=mz;
  221. queryRel(xo,0,zo,type,data); i=0;t=type; while(t) { t=type;d=data; if(queryAbs(mx+i,my,mz,t,d)) { queryAbs(rx+i,ry,rz,type,data); return 1 } i++ }; 1
  222.  
  223. # copy (replace unknown blocks with bedrock as a check)
  224. //g 0 xo=-64;zo=0; mx=112;my=4;mz=106; rx=mx;ry=my;rz=mz;
  225. queryRel(xo,0,zo,type,data); i=0;t=type; while(t) { t=type;d=data; if(queryAbs(mx+i,my,mz,t,d)) { queryAbs(rx+i,ry,rz,type,data); return 1 } i++ }; type=type?7:0
  226.  
  227. # End Version
  228. //g 0 xo=-64;zo=0; mx=112;my=4;mz=106; rx=176;ry=4;rz=106;
  229. queryRel(xo,0,zo,type,data); i=0;t=type; while(t) { t=type;d=data; if(queryAbs(mx+i,my,mz,t,d)) { queryAbs(rx+i,ry,rz,type,data); return 1 } i++ }; 1
  230.  
  231. # Nether Version
  232. //shift 64 east
  233. //g 0 xo=-128;zo=0; mx=112;my=4;mz=106; rx=240;ry=4;rz=106;
  234. queryRel(xo,0,zo,type,data); i=0;t=type; while(t) { t=type;d=data; if(queryAbs(mx+i,my,mz,t,d)) { queryAbs(rx+i,ry,rz,type,data); return 1 } i++ }; 1
  235.  
  236. # Try Replacing grass to slowsand, and the grass with netherwart
Advertisement
Add Comment
Please, Sign In to add comment