Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- World Edit Commands used in my video
- Ant 028 WE Transformations (by AntOfThy, April 2017)
- https://youtu.be/Dmk0uy8tRcU
- World Download (so you can try these command in the same world as the video)
- https://www.dropbox.com/s/rwaug8pvd7arqm2/WE_Transforms.zip?dl=1
- #
- # Block Replacement
- #
- # Select Villager House for Transform
- //sel extend
- # reselect new house
- # simple things are easy
- //replace cobble brick
- //replace log brick
- //replace wood cobble
- # But the Roof is harder
- # Data type fail!
- //replace wood_stairs cobble_stairs
- //undo
- # Do each data type separately!
- //replace wood_stairs:0 cobble_stairs:0
- //replace wood_stairs:1 cobble_stairs:1
- //replace wood_stairs:2 cobble_stairs:2
- //replace wood_stairs:3 cobble_stairs:3
- # Landscape (for nether)
- //replace grass,dirt netherrack
- //replace grass_path nether_brick
- # As you can see block replacement can be a real pain
- # So I wanted to see if I can do it in a different way.
- #
- # The Generate Command
- #
- # Select the castle turret
- //outset -h 2
- //expand 2 up
- # Equivalent Set command
- //g 95 1
- # World Edit Expression Parser - Functions
- # http://wiki.sk89q.com/wiki/WorldEdit/Expression_syntax#Functions
- # using generate replace based on type
- # query() -- lookup at x,y,z based on region coordinates
- //g 95 query(x,y,z,0,0)
- //g 95 !query(x,y,z,0,0)
- # Place glass in any air block above a non-air block
- //g -c 95 query(x,y,z,0,0) && !query(x,y-1,z,0,0)
- # Place glass in any air block next to a non-air block
- # Idea from http://forum.enginehub.org/threads/generate.16797/
- # select ALL lines of this to paste!
- //g -c 95 query(x,y,z,0,0)&&(
- !query(x-1,y,z,0,0) || !query(x+1,y,z,0,0) ||
- !query(x,y-1,z,0,0) || !query(x,y+1,z,0,0) ||
- !query(x,y,z-1,0,0) || !query(x,y,z+1,0,0) )
- #
- # Example Uses
- #
- # You can use the command rotate existing objects
- # Select the center block of the 'road'
- //outset -h 7
- //g -c 95 rotate(x,z,.4); query(x,y,z,type,data); 1
- # NOTE: ignore the result of the query, and always replace by ending in 1
- # Select Logs -- and randomise there orientation
- # Can be used for Wood Logs (17, 162), Hay Bales (170), Purpur Pillars (202)
- # data values need to be set to data%4 + 0,4,8 (+12 is all sided)
- //g 0 query(x,y,z,type,data); data=(data%4)+4*randint(3); 1
- //g 0 query(x,y,z,type,data); if(type==170) data=(data%4)+4*randint(3); 1
- //g 0 query(x,y,z,type,data); if(type==162 &&data%4==1) data=(data%4)+4*randint(3); 1
- # Quartz Pillar's (155:2) needs a slightly different formula (data of 2,3,4)
- //g 0 query(x,y,z,type,data); if(type==155 && data>=2) data=2+randint(3); 1
- #
- # Relative Query
- #
- # You can also lookup using relative coordinates (more useful)
- # queryRel() - lookup relative to the x,y,d coordinates
- //g -c 95 queryRel(0,0,0,0,0)
- //g -c 95 !queryRel(0,0,0,0,0)
- # glass example relative
- //g -c 95 queryRel(0,0,0,0,0)&&(
- !queryRel(-1,0,0,0,0) || !queryRel(1,0,0,0,0) ||
- !queryRel(0,-1,0,0,0) || !queryRel(0,1,0,0,0) ||
- !queryRel(0,0,-1,0,0) || !queryRel(0,0,1,0,0) )
- #
- # Relative Copy (to the east (+x) with original to the west (-x))
- #
- # Copy Blocks using Generate (set block if not air)
- //size
- //shift 15 east
- //g -c 0 queryRel(-15,0,0,type,data); type
- # NOTE on using Generate to Copy:
- # signs are blank, chests empty!
- # copy just specific block (stone_brick_stairs)
- //g -c 0 queryRel(-15,0,0,type,data); type==109
- # copy and replace the stone_brick_stairs (109) with quartz (156)
- # Note that result will be false if the if is false
- //g 0 queryRel(-15,0,0,type,data); if(type==109) type=156
- # copy all blocks, but replace the stone_brick_stairs (109) with quartz (156)
- //g 0 queryRel(-15,0,0,type,data); if(type==109) type=156; 1
- #
- # Absolute Query
- #
- # One other query function -- absolute coordinates...
- # Set whole region with another block in the world
- # In this case we give it a variable instead of a number
- # queryAbs() -- look up at absolute world
- //g -c 0 queryAbs(20,4,64,type,data); 1
- # Set it to that block, only if the original block it isn't air
- # First 'lookup' the type and data values, then check original block
- //g -c 95 queryAbs(20,4,64,type,data); !queryRel(-15,0,0,0,0)
- #
- # Replace using Looked up Block
- #
- # Replace block based on blocks located in the world
- # copy blocks that match the block (type & data)
- # This works as query functions are also a test -- but tests both type and data!
- //g 0 queryRel(-15,0,0,type,data); queryAbs(25,4,64,type,data);
- # If the type and data type match -- look up the replacement block
- //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
- #
- # Replace using a palette of blocks
- #
- # Replacing just ONE type of stairs is not good. What we need is to
- # replace multiple blocks a palette of block.
- # Matching Blocks starts at 30,4,64 going in the +x direction,
- # with replacement blocks at 30,4,66 going parallel in the +x direction.
- #
- # We loop over the line blocks, until we match, or we run out of blocks (air)
- # * lookup original block with i=0 (index) and start value of t=1
- # * loop over matching blocks until lookup matched (or air is reached)
- # * lookup replacement block and return
- # * else no match, so just copy block (unless air)
- //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
- # Minor improvement - skip loop over blocks if original is air blocks
- //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
- # Minor Change - also set air blocks
- //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
- # As we are using values all over the expression,
- # assign them to variables at the start of the expression
- # to allow them to be more easily modified.
- # xo,zo X,Z offset from selected region (the shift used)
- # mx,my,mz start location of match palette in +x direction
- # rx,ry,rz start location of replacement palette in +x direction
- #
- # The formula...
- # This should be typed in, as a single line,
- # all spaces and newlines in expression can be removed!
- //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
- # Formula as a single line, spaces removed...
- //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
- # Replace the final '1' with "type=type?7:0"
- # To set any non-air block, not found in the palette to bedrock
- #
- # Practical Example -- Transform Noodler's Blackwater Castle
- #
- # Select Castle corner
- //expand 47 east
- //expand 47 south
- //expand 52 up
- //size
- //shift 64 east
- # Copy (one to one)
- //g 0 xo=-64;zo=0; mx=112;my=4;mz=106; rx=mx;ry=my;rz=mz;
- 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
- # copy (replace unknown blocks with bedrock as a check)
- //g 0 xo=-64;zo=0; mx=112;my=4;mz=106; rx=mx;ry=my;rz=mz;
- 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
- # End Version
- //g 0 xo=-64;zo=0; mx=112;my=4;mz=106; rx=176;ry=4;rz=106;
- 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
- # Nether Version
- //shift 64 east
- //g 0 xo=-128;zo=0; mx=112;my=4;mz=106; rx=240;ry=4;rz=106;
- 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
- # Try Replacing grass to slowsand, and the grass with netherwart
Advertisement
Add Comment
Please, Sign In to add comment